Create an inbox (idempotent on requested username)
https://myagentmail.com/v1/inboxesRequires tenant master or workspace master key.
Username allocation
- If
usernameis set and your tenant already has an inbox atusername@domain, returns that inbox (HTTP 200, body containsexisted: true). The call is idempotent — safe to retry. - Otherwise tries to create
username@domain. If the global username is taken by another tenant, falls back tousername1,username2, … throughusername99. The actual allocated username is in the response body. - Pass
?strict=trueto disable auto-fallback. With strict mode, a global collision returns HTTP 409 with the conflicting resource info instead of suffixing.
IMAP/SMTP credentials — apiKey and imapPassword — are only
returned on first creation, never on idempotent returns.
Query parameters
strictboolean | When `true`, the request fails with `409 USERNAME_TAKEN` if the requested `username@domain` is already taken by another tenant. When omitted (default), we auto-fallback to `username1`, `username2`, etc. |
Request body
Content-Type: application/json
usernamestring | Lowercase alphanumeric + `.-_`. Auto-generated from the tenant name if omitted. **No tenant-id suffix is appended** — collisions are resolved via sequential numeric fallback (e.g. `scout`, `scout1`, `scout2`). |
displayNamestring | |
domainstring | Defaults to myagentmail.com |
workspaceIdstring | (Tenant master only) target workspace. Defaults to the tenant's default workspace. format: uuid |
Responses
idstring | format: uuid |
emailstring | Current primary outbound address — may be a custom-domain alias. |
canonicalEmailstring | Stable identity used for IMAP/SMTP auth. Never changes after creation. |
usernamestring | |
domainstring | |
displayNamestring | |
workspaceIdstring | format: uuid |
addressesobject[] | |
addressstring | |
isPrimaryboolean | |
imapPasswordstring | Only returned on creation and GET /inboxes/{id}. Stored plaintext so IMAP clients can log in. |
imapobject | |
hoststring | |
portinteger | |
tlsboolean | |
usernamestring | |
passwordstring | |
smtpobject | |
hoststring | |
portinteger | |
starttlsboolean | |
usernamestring | |
passwordstring | |
createdAtstring | format: date-time |
idstring | format: uuid |
emailstring | Current primary outbound address — may be a custom-domain alias. |
canonicalEmailstring | Stable identity used for IMAP/SMTP auth. Never changes after creation. |
usernamestring | |
domainstring | |
displayNamestring | |
workspaceIdstring | format: uuid |
addressesobject[] | |
addressstring | |
isPrimaryboolean | |
imapPasswordstring | Only returned on creation and GET /inboxes/{id}. Stored plaintext so IMAP clients can log in. |
imapobject | |
hoststring | |
portinteger | |
tlsboolean | |
usernamestring | |
passwordstring | |
smtpobject | |
hoststring | |
portinteger | |
starttlsboolean | |
usernamestring | |
passwordstring | |
createdAtstring | format: date-time |
errorrequired string | |
codestring |
errorrequired string | |
codestring |
Authentication
Send your API key in the X-API-Key header (or Authorization: Bearer <key>). Any prefix accepted by this endpoint — tk_, wk_, ak_, or sa_ — is documented in the key prefix table.