X Ai Search API
Scrape X Ai Search data with one API call. Natural-language search over X (Twitter) powered by xAI's Grok 4.3 model with the built-in x_search tool. Returns a synthesised answer plus X source citations. Pin results to specific authors via from_handles (or exclude with exclude_handles), and narrow to a time window with from_date / to_date. Costs 5 credits per call regardless of how many internal x_search invocations the model performs (see tool_calls_count in the response for visibility). Auto-refunds on upstream failure. Best for freeform questions like 'what is @elonmusk saying about xAI this week' that would otherwise require multiple structured calls to /v1/twitter/profile, /v1/twitter/user/tweets, etc.
Last updated August 2026Maintained by the SocialCrawl team
Returns a written answer to a plain-English question about X (Twitter), the X posts cited as sources, and how many searches the model ran.
Use it for open questions such as what an account has said about a topic this week, which profile and user/tweets would take several calls to answer.
Searching 48 platforms in parallel
What can you do with the Ai Search API?
The Ai Search endpoint gives you structured X data with computed fields in a single request. No scraping infrastructure to build or maintain.
Example Request
curl -H "x-api-key: YOUR_API_KEY" \
"https://www.socialcrawl.dev/v1/twitter/ai-search?query=What+is+%40elonmusk+saying+about+xAI+this+week%3F"import requests
response = requests.get(
"https://www.socialcrawl.dev/v1/twitter/ai-search",
params={
'query': 'What is @elonmusk saying about xAI this week?',
},
headers={"x-api-key": "YOUR_API_KEY"},
)
data = response.json()const response = await fetch(
"https://www.socialcrawl.dev/v1/twitter/ai-search?query=What+is+%40elonmusk+saying+about+xAI+this+week%3F",
{
headers: { "x-api-key": "YOUR_API_KEY" },
},
);
const data = await response.json();Parameters
| Parameter | Required | Description |
|---|---|---|
| query | Yes | Natural-language prompt describing what you want to learn from X. The model autonomously searches X using the x_search tool with any handle / date filters you provide. |
| from_handles | No | Comma-separated X handles (max 10). Restricts the search to posts from these accounts only. Mutually exclusive with exclude_handles. |
| exclude_handles | No | Comma-separated X handles (max 10) to exclude from search results. Mutually exclusive with from_handles. |
| from_date | No | ISO 8601 start date (YYYY-MM-DD). Limits the search window to posts on or after this date. |
| to_date | No | ISO 8601 end date (YYYY-MM-DD). Limits the search window to posts on or before this date. |
What does the X Ai Search API return?
This example shows the endpoint's response shape and fields. Values are illustrative; this is not a live capture.
Example response
{
"success": true,
"platform": "twitter",
"endpoint": "/v1/twitter/ai-search",
"data": {
"answer": "Elon Musk recently posted about xAI's new reasoning model, highlighting its real-time X search capability...",
"sources": [
{
"url": "https://x.com/elonmusk/status/1234567890",
"title": "elonmusk on X"
}
],
"tool_calls_count": 1
},
"credits_used": 5,
"credits_remaining": 95,
"request_id": "req-a1b2c3d4e5f6",
"cached": false
}Illustrative fixture for the documented response shape. Values are examples, not a production capture.
How does the X Ai Search API work?
Send a GET request with your API key and get back clean, structured JSON in our unified schema. Supported computed fields are populated when the source provides the required inputs.
Method
GET
Response
JSON
How do you scrape social media data in seconds?
The fastest social media scraping API for developers. Scrape profiles, posts, comments, and analytics from 48 platforms covering 10B+ monthly active users.
One schema, every platform
Query 48 platforms with identical response structures. Write your integration once.
Computed fields, not just scraped
When an endpoint supports these metrics and the source provides the required inputs, the normalized record includes engagement_rate, estimated_reach, content_category, and language — ready to use.
See your data before you code
Visual Data Explorer — paste any URL, get rich result cards, sortable tables, CSV export.
import requests
response = requests.get(
'https://www.socialcrawl.dev/v1/tiktok/profile',
params={'handle': 'charlidamelio'},
headers={'x-api-key': 'sc_YOUR_API_KEY'}
)
data = response.json(){
"success": true,
"platform": "tiktok",
"data": {
"author": {
"username": "charlidamelio",
"followers": 152400000
},
"engagement": {
"likes": 12400000000,
"engagement_rate": 0.087
},
"metadata": {
"language": "en",
"content_category": "lifestyle"
}
}
}Have a question? We got answers
Find answers to frequently asked questions about SocialCrawl's API, pricing, and capabilities.
Contact usWhat is the Twitter AI Search API?
How is AI search different from regular tweet search?
Can I scope the Twitter AI search to specific accounts or dates?
Which model powers Twitter AI search?
How much does the Twitter AI Search API cost?
Ask AI about SocialCrawl
Ready to scrape X Ai Search data?
Get your API key and start pulling X data in under 60 seconds.
