Create an API key
Mint a new API key. The full plaintext key is returned once, only here. Scopes default to ["send"] and may only include the mintable scopes send, read:emails, read:inbound, read:analytics, read:suppressions, manage:webhooks, and manage:suppressions. manage:keys can never be minted onto a key. manage:webhooks and manage:suppressions are allowed on live keys only: webhooks and suppressions are shared by both environments, so a test key holding them would reach live data. Creating a test key with either returns 422 validation_error with param scopes. The environment is taken from the session, never the body. Dashboard only (owner or admin). API keys get 403 insufficient_scope.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
namestringrequired>= 1scopesarray<"send" | "read:emails" | "read:inbound" | "read:analytics" | "read:suppressions" | "manage:webhooks" | "manage:suppressions">Defaults to ["send"] when omitted. Only mintable scopes are allowed. manage:webhooks and manage:suppressions are for live keys only.
>= 1 elementsdomain_idstringOptional domain (dom_…) the key is restricted to; must be owned by the organization.
Response
The API key was created; the plaintext is shown once.
object"api_key"required"api_key"idstringrequirednamestringrequiredkeystringrequiredThe full plaintext secret; returned only at creation and rotation, never again.
prefixstringrequiredlast4stringrequiredscopesarray<"send" | "read:emails" | "read:inbound" | "read:analytics" | "read:suppressions" | "manage:webhooks" | "manage:suppressions">requiredenvironment"live" | "test"required"live" | "test"created_atstring<date-time>required