Skip to content
Rigel docs
Open Rigel

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#

An email's HTML body: parameters
FieldDescription
household_idpathstringrequired

The household's ID.

email_message_idpathstringrequired

The email's ID.

pattern ^emm_[0-9A-HJKMNP-TV-Z]{26}$

Response#

200 The HTML body.

An email's HTML body: response fields
FieldDescription
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.

An email's HTML body: errors
StatusCodeWhen
400validation_failedA field is missing, misspelled or out of range. details.fields lists each problem.
401unauthenticatedThe request has no valid session.
404not_foundThe 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.

Request, curl
curl 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQSZJEAZ87SV36X29G7/html' \
  -H "Cookie: rigel_session=$RIGEL_SESSION"
Request, TypeScript
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();
Request, HTTP
GET /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQSZJEAZ87SV36X29G7/html HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Response, 200
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.

Request, curl
curl 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQKX2C5SXSVWKC472DN/html' \
  -H "Cookie: rigel_session=$RIGEL_SESSION"
Request, TypeScript
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();
Request, HTTP
GET /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/messages/emm_01M6V9CSQKX2C5SXSVWKC472DN/html HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Response, 200
HTTP/1.1 200 OK
Content-Type: application/json
X-Request-Id: req_01M6V9CSRQ6VJDG35Z1WCJKBTC

{
  "html": null
}

Rigel is in early access, and sign-up is by invitation. Open Rigel