Back to blog
Tutorials8 min read· Oct 8, 2026

iMessage API: How to Send and Receive iMessages From an App (2026)

Apple has no public iMessage API, so here is how a dedicated iMessage line lets your app or AI agent send blue-bubble messages, with read receipts, reactions and automatic SMS fallback.

AgentPhone TeamFounders
iMessage API: How to Send and Receive iMessages From an App (2026)

There is no official iMessage API. Apple has never published one, and there is no developer program that lets a server send a blue bubble on its own. If you want to send iMessages programmatically from an app or an AI agent, you need a provider that runs a real iMessage line for you and gives you an HTTP API in front of it. This guide explains how that works, what you get, what the limits are, and what it costs on AgentPhone.

Why iMessage instead of SMS

People in the US answer blue bubbles. An iMessage looks like it came from a person, not a short code. It also does things SMS cannot:

  • Read receipts and typing indicators. Your agent can show "typing..." while it thinks, and you can see when a message was read.
  • Tapback reactions. Hearts, thumbs up and the rest, in both directions.
  • Threaded replies and send effects. Reply to a specific message, or send with an effect.
  • Group chats. Your agent can sit in a group thread with several people.
  • Rich media. Multiple images in one send arrive as a carousel instead of separate MMS messages.

Green bubbles still matter. Not everyone has an iPhone, so any serious iMessage setup needs a fallback for Android and other phones.

What a "dedicated iMessage line" actually is

On AgentPhone an iMessage line is its own number type. It is not a setting you switch on for a normal SMS number. When you buy one, you get a real phone number that is registered with iMessage and connected to the same API and webhooks as every other AgentPhone channel.

There are two kinds of line:

LineCan start a conversationReplies to inboundPrice
Inbound-onlyNo, the person has to text firstYes$150 per month
Dedicated (outbound)Yes, up to 50 new contacts per dayYes$250 per month

If you want a specific area code, that is a $75 one-time fee. There is nothing per message on an iMessage line. You pay the flat monthly price whether you send ten messages or ten thousand.

Lines come from a warm pool, so most orders are ready right away. If the pool is empty, or you asked for a specific area code, the order goes through provisioning and you get the number when it is ready.

Buying a line through the API

You can buy a line in the dashboard (Numbers, then Get an iMessage Number) or with one API call:

bash
curl --fail-with-body "https://api.agentphone.ai/v1/numbers" \
-H "Authorization: Bearer $AGENTPHONE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"imessage","imessageType":"outbound","agentId":"YOUR_AGENT_ID"}'

imessageType defaults to outbound. Use inbound for a reply-only line. Attaching the line to an agent with agentId means inbound messages route to that agent's webhook without extra setup.

The call can succeed in two ways, and your code should handle both:

  • 200 with an id and phoneNumber. The line came straight from inventory. Save the number ID.
  • 202 with status: "provisioning" and a requestId. The order was accepted but the line is not ready yet. The requestId is not a number ID. Wait, then pick the line up from GET /v1/numbers or the dashboard. Do not keep re-buying while you wait.

iMessage lines bill to the card on file, separately from your prepaid credit, so add a payment method in Billing first.

Sending your first iMessage

Sending is the same endpoint you use for SMS. The sending number decides the transport.

bash
curl --fail-with-body "https://api.agentphone.ai/v1/messages" \
-H "Authorization: Bearer $AGENTPHONE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"number_id":"YOUR_NUMBER_ID","to_number":"+14155550123","body":"Hi, this is Maya from Northside Dental. Your cleaning is confirmed for Friday at 3pm."}'

A few rules for brand-new conversations:

  • Start with plain text. Links and attachments can be rejected until the other person sends a written reply. A reaction alone does not count as a reply.
  • Do not chain messages. A new contact can receive up to three messages before they reply.
  • On an inbound-only line, the person has to message you first.

Receiving messages and replying

Inbound iMessages arrive at your webhook as an agent.message event, the same event shape you get for SMS, WhatsApp and voice. Here is a real inbound event from one of our test numbers (this one arrived over SMS, which is why channel says sms. On an iMessage line it reads imessage):

json
{
"event": "agent.message",
"channel": "sms",
"timestamp": "2026-11-12T19:00:21.190127Z",
"agentId": "cmwdww6t15joz9tdelohw1ai9",
"data": {
"messageId": "cmwdwxm1t0yat635vb09g0b23",
"conversationId": "cmwdwwij40xwz635vp17p1gjx",
"numberId": "cmwdwwb8g5k129tde3cifylfg",
"from": "+14155550123",
"to": "+14155550199",
"message": "Can I move my appointment to Friday at 3pm?",
"mediaUrls": [],
"direction": "inbound",
"receivedAt": "2026-11-12T19:00:21.088000Z"
},
"recentHistory": [
{ "content": "Hi, is this the support line?", "direction": "inbound", "channel": "sms", "at": "2026-11-12T18:59:29.879000Z" },
{ "content": "Can I move my appointment to Friday at 3pm?", "direction": "inbound", "channel": "sms", "at": "2026-11-12T19:00:21.088000Z" }
]
}

Notice recentHistory. The conversation so far comes with every event, so your agent has context without a database lookup.

To reply, call POST /v1/messages with data.numberId as the sender and data.from as the recipient. Returning text from the webhook does not send a message. For a group chat, reply to data.group.groupId instead.

Read receipts, typing, reactions and groups

These are the features that make an agent feel human on iMessage. All of them need an iMessage-capable line, and standard SMS numbers reject them with a 400.

  • Typing indicator: POST /v1/conversations/{id}/typing while your model is working.
  • Reactions: POST /v1/messages/{message_id}/reactions with a tapback such as love.
  • Threaded reply: pass reply_to_message_id on a send.
  • Send effects: pass send_style.
  • Groups: conversations marked isGroup: true, with at most one attachment per group message.

Fallback for Android: RCS, then SMS

When the recipient cannot receive iMessage, the line falls back automatically, first to RCS and then to SMS. You make the same API call either way. The send response's channel tells you what you asked for. Message history reports deliveredChannel when the network used a fallback, so you can see what the recipient actually got. Some iMessage-only features, like effects, will not show up after a fallback.

Limits you should plan around

SituationLimit
New conversations you start50 new contacts per day per outbound line
Replies to existing conversationsUnlimited, they do not use the daily quota
Conversations started by the other personUp to 1,000 inbound contacts per day per line
New contact who has not repliedUp to three messages, links and media may be held
Conversation inactive for 14+ daysOne re-engagement message, then wait for a reply

Hitting the daily cap returns 429 with OUTBOUND_LIMIT_REACHED or NEW_CONVERSATION_LIMIT_REACHED. Retrying does not help, so wait for the reset. Safety pauses are separate from the 50 per day ceiling, so ramp new traffic slowly and message people who expect to hear from you. Buying more lines adds daily allowance but does not get around conversation or safety rules.

When iMessage is the right choice

Use an iMessage line when your recipients are mostly on iPhones in the US, when the conversation is high value (sales follow-up, appointments, concierge support), and when response rate matters more than raw volume. Use SMS when you need very high daily volume to people who have opted in, since SMS throughput is set by your 10DLC campaign instead of a 50 per day ceiling.

A nice side effect: iMessage does not need 10DLC registration, so a business can start texting customers from an iMessage line while its SMS registration is still in review.

FAQ

Is there an official Apple iMessage API? No. Apple offers Apple Messages for Business for verified brands, which is a different product. A dedicated iMessage line is how you send from a normal phone number.

How much does an iMessage API cost on AgentPhone? $150 per month for an inbound-only line, $250 per month for a dedicated line that can start conversations, and $75 one time for a specific area code. There is no per-message charge.

What happens if the recipient has an Android phone? The line falls back to RCS, then SMS, automatically. Check deliveredChannel in message history to see what was used.

How many people can I message per day? Up to 50 new contacts per day per outbound line. Replies to existing conversations do not count against that.

Can my AI agent use iMessage through MCP? Yes. The AgentPhone MCP server works with Claude Code, Cursor, ChatGPT and other MCP clients, and the same tools send iMessages from an iMessage line.

Ready to try it? Read the iMessage setup guide, check pricing, or create an account and start with $5 of free credit.

Filed under Tutorials · Published Oct 8, 2026All blog

Ready to give your AI Agent a phone number?