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

# ChatGPT API — answers, sources and search queries

> Ask ChatGPT a question and get its answer, cited sources, search queries, products and follow-up conversations.

`CHATGPT` asks ChatGPT with web search and returns the answer, every source it found, the searches it ran, and the product and place cards it drew.

| | |
| - | - |
| taskType | `CHATGPT` |
| Reads | `prompt` (falls back to `query`) |
| Credits | 1 per answer |
| Country | Optional, default `US`. `CN` and `HK` are asked from a Singapore exit with a local device location. |
| Location | Accepts `payload.location`. See [Regions and location](/engines/capacity.md). |

## Request

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "CHATGPT", "payload": { "prompt": "best CRM for a small team", "country": "US" } }'
```

## Response

| Field | Type | Description |
| - | - | - |
| `text` | string | The answer as plain text. |
| `markdown` | string | The answer as Markdown, photos in their card's place. On by default. |
| `model` | string | The model ChatGPT answered with. |
| `sources` | array | Every source: `position`, `url`, `label`, `footnote`, `datePublished`, `searchQueries`, `cited`, `citedText`. |
| `searchQueries` | string\[] | The web searches ChatGPT ran. On by default. |
| `shoppingCards`, `inlineProducts` | array | Product cards and product names linked in the answer. On by default (`include.shopping`). |
| `ads` | array | Sponsored items in the answer. On by default (`include.ads`). |
| `entities` | array | Places and products named in cards, each with its `type`, such as `local_business` or `product`, and its `name`. |
| `entityDetails` | array | The detail panel of each card. Only with `include.entityDetails`. See [Card details](#card-details). |
| `map` | array | Places shown in cards: address, coordinates, phone, rating, and the `icon` emoji ChatGPT pins them with. `provider` is the feed the record comes from (`serp` and `bright-feed` for Google Maps, `yelp-feed` for Yelp, `tripadvisor-feed` for Tripadvisor); `placeId` and `providerUrl` are the place's ID and page in that feed. `resolvedBy: "address"` marks a place ChatGPT found by the address the model wrote. `localName` is the record's other name, such as a Korean store's Korean name, and `closed` is `permanently` or `temporarily`. |
| `citationPills` | array | The sources behind each inline citation chip. |
| `layout` | object | The card layout, when ChatGPT draws the answer as cards. See below. |
| `forms` | array | Follow-up forms in the answer, when there are any. See [Conversations](#continue-a-conversation-later). |
| `conversation` | object | `id`, `turn` and `expiresAt` of the conversation the answer belongs to. |
| `html` | object | The screen ChatGPT showed. Only with `include.html`. |
| `rawResponse` | array | Parsed stream events. Only with `include.rawResponse`. |

For example, a trimmed response:

```json theme={"theme":"css-variables"}
{
  "text": "For a small team, HubSpot CRM and Pipedrive are the usual picks ...",
  "markdown": "For a small team, **HubSpot CRM** and **Pipedrive** are the usual picks ...",
  "model": "gpt-5-3",
  "sources": [
    {
      "position": 1,
      "url": "https://www.example.com/best-crm-small-business",
      "label": "The best CRM software for small businesses",
      "searchQueries": ["best CRM for small teams"],
      "cited": true,
      "citedText": ["HubSpot CRM and Pipedrive are the usual picks"]
    }
  ],
  "searchQueries": ["best CRM for small teams"],
  "conversation": { "id": "8f6c1d2e-...", "turn": 1, "expiresAt": "2026-10-19T12:00:00.000Z" }
}
```

Each source carries `searchQueries` (the searches whose results included it), `cited` (whether the answer cites it inline) and `citedText` (the answer text each citation backs). Sources that no search returned, such as products, have no `searchQueries`.

### Card layout

`layout` appears when ChatGPT draws the answer as cards. Its `nodes` follow the order ChatGPT shows them:

| Node | Holds |
| - | - |
| `row`, `box` | Groups of cards. |
| `title`, `text`, `badge` | The card copy. |
| `image` | The photo: `images[].url`, `thumbnailUrl` and `pageUrl`. |
| `markdown` | The rest of the answer. |
| `map` | In `places`, the `position` of each place it shows. |
| `form` | A form that asks you to pick a follow-up question. Its `choice` nodes hold the options and the one selected at first; its `button` node holds the question ChatGPT would send next (`prompt`). Forms are left out of `text` and `markdown`. |

## Include flags

`CHATGPT` honors every response flag. All are on by default except `rawResponse` and `html`; send `false` to turn one off.

| Flag | Default | Effect |
| - | - | - |
| `markdown` | `true` | Adds `markdown`. |
| `searchQueries` | `true` | Adds `searchQueries`. |
| `shopping` | `true` | Adds product cards. |
| `ads` | `true` | Adds `ads`. |
| `rawResponse` | `false` | Adds `rawResponse`. See [Markdown and raw responses](/engines/response-options.md). |
| `html` | `false` | Adds `html`, 0.25 credits when the page is stored. Rejected with `422 EVIDENCE_UNSUPPORTED` together with `location`, `CN`, `HK` or `continueFrom`. See [HTML pages](/engines/html-pages.md). |
| `analysis` | `false` | Adds `analysis`, 1 credit. See [Answer analysis](/engines/answer-analysis.md). |
| `citationAnalysis` | `false` | Runs a [Citation Analysis](/research/citation-analysis.md) on the answer. |
| `entityDetails` | `false` | Adds `entityDetails` at no extra cost. See [Card details](#card-details). |

## Card details

With `include.entityDetails`, every card in the answer (a product, place, app or brand) comes with the detail panel ChatGPT opens when a reader clicks it: a description, specifications, reviews and the pages behind them. Panels cite their own pages, so they show sources the answer text leaves out.

| Field | Description |
| - | - |
| `name`, `category`, `query` | The card as the answer shows it, its kind (`product`, `local_business`, `software`, `organization`) and the name ChatGPT looked it up by. |
| `status` | `ok`, or `failed` with an `error`. |
| `markdown` | The panel as Markdown, with citation chips written like the answer's. |
| `sources` | Each cited page once, in the order first cited: `position`, `url`, `label`, `site`, `description`. |
| `products` | The shopping card a product's panel opens on: `title`, `price`, `merchant`, `rating`, `num_reviews`, `url` and `offers`, shaped like `shoppingCards[].products`. Only when the panel shows one. |
| `images` | The panel's photos. |
| `complete` | `false` when ChatGPT stopped writing the panel early. The text and sources up to that point are included. |

`error` is `ENTITY_DETAIL_FAILED` when the panel request fails, `ENTITY_DETAIL_EMPTY` when the panel has no text, and `ENTITY_DETAIL_UNAVAILABLE` when the answer lacks the conversation or turn credentials needed to open its panels. Card details also work with `payload.location`, `CN`, `HK`, fallback answers and `include.html`.

A panel ChatGPT has written before returns in about a second; one it writes on request takes 10 to 30 seconds, with up to 4 panels at a time. Up to 20 cards per answer are opened. Panels add no credits, and each follow-up answer gets panels of its own.

```json theme={"theme":"css-variables"}
"entityDetails": [
  {
    "name": "Brooks Adrenaline GTS 25",
    "category": "product",
    "query": "Brooks Adrenaline GTS 25",
    "status": "ok",
    "markdown": "## Brooks Adrenaline GTS 25\n\nThe **Brooks Adrenaline GTS 25** is a **stability road running shoe** ... ([Brooks Running](https://www.brooksrunning.com/...))\n\n### Key specifications\n\n| Feature | Details |\n| --- | --- |\n| Heel-to-toe drop | 10 mm |\n...",
    "sources": [
      { "position": 1, "url": "https://www.brooksrunning.com/...", "label": "Men's Adrenaline GTS 25 Running Shoes | Brooks Running", "site": "Brooks Running" },
      { "position": 2, "url": "https://www.rei.com/product/249691/...", "label": "Brooks Adrenaline GTS 25 Road-Running Shoes - Men's | REI Co-op", "site": "REI" }
    ],
    "images": ["https://images.openai.com/..."],
    "complete": true
  }
]
```

## Follow-up questions

`payload.followUps` asks up to 4 more questions in the same conversation after the first answer, in order. Each item is one of:

* `{ "prompt": "..." }`: a question of your own.
* `{ "select": { "button": 0, "choices": { "budget": "Under $100" } } }`: presses a follow-up form's button in the previous answer.

`button` counts the answer's buttons from 0 and defaults to the first. `choices` picks options by each `choice` node's `name`, or as an array in the form's order; a pick is an option's `value` or `label`, or its position from 0. Choices you do not pick keep the option ChatGPT selected, so `{ "select": {} }` sends the button's own `prompt`.

```json theme={"theme":"css-variables"}
{
  "taskType": "CHATGPT",
  "payload": {
    "prompt": "best CRM for a small team",
    "country": "US",
    "followUps": [{ "prompt": "Which of these has the best free plan?" }]
  }
}
```

The top-level fields stay the first answer. `followUps` in the response lists each further answer with the question that was sent (`prompt`), what a `select` pressed (`selection`: the button `label` and each choice's value), and the same fields as the first answer.

When a `select` cannot be pressed, the remaining follow-ups are not asked, and `followUpsStopped` gives the follow-up's `index`, a `code` and a `message`:

| Code | Meaning |
| - | - |
| `NO_FOLLOW_UP_FORM` | The previous answer showed no form. |
| `BUTTON_NOT_FOUND` | No button at that index. |
| `CHOICE_NOT_FOUND` | No choice with that name. |
| `OPTION_NOT_FOUND` | No option matches the pick. |
| `PROMPT_UNAVAILABLE` | The button had no question to send. |

The task still completes with the answers it got. Each answer costs 1 credit: the task holds credits for every follow-up and charges only for the answers it returns. `include.analysis`, `include.citationAnalysis` and `include.html` apply to the first answer. Other engines reject `followUps` with `400 VALIDATION_ERROR`.

## Continue a conversation later

To read an answer before you choose the next question, send a new `CHATGPT` task with `payload.continueFrom` set to the id of a completed task, plus either a `prompt` or a `select` that presses a form in that task's last answer (the same rules as in `followUps`).

```json theme={"theme":"css-variables"}
{
  "taskType": "CHATGPT",
  "payload": {
    "continueFrom": "8f6c1d2e-...",
    "select": { "button": 0 }
  }
}
```

* An answer that shows a form carries `forms`: each form's `buttons`, whose order is `select.button`, and its `choices` with their `name`, the option selected at first and the `options`.
* `conversation.id` is the task that opened the conversation, `turn` counts its answers so far, and `expiresAt` is the last moment it can be continued, 3 hours after its first answer.
* A continuation asks under the last answer of the task you name, so naming the same task twice branches the conversation.
* It keeps the original `country` and `location`. Leave them out or send the same values.
* A task of another account or engine, a task that has not completed, or an invalid `select` is rejected with `400 VALIDATION_ERROR`. An expired conversation is rejected with `400 CONVERSATION_EXPIRED`. Neither is charged.
* A continuation costs the same as any ChatGPT task.

## Related

* [ChatGPT product page](https://querying.ai/en/engines/chatgpt)
* [Engine overview](/engines/overview.md)


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