Scrapers
Grok
Extract structured data from the Grok web interface - web sources, real X posts, follow-up questions, and three reasoning modes - as clean JSON.
GET
/
scrapers
/
grok
cURL
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/grok" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What are people on X saying about email marketing tools?" \
--data-urlencode "country=US" \
--data-urlencode "mode=MODEL_MODE_AUTO"import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/grok",
params={
"api_key": "YOUR_API_KEY",
"prompt": "What are people on X saying about email marketing tools?",
"country": "US",
"mode": "MODEL_MODE_AUTO",
}
)
print(response.json())
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What are people on X saying about email marketing tools?",
country: "US",
mode: "MODEL_MODE_AUTO",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/grok?${params}`
);
const data = await response.json();
console.log(data);
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What are people on X saying about email marketing tools?",
country: "US",
mode: "MODEL_MODE_AUTO",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/grok?${params}`
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrapellm.com/scrapers/grok",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrapellm.com/scrapers/grok"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrapellm.com/scrapers/grok")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrapellm.com/scrapers/grok")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scraper": "grok",
"status": "done",
"job_id": "job_abc123",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
"mode": "MODEL_MODE_AUTO",
"result": "Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo...",
"result_markdown": "Marketers commonly recommend **Mailchimp**, **HubSpot**, and **Klaviyo**...",
"web_sources": [
{
"title": "Best Email Marketing Platforms 2025",
"preview": "We tested 12 tools across deliverability, automation, and pricing...",
"url": "https://example.com/email-marketing-comparison"
}
],
"x_results": [
{
"post_id": "1234567890123456789",
"user_name": "marketingpro",
"name": "Marketing Pro",
"text": "Switched to Klaviyo last year and revenue from email went up 40%.",
"view_count": 84200,
"profile_image_url": "https://pbs.twimg.com/profile_images/example.jpg",
"create_time": "2025-11-02T14:32:00Z"
}
],
"related_questions": [
"What is the best email automation tool for e-commerce?",
"How does Klaviyo compare to Mailchimp?"
],
"conversation": {
"conversation_id": "conv_abc123",
"title": "Email Automation Tools",
"temporary": true,
"create_time": "2026-03-18T12:00:00Z",
"modify_time": "2026-03-18T12:00:05Z"
},
"llm_model": "grok-3",
"credits_used": 3,
"elapsed_ms": 7841.2,
"cached": false,
"markdown_url": "https://scrapellm.com/md/job_abc123.md"
}{
"detail": "Missing API key. Pass your key in the X-API-Key header or as ?api_key= in the URL."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}X (Twitter) posts includedEvery response includes
x_results - real posts from X that Grok pulled in to inform its answer. No other AI scraper surfaces this data.Overview
Use Grok to track brand sentiment on X, monitor real-time reactions to news, and understand what the X community is saying about any topic - all grounded in Grok’s AI-synthesised answer. The three reasoning modes let you trade off speed versus depth depending on your use case.Unique features
- X posts: Real posts from X (Twitter) that Grok cited - includes post text, author, view count, and timestamp
- Web sources: Standard web citations alongside the X posts
- Three reasoning modes:
AUTO,FAST, andEXPERTfor different speed/depth trade-offs - Related questions: Grok’s suggested follow-up questions
Modes
| Mode | Description |
|---|---|
MODEL_MODE_AUTO | Grok selects the model automatically (default) |
MODEL_MODE_FAST | Quick responses using Grok mini |
MODEL_MODE_EXPERT | Deeper reasoning using the full Grok model |
Example request
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/grok" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What are people on X saying about email marketing tools?" \
--data-urlencode "country=US" \
--data-urlencode "mode=MODEL_MODE_AUTO"
import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/grok",
headers={"X-API-Key": "YOUR_API_KEY"},
params={
"prompt": "What are people on X saying about email marketing tools?",
"country": "US",
"mode": "MODEL_MODE_AUTO",
}
)
print(response.json())
const params = new URLSearchParams({
prompt: "What are people on X saying about email marketing tools?",
country: "US",
mode: "MODEL_MODE_AUTO",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/grok?${params}`,
{ headers: { "X-API-Key": "YOUR_API_KEY" } }
);
const data = await response.json();
Response schema
Includes common response fields plus:| Field | Type | Description |
|---|---|---|
result | string | Plain-text response from Grok |
result_markdown | string | Markdown-formatted response |
web_sources | array | Web citations - each has title, url, and preview |
web_sources[].title | string | Article title |
web_sources[].url | string | Source URL |
web_sources[].preview | string | Text excerpt from the source |
x_results | array | Real X posts Grok surfaced |
x_results[].post_id | string | X post ID |
x_results[].user_name | string | X handle (without @) |
x_results[].name | string | Display name of the X user |
x_results[].text | string | Full text of the post |
x_results[].view_count | integer | Number of views |
x_results[].create_time | string | ISO 8601 timestamp of the post |
related_questions | array | Grok’s suggested follow-up questions |
mode | string | The reasoning mode used |
llm_model | string | Grok model used (e.g. grok-3) |
credits_used | integer | Credits consumed - always 3 for Grok |
elapsed_ms | float | End-to-end request duration in milliseconds |
cached | boolean | true if served from cache |
Common questions
Which countries are not supported?
JP (Japan) and TW (Taiwan) are not currently supported. Requests with these country codes will return an error.When should I use MODEL_MODE_EXPERT?
For complex research questions where depth matters more than speed - competitor analysis, in-depth market research, or multi-faceted topics. Expert mode takes longer but produces more thorough answers.
Are X posts always present in the response?
No. X posts only appear when Grok determines they’re relevant to the query. Social-focused questions like “What are people saying about X?” are more likely to surface posts than technical or factual queries.Authorizations
ApiKeyHeaderApiKeyQuery
Query Parameters
Grok reasoning mode:
MODEL_MODE_AUTO— Grok selects the model automatically (default).MODEL_MODE_FAST— Quick responses using Grok mini.MODEL_MODE_EXPERT— Deeper reasoning using the full Grok model.
Available options:
MODEL_MODE_AUTO, MODEL_MODE_FAST, MODEL_MODE_EXPERT Response
Scrape completed successfully.
cURL
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/grok" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What are people on X saying about email marketing tools?" \
--data-urlencode "country=US" \
--data-urlencode "mode=MODEL_MODE_AUTO"import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/grok",
params={
"api_key": "YOUR_API_KEY",
"prompt": "What are people on X saying about email marketing tools?",
"country": "US",
"mode": "MODEL_MODE_AUTO",
}
)
print(response.json())
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What are people on X saying about email marketing tools?",
country: "US",
mode: "MODEL_MODE_AUTO",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/grok?${params}`
);
const data = await response.json();
console.log(data);
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What are people on X saying about email marketing tools?",
country: "US",
mode: "MODEL_MODE_AUTO",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/grok?${params}`
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrapellm.com/scrapers/grok",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrapellm.com/scrapers/grok"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrapellm.com/scrapers/grok")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrapellm.com/scrapers/grok")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scraper": "grok",
"status": "done",
"job_id": "job_abc123",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
"mode": "MODEL_MODE_AUTO",
"result": "Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo...",
"result_markdown": "Marketers commonly recommend **Mailchimp**, **HubSpot**, and **Klaviyo**...",
"web_sources": [
{
"title": "Best Email Marketing Platforms 2025",
"preview": "We tested 12 tools across deliverability, automation, and pricing...",
"url": "https://example.com/email-marketing-comparison"
}
],
"x_results": [
{
"post_id": "1234567890123456789",
"user_name": "marketingpro",
"name": "Marketing Pro",
"text": "Switched to Klaviyo last year and revenue from email went up 40%.",
"view_count": 84200,
"profile_image_url": "https://pbs.twimg.com/profile_images/example.jpg",
"create_time": "2025-11-02T14:32:00Z"
}
],
"related_questions": [
"What is the best email automation tool for e-commerce?",
"How does Klaviyo compare to Mailchimp?"
],
"conversation": {
"conversation_id": "conv_abc123",
"title": "Email Automation Tools",
"temporary": true,
"create_time": "2026-03-18T12:00:00Z",
"modify_time": "2026-03-18T12:00:05Z"
},
"llm_model": "grok-3",
"credits_used": 3,
"elapsed_ms": 7841.2,
"cached": false,
"markdown_url": "https://scrapellm.com/md/job_abc123.md"
}{
"detail": "Missing API key. Pass your key in the X-API-Key header or as ?api_key= in the URL."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}