Get your API key
API reference

Account

The Account endpoints.

Auth: Session token · Public · API key · Base URL: https://api.mailkite.dev

Endpoints

Each row expands to its request and response schema. The address bar follows along, so any endpoint can be linked to directly.

GET /api/keys Get the account's unrestricted API key (mk_live_…). Read-or-create: the first call mints it.

Get the account's unrestricted API key (mk_live_…). Read-or-create: the first call mints it.

Response body

api-key-response.json
FieldTypeNotes
key req stringThe account's unrestricted API key (mk_live_…). Read-or-create: the first call mints it. rotate() invalidates the old key and returns a fresh one.
POST /api/keys/rotate Rotate the account API key: the old key stops working immediately and a fresh one is returned. The plaintext is only shown here.

Rotate the account API key: the old key stops working immediately and a fresh one is returned. The plaintext is only shown here.

Response body

api-key-response.json
FieldTypeNotes
key req stringThe account's unrestricted API key (mk_live_…). Read-or-create: the first call mints it. rotate() invalidates the old key and returns a fresh one.
GET /api/keys/scoped List the account's domain-scoped API keys. A scoped key can send and manage only its one domain — hand one to each site or CI job so a leak burns only that surface.

List the account's domain-scoped API keys. A scoped key can send and manage only its one domain — hand one to each site or CI job so a leak burns only that surface.

Response body

array scoped-key.json
FieldTypeNotes
id req stringKey id (key_…).
user_id req stringOwning account (usr_…).
domain_id req stringThe one domain this key is scoped to (dom_…). A scoped key can send and manage only this domain — ideal for a single site or CI job.
domain req stringDenormalized domain name, for display and fast scope checks.
name req stringUser-supplied label (e.g. the site or service using it).
key req stringThe key material (mk_live_…). Returned in full on list/create — treat like a password.
created_at req numberCreation time, ms epoch.
last_used_at req number · nullLast authenticated use, ms epoch — null if never used.
POST /api/keys/scoped Create a key scoped to one domain. Ideal for per-site installs (e.g. a WordPress plugin) — the site never holds the account master key.

Create a key scoped to one domain. Ideal for per-site installs (e.g. a WordPress plugin) — the site never holds the account master key.

Request body

create-scoped-key-request.json
FieldTypeNotes
domainId req stringThe domain (dom_…) the new key is limited to. Must belong to the calling account.
namestringOptional label shown in the dashboard (e.g. which site/integration holds this key).

Response body

scoped-key.json
FieldTypeNotes
id req stringKey id (key_…).
user_id req stringOwning account (usr_…).
domain_id req stringThe one domain this key is scoped to (dom_…). A scoped key can send and manage only this domain — ideal for a single site or CI job.
domain req stringDenormalized domain name, for display and fast scope checks.
name req stringUser-supplied label (e.g. the site or service using it).
key req stringThe key material (mk_live_…). Returned in full on list/create — treat like a password.
created_at req numberCreation time, ms epoch.
last_used_at req number · nullLast authenticated use, ms epoch — null if never used.
DELETE /api/keys/scoped/:id Revoke a domain-scoped key. Takes effect immediately.

Revoke a domain-scoped key. Takes effect immediately.

Response body

ok-response.json

The uniform acknowledgement for deletes and other actions with nothing else to report.

FieldTypeNotes
ok req trueAlways true — a non-2xx error body is returned otherwise.
GET /api/app-passwords List the account's app passwords. Each one opens a mailbox over IMAP and/or the mailbox API, scoped to a domain and an address pattern within it.

List the account's app passwords. Each one opens a mailbox over IMAP and/or the mailbox API, scoped to a domain and an address pattern within it.

Response body

array app-password.json

A credential that opens a mailbox over IMAP and/or the mailbox API. Scoped to one domain and an address pattern within it, so a single password can serve every address on a domain or exactly one. The secret itself is only ever returned once, at creation.

FieldTypeNotes
id req stringApp password id (apw_…).
user_id req stringOwning account (usr_…).
label req stringUser-supplied name, e.g. which client or agent holds it.
domain_idstring · nullThe hosted domain this password covers (dom_…). Null only for legacy account-wide credentials.
domain req stringDomain name this password covers. The literal `*` marks a legacy account-wide IMAP credential, which covers every domain the account owns; new passwords always name one domain.
address req stringLocal-part pattern within the domain: `*` (every address), `hello` (exact), `support-*` / `*-agent` (glob). Same wildcard grammar as inbound routes.
protocols req "imap" · "api"[]What this password may authenticate: `imap` for IMAP LOGIN, `api` for Bearer auth on the mailbox API. At least one.
key_prefix req stringFirst characters of the secret, for display (the rest is never retrievable).
created_at req numberCreation time, ms epoch.
last_used_at req number · nullLast authenticated use, ms epoch — null if never used.
legacy req booleanTrue for pre-existing IMAP-only credentials (mk_imap_…) surfaced in this shape. They keep working indefinitely but cannot grant `api`.
secretstringThe password itself (mk_pw_…). Returned ONLY in the create response — store it then, it is never shown again.
POST /api/app-passwords Create an app password for one domain and address pattern. Hand it to a mail client or an agent — the secret is returned once and never again.

Create an app password for one domain and address pattern. Hand it to a mail client or an agent — the secret is returned once and never again.

Request body

create-app-password-request.json
FieldTypeNotes
domain req stringThe hosted domain this password covers. Must belong to the calling account.
domainIdstringThe domain by id (dom_…), as an alternative to `domain`.
addressstringLocal-part pattern within the domain — `*` (default, every address), `hello`, `support-*`, `*-agent`. No `@`: the domain is already named.
protocols"imap" · "api"[]What the password may authenticate. Defaults to `["imap"]`.
labelstringOptional name shown in the dashboard (e.g. the client or agent holding it).

Response body

app-password.json

A credential that opens a mailbox over IMAP and/or the mailbox API. Scoped to one domain and an address pattern within it, so a single password can serve every address on a domain or exactly one. The secret itself is only ever returned once, at creation.

FieldTypeNotes
id req stringApp password id (apw_…).
user_id req stringOwning account (usr_…).
label req stringUser-supplied name, e.g. which client or agent holds it.
domain_idstring · nullThe hosted domain this password covers (dom_…). Null only for legacy account-wide credentials.
domain req stringDomain name this password covers. The literal `*` marks a legacy account-wide IMAP credential, which covers every domain the account owns; new passwords always name one domain.
address req stringLocal-part pattern within the domain: `*` (every address), `hello` (exact), `support-*` / `*-agent` (glob). Same wildcard grammar as inbound routes.
protocols req "imap" · "api"[]What this password may authenticate: `imap` for IMAP LOGIN, `api` for Bearer auth on the mailbox API. At least one.
key_prefix req stringFirst characters of the secret, for display (the rest is never retrievable).
created_at req numberCreation time, ms epoch.
last_used_at req number · nullLast authenticated use, ms epoch — null if never used.
legacy req booleanTrue for pre-existing IMAP-only credentials (mk_imap_…) surfaced in this shape. They keep working indefinitely but cannot grant `api`.
secretstringThe password itself (mk_pw_…). Returned ONLY in the create response — store it then, it is never shown again.
DELETE /api/app-passwords/:id Revoke an app password. Takes effect immediately — any IMAP session or API call using it stops authenticating.

Revoke an app password. Takes effect immediately — any IMAP session or API call using it stops authenticating.

Response body

ok-response.json

The uniform acknowledgement for deletes and other actions with nothing else to report.

FieldTypeNotes
ok req trueAlways true — a non-2xx error body is returned otherwise.
GET /api/billing/usage Current billing-period usage: emails used vs the plan's included bucket (null = unlimited), AI actions, and the overage state that gates sending. Powers quota meters in dashboards and integrations.

Current billing-period usage: emails used vs the plan's included bucket (null = unlimited), AI actions, and the overage state that gates sending. Powers quota meters in dashboards and integrations.

Response body

usage-response.json
FieldTypeNotes
plan req stringThe account's plan id.
emails req objectEmail volume this billing period (inbound + outbound share one bucket).
emails.used req numberEmails counted so far this period.
emails.included req number · nullThe plan's included monthly emails — null means unlimited.
aiActions req objectAI agent actions this period (pay-as-you-go — no included bucket).
aiActions.used req numberAI actions counted so far this period.
meteringEnabled req booleanTrue when overage metering is active (billing configured and a subscription exists).
meters req string[]The usage meters billed on this account.
overage req objectOverage state — drives the dashboard notice and the plugin quota bar.
overage.over req booleanPast the plan's included email bucket this period.
overage.metered req booleanOverage is being metered and billed normally.
overage.blocked req booleanSending is blocked until the payment card is fixed.
overage.status req string · nullCard-gate status when in overage (ok | failed …) — null outside overage.
overage.code req string · nullMachine-readable reason code when blocked — null otherwise.
POST /api/v1/provision Create a MailKite account from just an email — no password. Returns the new account's API key immediately; a verification link is emailed, and SENDING stays blocked until the address is verified (poll me()). An existing email returns 409 account_exists with no credentials. Powers plugin/CLI onboarding.

Create a MailKite account from just an email — no password. Returns the new account's API key immediately; a verification link is emailed, and SENDING stays blocked until the address is verified (poll me()). An existing email returns 409 account_exists with no credentials. Powers plugin/CLI onboarding.

Request body

register-request.json
FieldTypeNotes
email req stringThe account email. A verification link is sent to it — the account cannot send email until the address is verified, which is what makes registering safe without a password.
channelstringDistribution-channel slug this registration came through (e.g. wordpress-plugin). Invalid values are dropped, never an error.
refstringReferral code of the account that referred this signup, when any.
referrerstringFirst-touch landing referrer URL, when known. Invalid values are dropped, never an error.

Response body

register-response.json
FieldTypeNotes
api_key req stringThe new account's API key (mk_live_…) — store it now; it is only returned at registration. Sending stays blocked until the email is verified.
user_id req stringThe new account id (usr_…).
email req stringThe normalized account email the verification link was sent to.
email_verified req booleanAlways false at registration — poll me() until it flips after the user clicks the link.
is_new req booleanAlways true — an existing email returns 409 account_exists (with no credentials) instead.
GET /v1/me The account behind this credential: email, whether it is verified (sending is blocked until it is), and plan. Use to poll verification state after register().

The account behind this credential: email, whether it is verified (sending is blocked until it is), and plan. Use to poll verification state after register().

Response body

me-response.json
FieldTypeNotes
email req stringThe account email behind this credential.
emailVerified req booleanWhether the account email is verified. Sending is blocked until true.
plan req stringThe account's plan id.