> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapebadger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ask Grok

> Ask the real Grok assistant and get the answer, web citations, X post references, tool usage, and follow-up suggestions.

Ask the real Grok assistant and receive structured JSON with web and X grounding. Accepts `GET` query parameters or a `POST` JSON body with the same fields.

**Credits:** 20

> [!WARNING]
>
> Set your client timeout to **at least 90 seconds** for grounded answers.

## Authorization

**X-API-Key** `string` *required*

Your ScrapeBadger API key.

## Parameters

**prompt** `string` *required*

The prompt to send. Maximum 4,000 characters.

**conversation\_id** `string`

The complete ID from a previous response. Includes prior-turn context and pins the follow-up to the owning X account.

**mode** `string` (default: auto)

Assistant mode: `auto`, `fast`, or `expert`.

**web\_search** `string` (default: auto)

`auto` lets Grok decide, `force` requests web and X research, and `off` disables those tools.

## Response

**answer** `string`

The answer without thinking text, tool-card markup, or inline citation tags.

**answer\_markdown** `string`

The answer with inline citations rendered as Markdown links.

**conversation\_id** `string`

Opaque identifier used for follow-ups and conversation history. Preserve the complete value.

**response\_id** `string | null`

Identifier of the assistant response.

**model** `string`

The upstream model option used.

**mode** `string`

The requested assistant mode.

**citations** `Citation[]`

Inline citation cards with `card_id`, `url`, `domain`, `citation_index`, `start_index`, and `end_index`. X citations can also include `post_id` and `username`.

**search\_results** `SearchResult[]`

Web results with `url`, `title`, `snippet`, and `domain`.

**x\_search\_results** `XPost[]`

X post references with `id` and `url`.

**source\_domains** `string[]`

Distinct domains across web results and citations.

**follow\_up\_suggestions** `string[]`

Suggested follow-up prompts.

**tool\_usages** `ToolUsage[]`

Tool calls with `card_id`, `tool_name`, and parsed `tool_args`.

**web\_search\_triggered** `boolean`

Whether Grok invoked web search.

**x\_search\_triggered** `boolean`

Whether Grok invoked X keyword or semantic search.

**truncated** `boolean`

Whether the upstream stream lacked its normal completion marker.

**elapsed\_ms** `integer`

End-to-end time in milliseconds.

## Example

```bash cURL theme={null}
curl "https://scrapebadger.com/v1/grok/ask?prompt=What%20is%20the%20capital%20of%20Lithuania%3F&mode=fast&web_search=off" \
  -H "X-API-Key: YOUR_API_KEY" \
  --max-time 90
```

```javascript Node.js theme={null}
const res = await fetch("https://scrapebadger.com/v1/grok/ask", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.SCRAPEBADGER_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ prompt: "Best web scraping APIs", web_search: "force" }),
  signal: AbortSignal.timeout(90_000),
});
const data = await res.json();
console.log(data.answer);
```

```python Python theme={null}
import requests

res = requests.post(
    "https://scrapebadger.com/v1/grok/ask",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={"prompt": "Best web scraping APIs", "web_search": "force"},
    timeout=90,
)
print(res.json()["answer"])
```

```json Response theme={null}
{
  "answer": "The capital of Lithuania is Vilnius.",
  "answer_markdown": "The capital of Lithuania is Vilnius.",
  "conversation_id": "187055:2121372254449864788",
  "response_id": "2121372258530926593",
  "model": "grok-3-latest",
  "mode": "fast",
  "citations": [],
  "search_results": [],
  "x_search_results": [],
  "source_domains": [],
  "follow_up_suggestions": ["Explore Vilnius history", "Baltic states capitals"],
  "tool_usages": [],
  "web_search_triggered": false,
  "x_search_triggered": false,
  "truncated": false,
  "elapsed_ms": 6845
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.