Get your API key
API reference

Agents & routing

Send a message to one of your inbox agents and get its reply, or run a registered route directly. See Connect your agent for a guided walk-through.

Auth: 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.

POST /v1/agent Send a message to one of your inbox agents and get its reply. Defaults to the account's default agent; pass `routeId` or `address` to target a specific agent, or `model` to override the model. This is separate from inbound routing — it does not match or override routes.

Send a message to one of your inbox agents and get its reply. Defaults to the account's default agent; pass `routeId` or `address` to target a specific agent, or `model` to override the model. This is separate from inbound routing — it does not match or override routes.

Request body

agent-request.json
FieldTypeNotes
text req stringThe message for the agent — it reads this as the incoming email body and decides what to do.
subjectstringOptional subject line the agent sees on the message.
fromstringOptional sender address the agent sees as the originator. Defaults to the account's API caller address.
htmlstringOptional HTML body. `text` is still required — the agent reasons over the plain-text content.
routeIdstringTarget a specific agent by its route id (rte_…). Omit to use the account's default agent (its most recently created agent route).
addressstringTarget the agent whose route matches this address. Alternative to routeId.
modelstringOverride the model the agent runs on for this call (e.g. claude-sonnet-4-6).

Response body

agent-response.json
FieldTypeNotes
ok req booleanWhether the agent ran to completion.
textstringThe agent's reply — its final message after running.
messageIdstringId of the stored message the agent processed (msg_…).
errorstringError detail when `ok` is false.
POST /v1/route Route a message to one of your registered routes (by `routeId` or `address`), running that route's action — agent, webhook, or forward. The route must already exist on your account; arbitrary destinations are not allowed.

Route a message to one of your registered routes (by `routeId` or `address`), running that route's action — agent, webhook, or forward. The route must already exist on your account; arbitrary destinations are not allowed.

Request body

route-message-request.json
FieldTypeNotes
routeIdstringTarget route by id (rte_…). One of routeId or address is required. The route must already be registered on this account.
addressstringTarget route by the address it matches. One of routeId or address is required.
from req stringSender address recorded on the message.
subjectstringOptional subject line.
textstringPlain-text body.
htmlstringHTML body.

Response body

route-response.json
FieldTypeNotes
id req stringStored message id (msg_…).
routed req booleanWhether the message was handed to the route's action.
action req stringThe action the matched route performed: webhook, forward, agent, store, or drop.