ChatGPT Answer API — Answers With Sources
Documentation menu
FetchLayer FetchLayer API

Ask ChatGPT and get the answer with its sources

The answer ChatGPT gives a prompt, with everything behind it: the answer as Markdown and as plain text, the pages it cites (each with the sentence that cites it), every inline citation, the web searches it actually ran, and every page it looked at while searching — each flagged cited, because a page can be read and never cited. This is what an anonymous visitor sees, not an API completion: there is no model, temperature or system prompt to choose. null means the answer did not show a field, not zero: searchQueries and retrievedPages are null when it did not list them, [] when it listed none, and model is null when the answer did not name one. Answers vary between runs, so one answer is an anecdote — use ai-rank to track a brand across several. Billing: 1 credit — one answer.

POST /ask Answers
https://api.fetchlayer.dev/chatgpt/ask
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

prompt string required

The prompt, exactly as a person would type it into ChatGPT (1–4000 characters).

provider string optional

The assistant to ask. chatgpt is the only one available today; the field exists so the same request serves further assistants as they are added. (default: chatgpt)

country string optional

Two-letter country the answer should come from, such as US, GB or DE. Answers differ by country. When that country cannot be served, the answer comes from the default one and notes says so. (default: us)

language string optional

Language of ChatGPT’s own interface, such as en, de or pt-BR. The answer itself follows the language of your prompt. (default: en)

webSearch string optional

auto lets ChatGPT decide whether to search the web; on asks it to search before answering, and answer.usedWebSearch reports what it did. There is no "off": an anonymous visitor has no such setting. (default: auto)

format string optional

json or markdown. (default: json)

Response Fields

ask

Ask ChatGPT and get the answer with its sources

resultType string

ask, mentions, ai-rank, prompt-discovery or visibility-report.

provider string

The assistant that was asked. Always "chatgpt" today.

requestedUrl string

The assistant page the answers correspond to.

transport string

The upstream source. Always "chatgpt".

notes string[]

Caveats you can act on — a country that could not be served, runs that could not be completed, details the answer did not show. Empty when there are none. Read it on every call.

answersGenerated number

Answers ChatGPT produced for this request.

pagesScraped number

Billable units, which is the same number: one credit per answer. An answer that could not be produced is never billed.

scrapedAt string

ISO 8601 timestamp of when the data was collected.

prompt string

The prompt that was asked.

country string

The country the answer came from.

language string

The interface language used.

webSearch string

The web-search mode requested, auto or on.

answer.markdown string

The answer as Markdown. Citations appear inline as ([label](url)).

answer.text string

The answer as plain text: no formatting, no citation labels. Every character offset in this response points into this string.

answer.sources object[]

The pages the answer cites, in the order it first cites them.

answer.sources[].position number

1-based position in the citation order.

answer.sources[].url string

The destination URL, with the assistant’s own tracking parameter removed.

answer.sources[].title string

The page title.

answer.sources[].domain string

Hostname of url.

answer.sources[].attribution string

The label shown on the citation, e.g. "Reddit Help".

answer.sources[].publishedAt string

When the page was published, or null when the answer did not show it.

answer.sources[].citedText string

The sentence that first cites this page. null for a page listed only in the answer’s closing "Sources" list, which comes after the cited ones.

answer.sources[].citationCount number

How many citations in the answer point at this page.

answer.inlineCitations object[]

Each citation in the answer: index, citedText (the sentence it is attached to) and sourcePositions (into sources).

answer.searchQueries string[]

The web searches ChatGPT ran for this answer, in order. [] when it did not search, null when the answer did not show them.

answer.retrievedPages object[]

Every page it looked at while searching — url, title, domain, snippet, publishedAt and cited. A page can be read and never cited, which is worth knowing on its own. null when the answer did not show them.

answer.sitesConsulted number

How many sites ChatGPT said it consulted, or null.

answer.usedWebSearch boolean

Whether this answer used the web.

answer.model string

The model the answer reported, or null when it did not say. It is never guessed.

answer.answeredAt string

ISO 8601 timestamp of when the answer finished.

Request

curl -X POST "https://api.fetchlayer.dev/chatgpt/ask" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"reddit api alternatives"}'

Response

{
  "resultType": "ask",
  "provider": "chatgpt",
  "requestedUrl": "https://chatgpt.com/",
  "transport": "chatgpt",
  "notes": [],
  "answersGenerated": 1,
  "pagesScraped": 1,
  "scrapedAt": "2026-09-16T01:57:30.208Z",
  "prompt": "reddit api alternatives",
  "country": "us",
  "language": "en",
  "webSearch": "auto",
  "answer": {
    "markdown": "For **Reddit API alternatives in 2026**, the main options are:\n\n- **Arctic Shift** — free historical Reddit dumps; best for bulk research/archive data, not real-time. ([Reddit APIs](https://www.redditapis.com/blogs/reddit-api-ai-training-data-2026))\n…",
    "text": "For Reddit API alternatives in 2026, the main options are:\n\nArctic Shift — free historical Reddit dumps; best for bulk research/archive data, not real-time.\n…",
    "sources": [
      {
        "position": 1,
        "url": "https://www.redditapis.com/blogs/reddit-api-ai-training-data-2026",
        "title": "Arctic Shift for Reddit 2026: AI Training Data, JSONL, APIs",
        "domain": "redditapis.com",
        "attribution": "Reddit APIs",
        "publishedAt": "2026-06-25T00:00:00.000Z",
        "citedText": "Arctic Shift — free historical Reddit dumps; best for bulk research/archive data, not real-time.",
        "citationCount": 2
      }
    ],
    "inlineCitations": [
      {
        "index": 1,
        "citedText": "Arctic Shift — free historical Reddit dumps; best for bulk research/archive data, not real-time.",
        "sourcePositions": [
          1
        ]
      }
    ],
    "searchQueries": [
      "Reddit API alternatives Reddit data API Pushshift Arctic Shift PullPush 2026"
    ],
    "retrievedPages": [
      {
        "url": "https://www.redditapis.com/pushshift-alternative",
        "title": "Pushshift Alternative: The Maintained Reddit Data API",
        "domain": "redditapis.com",
        "snippet": null,
        "publishedAt": null,
        "cited": false
      }
    ],
    "sitesConsulted": 8,
    "usedWebSearch": true,
    "model": "gpt-5-6",
    "answeredAt": "2026-09-16T01:57:30.206Z"
  }
}