Discord · Search
Search messages
One server search page, with native filters and offset paging. Costs 4 credits a message.
01
Request
POST /discord/messages/search with your Loci API key to fetch one page of messages.
| guild_id | required server (guild) ID, as a string |
| limit | messages per page; integer, default 25 |
| offset | page starting position; integer, default 0 |
For example, search for release messages in this server:
curl --request POST 'https://scraping.loci.lat/discord/messages/search' \
--header 'Authorization: Bearer YOUR_LOCI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"guild_id": "302094807046684672",
"content": "release",
"limit": 25,
"offset": 0
}'Search the server by sending guild_id. To select a channel, add "channel_id": ["302987265229979649"].
| content | string. Text to search for. |
| channel_id | array of strings. Search selected channels. Leave blank to search the server. |
| author_id | array of strings. Match messages by these authors. |
| author_type | array of strings. user, bot or webhook. Prefix a value with - to exclude it. |
| mentions | array of strings. Match messages mentioning these users. |
| mentions_role_id | array of strings. Match messages mentioning these roles. |
| mention_everyone | boolean. Filter messages that mention everyone. |
| replied_to_user_id | array of strings. Match replies to these users. |
| replied_to_message_id | array of strings. Match replies to these messages. |
| min_id | string. Start of the message ID range. |
| max_id | string. End of the message ID range. |
| pinned | boolean. Filter by whether messages are pinned. |
| has | array of strings. image, sound, video, file, sticker, embed, link, poll, snapshot. Prefix - to exclude. |
| embed_type | array of strings. image, video, gif, sound or article. |
| embed_provider | array of strings. Match embeds by provider name. |
| link_hostname | array of strings. Match links by hostname. |
| attachment_filename | array of strings. Match attachments by filename. |
| attachment_extension | array of strings. Match attachments by file extension. |
| sort_by | string. Defaults to timestamp. Values: timestamp, relevance. |
| sort_order | string. Defaults to desc. Values: desc, asc. |
| include_nsfw | boolean. Include NSFW results. Defaults to false. |
| slop | integer. Word proximity for text matching. Defaults to 2. |
Send filter lists as JSON arrays and IDs as strings.
02
Next page example
The first page uses offset: 0. With limit: 25, the next page uses offset: 25, then 50, 75 and so on. Keep the same guild and filters.
Add the requested limit to offset for each following page.
{
"guild_id": "302094807046684672",
"content": "release",
"limit": 25,
"offset": 25
}▸ ▾ Next page response example (illustrative)
{
"cost": 8,
"request_duration": 340,
"parse_duration": 0,
"created_at": 1793440802,
"data": {
"guild_id": "302094807046684672",
"total_results": 57,
"doing_deep_historical_index": false,
"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": {
"guild_id": "302094807046684672",
"total_results": 57,
"doing_deep_historical_index": false,
"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": []
}
]
}
}Matching messages are returned in data.messages. data.total_results contains the reported match count.
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.