Docs
REST API reference
Send and read iMessages programmatically. Connect any app, CRM, or agent.
Base URL
All endpoints below are relative to this host. HTTPS only.
Authentication
Every /v1/* request must carry your key in the X-API-KEY header (Authorization: Bearer <key> also works).
X-API-KEY: <your-api-key>Keep it secret — anyone holding this key can read and send your iMessages. Manage or regenerate it in Settings inside the dashboard. An account can hold several keys — one per integration, each full-access or read-only, revocable on its own without touching the others — so you never have to burn a key that is already wired into n8n or Zapier.
Errors, limits & conventions
- Every success response is wrapped in a
dataenvelope; every failure in anerrorenvelope. - Identifiers: conversations, drafts, and contacts are addressed by their server-generated
id(collision-proof). Messages are addressed bymessageGUID— the stable iMessage UUID — always scoped to your account. - Case & naming: input is snake_case (
phone_number,display_name,photo_url); responses are camelCase. API-created contacts are markedsource=manualso the Mac connector never overwrites your edits. - Phone numbers are stored E.164 (
+14155551234). The stored field spelledrefrenceis returned asreferenceby the API.
Error envelope example
{ "error": { "code": "unauthorized", "message": "Invalid API key." } }Quickstart — send your first iMessage
curl -X POST \
https://api.automessage.app/v1/drafts \
-H "X-API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"to":"+14155551234","body":"Hello from the autoMessage API"}'Sending is asynchronous: you create a draft, your Mac connector delivers it over iMessage, then the draft records the outcome.
Response
{
"data": {
"id": "aB3dE5…",
"to": "+14155551234",
"body": "Hello from the autoMessage API",
"sent": false,
"sendError": false,
"sentMessage": null
}
}Prefer AI tools over raw HTTP?
The autoMessage MCP server gives Claude, Cursor, Codex, and any MCP client these same capabilities as native tools — install it in 30 seconds.
Conversations
Read-only. Threads are created by real iMessage activity.
GET/v1/conversationsList or search your conversations, newest activity first.
QueryPass at most one primary filter — participant (phone/email in the thread; matches 1:1 AND groups; loose formats like "(502) 544-2686" are normalized), name (case-insensitive display-name substring), handle (exact 1:1 recipient), group (true/false), or unread (true). All also accept activeSince / activeBefore (ISO-8601), limit (default 50, max 200), and cursor (from pagination.nextCursor). Combining primaries returns 400.
Response
{
"data": [ {
"id": "zjueBDrNP2490J6JPWnJ",
"displayName": "+14155551234",
"groupName": "",
"participants": ["+14155551234"],
"previewMessage": "See you at 2pm!",
"unreadCount": 1,
"lastActive": "2026-07-16T17:13:29.497Z",
"contacts": [],
"owner": "users/<your-uid>"
} ]
}GET/v1/conversations/{id}Fetch a single conversation by its id.
Response
{ "data": {
"id": "zjueBDrNP2490J6JPWnJ",
"displayName": "+14155551234",
"groupName": "",
"participants": ["+14155551234"],
"previewMessage": "See you at 2pm!",
"unreadCount": 1,
"lastActive": "2026-07-16T17:13:29.497Z",
"contacts": [],
"owner": "users/<your-uid>"
} }POST/v1/conversations/{id}/readMark every unread received message in the thread as read; the dashboard badge clears at once.
Response
{ "data": {
"conversationId": "zjueBDrNP2490J6JPWnJ",
"markedRead": 3,
"unreadCount": 0,
"macSync": "off"
} }
// macSync is "requested" when you switched on "Mark read on Mac" in autoMessage:
// your Mac then opens the thread in Messages in the background so the read
// receipt goes out over iMessage (best effort, 1:1 threads; the outcome lands on
// the conversation as markReadResult). chat.db itself is never written.GET/v1/conversations/{id}/messagesPaginated messages in a thread, with sender names resolved from your contacts.
Querylimit (default 50) · direction = inbound / outbound · since / before = ISO 8601 timestamps (an offset like +05:30 or a date-only value is fine; anything unparseable is a 400, never silently ignored) · cursor = pagination.nextCursor from the previous page, passed verbatim (opaque; encodes the last item's sentDate + id so nothing is skipped). Response includes nextCursor when more pages exist.
Response
{
"data": [ {
"id": "0NQXTM0s4ZgJGqrv4qbK",
"messageGUID": "8328F671-7D1D-B351-EF5E-B0963FD80FF1",
"conversationGUID": "zjueBDrNP2490J6JPWnJ",
"sender": "+14155551234",
"senderName": "Jane Appleseed",
"body": "See you at 2pm!",
"type": "iMessage",
"outbound": false,
"read": true,
"sentDate": "2026-07-16T17:13:29.497Z",
"dateRead": null,
"dateDelivered": null,
"delivered": null,
"deliveryError": null,
"cacheHasAttachments": false,
"attachments": [],
"tapbacks": [],
"replyToGUID": "",
"unsent": false,
"reference": ""
} ],
"nextCursor": "MTc4NDA1NjAwOS40OTcwMDAwMDAuMmNhNzM4ZjM"
}Messages
Read-only. Individual messages are addressed by their iMessage GUID.
GET/v1/messagesEvery message on the account across all threads, newest first — the "what came in since I last looked" feed.
Querylimit (default 50, max 200) · direction = inbound / outbound · since / before = ISO 8601 timestamps (unparseable → 400) · cursor = pagination.nextCursor from the previous page, passed verbatim. Each item is the same Message shape as the per-thread listing, with conversationGUID telling you which thread it belongs to.
Response
{
"data": [ { "...": "Message — see /v1/conversations/{id}/messages for the full shape" } ],
"pagination": { "limit": 50, "nextCursor": "MTc4NDA1NjAwOS40OTcwMDAwMDAuMmNhNzM4ZjM" }
}POST/v1/messages/{messageGUID}/readMark one received message as read and recount its thread.
Response
{
"data": { "...": "the message, now read: true" },
"meta": { "conversationId": "zjueBDrNP2490J6JPWnJ", "markedRead": 1, "unreadCount": 2, "macSync": "off" }
}GET/v1/messages/{messageGUID}Look up any single message you own by its iMessage GUID.
Response
{ "data": {
"id": "0NQXTM0s4ZgJGqrv4qbK",
"messageGUID": "8328F671-7D1D-B351-EF5E-B0963FD80FF1",
"conversationGUID": "zjueBDrNP2490J6JPWnJ",
"sender": "+14155551234",
"senderName": "Jane Appleseed",
"body": "See you at 2pm!",
"type": "iMessage",
"outbound": false,
"read": true,
"sentDate": "2026-07-16T17:13:29.497Z",
"dateRead": null,
"dateDelivered": null,
"delivered": null,
"deliveryError": null,
"cacheHasAttachments": false,
"attachments": [],
"tapbacks": [],
"replyToGUID": "",
"unsent": false,
"reference": ""
} }Drafts — sending iMessages
Create, list, poll, edit, and cancel outbound drafts.
POST/v1/draftsQueue an iMessage for delivery — to a number or email, or into an existing thread (group chats included).
Request body
{
"to": "+14155551234",
"body": "Hello from the autoMessage API"
}
// …or into an existing conversation (the only way to reach a GROUP chat).
// Exactly one of "to" / "conversationId"; 404 if the thread is not yours.
// A reply into an existing group never counts against the new-outreach limit.
{
"conversationId": "zjueBDq8rN2pLx0vT7aK",
"body": "Hi all — running 5 min late"
}
// Always 202, never 429. When the Mac will HOLD the message instead of sending
// it at once, the response carries meta.queued.reason — and the draft reads
// status "held" with the same hold.reason:
// outreach_limit_reached new conversations per rolling 24 h — threads you
// opened, replied or not (limit / used / resumesAt)
// unreplied_limit_reached of the threads you opened in the last 7 days, too
// many have no reply yet — frees as people reply or
// the oldest age out (limit / used / resumesAt)
// warming_up the Mac's Messages history is still thin, so new
// conversations per day are capped below your own limit
// for now (limit = today's ceiling; it rises on its own)
// (these three apply only to a message that would START a 1:1 conversation;
// replies and follow-ups into conversations you already have are never held here)
// send_paused sending is paused on the account: several sends failed
// to deliver and stayed failed, the burst guard, or by hand
// — resumed from the dashboard (resumesAt only when timed)
// thread_delivery_failing the last message into that conversation was not
// delivered — held until they reply or Messages' own
// retry lands (carries conversationId)
//
// The Mac can also hold a draft at SEND time (status "held", never in meta.queued)
// for the account's conversation guardrails, each a toggle in Settings:
// follow_up_limit that many messages in a row with no reply (default 3)
// awaiting_first_message "only message people who texted first" is on
// identical_message_limit the same text already went to 3 other conversations
// in 24 h — personalise it to send now
// target_lookup_failed the Mac could not check the thread (offline) and holds
// instead of guessing; retried every couple of minutes
// quiet_hours 8 pm–9 am in the recipient's time zone (area code);
// a thread they wrote to in the last 30 min is exempt
// Each one sends on its own once it clears (a reply, an edit, the window moving).Response
{ "data": {
"id": "aB3dE5fGh7…",
"to": "+14155551234",
"conversationId": null,
"chatGUID": null,
"body": "Hello from the autoMessage API",
"sent": false,
"sendError": null,
"draftDate": "2026-07-16T18:00:00.000Z",
"sentDate": null,
"sentMessage": null,
"responseWebhook": null,
"owner": "users/<your-uid>"
} }GET/v1/draftsList your drafts, newest first.
Querylimit (default 50, max 200) · status = queued / sending / held / blocked / sent / cancelled / failed · cursor = pagination.nextCursor from the previous page, passed verbatim (opaque). Keep paging until nextCursor is null — a narrowed status page may carry fewer than limit rows and still have a cursor.
Response
{
"data": [ {
"id": "aB3dE5fGh7…",
"to": "+14155551234",
"body": "Hello from the autoMessage API",
"status": "sent",
"sent": true,
"sendError": null,
"draftDate": "2026-07-16T18:00:00.000Z",
"sentDate": "2026-07-16T18:00:07.412Z",
"sentMessage": "conversations/zjueBD…/messages/0NQXTM…",
"responseWebhook": null
} ],
"pagination": { "limit": 50, "nextCursor": "MTc4NDA1NjAwOS40OTcwMDAwMDAuYUIzZEU1ZkdoNw" }
}GET/v1/drafts/{id}Poll delivery status.
Response
{ "data": {
"id": "aB3dE5fGh7…",
"to": "+14155551234",
"body": "Hello from the autoMessage API",
"sent": true,
"sendError": null,
"draftDate": "2026-07-16T18:00:00.000Z",
"sentDate": "2026-07-16T18:00:07.412Z",
"sentMessage": "conversations/zjueBD…/messages/0NQXTM…",
"responseWebhook": null,
"owner": "users/<your-uid>"
} }PATCH/v1/drafts/{id}Edit a draft that has not sent yet.
Request body
{
"body": "Updated message text"
}Response
{ "data": {
"id": "aB3dE5fGh7…",
"to": "+14155551234",
"body": "Hello from the autoMessage API",
"sent": false,
"sendError": null,
"draftDate": "2026-07-16T18:00:00.000Z",
"sentDate": null,
"sentMessage": null,
"responseWebhook": null,
"owner": "users/<your-uid>"
} }DELETE/v1/drafts/{id}Cancel an unsent draft (soft-cancel — the record is kept, sendError becomes "cancelled").
Response
{
"data": {
"id": "aB3dE5fGh7…",
"sent": false,
"sendError": "cancelled",
"cancelledAt": "2026-07-16T18:02:11.000Z"
}
}Contacts
Manage your address book from code. API-created rows are marked source=manual.
GET/v1/contactsList your contacts.
Querylimit (default 200).
Response
{
"data": [ {
"id": "<your-uid>__+14155551234",
"displayName": "Jane Appleseed",
"phoneNumber": "+14155551234",
"email": "jane@example.com",
"photoURL": "",
"userName": "",
"url1": "",
"source": "manual",
"wouldSyncBack": false,
"createdTime": "2026-07-16T18:00:00.000Z",
"editedTime": null,
"owner": "users/<your-uid>"
} ]
}POST/v1/contactsCreate or update a contact (idempotent upsert per handle).
Request body
{
"phone_number": "+14155551234",
"display_name": "Jane Appleseed",
"email": "jane@example.com",
"photo_url": "https://example.com/jane.jpg"
}Response
{ "data": {
"id": "<your-uid>__+14155551234",
"displayName": "Jane Appleseed",
"phoneNumber": "+14155551234",
"email": "jane@example.com",
"photoURL": "",
"userName": "",
"url1": "",
"source": "manual",
"wouldSyncBack": false,
"createdTime": "2026-07-16T18:00:00.000Z",
"editedTime": null,
"owner": "users/<your-uid>"
} }GET/v1/contacts/{id}Fetch a single contact.
Response
{ "data": {
"id": "<your-uid>__+14155551234",
"displayName": "Jane Appleseed",
"phoneNumber": "+14155551234",
"email": "jane@example.com",
"photoURL": "",
"userName": "",
"url1": "",
"source": "manual",
"wouldSyncBack": false,
"createdTime": "2026-07-16T18:00:00.000Z",
"editedTime": null,
"owner": "users/<your-uid>"
} }PATCH/v1/contacts/{id}Update fields on a contact (also forces source=manual).
Request body
{
"display_name": "Jane A."
}Response
{ "data": {
"id": "<your-uid>__+14155551234",
"displayName": "Jane Appleseed",
"phoneNumber": "+14155551234",
"email": "jane@example.com",
"photoURL": "",
"userName": "",
"url1": "",
"source": "manual",
"wouldSyncBack": false,
"createdTime": "2026-07-16T18:00:00.000Z",
"editedTime": null,
"owner": "users/<your-uid>"
} }DELETE/v1/contacts/{id}Delete a contact.
Response
{ "data": { "id": "<your-uid>__+14155551234", "deleted": true } }Response webhooks
Attach a responseWebhook to a draft and, after that draft sends, the subscription is registered on the matched conversation. Any future inbound message in that conversation posts a JSON payload to your URL. The URL must be a public HTTPS endpoint — private and internal addresses are rejected.
Verifying signatures
When you register a webhook, the response returns a meta.webhookSecret (prefixed whsec_) shown only once — store it. Every delivery carries an X-AutoMessage-Signature header of the form t=<timestamp>,v1=<hmac>. Recompute it as HMAC-SHA256(secret, "<timestamp>.<raw-body>") and compare in constant time; reject old timestamps to prevent replays.
import crypto from 'node:crypto';
function verify(rawBody, header, secret) {
const [t, v1] = header.split(',').map(p => p.split('=')[1]);
const expected = crypto
.createHmac('sha256', secret)
.update(`${t}.${rawBody}`)
.digest('hex');
const ok = crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
const fresh = Math.abs(Date.now()/1000 - Number(t)) < 300; // 5 min
return ok && fresh;
}POST/v1/draftsDraft body with an attached responseWebhook.
Request body
{
"to": "+14155551234",
"body": "Hello from the autoMessage API",
"responseWebhook": {
"url": "https://your.app/hooks/imessage"
}
}Account-level webhooks
A response webhook follows one thread. An account-level subscription receives every message that arrives on your account, the moment your Mac syncs it — this is what the n8n trigger's instant mode and Zapier use. Up to five per account; the URL must be a public HTTPS endpoint. The same X-AutoMessage-Signature scheme above applies to every delivery. A subscription that fails 25 deliveries in a row is switched off (disabled: true) until you re-subscribe the same URL, which also rotates its secret. If the same URL is also attached to a thread as a response webhook, that thread's messages are delivered once, signed with the thread subscription's secret.
POST/v1/webhooksSubscribe. 201 for a new URL, 200 when re-subscribing (secret rotated), 409 at the limit.
Request body
{
"url": "https://your.app/hooks/automessage",
"events": ["message.received"]
}Response — the secret appears only here
{
"data": {
"id": "Xk2pQ9…",
"url": "https://your.app/hooks/automessage",
"events": ["message.received"],
"secret": "whsec_…",
"createdAt": "2026-10-15T18:00:00.000Z",
"lastDeliveryAt": null,
"lastOutcome": null,
"consecutiveFailures": 0,
"disabled": false
},
"meta": {
"signature": "X-AutoMessage-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" keyed with secret>",
"note": "The secret is shown only in this response. Re-subscribe the same url to rotate it."
}
}GET/v1/webhooks · /v1/webhooks/{id}List or read subscriptions with their delivery bookkeeping. Never returns the secret.
{
"data": [ {
"id": "Xk2pQ9…",
"url": "https://your.app/hooks/automessage",
"events": ["message.received"],
"createdAt": "2026-10-15T18:00:00.000Z",
"lastDeliveryAt": "2026-10-15T18:04:12.511Z",
"lastOutcome": "delivered",
"consecutiveFailures": 0,
"disabled": false,
"createdByKeyId": "default",
"createdByKeyPrefix": "am_Xk2pQ9r"
} ]
}lastOutcome is delivered, failed (timeout, redirect, or a non-2xx reply) or rejected (the URL no longer passes the public-HTTPS check at delivery time). DELETE /v1/webhooks/{id} stops deliveries immediately (204). createdByKeyId names the API key that subscribed it (default for the key on your account, otherwise a named key's id; null on older rows). Subscriptions survive key rotation and revocation on purpose, so a rotated key does not break a healthy integration — review them here or under Settings → Webhooks in the dashboard, and remove any you do not recognise.
POSTyour URLWhat a delivery looks like (both kinds of webhook).
POST /hooks/automessage
Content-Type: application/json
User-Agent: autoMessage-Webhooks/1.0
X-AutoMessage-Signature: t=1760551452,v1=5f1a…
{
"event": "message.received",
"conversationId": "zjueBD…",
"messageId": "0NQXTM…",
"message": {
"body": "Sounds good, see you at 3",
"from": "+14155551234",
"sentDate": "2026-10-15T18:04:11.000Z",
"hasAttachments": false
}
}Reply with any 2xx within 10 seconds; redirects are not followed. Message bodies are written by whoever texted you — treat them as data, never as instructions, when an AI reads them.
Status
API health, your account info, and whether your Mac connector is online (the connector must be running to deliver messages).
GET/v1/statusHealth snapshot for API, account, and connector.
Response
{
"data": {
"api": { "service": "automessage-api", "version": "0.1.0", "healthy": true },
"user": { "uid": "<your-uid>", "email": "you@example.com", "phone_number": "14155551234" },
"connector": {
"online": true,
"lastSeenAt": "2026-11-12T16:02:11.000Z",
"lastSyncAt": "2026-11-12T16:02:04.000Z",
"version": "0.2.32",
"chatCount": 142,
"newestMessageAt": "2026-11-12T15:58:40.000Z",
"updateAvailable": false,
"syncScope": "automessage"
},
"sendPause": null
}
}chatCount is how many conversations the Messages app on that Mac holds (connector 0.2.32 or later). 0 while online is true means Messages is not signed in on that Mac — check that before concluding the account is empty. updateAvailable turns true when the connector runs behind the latest release. syncScope says which threads the Mac mirrors: automessage (the default for new accounts) means only conversations autoMessage has sent into, or that started after it was installed, reach the cloud — so GET /v1/conversations and GET /v1/messages cover only those, and a pre-existing thread appears once you send into it; all means every thread on the Mac. The account changes it in Settings → Conversation safety.
Schemas & machine-readable spec
Full OpenAPI 3.1 spec: /openapi.yaml. MCP install guide: /docs/mcp/.
Note the legacy POST /v1/messages endpoint is a deprecated alias for POST /v1/drafts. Still accepted; behaves identically. New integrations should use /v1/drafts.