Messages
Read direct-message conversations and reply to them. Available on Instagram accounts.
Conversations
GET/v1/accounts/{id}/conversations
The account’s conversations. Pass next_cursor back as cursor for more.
curl https://api.postpeg.com/v1/accounts/acc_mfz20b5n1s8f4j7xv2p9r6hu1c/conversations \
-H "Authorization: Bearer $POSTPEG_KEY"{
"data": [
{
"id": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4",
"account_id": "acc_mfz20b5n1s8f4j7xv2p9r6hu1c",
"platform": "instagram",
"participant": {
"id": "6512345678901234",
"name": "Ren",
"avatar_url": null
},
"last_message": "Hi! Are you open on Sunday?",
"unread_count": 1,
"updated_at": "2026-10-01T11:02:19.000Z",
"url": null
}
],
"next_cursor": null
}Messages
GET/v1/accounts/{id}/conversations/{conversation_id}/messages
Newest first. direction is incoming or outgoing. Attachment URLs from Instagram are signed and expire: use them right away, don’t store them.
curl https://api.postpeg.com/v1/accounts/acc_mfz20b5n1s8f4j7xv2p9r6hu1c/conversations/aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4/messages \
-H "Authorization: Bearer $POSTPEG_KEY"{
"data": [
{
"id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZA",
"conversation_id": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4",
"direction": "incoming",
"text": "Hi! Are you open on Sunday?",
"sender": {
"id": "6512345678901234",
"name": "Ren"
},
"attachments": [],
"created_at": "2026-10-01T11:02:19.000Z"
}
],
"next_cursor": null
}Send a reply
POST/v1/accounts/{id}/conversations/{conversation_id}/messages
| Field | Description |
|---|---|
textstring, 1–1000 | The message. |
attachment_urlhttps URL | A public file to attach. |
Send text, attachment_url, or both. Add an Idempotency-Key header so a retry never sends the same message twice.
curl https://api.postpeg.com/v1/accounts/acc_mfz20b5n1s8f4j7xv2p9r6hu1c/conversations/aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4/messages \
-H "Authorization: Bearer $POSTPEG_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: reply-sunday-hours" \
-d '{
"text": "We are! 9 to 3 on Sundays."
}'{
"id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZB",
"conversation_id": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4"
}id can be null when the network accepts the message without returning an id.
The 24-hour window
Instagram only lets a business reply within 24 hours of the person’s last message. Outside that window Instagram refuses, and you get a 502 with its reason:
{
"type": "https://postpeg.com/errors/upstream_error",
"title": "Upstream error",
"status": 502,
"detail": "The platform refused the request: …",
"code": "upstream_error",
"request_id": "8f14e45f-ceea-467a-9575-1f2a5c3e6b0d"
}