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.aiEvery 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.jsonIt 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}/check | Ask whether a command would be accepted, without sending it. |
GET /v1/commands/{commandId} | What happened to a command. |
GET /v1/response_stream | Results, incoming messages and, on request, more events (SSE). |
GET /v1/events | The project's events, read back, newest first. |
GET /v1/whoami | What this key is, what it can send from, and its command ceiling. |
GET /v1/capabilities | What works where, on every channel. |
GET /v1/public/channel-availability | Which channels are on for everyone. Needs no key. |
GET /v1/reachability | Whether a line can write to a person now, and why not. |
POST /v1/handle-check | Test whether an address is reachable. |
POST /v1/conversation-lookup | A line's conversation with an address, by its id. |
GET /v1/attachments/{id} | Fetch an attachment. |
GET /v1/messages/{messageId}/receipts | Ask what one message's receipts say, now. |
GET /v1/conversations | A 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}/messages | Read 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}/consent | Record that a person asked you to stop. |
GET /v1/lines/available | Which of your lines somebody new would get now. |
GET /v1/lines/{lineId}/health | How one of your lines is doing, measure by measure. |
GET /v1/lines/{lineId}/reputation | The same answer under its old name; deprecated. |
GET /v1/lines/{lineId}/templates | A line's message templates. |
POST /v1/line-setups | Start adding a line. |
GET /v1/line-setups/{setupId} | A line setup as it stands. |
POST /v1/line-setups/{setupId}/checks | Run a line setup's checks again. |
POST /v1/line-setups/{setupId}/cancel | Cancel an open line setup. |
GET /v1/webhook-endpoints | A project's webhook endpoints. Personal access token. |
POST /v1/webhook-endpoints | Add 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-secret | Make a new signing secret. Personal access token. |
GET /v1/webhook-endpoints/{endpointId}/deliveries | Each attempt to deliver to one endpoint. Personal access token. |
GET /v1/projects | The projects a personal access token reaches. |
GET /v1/projects/{projectId} | One of those projects. |
GET /v1/members | Everyone in the organization. Personal access token. |
GET /v1/audit-logs | The organization's audit log. Personal access token. |
POST /v1/cli/logins | Start a sign-in from a terminal. Needs no credential. |
POST /v1/cli/logins/token | Poll that sign-in for its tokens. Needs no credential. |
POST /v1/cli/tokens/renew | Renew a terminal sign-in with its refresh token. |
POST /v1/cli/tokens/revoke | Sign out with a refresh token. |
POST /v1/personal-tokens/current/revoke | Revoke 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
POSTwhose body, when it has one, is a JSON object. A body that is not JSON is400 bad_request. JSON that is not an object, such as an array, a string or a number, is422 validation_failed. - The body has two top-level keys:
target(who) andpayload(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_largebefore 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
| Method | Path | Purpose |
|---|---|---|
POST | /v1/commands/:type | Queue a command |
POST | /v1/commands/:type/check | Ask whether a command would be accepted |
GET | /v1/commands/:commandId | Read a command's outcome |
GET | /v1/response_stream | Results, incoming messages and, on request, more events (SSE) |
GET | /v1/events | Catch up on events |
GET | /v1/whoami | What this key is, its lines, and its command ceiling |
GET | /v1/capabilities | What works where |
GET | /v1/public/channel-availability | Which channels are on for everyone; needs no key |
GET | /v1/reachability | Whether a line can reach a person now |
POST | /v1/handle-check | Test whether an address is reachable |
POST | /v1/conversation-lookup | Find a line's conversation with an address |
GET | /v1/attachments/:id | Download an inbound attachment |
GET | /v1/messages/:messageId/receipts | Ask what one message's receipts say, now |
GET | /v1/conversations | List a line's conversations |
GET | /v1/conversations/:conversationId | Read a conversation: a group's name, members and status |
GET | /v1/conversations/:conversationId/messages | Read a conversation's history, newest first |
GET | /v1/contacts/:contactId | Read a contact |
GET | /v1/people/:personId | Read a person |
POST | /v1/contacts/:contactId/consent | Opt a person out |
GET | /v1/lines/available | Which of your lines somebody new would get now |
GET | /v1/lines/:lineId/health | Read a line's health |
GET | /v1/lines/:lineId/reputation | The same, under its old name; deprecated |
GET | /v1/lines/:lineId/templates | List a line's message templates |
POST | /v1/line-setups | Start adding a line |
GET | /v1/line-setups/:setupId | Read a line setup |
POST | /v1/line-setups/:setupId/checks | Run a setup's checks again |
POST | /v1/line-setups/:setupId/cancel | Cancel a line setup |
GET | /v1/webhook-endpoints | List webhook endpoints |
POST | /v1/webhook-endpoints | Create a webhook endpoint |
GET | /v1/webhook-endpoints/:endpointId | Read a webhook endpoint |
PATCH | /v1/webhook-endpoints/:endpointId | Update a webhook endpoint |
DELETE | /v1/webhook-endpoints/:endpointId | Delete a webhook endpoint |
POST | /v1/webhook-endpoints/:endpointId/rotate-secret | Rotate its signing secret |
GET | /v1/webhook-endpoints/:endpointId/deliveries | List its delivery attempts |
GET | /v1/projects | List projects |
GET | /v1/projects/:projectId | Read a project |
GET | /v1/members | List members |
GET | /v1/audit-logs | List audit log entries |
POST | /v1/cli/logins | Start a sign-in from a terminal |
POST | /v1/cli/logins/token | Poll a sign-in from a terminal |
POST | /v1/cli/tokens/renew | Renew a terminal sign-in |
POST | /v1/cli/tokens/revoke | Sign out with a refresh token |
POST | /v1/personal-tokens/current/revoke | Revoke 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.