X (Twitter) search API
Search recent posts with X’s own query syntax (from:, to:, since:, until:, min_faves:, lang:, quoted phrases, -exclude, OR), newest first or X’s top ranking. Not switched on yet.
GET /v1/x/search/tweetsNot switched on yet10 credits per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/x/search/tweets?q=from%3ANASA%20moon&product=latest",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()No bundled sample for this call. The response is a XTimelineResponse; its fields are listed below.
Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | X search query. Example: from:NASA moon. |
productquery | "latest" | "top" | latest (newest first, default) or top. One of latest, top. |
sincequery | string | Only posts on or after this time (sent to X as since_time:): YYYY-MM-DD (UTC) or an ISO 8601 timestamp. Example: 2026-11-01. |
untilquery | string | Only posts on or before this time (sent to X as until_time:): YYYY-MM-DD (UTC) or an ISO 8601 timestamp. Example: 2026-11-01. |
afterquery | string | Cursor: the previous page's meta.next_token. |
Response fields
200 with a XTimelineResponse, in the shape of X’s API v2 Tweet and User objects.
| Field | Type | Description |
|---|---|---|
data | XTweet[] | |
includes | XIncludes | Objects the response refers to by id, each once: authors, quoted and reposted posts, media, polls. |
meta | XTimelineMeta |
Status codes
| Status | Meaning |
|---|---|
200 | Matching posts, with a next_token. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The post or account does not exist, was deleted, or is suspended. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | X is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Can I use it today?
Not switched on yet: this endpoint needs logged-in X sessions, which this deployment does not have configured. Until then it answers 503 upstream_unavailable with a hint and is never charged.
Which operators work?
X’s own: from:, to:, since:, until:, min_faves:, lang:, quoted phrases, -word to exclude, and OR.
X is a trademark of X Corp. We are not affiliated with or endorsed by X Corp.