X post search API
Public posts found through a web search engine.
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
DuckDuckGo, restricted to x.com, then read like tweet through X's public post widget, so views, retweet and bookmark counts are missing. This is engine-indexed discovery, not X's own search (which needs a login): coverage is incomplete, recent posts can be missing and the order is the engine's. Deleted, protected and unreachable posts are left out. Cursor pages 1 to 11.
You send query.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/twitter/search/posts" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'query=ai agents'import os
import requests
params = {
"query": "ai agents",
}
res = requests.get(
"https://api.socialscrape.io/v1/twitter/search/posts",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/twitter/search/posts");
url.search = new URLSearchParams({
query: "ai agents",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape X post search",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/twitter/search/posts",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "query",
"value": "ai agents"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | Keyword or phrase to look for in public X posts. Also accepted as keyword, q. |
cursor | string | Opaque cursor from the previous page; pass it back unchanged. Also accepted as continuationToken, continuation_token, next_max_id, max_id, max_cursor, min_time, after, page_token, pageToken, paginationToken, next_page_id, page. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_c40c15da8712aea7c04078e6",
"data": {
"object": "list",
"items": [
{
"object": "post",
"platform": "twitter",
"id": "2089382171291070550",
"url": "https://x.com/public/status/2089382171291070550",
"type": "tweet",
"author": {
"id": "4875271155",
"handle": "public",
"name": "Public",
"url": "https://x.com/public",
"avatar_url": "https://pbs.twimg.com/profile_images/2029954921500450820/TM-s7Olp_400x400.png",
"verified": true
},
"title": null,
"text": "BREAKING: New updates to AI Agents on Public\n\n→ We’ve launched the first-ever marketplace of AI Agents for your portfolio.\n→ Deploy them immediately or custo...",
"published_at": "2026-08-17T16:01:43Z",
"duration_seconds": 148.356,
"language": "en",
"hashtags": null,
"mentions": null,
"stats": {
"views": null,
"likes": 271,
"comments": 58,
"shares": null,
"saves": null,
"dislikes": null
},
"media": {
"thumbnail_url": "https://pbs.twimg.com/amplify_video_thumb/2089380922604789760/img/YsvWjEQtSRL1BBVP.jpg",
"video_url": "https://video.twimg.com/amplify_video/2089380922604789760/vid/avc1/1920x1080/_HrIDXI1YaM9p_0n.mp4",
"audio_url": null,
"image_urls": null,
"width": 1920,
"height": 1080
},
"song": null,
"location": null,
"is_pinned": null,
"is_sponsored": null,
"extra": {
"is_edited": false,
"media": [
{
"duration_seconds": 148.356,
"height": 1080,
"type": "video",
"url": "https://pbs.twimg.com/amplify_video_thumb/2089380922604789760/img/YsvWjEQtSRL1BBVP.jpg",
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2089380922604789760/pl/sILBlF5iBC0thC83.m3u8?v=7c0"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089380922604789760/vid/avc1/480x270/kcwI8ExpuWeSY-m-.mp4"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2089380922604789760/vid/avc1/640x360/-n3gU9091zWRTKyv.mp4"
}
],
"width": 1920
}
],
"possibly_sensitive": false,
"source_shape": "syndication"
}
},
{
"object": "post",
"platform": "twitter",
"id": "2115190541688398184",
"url": "https://x.com/AlexTamkin/status/2115190541688398184",
"type": "tweet",
"author": {
"id": "846245360",
"handle": "AlexTamkin",
"name": "Alex Tamkin",
"url": "https://x.com/AlexTamkin",
"avatar_url": "https://pbs.twimg.com/profile_images/1971860057190207488/UVKmQfr-_400x400.jpg",
"verified": true
},
"title": null,
"text": "New Anthropic research: How AI agents shape experts' judgment calls\n\nWhen experts delegate work to an agent, do they still make the key decisions? We tested ...",
"published_at": "2026-10-27T21:14:58Z",
"duration_seconds": 15,
"language": "en",
"hashtags": null,
"mentions": null,
"stats": {
"views": null,
"likes": 4257,
"comments": 314,
"shares": null,
"saves": null,
"dislikes": null
},
"media": {
"thumbnail_url": "https://pbs.twimg.com/amplify_video_thumb/2115181954740187136/img/iRp2D80CClkkY95v.jpg",
"video_url": "https://video.twimg.com/amplify_video/2115181954740187136/vid/avc1/1600x900/jKk5QaS9zEkshd2n.mp4",
"audio_url": null,
"image_urls": null,
"width": 1600,
"height": 900
},
"song": null,
"location": null,
"is_pinned": null,
"is_sponsored": null,
"extra": {
"is_edited": false,
"media": [
{
"duration_seconds": 15,
"height": 900,
"type": "video",
"url": "https://pbs.twimg.com/amplify_video_thumb/2115181954740187136/img/iRp2D80CClkkY95v.jpg",
"variants": [
{
"content_type": "application/x-mpegURL",
"url": "https://video.twimg.com/amplify_video/2115181954740187136/pl/jDXVoGQUDPWrcbuS.m3u8"
},
{
"bitrate": 256000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2115181954740187136/vid/avc1/480x270/KSyXPnvgjKX-kAKb.mp4"
},
{
"bitrate": 832000,
"content_type": "video/mp4",
"url": "https://video.twimg.com/amplify_video/2115181954740187136/vid/avc1/640x360/H9Ani75NyQGJZ0XQ.mp4"
}
],
"width": 1600
}
],
"possibly_sensitive": false,
"source_shape": "syndication"
}
}
],
"cursor": "eyJwIjoyLCJmIjp7InEiOiJhaSBhZ2VudHMgc2l0ZTp4LmNvbSBpbnVybDpzdGF0dXMiLCJzIjoiMTAiLCJuZXh0UGFyYW1zIjoiIiwidiI6ImwiLCJvIjoianNvbiIsImRjIjoiMTEiLCJhcGkiOiJkLmpzI...",
"has_more": true,
"parent": null
},
"cursor": "eyJwIjoyLCJmIjp7InEiOiJhaSBhZ2VudHMgc2l0ZTp4LmNvbSBpbnVybDpzdGF0dXMiLCJzIjoiMTAiLCJuZXh0UGFyYW1zIjoiIiwidiI6ImwiLCJvIjoianNvbiIsImRjIjoiMTEiLCJhcGkiOiJkLmpzI...",
"has_more": true
}Fields
A page of results. Each entry in items is a Post. cursor and has_more page through the rest.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "post" | ||
platform | Platform | yes | |
id | string | yes | |
url | string or null | ||
type | "video" or "short" or "reel" or "image" or "carousel" or "story" or "live" or "clip" or "text" or "link" or "tweet" or "pin" or "community_post" or "episode" or "unknown" | ||
author | Author or null | ||
title | string or null | ||
text | string or null | ||
published_at | string (ISO 8601 date-time) or null | ||
duration_seconds | number or null | ||
language | string or null | ||
hashtags | string[] or null | ||
mentions | string[] or null | ||
stats | Stats |
Show the other 6 fields
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), not_found (do not retry), upstream_blocked (retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
How do I get more than one page?
Send the same request with cursor set to the cursor you received, until has_more is false. Each page costs its own price. See pagination.
Is there an SDK call for it?
The preview Python client has client.twitter.search_posts(...) and the TypeScript client client.twitter.searchPosts(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.