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
A call can take up to about 75 s while exits are tried, so set your client
timeout to at least 90 s. Every call renders a fresh answer: nothing is
cached, so the same prompt sent again gets a new answer and is billed again.
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
Where the asker is. Perplexity answers a local question (best dentist,
popular cafes, moving companies) for this place. Without it, that place
is the exit’s city, which changes from call to call (a JP exit can be in
Hamamatsu one call and Atsugi the next).A city from the list below, or lat,lng in decimal degrees (up to 8 decimal
places), e.g. 35.6812,139.7671. Case does not matter, and spaces and
underscores count as hyphens: New York and new_york both mean
new-york. Any other value is a 400, not billed. A JSON string on
POST.It does not change the egress. country still picks the exit and the answer
language, so pair the two: country=JP&location=tokyo. Questions that are
not local are unaffected.
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.
Show Citation
string
Source URL.
string | null
Page title.
string | null
Snippet Perplexity retrieved from the page.
string | null
Hostname, e.g. techcrunch.com.
string | null
Perplexity’s source kind, e.g. web, scholar, social.
number | null
Publication date as a Unix timestamp.
string | null
Publication date as an ISO-8601 UTC string.
string | null
Last-updated date as reported by Perplexity.
integer | null
The inline [n] marker number.
integer | null
Character offset in answer where the cited span begins.
integer | null
Character offset in answer where the cited span ends.
string | null
The substring of answer this source supports.
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.
string[]
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.
string | null
The location the ask was sent with, in canonical form, e.g. tokyo or 35.6812,139.7671. null when you did not set one.
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
curl -G "https://scrapebadger.com/v1/perplexity/ask" \ -H "X-API-Key: YOUR_API_KEY" \ --data-urlencode "prompt=Which companies lead the web scraping API market?" \ --data-urlencode "country=US" \ --max-time 120
const res = await fetch("https://scrapebadger.com/v1/perplexity/ask", { method: "POST", headers: { "X-API-Key": process.env.SCRAPEBADGER_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ prompt: "Which companies lead the web scraping API market?", country: "US", }), signal: AbortSignal.timeout(120_000),});const data = await res.json();console.log(data.country, data.answer);
import requestsres = requests.post( "https://scrapebadger.com/v1/perplexity/ask", headers={"X-API-Key": "YOUR_API_KEY"}, json={"prompt": "Which companies lead the web scraping API market?", "country": "US"}, timeout=120,)data = res.json()for c in data["citations"]: print(c["domain"], "->", c["matched_text"])
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
{ "detail": { "code": "country_unavailable", "message": "no DE exit answered in 16 attempts {...}; strict_country never falls back to another country" }}
Location
A question that names no place, such as best dentist, gets an answer for the
asker’s city. Without location, that is the exit’s city, so it changes
between calls. Set location to keep those answers on one place:
Perplexity now answers for Tokyo. The response carries the value next to
country:
{ "country": "JP", "location": "tokyo"}
An unknown city or a malformed lat,lng fails before any attempt is made. It
is not billed:
400 Response
{ "detail": "location must be a city (tokyo, osaka, seoul, new-york, london, ...) or 'lat,lng' in decimal degrees"}
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.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"ScrapeBadger","colors":{"primary":"#16A34A","light":"#22C55E","dark":"#15803D"},"logo":{"light":"https://mintcdn.com/scrapebadger/gnGR4eL2rEJ4E7w3/logo/light.png?fit=max\u0026auto=format\u0026n=gnGR4eL2rEJ4E7w3\u0026q=85\u0026s=d393e30b48870f8495f788d1fad76ad3","dark":"https://mintcdn.com/scrapebadger/pHswKIBb9VFWmUQY/logo/dark.png?fit=max\u0026auto=format\u0026n=pHswKIBb9VFWmUQY\u0026q=85\u0026s=a5c2b0f2229bc45c6de7fb33b2318941"},"favicon":"https://mintcdn.com/scrapebadger/q5UXhzQrMbsIglQS/favicon.png?fit=max\u0026auto=format\u0026n=q5UXhzQrMbsIglQS\u0026q=85\u0026s=cf0ec94b52375fd84ae198f26e812030","api":{"openapi":["https://scrapebadger.com/api/twitter-openapi.json","openapi-web-scraping.json","openapi-vinted.json","openapi-amazon.json","openapi-rufus.json","openapi-ebay.json","openapi-realtor.json","openapi-zillow.json","openapi-tiktok.json","openapi-reddit.json","openapi-google.json","openapi-account.json","openapi-github.json","openapi-autoscout24.json","openapi-brave.json","openapi-yelp.json","openapi-facebook.json"],"playground":{}},"navbar":{"links":[{"href":"mailto:support@scrapebadger.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://scrapebadger.com/dashboard?utm_source=docs\u0026utm_medium=referral"}},"footer":{"socials":{"x":"https://x.com/scrapebadger","github":"https://github.com/scrape-badger"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Dashboard","icon":"gauge","href":"https://scrapebadger.com/dashboard?utm_source=docs\u0026utm_medium=referral"},{"anchor":"Pricing","icon":"credit-card","href":"https://scrapebadger.com/pricing"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"scrapebadger","hasAudioNarration":false,"actualSubdomain":"scrapebadger","customDomains":["docs.scrapebadger.com"],"gitSource":{"type":"github","owner":"scrape-badger","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6af7bbf44ba45ee562164c7e","clientVersion":"0.0.4138","searchFilterCounts":[{"language":"default","tag":"Search","count":71},{"language":"default","tag":"Twitter","count":62},{"language":"default","tag":"Naver","count":56},{"language":"default","tag":"Google","count":50},{"language":"default","tag":"Overview","count":45},{"language":"default","tag":"Reference","count":40},{"language":"default","tag":"Endpoints","count":39},{"language":"default","tag":"TikTok","count":36},{"language":"default","tag":"Users","count":29},{"language":"default","tag":"Getting Started","count":22}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".nav-tabs{min-width:0;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin}.nav-tabs-item{flex-shrink:0;white-space:nowrap}"}],"page":{"pagePath":"api-reference/endpoint/perplexity/ask","slug":"/api-reference/endpoint/perplexity/ask","pageMetadata":{"title":"Ask Perplexity","api":"GET https://scrapebadger.com/v1/perplexity/ask","description":"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.","href":"/api-reference/endpoint/perplexity/ask"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Expandable,Heading,ParamField,ResponseField,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Ask `,_jsxs(_components.strong,{children:[`the real `,_jsx(_components.code,{children:`perplexity.ai`})]}),` a question anonymously and get the answer back\nas JSON, plus every source Perplexity retrieved, which of those it cited, and\nthe sub-queries it searched for.`]}),`\n`,_jsxs(_components.p,{children:[`Accepts `,_jsx(_components.code,{children:`GET`}),` (query params) or `,_jsx(_components.code,{children:`POST`}),` (JSON body) with identical fields.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Credits:`}),` 20`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`A call can take up to about 75 s while exits are tried, so set your client\ntimeout to at least 90 s. Every call renders a fresh answer: nothing is\ncached, so the same prompt sent again gets a new answer and is billed again.`})}),`\n`,_jsx(Heading,{level:`2`,id:`authorization`,children:`Authorization`}),`\n`,_jsx(ParamField,{header:`X-API-Key`,type:`string`,required:true,id:`param-x-api-key`,children:_jsx(_components.p,{children:`Your ScrapeBadger API key.`})}),`\n`,_jsx(Heading,{level:`2`,id:`query-parameters`,children:`Query Parameters`}),`\n`,_jsx(ParamField,{query:`prompt`,type:`string`,required:true,id:`param-prompt`,children:_jsxs(_components.p,{children:[`The question to ask. Maximum `,_jsx(_components.strong,{children:`4,096 characters`}),`. Each request is standalone,\nso include all the context you need here.`]})}),`\n`,_jsxs(ParamField,{query:`country`,type:`string`,id:`param-country`,children:[_jsxs(_components.p,{children:[`ISO-3166 alpha-2 market, e.g. `,_jsx(_components.code,{children:`US`}),`, `,_jsx(_components.code,{children:`DE`}),`, `,_jsx(_components.code,{children:`JP`}),`. Sets the ask’s language and\ntimezone (e.g. `,_jsx(_components.code,{children:`DE`}),`: `,_jsx(_components.code,{children:`de-DE`}),`, `,_jsx(_components.code,{children:`Europe/Berlin`}),`). Omit it and the market whose\nexits answer best right now is used.`]}),_jsxs(_components.p,{children:[`The egress is `,_jsx(_components.strong,{children:`best-effort`}),`: when that market has no exit left, another one\ncarries the ask and the response `,_jsx(_components.code,{children:`country`}),` says which. Set `,_jsx(_components.code,{children:`strict_country`}),`\nto forbid that.`]})]}),`\n`,_jsx(ParamField,{query:`strict_country`,type:`boolean`,default:`false`,id:`param-strict-country`,children:_jsxs(_components.p,{children:[`Answer only from an exit in `,_jsx(_components.code,{children:`country`}),`, never another one. When no exit there\nanswers in time the call fails with `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`503`})}),` and\n`,_jsx(_components.code,{children:`detail.code = \"country_unavailable\"`}),`. It is `,_jsx(_components.strong,{children:`not billed`}),` (only `,_jsx(_components.code,{children:`2xx`}),`\nresponses are). Requires `,_jsx(_components.code,{children:`country`}),` — `,_jsx(_components.code,{children:`400`}),` otherwise. A JSON `,_jsx(_components.code,{children:`boolean`}),` on\n`,_jsx(_components.code,{children:`POST`}),`.`]})}),`\n`,_jsxs(ParamField,{query:`location`,type:`string`,id:`param-location`,children:[_jsxs(_components.p,{children:[`Where the asker is. Perplexity answers a local question (`,_jsx(_components.code,{children:`best dentist`}),`,\n`,_jsx(_components.code,{children:`popular cafes`}),`, `,_jsx(_components.code,{children:`moving companies`}),`) for this place. Without it, that place\nis the exit’s city, which changes from call to call (a `,_jsx(_components.code,{children:`JP`}),` exit can be in\nHamamatsu one call and Atsugi the next).`]}),_jsxs(_components.p,{children:[`A city from the list below, or `,_jsx(_components.code,{children:`lat,lng`}),` in decimal degrees (up to 8 decimal\nplaces), e.g. `,_jsx(_components.code,{children:`35.6812,139.7671`}),`. Case does not matter, and spaces and\nunderscores count as hyphens: `,_jsx(_components.code,{children:`New York`}),` and `,_jsx(_components.code,{children:`new_york`}),` both mean\n`,_jsx(_components.code,{children:`new-york`}),`. Any other value is a `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`400`})}),`, not billed. A JSON `,_jsx(_components.code,{children:`string`}),` on\n`,_jsx(_components.code,{children:`POST`}),`.`]}),_jsxs(_components.p,{children:[`It does not change the egress. `,_jsx(_components.code,{children:`country`}),` still picks the exit and the answer\nlanguage, so pair the two: `,_jsx(_components.code,{children:`country=JP\u0026location=tokyo`}),`. Questions that are\nnot local are unaffected.`]}),_jsx(Expandable,{title:`Cities`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Japan:`}),` `,_jsx(_components.code,{children:`tokyo`}),`, `,_jsx(_components.code,{children:`yokohama`}),`, `,_jsx(_components.code,{children:`osaka`}),`, `,_jsx(_components.code,{children:`nagoya`}),`, `,_jsx(_components.code,{children:`sapporo`}),`, `,_jsx(_components.code,{children:`fukuoka`}),`, `,_jsx(_components.code,{children:`kyoto`}),`, `,_jsx(_components.code,{children:`kobe`}),`, `,_jsx(_components.code,{children:`sendai`}),`, `,_jsx(_components.code,{children:`hiroshima`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Asia-Pacific:`}),` `,_jsx(_components.code,{children:`seoul`}),`, `,_jsx(_components.code,{children:`busan`}),`, `,_jsx(_components.code,{children:`taipei`}),`, `,_jsx(_components.code,{children:`hong-kong`}),`, `,_jsx(_components.code,{children:`singapore`}),`, `,_jsx(_components.code,{children:`bangkok`}),`, `,_jsx(_components.code,{children:`hanoi`}),`, `,_jsx(_components.code,{children:`ho-chi-minh-city`}),`, `,_jsx(_components.code,{children:`jakarta`}),`, `,_jsx(_components.code,{children:`kuala-lumpur`}),`, `,_jsx(_components.code,{children:`manila`}),`, `,_jsx(_components.code,{children:`mumbai`}),`, `,_jsx(_components.code,{children:`delhi`}),`, `,_jsx(_components.code,{children:`bangalore`}),`, `,_jsx(_components.code,{children:`sydney`}),`, `,_jsx(_components.code,{children:`melbourne`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Americas:`}),` `,_jsx(_components.code,{children:`new-york`}),`, `,_jsx(_components.code,{children:`los-angeles`}),`, `,_jsx(_components.code,{children:`chicago`}),`, `,_jsx(_components.code,{children:`san-francisco`}),`, `,_jsx(_components.code,{children:`houston`}),`, `,_jsx(_components.code,{children:`miami`}),`, `,_jsx(_components.code,{children:`seattle`}),`, `,_jsx(_components.code,{children:`washington`}),`, `,_jsx(_components.code,{children:`toronto`}),`, `,_jsx(_components.code,{children:`vancouver`}),`, `,_jsx(_components.code,{children:`mexico-city`}),`, `,_jsx(_components.code,{children:`sao-paulo`}),`, `,_jsx(_components.code,{children:`buenos-aires`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Europe:`}),` `,_jsx(_components.code,{children:`london`}),`, `,_jsx(_components.code,{children:`manchester`}),`, `,_jsx(_components.code,{children:`paris`}),`, `,_jsx(_components.code,{children:`berlin`}),`, `,_jsx(_components.code,{children:`munich`}),`, `,_jsx(_components.code,{children:`hamburg`}),`, `,_jsx(_components.code,{children:`frankfurt`}),`, `,_jsx(_components.code,{children:`madrid`}),`, `,_jsx(_components.code,{children:`barcelona`}),`, `,_jsx(_components.code,{children:`rome`}),`, `,_jsx(_components.code,{children:`milan`}),`, `,_jsx(_components.code,{children:`amsterdam`}),`, `,_jsx(_components.code,{children:`brussels`}),`, `,_jsx(_components.code,{children:`vienna`}),`, `,_jsx(_components.code,{children:`zurich`}),`, `,_jsx(_components.code,{children:`lisbon`}),`, `,_jsx(_components.code,{children:`warsaw`}),`, `,_jsx(_components.code,{children:`istanbul`})]}),`\n`]})})]}),`\n`,_jsx(ParamField,{query:`focus`,type:`string`,default:`web`,id:`param-focus`,children:_jsxs(_components.p,{children:[`Retrieval focus: `,_jsx(_components.code,{children:`web`}),`, `,_jsx(_components.code,{children:`scholar`}),` (academic sources) or `,_jsx(_components.code,{children:`social`}),`\n(discussions and forums).`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(ResponseField,{name:`prompt`,type:`string`,id:`param-prompt-1`,children:`Echo of the prompt you sent.`}),`\n`,_jsx(ResponseField,{name:`answer`,type:`string`,id:`param-answer`,children:`The answer text. Citation offsets index into this string.`}),`\n`,_jsx(ResponseField,{name:`answer_markdown`,type:`string | null`,id:`param-answer-markdown`,children:`The answer with its Markdown formatting.`}),`\n`,_jsxs(ResponseField,{name:`citations`,type:`Citation[]`,id:`param-citations`,children:[_jsx(_components.p,{children:`The sources the answer actually references.`}),_jsxs(Expandable,{title:`Citation`,children:[_jsx(ResponseField,{name:`url`,type:`string`,id:`param-url`,children:`Source URL.`}),_jsx(ResponseField,{name:`title`,type:`string | null`,id:`param-title`,children:`Page title.`}),_jsx(ResponseField,{name:`snippet`,type:`string | null`,id:`param-snippet`,children:`Snippet Perplexity retrieved from the page.`}),_jsxs(ResponseField,{name:`domain`,type:`string | null`,id:`param-domain`,children:[`Hostname, e.g. `,_jsx(_components.code,{children:`techcrunch.com`}),`.`]}),_jsxs(ResponseField,{name:`source_type`,type:`string | null`,id:`param-source-type`,children:[`Perplexity’s source kind, e.g. `,_jsx(_components.code,{children:`web`}),`, `,_jsx(_components.code,{children:`scholar`}),`, `,_jsx(_components.code,{children:`social`}),`.`]}),_jsx(ResponseField,{name:`pub_date_utc`,type:`number | null`,id:`param-pub-date-utc`,children:`Publication date as a Unix timestamp.`}),_jsx(ResponseField,{name:`published_at`,type:`string | null`,id:`param-published-at`,children:`Publication date as an ISO-8601 UTC string.`}),_jsx(ResponseField,{name:`last_updated`,type:`string | null`,id:`param-last-updated`,children:`Last-updated date as reported by Perplexity.`}),_jsxs(ResponseField,{name:`ref_index`,type:`integer | null`,id:`param-ref-index`,children:[`The inline `,_jsx(_components.code,{children:`[n]`}),` marker number.`]}),_jsxs(ResponseField,{name:`start_index`,type:`integer | null`,id:`param-start-index`,children:[`Character offset in `,_jsx(_components.code,{children:`answer`}),` where the cited span begins.`]}),_jsxs(ResponseField,{name:`end_index`,type:`integer | null`,id:`param-end-index`,children:[`Character offset in `,_jsx(_components.code,{children:`answer`}),` where the cited span ends.`]}),_jsxs(ResponseField,{name:`matched_text`,type:`string | null`,id:`param-matched-text`,children:[`The substring of `,_jsx(_components.code,{children:`answer`}),` this source supports.`]})]})]}),`\n`,_jsx(ResponseField,{name:`search_results`,type:`SearchResult[]`,id:`param-search-results`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.strong,{children:`full`}),` set Perplexity retrieved, cited or not. Same fields as\n`,_jsx(_components.code,{children:`Citation`}),` without the answer offsets, plus `,_jsx(_components.code,{children:`cited`}),` (`,_jsx(_components.code,{children:`boolean`}),`).`]})}),`\n`,_jsx(ResponseField,{name:`source_domains`,type:`string[]`,id:`param-source-domains`,children:`Distinct hostnames across the sources.`}),`\n`,_jsx(ResponseField,{name:`related_questions`,type:`string[]`,id:`param-related-questions`,children:`Perplexity’s suggested follow-up questions.`}),`\n`,_jsxs(ResponseField,{name:`images`,type:`MediaItem[]`,id:`param-images`,children:[`Images attached to the answer (`,_jsx(_components.code,{children:`url`}),`, `,_jsx(_components.code,{children:`title`}),`, `,_jsx(_components.code,{children:`source_url`}),`, `,_jsx(_components.code,{children:`thumbnail`}),`).`]}),`\n`,_jsx(ResponseField,{name:`videos`,type:`MediaItem[]`,id:`param-videos`,children:`Videos attached to the answer, same shape.`}),`\n`,_jsx(ResponseField,{name:`web_search_triggered`,type:`boolean`,id:`param-web-search-triggered`,children:`Whether Perplexity searched the web for this answer.`}),`\n`,_jsxs(ResponseField,{name:`truncated`,type:`boolean`,id:`param-truncated`,children:[_jsx(_components.code,{children:`true`}),` when the stream budget expired mid-answer, so `,_jsx(_components.code,{children:`answer`}),` is partial.`]}),`\n`,_jsx(ResponseField,{name:`search_queries`,type:`string[]`,id:`param-search-queries`,children:`The sub-queries Perplexity sent to its search backend (its retrieval fan-out).`}),`\n`,_jsx(ResponseField,{name:`focus`,type:`string`,id:`param-focus-1`,children:`The retrieval focus used.`}),`\n`,_jsx(ResponseField,{name:`model`,type:`string | null`,id:`param-model`,children:`Which model answered. Reported, not requestable.`}),`\n`,_jsx(ResponseField,{name:`backend_uuid`,type:`string | null`,id:`param-backend-uuid`,children:`Perplexity’s id for this answer.`}),`\n`,_jsxs(ResponseField,{name:`country`,type:`string`,id:`param-country-1`,children:[`The market that actually answered. Without `,_jsx(_components.code,{children:`strict_country`}),` it can differ from the `,_jsx(_components.code,{children:`country`}),` you asked for.`]}),`\n`,_jsxs(ResponseField,{name:`location`,type:`string | null`,id:`param-location-1`,children:[`The `,_jsx(_components.code,{children:`location`}),` the ask was sent with, in canonical form, e.g. `,_jsx(_components.code,{children:`tokyo`}),` or `,_jsx(_components.code,{children:`35.6812,139.7671`}),`. `,_jsx(_components.code,{children:`null`}),` when you did not set one.`]}),`\n`,_jsxs(ResponseField,{name:`answer_length`,type:`integer`,id:`param-answer-length`,children:[`Length of `,_jsx(_components.code,{children:`answer`}),` in characters.`]}),`\n`,_jsxs(ResponseField,{name:`citation_count`,type:`integer`,id:`param-citation-count`,children:[`Number of entries in `,_jsx(_components.code,{children:`citations`}),`.`]}),`\n`,_jsx(ResponseField,{name:`latency_ms`,type:`integer`,id:`param-latency-ms`,children:`End-to-end time in milliseconds.`}),`\n`,_jsx(ResponseField,{name:`created_utc`,type:`number | null`,id:`param-created-utc`,children:`Answer creation time as a Unix timestamp.`}),`\n`,_jsx(ResponseField,{name:`created_at`,type:`string | null`,id:`param-created-at`,children:`Answer creation time as an ISO-8601 UTC string.`}),`\n`,_jsx(Heading,{level:`2`,id:`example`,children:`Example`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -G`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://scrapebadger.com/v1/perplexity/ask\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key: YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"prompt=Which companies lead the web scraping API market?\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"country=US\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-time`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 120`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node.js`,numberOfLines:`14`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://scrapebadger.com/v1/perplexity/ask\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SCRAPEBADGER_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` prompt:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Which companies lead the web scraping API market?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` country:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"US\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signal:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` AbortSignal`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`timeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`120_000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`country`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`answer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,numberOfLines:`11`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`res `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://scrapebadger.com/v1/perplexity/ask\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-API-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"prompt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Which companies lead the web scraping API market?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"country\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"US\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` timeout`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`120`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res.json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` c `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"citations\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(c[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"domain\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"->\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, c[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"matched_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`strict-country`,children:`Strict country`}),`\n`,_jsxs(_components.p,{children:[`By default `,_jsx(_components.code,{children:`country`}),` is best-effort, so a market that is short of exits still\ngets an answer, from another market. Check the response `,_jsx(_components.code,{children:`country`}),` to see which\none answered. When the market matters more than the answer (local rankings,\nper-country visibility tracking), set `,_jsx(_components.code,{children:`strict_country=true`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -G`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://scrapebadger.com/v1/perplexity/ask\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key: YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"prompt=best electricity provider\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"country=DE\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"strict_country=true\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-time`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 120`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If no exit in that market answers in time you get a `,_jsx(_components.code,{children:`503`}),`, which is not billed.\nRetry later rather than dropping `,_jsx(_components.code,{children:`strict_country`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:`503 Response`,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"detail\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"country_unavailable\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"no DE exit answered in 16 attempts {...}; strict_country never falls back to another country\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`location`,children:`Location`}),`\n`,_jsxs(_components.p,{children:[`A question that names no place, such as `,_jsx(_components.code,{children:`best dentist`}),`, gets an answer for the\nasker’s city. Without `,_jsx(_components.code,{children:`location`}),`, that is the exit’s city, so it changes\nbetween calls. Set `,_jsx(_components.code,{children:`location`}),` to keep those answers on one place:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -G`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://scrapebadger.com/v1/perplexity/ask\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key: YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"prompt=best dentist\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"country=JP\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data-urlencode`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"location=tokyo\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-time`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 120`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Perplexity now answers for Tokyo. The response carries the value next to\n`,_jsx(_components.code,{children:`country`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"country\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"JP\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"location\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tokyo\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`An unknown city or a malformed `,_jsx(_components.code,{children:`lat,lng`}),` fails before any attempt is made. It\nis not billed:`]}),`\n`,_jsx(CodeBlock,{filename:`400 Response`,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"detail\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"location must be a city (tokyo, osaka, seoul, new-york, london, ...) or 'lat,lng' in decimal degrees\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Perplexity is non-deterministic. The same prompt can return different wording\nand different sources on each call. For tracking, sample on a schedule and\naggregate.`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Ask Perplexity","api":"GET https://scrapebadger.com/v1/perplexity/ask","description":"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.","href":"/api-reference/endpoint/perplexity/ask"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Authorization","slug":"authorization","depth":2,"children":[]},{"title":"Query Parameters","slug":"query-parameters","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[]},{"title":"Example","slug":"example","depth":2,"children":[]},{"title":"Strict country","slug":"strict-country","depth":2,"children":[]},{"title":"Location","slug":"location","depth":2,"children":[]}],"codeExamples":{},"endpoint":{"title":"Ask Perplexity","path":"/v1/perplexity/ask","servers":[{"url":"https://scrapebadger.com"}],"method":"get","request":{"security":[],"parameters":{"query":{"prompt":{"schema":[{"type":"string","description":"The question to ask. Maximum 4,096 characters . Each request is standalone, so include all the context you need here.","required":true}]},"country":{"schema":[{"type":"string","description":"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."}]},"strict_country":{"schema":[{"type":"boolean","description":"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` ."}]},"location":{"schema":[{"type":"string","description":"Where the asker is. Perplexity answers a local question ( `best dentist` , `popular cafes` , `moving companies` ) for this place. Without it, that place is the exit’s city, which changes from call to call (a `JP` exit can be in Hamamatsu one call and Atsugi the next). A city from the list below, or `lat,lng` in decimal degrees (up to 8 decimal places), e.g. `35.6812,139.7671` . Case does not matter, and spaces and underscores count as hyphens: `New York` and `new_york` both mean `new-york` . Any other value is a `400` , not billed. A JSON `string` on `POST` . It does not change the egress. `country` still picks the exit and the answer language, so pair the two: `country=JP\u0026location=tokyo` . Questions that are not local are unaffected."}]},"focus":{"schema":[{"type":"string","description":"Retrieval focus: `web` , `scholar` (academic sources) or `social` (discussions and forums)."}]}},"header":{"X-API-Key":{"schema":[{"type":"string","description":"Your ScrapeBadger API key.","required":true}]}},"cookie":{},"path":{}},"body":{}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"prompt":[{"type":"string","description":"Echo of the prompt you sent."}],"answer":[{"type":"string","description":"The answer text. Citation offsets index into this string."}],"answer_markdown":[{"type":"object","properties":{},"description":"The answer with its Markdown formatting."}],"citations":[{"type":"array","items":[{"type":"object","properties":{"url":[{"type":"string","description":"Source URL."}],"title":[{"type":"object","properties":{},"description":"Page title."}],"snippet":[{"type":"object","properties":{},"description":"Snippet Perplexity retrieved from the page."}],"domain":[{"type":"object","properties":{},"description":"Hostname, e.g. `techcrunch.com` ."}],"source_type":[{"type":"object","properties":{},"description":"Perplexity’s source kind, e.g. `web` , `scholar` , `social` ."}],"pub_date_utc":[{"type":"object","properties":{},"description":"Publication date as a Unix timestamp."}],"published_at":[{"type":"object","properties":{},"description":"Publication date as an ISO-8601 UTC string."}],"last_updated":[{"type":"object","properties":{},"description":"Last-updated date as reported by Perplexity."}],"ref_index":[{"type":"object","properties":{},"description":"The inline `[n]` marker number."}],"start_index":[{"type":"object","properties":{},"description":"Character offset in `answer` where the cited span begins."}],"end_index":[{"type":"object","properties":{},"description":"Character offset in `answer` where the cited span ends."}],"matched_text":[{"type":"object","properties":{},"description":"The substring of `answer` this source supports."}]}}],"description":"The sources the answer actually references."}],"search_results":[{"type":"array","items":[{"type":"object","properties":{}}],"description":"The full set Perplexity retrieved, cited or not. Same fields as `Citation` without the answer offsets, plus `cited` ( `boolean` )."}],"source_domains":[{"type":"array","items":[{"type":"string"}],"description":"Distinct hostnames across the sources."}],"related_questions":[{"type":"array","items":[{"type":"string"}],"description":"Perplexity’s suggested follow-up questions."}],"images":[{"type":"array","items":[{"type":"object","properties":{}}],"description":"Images attached to the answer ( `url` , `title` , `source_url` , `thumbnail` )."}],"videos":[{"type":"array","items":[{"type":"object","properties":{}}],"description":"Videos attached to the answer, same shape."}],"web_search_triggered":[{"type":"boolean","description":"Whether Perplexity searched the web for this answer."}],"truncated":[{"type":"boolean","description":"`true` when the stream budget expired mid-answer, so `answer` is partial."}],"search_queries":[{"type":"array","items":[{"type":"string"}],"description":"The sub-queries Perplexity sent to its search backend (its retrieval fan-out)."}],"focus":[{"type":"string","description":"The retrieval focus used."}],"model":[{"type":"object","properties":{},"description":"Which model answered. Reported, not requestable."}],"backend_uuid":[{"type":"object","properties":{},"description":"Perplexity’s id for this answer."}],"country":[{"type":"string","description":"The market that actually answered. Without `strict_country` it can differ from the `country` you asked for."}],"location":[{"type":"object","properties":{},"description":"The `location` the ask was sent with, in canonical form, e.g. `tokyo` or `35.6812,139.7671` . `null` when you did not set one."}],"answer_length":[{"type":"integer","description":"Length of `answer` in characters."}],"citation_count":[{"type":"integer","description":"Number of entries in `citations` ."}],"latency_ms":[{"type":"integer","description":"End-to-end time in milliseconds."}],"created_utc":[{"type":"object","properties":{},"description":"Answer creation time as a Unix timestamp."}],"created_at":[{"type":"object","properties":{},"description":"Answer creation time as an ISO-8601 UTC string."}]}}],"examples":{"example":{"value":{"prompt":"\u003cstring>","answer":"\u003cstring>","answer_markdown":{},"citations":[{"url":"\u003cstring>","title":{},"snippet":{},"domain":{},"source_type":{},"pub_date_utc":{},"published_at":{},"last_updated":{},"ref_index":{},"start_index":{},"end_index":{},"matched_text":{}}],"search_results":[{}],"source_domains":["\u003cstring>"],"related_questions":["\u003cstring>"],"images":[{}],"videos":[{}],"web_search_triggered":true,"truncated":true,"search_queries":["\u003cstring>"],"focus":"\u003cstring>","model":{},"backend_uuid":{},"country":"\u003cstring>","location":{},"answer_length":123,"citation_count":123,"latency_ms":123,"created_utc":{},"created_at":{}}}}}}},"deprecated":false}},"jsLinks":[],"subdomain":"scrapebadger","siteName":"ScrapeBadger","title":"Ask Perplexity - ScrapeBadger","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-09T22:41:45.339Z","originalFileLocation":"api-reference/endpoint/perplexity/ask.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ScrapeBadger\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Ask Perplexity - ScrapeBadger\">\u003cmeta data-mint-head property=\"og:description\" content=\"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ScrapeBadger\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://scrapebadger.mintlify.site/_mintlify/api/og/v2?division=Ask\u0026amp;title=Ask+Perplexity\u0026amp;description=Send+a+prompt+to+the+real+perplexity.ai+and+get+the+grounded+answer+as+structured+JSON%2C+with+its+cited+sources%2C+search+queries+and+related+questions.\u0026amp;theme=c13b03cf41cd0fda854fce47\u0026amp;signature=6a9343006a73ee4e86980be75bc1e52c570d4d585cf77c0da759801b3e0fec48\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Ask Perplexity - ScrapeBadger\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://scrapebadger.mintlify.site/_mintlify/api/og/v2?division=Ask\u0026amp;title=Ask+Perplexity\u0026amp;description=Send+a+prompt+to+the+real+perplexity.ai+and+get+the+grounded+answer+as+structured+JSON%2C+with+its+cited+sources%2C+search+queries+and+related+questions.\u0026amp;theme=c13b03cf41cd0fda854fce47\u0026amp;signature=6a9343006a73ee4e86980be75bc1e52c570d4d585cf77c0da759801b3e0fec48\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/scrapebadger/B7QFAHnHtKjf5kVI/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ScrapeBadger\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A34A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/endpoint/perplexity/ask.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.scrapebadger.com/#organization\",\"name\":\"ScrapeBadger\",\"url\":\"https://docs.scrapebadger.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/scrapebadger/gnGR4eL2rEJ4E7w3/logo/light.png?fit=max\u0026auto=format\u0026n=gnGR4eL2rEJ4E7w3\u0026q=85\u0026s=d393e30b48870f8495f788d1fad76ad3\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.scrapebadger.com#website\",\"name\":\"ScrapeBadger\",\"url\":\"https://docs.scrapebadger.com\",\"publisher\":{\"@id\":\"https://docs.scrapebadger.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask#webpage\",\"url\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask\",\"name\":\"Ask Perplexity\",\"description\":\"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\",\"dateModified\":\"2026-11-09T22:41:45.339Z\",\"isPartOf\":{\"@id\":\"https://docs.scrapebadger.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"ScrapeBadger\",\"item\":\"https://docs.scrapebadger.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ask Perplexity\",\"item\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask#apireference\",\"headline\":\"Ask Perplexity\",\"name\":\"Ask Perplexity\",\"description\":\"Send a prompt to the real perplexity.ai and get the grounded answer as structured JSON, with its cited sources, search queries and related questions.\",\"url\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask\",\"mainEntityOfPage\":{\"@id\":\"https://docs.scrapebadger.com/api-reference/endpoint/perplexity/ask#webpage\"},\"dateModified\":\"2026-11-09T22:41:45.339Z\",\"publisher\":{\"@id\":\"https://docs.scrapebadger.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.scrapebadger.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"ScrapeBadger\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"ScrapeBadger\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/endpoint/perplexity/ask.md","siteName":"ScrapeBadger","nav":{"global":{"anchors":[{"anchor":"Dashboard","icon":"gauge","href":"https://scrapebadger.com/dashboard?utm_source=docs\u0026utm_medium=referral"},{"anchor":"Pricing","icon":"credit-card","href":"https://scrapebadger.com/pricing"}]},"tabs":[{"tab":"Getting Started","pages":[{"title":"Getting Started","href":""}]},{"tab":"Web Scraping","pages":[{"title":"Web Scraping","href":"/web-scraping/overview"}]},{"tab":"Google","pages":[{"title":"Google","href":"/google/overview"}]},{"tab":"Baidu","pages":[{"title":"Baidu","href":"/baidu/overview"}]},{"tab":"Bing","pages":[{"title":"Bing","href":"/bing/overview"}]},{"tab":"DuckDuckGo","pages":[{"title":"DuckDuckGo","href":"/duckduckgo/overview"}]},{"tab":"Yahoo","pages":[{"title":"Yahoo","href":"/yahoo/overview"}]},{"tab":"Yandex","pages":[{"title":"Yandex","href":"/yandex/overview"}]},{"tab":"Naver","pages":[{"title":"Naver","href":"/naver/overview"}]},{"tab":"Reddit","pages":[{"title":"Reddit","href":"/reddit/overview"}]},{"tab":"Vinted","pages":[{"title":"Vinted","href":"/vinted/overview"}]},{"tab":"Depop","pages":[{"title":"Depop","href":"/depop/overview"}]},{"tab":"Wallapop","pages":[{"title":"Wallapop","href":"/wallapop/overview"}]},{"tab":"LinkedIn","pages":[{"title":"LinkedIn","href":"/linkedin/overview"}]},{"tab":"Amazon","pages":[{"title":"Amazon","href":"/amazon/overview"}]},{"tab":"eBay","pages":[{"title":"eBay","href":"/ebay/overview"}]},{"tab":"Walmart","pages":[{"title":"Walmart","href":"/walmart/overview"}]},{"tab":"Google Play","pages":[{"title":"Google Play","href":"/google-play/overview"}]},{"tab":"App Store","pages":[{"title":"App Store","href":"/app-store/overview"}]},{"tab":"Leboncoin","pages":[{"title":"Leboncoin","href":"/leboncoin/overview"}]},{"tab":"Gumtree","pages":[{"title":"Gumtree","href":"/gumtree/overview"}]},{"tab":"Immobiliare","pages":[{"title":"Immobiliare","href":"/immobiliare/overview"}]},{"tab":"LoopNet","pages":[{"title":"LoopNet","href":"/loopnet/overview"}]},{"tab":"Airbnb","pages":[{"title":"Airbnb","href":"/airbnb/overview"}]},{"tab":"Booking.com","pages":[{"title":"Booking.com","href":"/booking/overview"}]},{"tab":"Apartments.com","pages":[{"title":"Apartments.com","href":"/apartments/overview"}]},{"tab":"Realtor","pages":[{"title":"Realtor","href":"/realtor/overview"}]},{"tab":"Zillow","pages":[{"title":"Zillow","href":"/zillow/overview"}]},{"tab":"YouTube","pages":[{"title":"YouTube","href":"/youtube/overview"}]},{"tab":"Instagram","pages":[{"title":"Instagram","href":"/instagram/overview"}]},{"tab":"Facebook","pages":[{"title":"Facebook","href":"/facebook/overview"}]},{"tab":"TikTok","pages":[{"title":"TikTok","href":"/tiktok/overview"}]},{"tab":"Twitter","pages":[{"title":"Twitter","href":"/api-reference/introduction"}]},{"tab":"ChatGPT","pages":[{"title":"ChatGPT","href":"/chatgpt/overview"}]},{"tab":"Grok","pages":[{"title":"Grok","href":"/grok/overview"}]},{"tab":"Amazon Rufus","pages":[{"title":"Amazon Rufus","href":"/rufus/overview"}]},{"tab":"Gemini","pages":[{"title":"Gemini","href":"/gemini/overview"}]},{"tab":"Perplexity","groups":[{"group":"Ask","pages":[{"title":"Ask Perplexity","api":"GET https://scrapebadger.com/v1/perplexity/ask","href":"/api-reference/endpoint/perplexity/ask"}]},{"group":"Brand Visibility","pages":[{"title":"Brand Visibility","api":"GET https://scrapebadger.com/v1/perplexity/brand-visibility","description":"Ask Perplexity a question and get an AEO/GEO analysis of how your brand appears in the answer: mentions, position, share of voice against competitors, and whether your domain was cited.","href":"/api-reference/endpoint/perplexity/brand-visibility"}]},{"group":"Reference","pages":[{"title":"List Models","api":"GET https://scrapebadger.com/v1/perplexity/models","href":"/api-reference/endpoint/perplexity/list-models"}]}]},{"tab":"Copilot","pages":[{"title":"Copilot","href":"/copilot/overview"}]},{"tab":"MCP Server","pages":[{"title":"MCP Server","href":"/mcp/overview"}]},{"tab":"CLI","pages":[{"title":"CLI","href":"/cli/overview"}]},{"tab":"ASOS","pages":[{"title":"ASOS","href":"/asos/overview"}]},{"tab":"Target","pages":[{"title":"Target","href":"/target/overview"}]},{"tab":"Etsy","pages":[{"title":"Etsy","href":"/etsy/overview"}]},{"tab":"AliExpress","pages":[{"title":"AliExpress","href":"/aliexpress/overview"}]},{"tab":"Best Buy","pages":[{"title":"Best Buy","href":"/bestbuy/overview"}]},{"tab":"GitHub","pages":[{"title":"GitHub","href":"/github/overview"}]},{"tab":"AutoScout24","pages":[{"title":"AutoScout24","href":"/autoscout24/overview"}]},{"tab":"Brave","pages":[{"title":"Brave","href":"/brave/overview"}]},{"tab":"Yelp","pages":[{"title":"Yelp","href":"/yelp/overview"}]}]},"basePath":"","title":"Ask Perplexity - ScrapeBadger","buildId":"dpl_715YoAgvjTGBDdo8RtXmHKM22b5p","deploymentId":"dpl_715YoAgvjTGBDdo8RtXmHKM22b5p","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-BvKnMd7F.js","utils-BMt52org.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-CGXZuDGO.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-Dl57XWH2.js","snippetPresets-CWd8CxSk.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-BR-Wkc_D.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-YMmi08aZ.js","shallow-DBC1OB78.js","getApiPlaygroundDisplay-Be7mmEzP.js","CodeSnippet-B14o1TgQ.js","CodeSnippets-CJ2q3fTq.js","Page-Chgj7sZe.js","getPastedJson-DnpLXm8x.js","icon-BpkSFtdK.js","MethodPill-BO3zPf-g.js","DuplicateIcon-Bib3qwfw.js","createIcon-CY2noFo3.js","DynamicMarkdown-TAXIW2vN.js","SectionHeading-Dfs3Fmfw.js","axios-vUo_bRtp.js"]}