Discord · Channels
Channel messages
One channel history page, using native message ID boundaries. Costs 4 credits a message.
01
Request
POST /discord/channels/messages with your Loci API key to fetch one page of messages.
| channel_id | required channel ID or Discord channel/message URL, as a string; url and channel_url are also accepted |
| limit | messages per page; integer, default 100 |
| before / after / around | message ID for older messages, newer messages or a surrounding window |
For example, fetch recent messages from this channel:
curl --request POST 'https://scraping.loci.lat/discord/channels/messages' \
--header 'Authorization: Bearer YOUR_LOCI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"channel_id": "302987265229979649",
"limit": 100
}'The default page contains recent messages, newest first. Use before for older messages, after for newer messages, or around for a window around a message.
02
Next page example
Take the oldest returned message ID—1564317995990519851 in the example below—and send it as before to read older messages.
For newer messages, use after with the newest returned ID instead. An empty page contains messages: [].
{
"channel_id": "302987265229979649",
"limit": 100,
"before": "1564317995990519851"
}▸ ▾ Next page response example (illustrative)
{
"cost": 8,
"request_duration": 340,
"parse_duration": 0,
"created_at": 1793440802,
"data": {
"channel_id": "302987265229979649",
"messages": [
{
"id": "1564317995990519850",
"channel_id": "302987265229979649",
"type": 0,
"content": "Release notes are ready.",
"author": {
"id": "123456789012345678",
"username": "example-bot",
"global_name": null,
"avatar": null,
"bot": true
},
"timestamp": "2026-10-31T09:59:00+00:00",
"edited_timestamp": null,
"mentions": [],
"mention_roles": [],
"attachments": [],
"embeds": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"flags": 0,
"components": []
},
{
"id": "1564317995990519849",
"channel_id": "302987265229979649",
"type": 0,
"content": "The release build passed testing.",
"author": {
"id": "123456789012345678",
"username": "example-bot",
"global_name": null,
"avatar": null,
"bot": true
},
"timestamp": "2026-10-31T09:58:00+00:00",
"edited_timestamp": null,
"mentions": [],
"mention_roles": [],
"attachments": [],
"embeds": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"flags": 0,
"components": []
}
]
}
}03
Response example
This illustrative response contains two messages and costs 8 credits. IDs are strings, flags and counts are numbers, and timestamps retain Discord’s ISO format. The reply includes its referenced message.
▸ ▾ Full response example
{
"cost": 8,
"request_duration": 340,
"parse_duration": 0,
"created_at": 1793440802,
"data": {
"channel_id": "302987265229979649",
"messages": [
{
"id": "1564317995990519852",
"channel_id": "302987265229979649",
"type": 19,
"content": "Release testing starts today. Reply here with feedback.",
"author": {
"id": "123456789012345678",
"username": "example-bot",
"global_name": null,
"avatar": null,
"bot": true
},
"timestamp": "2026-10-31T10:00:01+00:00",
"edited_timestamp": null,
"mentions": [],
"mention_roles": [],
"attachments": [],
"embeds": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"flags": 0,
"components": [],
"message_reference": {
"type": 0,
"guild_id": "302094807046684672",
"channel_id": "302987265229979649",
"message_id": "1564317995990519851"
},
"referenced_message": {
"id": "1564317995990519851",
"channel_id": "302987265229979649",
"type": 0,
"content": "The next release is ready for testing.",
"author": {
"id": "123456789012345678",
"username": "example-bot",
"global_name": null,
"avatar": null,
"bot": true
},
"timestamp": "2026-10-31T10:00:00+00:00",
"edited_timestamp": null,
"mentions": [],
"mention_roles": [],
"attachments": [],
"embeds": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"flags": 0,
"components": []
}
},
{
"id": "1564317995990519851",
"channel_id": "302987265229979649",
"type": 0,
"content": "The next release is ready for testing.",
"author": {
"id": "123456789012345678",
"username": "example-bot",
"global_name": null,
"avatar": null,
"bot": true
},
"timestamp": "2026-10-31T10:00:00+00:00",
"edited_timestamp": null,
"mentions": [],
"mention_roles": [],
"attachments": [],
"embeds": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"flags": 0,
"components": []
}
]
}
}04
Fields
response {}
data {}
data.messages []
▸ ▾ authorobjectAuthor account details.
▸ ▾ mentionsobject[]Mentioned users.
▸ ▾ attachmentsobject[]Native file, image, audio or video attachments.
▸ ▾ embedsobject[]Native embedded cards and media.
▸ ▾ fieldsobject[]Named text fields.
▸ ▾ imageobjectEmbedded image.
▸ ▾ thumbnailobjectThumbnail image.
▸ ▾ videoobjectEmbedded video.
▸ ▾ reactionsobject[]Reaction details when present.
▸ ▾ emojiobjectReaction emoji.
▸ ▾ count_detailsobjectNormal and burst reaction counts.
▸ ▾ message_referenceobjectReply or forward target, when present.
Message fields keep Discord’s names and types, including authors, attachments, embeds, reactions and referenced messages when present.
The full native resource is described in Discord’s message API reference.
05
Credits
The listed cost is 4 credits per returned message: 100 credits for 25 messages or 400 credits for 100. cost shows the actual deduction, capped at your remaining balance. Empty results cost zero; failed calls return the credits deducted.