Overview

Reference for the Mapier messaging API, HTTP routes over lines such as iMessage. The base URL, how requests and answers look, and every endpoint

The Mapier API is a set of HTTP routes over your lines on iMessage and WhatsApp. You send commands, and you read their results on one event stream or as signed webhooks. One OpenAPI document describes everything a key or a token can reach. Every example in these docs is a plain fetch or curl you can paste into a terminal, and any generator turns the document into a typed client.

Base URL

https://api.mapier.ai

Every path starts with /v1. A future /v2 would sit beside /v1, not replace it. Within /v1, a change that could break a working integration, such as a renamed word, ships behind a new dated version. You choose it with the x-mapier-version header, which every route that takes a key or a token reads. Versions explains.

The OpenAPI document

https://api.mapier.ai/openapi.json

It describes /v1 and only /v1: every field, and every error code each operation can return, with its status.

Operation
POST /v1/commands/{type}Send a command; the 202 gives its commandId.
POST /v1/commands/{type}/checkAsk whether a command would be accepted, without sending it.
GET /v1/commands/{commandId}What happened to a command.
GET /v1/response_streamResults, incoming messages and, on request, more events (SSE).
GET /v1/eventsThe project's events, read back, newest first.
GET /v1/whoamiWhat this key is, what it can send from, and its command ceiling.
GET /v1/capabilitiesWhat works where, on every channel.
GET /v1/public/channel-availabilityWhich channels are on for everyone. Needs no key.
GET /v1/reachabilityWhether a line can write to a person now, and why not.
POST /v1/handle-checkTest whether an address is reachable.
POST /v1/conversation-lookupA line's conversation with an address, by its id.
GET /v1/attachments/{id}Fetch an attachment.
GET /v1/messages/{messageId}/receiptsAsk what one message's receipts say, now.
GET /v1/conversationsA line's conversations, newest first, by kind and status.
GET /v1/conversations/{conversationId}A conversation as it stands: a group's name, members and status.
GET /v1/conversations/{conversationId}/messagesRead a conversation's history, newest first.
GET /v1/contacts/{contactId}One address of one person.
GET /v1/people/{personId}A person and every address they have.
POST /v1/contacts/{contactId}/consentRecord that a person asked you to stop.
GET /v1/lines/availableWhich of your lines somebody new would get now.
GET /v1/lines/{lineId}/healthHow one of your lines is doing, measure by measure.
GET /v1/lines/{lineId}/reputationThe same answer under its old name; deprecated.
GET /v1/lines/{lineId}/templatesA line's message templates.
POST /v1/line-setupsStart adding a line.
GET /v1/line-setups/{setupId}A line setup as it stands.
POST /v1/line-setups/{setupId}/checksRun a line setup's checks again.
POST /v1/line-setups/{setupId}/cancelCancel an open line setup.
GET /v1/webhook-endpointsA project's webhook endpoints. Personal access token.
POST /v1/webhook-endpointsAdd a webhook endpoint. Personal access token.
GET /v1/webhook-endpoints/{endpointId}One webhook endpoint. Personal access token.
PATCH /v1/webhook-endpoints/{endpointId}Change a webhook endpoint. Personal access token.
DELETE /v1/webhook-endpoints/{endpointId}Delete a webhook endpoint. Personal access token.
POST /v1/webhook-endpoints/{endpointId}/rotate-secretMake a new signing secret. Personal access token.
GET /v1/webhook-endpoints/{endpointId}/deliveriesEach attempt to deliver to one endpoint. Personal access token.
GET /v1/projectsThe projects a personal access token reaches.
GET /v1/projects/{projectId}One of those projects.
GET /v1/membersEveryone in the organization. Personal access token.
GET /v1/audit-logsThe organization's audit log. Personal access token.
POST /v1/cli/loginsStart a sign-in from a terminal. Needs no credential.
POST /v1/cli/logins/tokenPoll that sign-in for its tokens. Needs no credential.
POST /v1/cli/tokens/renewRenew a terminal sign-in with its refresh token.
POST /v1/cli/tokens/revokeSign out with a refresh token.
POST /v1/personal-tokens/current/revokeRevoke the personal access token that calls.

The shape of every request

curl https://api.mapier.ai/v1/commands/message.send \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: hello-1" \
  -H "x-mapier-version: 2026-12-01" \
  -d '{
    "target": { "channel": "imessage", "to": "+14155550100" },
    "payload": { "kind": "text", "text": "hello" }
  }'

Three things are always true of a command request:

  • It is a POST whose body, when it has one, is a JSON object. A body that is not JSON is 400 bad_request. JSON that is not an object, such as an array, a string or a number, is 422 validation_failed.
  • The body has two top-level keys: target (who) and payload (what). Both are objects; a command that needs neither may leave the body out. See Send a message › Who gets it.
  • The body is at most 65,536 bytes. A larger one is refused with 413 payload_too_large before it is read, and before the key is checked.

See Authentication for how requests are identified.

The shape of every response

Successful command submissions return 202 Accepted:

{
  "commandId": "3f1a0c2e-8b47-4d19-9a5e-2c6f0b8d4e71",
  "status": "queued",
  "repeated": false,
  "lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d",
  "lineSelection": "reused_active_chat"
}

Prop

Type

The 202 is always queued. The result arrives as the command event: succeeded, failed, cancelled or expired, or ambiguous or no_effect when the channel took the command and could not prove what it changed.

Every refusal is one envelope:

{ "error": { "code": "not_found", "message": "That conversation does not exist." } }

Switch on code: it is a closed set and each value maps to exactly one HTTP status. message is a sentence for a person and may change; never parse it. details is optional. On a 422 validation_failed it is an array, one { path, message, … } entry per field that failed. On other refusals it is an object, usually with a reason to switch on (as on 503 line_unavailable) and the fields that go with it. A 429 from a route's own quota also carries a Retry-After header. Errors lists every code.

202 does not mean it worked

A 202 means the command was queued, not that it was delivered. The line carries it out on its channel, and the result, success or failure, arrives on the response stream as a command event, usually within a few seconds.

Not every payload is checked before the 202. A message.send payload is checked before anything is written: a payload field the line cannot carry is a 422 validation_failed at payload.<key>, never dropped. A reaction.set, profile.share or group.create payload can be accepted with 202 and then end failed on the stream when the channel refuses it. See what is checked before anything is queued. If you are testing a new payload shape, watch the stream.

Endpoints

MethodPathPurpose
POST/v1/commands/:typeQueue a command
POST/v1/commands/:type/checkAsk whether a command would be accepted
GET/v1/commands/:commandIdRead a command's outcome
GET/v1/response_streamResults, incoming messages and, on request, more events (SSE)
GET/v1/eventsCatch up on events
GET/v1/whoamiWhat this key is, its lines, and its command ceiling
GET/v1/capabilitiesWhat works where
GET/v1/public/channel-availabilityWhich channels are on for everyone; needs no key
GET/v1/reachabilityWhether a line can reach a person now
POST/v1/handle-checkTest whether an address is reachable
POST/v1/conversation-lookupFind a line's conversation with an address
GET/v1/attachments/:idDownload an inbound attachment
GET/v1/messages/:messageId/receiptsAsk what one message's receipts say, now
GET/v1/conversationsList a line's conversations
GET/v1/conversations/:conversationIdRead a conversation: a group's name, members and status
GET/v1/conversations/:conversationId/messagesRead a conversation's history, newest first
GET/v1/contacts/:contactIdRead a contact
GET/v1/people/:personIdRead a person
POST/v1/contacts/:contactId/consentOpt a person out
GET/v1/lines/availableWhich of your lines somebody new would get now
GET/v1/lines/:lineId/healthRead a line's health
GET/v1/lines/:lineId/reputationThe same, under its old name; deprecated
GET/v1/lines/:lineId/templatesList a line's message templates
POST/v1/line-setupsStart adding a line
GET/v1/line-setups/:setupIdRead a line setup
POST/v1/line-setups/:setupId/checksRun a setup's checks again
POST/v1/line-setups/:setupId/cancelCancel a line setup
GET/v1/webhook-endpointsList webhook endpoints
POST/v1/webhook-endpointsCreate a webhook endpoint
GET/v1/webhook-endpoints/:endpointIdRead a webhook endpoint
PATCH/v1/webhook-endpoints/:endpointIdUpdate a webhook endpoint
DELETE/v1/webhook-endpoints/:endpointIdDelete a webhook endpoint
POST/v1/webhook-endpoints/:endpointId/rotate-secretRotate its signing secret
GET/v1/webhook-endpoints/:endpointId/deliveriesList its delivery attempts
GET/v1/projectsList projects
GET/v1/projects/:projectIdRead a project
GET/v1/membersList members
GET/v1/audit-logsList audit log entries
POST/v1/cli/loginsStart a sign-in from a terminal
POST/v1/cli/logins/tokenPoll a sign-in from a terminal
POST/v1/cli/tokens/renewRenew a terminal sign-in
POST/v1/cli/tokens/revokeSign out with a refresh token
POST/v1/personal-tokens/current/revokeRevoke the token that calls

Every one of them reads x-mapier-version but the five that take no credential: GET /v1/public/channel-availability and the four /v1/cli/ routes a terminal signs in with.

Most routes take a project API key, and most of those take a personal access token too; the webhook endpoint, organization and sign-out routes take a personal access token only.

Conventions

Identifiers. Phone numbers are E.164 (+14155550100). Email addresses are lowercase and NFC-normalized. Conversation ids are Mapier UUIDs, not a channel's own ids — you get them from inbound message events.

Timestamps. ISO 8601 with a Z suffix. occurredAt on an inbound message is when the channel says it was sent, not when Mapier received it.

Forward compatibility. Fields are added to responses and events without a version bump. Parse defensively: ignore keys you do not recognize, and treat enum values you do not recognize — especially errorCode — as unknown rather than impossible. A change your integration could not absorb that way, such as a request handled differently or a renamed word, waits for a new dated version.

Guide