Images and files
- iMessage
Send photos, video, audio and documents by link, with optional text
Put a public https link to each file in a media message. Mapier or the channel fetches the file, so keep the link working until the result arrives.
| You want | Send |
|---|---|
| One photo or file | media with one link |
| Several photos as one message | multipart with several photo parts, on iMessage |
| Photos with text | multipart with photo and text parts, on iMessage |
| A contact card | contact, or a .vcf file in media |
| A sticker | sticker |
| Channel | Words with a file | Files in one message |
|---|---|---|
| iMessage | A text part in a multipart | Up to 10 photos, in a multipart |
A caption, up to 1,024 characters | One |
Send a photo with text
This reply goes into a conversation the person started. To write to someone new, check who can write first.
curl -X POST https://api.mapier.ai/v1/commands/message.send \
-H "Authorization: Bearer $MAPIER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-4821-photo" \
-H "x-mapier-version: 2026-12-01" \
-d '{
"target": { "conversationId": "a0000000-0000-4000-8000-000000000001" },
"payload": {
"kind": "multipart",
"parts": [
{ "kind": "media", "url": "https://example.com/orders/4821/table.jpg" },
{ "kind": "text", "text": "Yes, by the window." }
]
}
}'{
"commandId": "0192b3e1-…",
"status": "queued",
"repeated": false,
"lineId": "0192a7b0-…",
"lineSelection": "reused_active_chat",
"channel": "imessage"
}Keep commandId. Its result on the stream says whether the file went out.
On WhatsApp, the same photo with text is one media message with a caption:
{
"kind": "media",
"url": "https://example.com/orders/4821/table.jpg",
"caption": "Yes, by the window."
}A single photo or file is media with one url. On iMessage, nothing else goes beside it:
{ "kind": "media", "url": "https://example.com/orders/4821/receipt.pdf" }A multipart holds 2 to 20 parts in the order you list them, at most 10 of them photos, and no link twice. Mapier fetches every link before the message goes out. If one link fails, nothing is sent and the error names the part.
Limits
Send a message › Files lists the largest file and the most files per message on each channel.
| Channel | Who fetches the link | What it takes |
|---|---|---|
| iMessage | Mapier, before it sends | https only, at most 8 MiB: an image, a PDF, common audio or video, or a vCard (.vcf) whose declared type matches its bytes |
On iMessage, a photo or file goes only into a conversation the person has written in, or a group chat.
When a file fails after sending
A file the channel cannot use ends as a failed result:
id: 0192…
event: command
data: {"commandId":"0192b3f7-…","type":"message.send","status":"failed","failureClass":"content","errorCode":"…","messageId":null,"conversationId":"a0000000-…","lineId":"0192a7b0-…"}failureClass: content means the file or text was refused. Fix the file, then send it again. errorCode is the channel's own word, for your logs.
Results and delivery lists every class.
Receive a file
An incoming message.received event lists each file in attachments. Download any file with GET /v1/attachments/{id}.
{
"messageId": "0192d0a1-…",
"conversationId": "a0000000-0000-4000-8000-000000000001",
"lineId": "0192a7b0-…",
"channel": "imessage",
"from": "+15550100100",
"text": "Here is my receipt.",
"attachments": [
{ "id": "0192e4f2-…", "mimeType": "image/jpeg", "filename": "receipt.jpg", "byteSize": 482113 }
]
}mimeType, filename and byteSize are what the person's device declared, or null. A voice note adds "kind": "voice_note", and a sticker adds "isSticker": true.
Errors you may see
Each of these comes back at once, and nothing is sent. A problem Mapier cannot check up front ends as a failed result instead.
| Error | Means | Fix |
|---|---|---|
403 recipient_not_allowed | This person cannot get files from you yet | Check who can write first |
404 unsupported_command, not_on_channel | A multipart on a line whose channel takes one file per message | Send one file per message |
422 validation_failed, conversation_not_confirmed | The person has not written in this conversation yet | Send a text first |
422 validation_failed, media_too_large | The file is too large | Send a smaller file |
422 validation_failed, unsupported_media_type | The file type is not supported | Convert the file |
422 validation_failed, media_fetch_failed | Mapier could not fetch the link | Check the link, then retry |
422 validation_failed, media_fetch_refused | The link is not https, or points inside a private network | Host the file at a public https link |
503 service_busy | Mapier is busy fetching many files | Wait retryAfter seconds, then retry |