Skip to content
Rigel docs
Open Rigel

Add a custom domain

email.domains_create

POST/api/v1/households/{household_id}/email/domains

  • Route

Claims the domain for the household, has the mail service verify it for sending, and records it with the DNS records its owner must add. Fails with domain_taken when another household has it, invalid_domain, or sending_not_configured when this server has no mail service keys.

Parameters#

Add a custom domain: parameters
FieldDescription
household_idpathstringrequired

The household's ID.

Request body#

JSON, as application/json.

Add a custom domain: request body fields
FieldDescription
domainstringrequired

The domain, such as okafors.example.

1 to 253 characters

Response#

201 The domain was added.

Add a custom domain: response fields
FieldDescription
email_domain_idstringrequired

The new domain.

Errors#

Every error has the same envelope: error.code, error.message, error.details, error.recovery and error.request_id.

Add a custom domain: 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.
409Read error.codeDescribed above.
503Read error.codeDescribed above.

Examples#

These are real. Each was recorded from a sample household, the Okafors, running through the whole API when this site was built.

Add a custom domain

The API has the mail service verify the domain for sending. The DNS records to add come from email.domain.records.

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -d '{
  "domain": "okafors.example.com"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    domain: "okafors.example.com",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json

{
  "domain": "okafors.example.com"
}
Response, 201
HTTP/1.1 201 Created
Content-Type: application/json
X-Request-Id: req_01M6V9CSQ5G58TRZ4XFHGQE04Y

{
  "email_domain_id": "emd_01M6V9CSQ63D47MKP7KG4FEBDJ"
}

Add a second custom domain

Request, curl
curl -X POST 'https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains' \
  -H "Cookie: rigel_session=$RIGEL_SESSION" \
  -H 'Content-Type: application/json' \
  -d '{
  "domain": "okafor.example.net"
}'
Request, TypeScript
const response = await fetch("https://rigel.house/api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Cookie: `rigel_session=${process.env.RIGEL_SESSION}`,
  },
  body: JSON.stringify({
    domain: "okafor.example.net",
  }),
});
const data = await response.json();
Request, HTTP
POST /api/v1/households/hh_01M6V9CS6GGVFCY7NAS8ZTQV95/email/domains HTTP/1.1
Host: rigel.house
Cookie: rigel_session=<your session>
Content-Type: application/json

{
  "domain": "okafor.example.net"
}
Response, 201
HTTP/1.1 201 Created
Content-Type: application/json
X-Request-Id: req_01M6V9CSSD37XGH766FPM8R949

{
  "email_domain_id": "emd_01M6V9CSSD5VZEVZHZH5TE669F"
}

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