iMessage API

An iMessage API for AI agents, on Macs we run.

Apple publishes no iMessage API. Mapier Convo runs Macs signed into Apple accounts and puts one API in front of them: your agent sends commands and reads events, with no Apple hardware of its own.

What it does

Send, reply, react and run group chats through one API.

Your agent works in the iMessage thread your customers already have open.

  • Text, to a person or into a thread: send to a new address or into a one-to-one conversation your line already has open.
  • Threaded replies: quote an earlier message, so the reply lands on the line it answers.
  • Tapbacks: the six classic tapbacks, added or removed, on any message in a direct or group thread.
  • Group chats: create a group with its opening message, rename it, add participants.
  • Reachability check: ask whether an address can receive iMessage before you send, with a reason when not.

Developers

A request, and the events it settles with.

Your agent sends a command and reads what became of it on the event stream. Retries never double-send: the same Idempotency-Key is adopted, not sent twice.

curl

curl -sS -X POST "$MAPIER_BASE_URL/v1/commands/message.send" \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-2481-shipped" \
  -d '{
    "target": {
      "channel": "imessage",
      "recipient": "+15555550100"
    },
    "payload": {
      "text": "Order 2481 shipped. Reply here if anything is off."
    }
  }'
# 202 { "commandId": "…", "status": "queued",
#       "disposition": "queued" }

stream.ts

const base = process.env.MAPIER_BASE_URL;

const response = await fetch(`${base}/v1/response_stream`, {
  headers: {
    authorization: `Bearer ${process.env.MAPIER_API_KEY}`,
    accept: "text/event-stream",
    // Resume where you left off. Frames replay for 90 days.
    "last-event-id": lastEventId,
  },
});

for await (const frame of sseFrames(response.body)) {
  if (frame.event === "message") {
    // { conversationId, from, text, externalId,
    //   replyToExternalId, occurredAt, attachmentIds }
    const inbound = JSON.parse(frame.data);
    await send({
      target: { conversationId: inbound.conversationId },
      payload: { text: await reply(inbound.text) },
    });
  }
  if (frame.event === "command") {
    // { commandId, logicalActionId, status,
    //   errorCode, conversationId }
    // status: succeeded | failed | ambiguous |
    //         no_effect | cancelled | expired
  }
}

Read the quickstart

iMessage infrastructure

The fleet behind the line.

iMessage lines run on Mac minis we rebuild as blade servers and rack in data centres. We run the hardware, so a line is ours to keep healthy.

Mac servers
450
iMessage lines
3,300

FAQ

Questions about the iMessage API

Does my agent need a Mac?

No. iMessage lines run on Mac minis we rebuild as blade servers and rack in data centres. Each Mac is signed into an Apple account, and your application calls one HTTP API with no Apple hardware to run.

Can my agent check an address before it sends?

Yes. Ask first: a reachability check returns whether the address can receive and, when it cannot, why.

Which languages can call it?

Any. The API is plain HTTPS with an OpenAPI description, so there is no SDK to install and nothing to run on your side but your own code.

What happens when a send is retried?

Add an Idempotency-Key to a send and a retry is adopted: the original result comes back and nothing goes out twice.

Can I build without reaching a real number?

Yes. A test key reaches a sandbox with a simulated phone — sends and reactions settle there as they would on a live line — and can never reach a real number.

How is it priced?

On three plans: Pro, Ultra Scale and Enterprise. The pricing page sets them side by side, with what each includes.

Read on

More on the iMessage API

  • iMessage API pricing

    Three plans, side by side, and the questions about them.

    See pricing
  • Quickstart

    Create a project and a test key, send a command, listen for events.

    Read the quickstart
  • What is an iMessage API?

    What runs underneath one, how it works, and what to check before you build on it.

    Read
  • iMessage API providers compared

    Where each runs, which channels it has, group chats, and where each fits better.

    Read
  • How to give an AI agent an iMessage line

    Request a line, open the event stream, reply by conversation.

    Read

Give your agent a real line.
Talk to the people who build it.