An email's HTML body
email.messages_html
GET/api/v1/households/{household_id}/email/messages/{email_message_id}/html
- Route
The email's HTML body as JSON, for the sandboxed frame that shows it. It is never served as a page, and it is not safe to put in the page as it is: clean it first. html is null when the email has no HTML body.
Parameters#
| Field | Description |
|---|---|
household_idpathstringrequired | The household's ID. |
email_message_idpathstringrequired | The email's ID. |
Response#
200 The HTML body.
| Field | Description |
|---|---|
htmlstring or nullrequired | UNTRUSTED HTML from the sender, or null when there is none. |
Errors#
Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.
| Status | Code | When |
|---|---|---|
400 | validation_failed | A field is missing, misspelled or out of range. details.fields lists each problem. |
401 | unauthenticated | The request has no valid session. |
404 | not_found | The household doesn't exist, or you aren't a member of it. |
Examples#
These are real. Each was recorded from a sample household, the Okafors, running through the whole API when this site was built.
Read an email's HTML body
Untrusted HTML from the sender, for a sandboxed frame. Clean it before putting it in a page.
curl 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQSZJEAZ87SV36X29G7/html' \
-H "Cookie: rigel_session=$RIGEL_SESSION"const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQSZJEAZ87SV36X29G7/html", {
headers: {
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
});
const data = await response.json();GET /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQSZJEAZ87SV36X29G7/html HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSRM457JRNBRHM9FJCV6
{
"html": "<h1>Ten plants for November</h1><p>Bulbs to plant now, and what to do with the last of the tomatoes.</p><ul><li>Tulips: plant 6 inches deep</li><li>Garlic: plant before the ground freezes</li></ul>"
}An email with no HTML body
html is null when the email was plain text only.
curl 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQKX2C5SXSVWKC472DN/html' \
-H "Cookie: rigel_session=$RIGEL_SESSION"const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQKX2C5SXSVWKC472DN/html", {
headers: {
Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
},
});
const data = await response.json();GET /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQKX2C5SXSVWKC472DN/html HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSRQ6VJDG35Z1WCJKBTC
{
"html": null
}