Skip to main content
GET
Ask Perplexity
Ask the real perplexity.ai a question anonymously and get the answer back as JSON, plus every source Perplexity retrieved, which of those it cited, and the sub-queries it searched for. Accepts GET (query params) or POST (JSON body) with identical fields. Credits: 20
This is a live answer, not a cache. A call can take up to about 75 s while exits are tried, so set your client timeout to at least 90 s.

Authorization

string
required
Your ScrapeBadger API key.

Query Parameters

string
required
The question to ask. Maximum 4,096 characters. Each request is standalone, so include all the context you need here.
string
ISO-3166 alpha-2 market, e.g. US, DE, JP. Sets the ask’s language and timezone (e.g. DE: de-DE, Europe/Berlin). Omit it and the market whose exits answer best right now is used.The egress is best-effort: when that market has no exit left, another one carries the ask and the response country says which. Set strict_country to forbid that.
boolean
default:"false"
Answer only from an exit in country, never another one. When no exit there answers in time the call fails with 503 and detail.code = "country_unavailable". It is not billed (only 2xx responses are). Requires country — 400 otherwise. A JSON boolean on POST.
string
default:"web"
Retrieval focus: web, scholar (academic sources) or social (discussions and forums).

Response

string
Echo of the prompt you sent.
string
The answer text. Citation offsets index into this string.
string | null
The answer with its Markdown formatting.
Citation[]
The sources the answer actually references.
SearchResult[]
The full set Perplexity retrieved, cited or not. Same fields as Citation without the answer offsets, plus cited (boolean).
string[]
Distinct hostnames across the sources.
Perplexity’s suggested follow-up questions.
MediaItem[]
Images attached to the answer (url, title, source_url, thumbnail).
MediaItem[]
Videos attached to the answer, same shape.
boolean
Whether Perplexity searched the web for this answer.
boolean
true when the stream budget expired mid-answer, so answer is partial.
string[]
The sub-queries Perplexity sent to its search backend (its retrieval fan-out).
string
The retrieval focus used.
string | null
Which model answered. Reported, not requestable.
string | null
Perplexity’s id for this answer.
string
The market that actually answered. Without strict_country it can differ from the country you asked for.
integer
Length of answer in characters.
integer
Number of entries in citations.
integer
End-to-end time in milliseconds.
number | null
Answer creation time as a Unix timestamp.
string | null
Answer creation time as an ISO-8601 UTC string.

Example

Strict country

By default country is best-effort, so a market that is short of exits still gets an answer, from another market. Check the response country to see which one answered. When the market matters more than the answer (local rankings, per-country visibility tracking), set strict_country=true:
If no exit in that market answers in time you get a 503, which is not billed. Retry later rather than dropping strict_country:
503 Response
Perplexity is non-deterministic. The same prompt can return different wording and different sources on each call. For tracking, sample on a schedule and aggregate.