Give customers an email address on your domain
Offer each customer account one free address on your storefront's mail domain, at sign-up or from the account page, with the Organization API.
Your storefront can give each customer account one free email address on a mail domain of yours, such as alex@example.gg. The customer picks the name when they sign up, or later from their account page. Their own email stays the address they sign in with, and the new address is an inbox they read in webmail or in any mail app. This page shows the calls a storefront makes and what to show for each refusal.
It differs from Mail Hosting, which a customer buys to run mailboxes on a domain of their own.
Before you begin
Section titled Before you begin- Ask support to turn customer addresses on for your organization and to name the mail domain. Coritan staff declare the domain for your storefront and set up its mail service. You cannot set it through the API. Until then the offer answers
enabled: falseand the other routes on this page refuse. - Ask support to set your organization's webmail address, so the account page can link to it. See Run Mail Hosting for your customers.
- Get a customer token for the account page calls, as Sign customers in to your storefront describes. They send it as
Authorization: Bearer $CUSTOMER_TOKEN. - If your sign-up form shows a security check, keep sending its answer as
turnstile_token. A sign-up that asks for an address passes the same check.
Check whether your storefront offers an address
Section titled Check whether your storefront offers an addresscurl "https://api.coritan.com/api/v1/orgs/acme/auth/mailbox-domain"
{"enabled": true, "domain": "example.gg"}
The call needs no token. Show the name field only while enabled is true, and print domain after it. An organization that offers no address answers 200 with {"enabled": false, "domain": null}. domain can hold a name while enabled is false: the domain is declared but not ready, so offer nothing yet.
Check a name as the customer types
Section titled Check a name as the customer typescurl "https://api.coritan.com/api/v1/orgs/acme/auth/mailbox-availability?local_part=alex"
{"available": true, "reason": "ok", "detail": null, "address": "alex@example.gg"}
local_part is the name before the @, 1 to 64 characters. We trim it and lower its case before the check. The answer has these fields:
| Field | What it holds |
|---|---|
available |
true when the customer can take the name. |
reason |
ok, invalid (the name breaks a rule), reserved (a name we keep back, such as support or admin) or taken. |
detail |
A sentence to show under the field, or null when the name is free. |
address |
The whole address, or null for an invalid name. |
A usable name has 3 to 40 letters, digits, dots, dashes or underscores. It starts and ends with a letter or a digit, has no plus sign and no two dots in a row. A name is taken when a mailbox has the address, or when another of your customers signs in with it.
The check answers 404 when your organization offers no address. One network can ask 60 times a minute. After that the answer is 429: wait a few seconds and ask again. Your form can go on without an answer, because the request that makes the address checks the name again.
Make the address at sign-up
Section titled Make the address at sign-upAdd mailbox_local_part to the sign-up request from Register a customer:
curl -X POST "https://api.coritan.com/api/v1/orgs/acme/auth/register" \
-H "Content-Type: application/json" \
-d '{"email": "alex@example.com", "password": "a long passphrase", "mailbox_local_part": "alex", "turnstile_token": "..."}'
email is still required and is still what the customer signs in with. The answer is the 201 a sign-up always gives, with one more field:
{"access_token": "...", "refresh_token": "...", "token_type": "bearer", "expires_in": 86400, "customer_id": 4812, "mailbox_address": "alex@example.gg"}
mailbox_address is the address we made. It is null when the request left mailbox_local_part out or sent it blank, and then the sign-up works exactly as it did before. An answer that asks for a two-factor step carries mailbox_address too.
We make the account and the address together or not at all. When we refuse the address, no account exists, and your form can send the request again with another name or without the field. We make the address at once and do not wait for the customer to confirm email.
The address takes the account password as its own password. Tell the customer on the form, for example: "Its password is your account password."
Show the address on the account page
Section titled Show the address on the account pagecurl "https://api.coritan.com/api/v1/orgs/acme/portal/mailbox" \
-H "Authorization: Bearer $CUSTOMER_TOKEN"
{
"offer": {"enabled": true, "domain": "example.gg"},
"mailbox": {"address": "alex@example.gg", "status": "active", "created_at": "2026-11-14T10:00:00+00:00"},
"webmail_url": "https://mail.example.gg"
}
| Field | What it holds |
|---|---|
offer |
What GET /auth/mailbox-domain answers for your organization. |
mailbox |
null while the customer has no address. Otherwise address, status and created_at. |
mailbox.status |
active, or disabled when we turned the address off or paused its sending. |
webmail_url |
Where the customer reads the mail in a browser, or null when your organization has no webmail. |
A customer keeps their address if you stop offering new ones, so mailbox can be set while offer.enabled is false. Offer the form in the next section only while mailbox is null and offer.enabled is true.
Let a signed-in customer make their address
Section titled Let a signed-in customer make their addressCheck the name as the customer types. This check knows who is asking, so the customer's own sign-in address counts as free for them: someone who signs in with sam@example.gg can take sam.
curl "https://api.coritan.com/api/v1/orgs/acme/portal/mailbox/availability?local_part=alex" \
-H "Authorization: Bearer $CUSTOMER_TOKEN"
The answer has the same fields as the check before sign-up. It answers 404 when your organization offers no address, and 429 after 60 checks a minute by one customer.
Then make the address. Ask the customer for their account password in the same form:
curl -X POST "https://api.coritan.com/api/v1/orgs/acme/portal/mailbox" \
-H "Authorization: Bearer $CUSTOMER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"local_part": "alex", "password": "a long passphrase"}'
The password confirms the request and becomes the address's password. The answer is 201 with the body of GET /portal/mailbox, which now holds the address.
Caution
An account has one address, and its name cannot be changed afterwards. Ask the customer to confirm the whole address before you send the request.
A customer who signs in only with a social account or an emailed code has no password. Email them a password link with POST /auth/forgot-password, as Verify an address and reset a password describes, then offer the form again.
What follows the account
Section titled What follows the account- The address signs in with the account password, in webmail and in mail apps. When the customer changes or resets their account password, or sets a first one, the address takes the new password. A password your staff set for the customer does not reach the address: it keeps its password until the customer next changes the account's, so a staff member cannot open a customer's mail.
- A customer can give the address a separate password in webmail. From then on it keeps that password, whatever happens to the account password.
- The address sends mail only while the customer's account is active.
- When a customer closes their account, or your staff close it for good, we delete the address and its mail first. If the mail service cannot delete it at that moment, the close answers
409and the account stays open, so the customer can try again. No route deletes the address on its own. - The addresses are your customers' personal inboxes. Your organization's Email pages do not list them, and your staff cannot read them, delete them or reset a mailbox password there.
One network, an IPv4 address or an IPv6 /64, can make 3 addresses an hour and 5 a day, counting sign-ups and account pages together.
Result
Section titled ResultThe customer has name@<your domain>, and GET /portal/mailbox returns it with status active. They open webmail_url and sign in with the address and their account password.
Troubleshooting
Section titled TroubleshootingA refusal about the address has detail, one sentence you can show under the name field, and code, a word that starts with mailbox_. A refusal about anything else on the sign-up form has another code or none, so your page can tell where to show each.
422withmailbox_not_offeredat sign-up,404withmailbox_not_offeredon the account page- Your organization offers no address. Hide the field, and send the sign-up again without
mailbox_local_part. 422withmailbox_name_invalid- The name breaks a rule, and
detailsays which, such asPick at least 3 characters.Ask for another name. 422withmailbox_name_reservedThat name is reserved. Try another name.We keep back role names such assupportandbilling.409withmailbox_takenThat address is already taken. Try another name.422withmailbox_refused- We could not use the name for a reason the check did not catch, such as someone taking it a moment earlier. Show
detailand ask for another name. 403withmailbox_network_refused- We do not make mailboxes from the customer's network.
detailsays why: the network is blocked, it is a hosting, VPN, proxy or Tor network, or we paused a mailbox made from it in the last 7 days. Another name does not help. Let the customer sign up without an address and add one later from another network. 429withmailbox_rate_limited- The customer's network has made as many addresses as it may for now, or the customer tried the account page form more than 5 times in an hour.
Retry-Aftersays how many seconds to wait. At sign-up, offer to go on without an address. 503withmailbox_unavailableormailbox_not_saved- Our mail service could not make the address. Nothing was made, and at sign-up no account was made. Try again in a few minutes, or let the customer sign up without an address.
409withmailbox_existsThis account already has an address.ReadGET /portal/mailboxand show it.422withmailbox_wrong_passwordThat is not your account password.The answer is never401, so your page does not mistake it for an expired session.422withmailbox_password_required- The account has no password yet. The customer sets one with a password link, then tries again.
403 A support session cannot make the customer's email address. Ask the customer to make it from their account.- A member of your staff is signed in as the customer. Only the customer makes their address.
401- The token is missing, expired, or belongs to a customer of another organization.
409with the headerX-Close-Refused-Reason: mailbox_not_deletedwhen closing an account- We could not delete the customer's address from the mail service, so the account is still open. Send the close request again in a few minutes.
Related
Section titled RelatedAPI operations on this page
| Method | Path | What it does |
|---|---|---|
GET | /api/v1/orgs/{org_slug}/auth/mailbox-domain | Whether this storefront gives each account a free email address, and on which domain |
GET | /api/v1/orgs/{org_slug}/auth/mailbox-availability | Whether a name is free for a new account's email address |
GET | /api/v1/orgs/{org_slug}/portal/mailbox | The signed-in customer's own email address on the storefront's mail domain |
POST | /api/v1/orgs/{org_slug}/portal/mailbox | Make the signed-in customer's email address on the storefront's mail domain |
GET | /api/v1/orgs/{org_slug}/portal/mailbox/availability | Whether a name is free for the signed-in customer's email address |