Get your API key
API reference

Routes

Inbound routing rules — match an address and deliver it to a webhook, agent, or forward. See Inbound webhooks for a guided walk-through.

Auth: Session token · 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/routes List inbound routing rules.

List inbound routing rules.

Response body

array route.json

An inbound routing rule: which addresses it matches and what happens to matching mail (webhook POST, forward, store, drop, or an inbox agent). The per-route signing secret is returned ONCE on create and via GET /api/domains/:id/webhook/secret — list responses omit it.

FieldTypeNotes
id req stringRoute id (rte_…).
user_id req stringOwning account (usr_…).
match_pattern req stringWhich recipient addresses this route matches: an exact address, `*@domain`, a prefix pattern like `ticket+*@domain`, or a `/regex/`.
action req "webhook" · "forward" · "store" · "drop" · "agent"What happens to a matching message.
destinationstring · nullWebhook URL or forward address. null for store/drop/agent actions.
agent_promptstring · nullInstructions for the built-in inbox agent (action 'agent' only).
agent_forward_tostring · nullExtra addresses the inbox agent's forward tool may reach, as a JSON array string. null = owner-controlled addresses only.
agent_context"message" · "thread" · "sender" · nullHow much mail the inbox agent may read once the sender is verified. null = 'message' (just the inbound email).
active req 0 · 11 while the route is enabled.
ack_mode req "lenient" · "ack"Webhook acknowledgement strictness: 'lenient' accepts any 2xx; 'ack' also requires {"status":"ok"} (or the x-mailkite-ack header) on every delivery.
last_status"ok" · "fail" · "running" · "timeout" · nullOutcome of the route's most recent action. null = never exercised.
last_status_messagestring · nullHuman-readable detail of the last outcome (e.g. 'HTTP 500').
last_status_codeinteger · nullTransport status code of the last outcome, when relevant.
last_status_atinteger · nullWhen the last outcome landed, in Unix epoch milliseconds (UTC); null when it has never happened.
consecutive_failuresintegerCurrent failing streak (0 when healthy).
first_failed_atinteger · nullWhen the current failing streak began, in Unix epoch milliseconds (UTC); null when it has never happened.
unhealthy_notified_atinteger · nullWhen the owner was emailed about the current streak, in Unix epoch milliseconds (UTC); null when it has never happened.
signing_secretstring · nullPer-route webhook signing secret (whsec_…). Returned on create; read later via GET /api/domains/:id/webhook/secret. null until first read lazily creates it.
created_at req integerWhen the route was created, in Unix epoch milliseconds (UTC).
POST /api/routes Create a route (match, action, destination).

Create a route (match, action, destination).

Request body

create-route-request.json
FieldTypeNotes
match req stringAddress pattern: exact, *@domain, addr+*@domain, or /regex/.
action"webhook" · "forward" · "store" · "drop" · "agent"What to do with matching mail. Defaults to webhook.
destinationstringRequired for action webhook (URL) or forward (address).
agentPromptstringRequired for action agent — instructions for the inbox agent.
agentForwardTostring[]For action agent: addresses the inbox agent's forward tool may send to. The agent can always forward to your account email and any address on a verified domain you own; this adds extra approved addresses (e.g. an escalation inbox).
agentContext"message" · "thread" · "sender"For action agent: how much mail the agent may read once the sender is verified (they replied to an earlier agent message from a DMARC-passing address). 'message' (default) = only the incoming email; 'thread' = this conversation; 'sender' = all past mail with this sender.

Response body

route.json

An inbound routing rule: which addresses it matches and what happens to matching mail (webhook POST, forward, store, drop, or an inbox agent). The per-route signing secret is returned ONCE on create and via GET /api/domains/:id/webhook/secret — list responses omit it.

FieldTypeNotes
id req stringRoute id (rte_…).
user_id req stringOwning account (usr_…).
match_pattern req stringWhich recipient addresses this route matches: an exact address, `*@domain`, a prefix pattern like `ticket+*@domain`, or a `/regex/`.
action req "webhook" · "forward" · "store" · "drop" · "agent"What happens to a matching message.
destinationstring · nullWebhook URL or forward address. null for store/drop/agent actions.
agent_promptstring · nullInstructions for the built-in inbox agent (action 'agent' only).
agent_forward_tostring · nullExtra addresses the inbox agent's forward tool may reach, as a JSON array string. null = owner-controlled addresses only.
agent_context"message" · "thread" · "sender" · nullHow much mail the inbox agent may read once the sender is verified. null = 'message' (just the inbound email).
active req 0 · 11 while the route is enabled.
ack_mode req "lenient" · "ack"Webhook acknowledgement strictness: 'lenient' accepts any 2xx; 'ack' also requires {"status":"ok"} (or the x-mailkite-ack header) on every delivery.
last_status"ok" · "fail" · "running" · "timeout" · nullOutcome of the route's most recent action. null = never exercised.
last_status_messagestring · nullHuman-readable detail of the last outcome (e.g. 'HTTP 500').
last_status_codeinteger · nullTransport status code of the last outcome, when relevant.
last_status_atinteger · nullWhen the last outcome landed, in Unix epoch milliseconds (UTC); null when it has never happened.
consecutive_failuresintegerCurrent failing streak (0 when healthy).
first_failed_atinteger · nullWhen the current failing streak began, in Unix epoch milliseconds (UTC); null when it has never happened.
unhealthy_notified_atinteger · nullWhen the owner was emailed about the current streak, in Unix epoch milliseconds (UTC); null when it has never happened.
signing_secretstring · nullPer-route webhook signing secret (whsec_…). Returned on create; read later via GET /api/domains/:id/webhook/secret. null until first read lazily creates it.
created_at req integerWhen the route was created, in Unix epoch milliseconds (UTC).
DELETE /api/routes/:id Delete an inbound routing rule by id. Pair with createRoute to register and tear down a webhook destination — e.g. an automation platform subscribing on enable and cleaning up on disable.

Delete an inbound routing rule by id. Pair with createRoute to register and tear down a webhook destination — e.g. an automation platform subscribing on enable and cleaning up on disable.

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.