# Track ChatGPT answers

`POST https://api.answerline.dev/v1/monitor/chatgpt`

Get structured output from ChatGPT for any prompt in supported regions: the answer, its cited sources, ads, shopping cards and brand entities

From $1.00 per 1,000 requests. Failed requests are free. Also runs as an async task of type `CHATGPT`.

## Body

- `prompt` (string, required): Prompt submitted to ChatGPT, up to 2,000 characters. A longer prompt is refused with a 400 that states its length.
- `country` (string, required): Code of the country or region used to localize the response
- `include` (object): Flags that add extra output formats to the response (optional)
  - `include.html` (boolean): A copy of the ChatGPT page as it was when the answer was captured, stored on our file host and linked in `html`, to check the answer against. It is free.
  - `include.markdown` (boolean): Add a markdown version of the response to the result
  - `include.rawResponse` (boolean): Return the answer as normalized stream events. For the engine's answer as received, use `include.rawWire`.
  - `include.searchQueries` (boolean): Return the fan-out queries ChatGPT issued while producing the response (empty on the answers served today)
  - `include.ads` (boolean): Return ads that ChatGPT shows in its response (empty on the answers served today)
  - `include.shopping` (boolean): Return shopping cards plus products shown inline (inlineProducts), with their prices and offers. Free. Today the products from ChatGPT's shopping search come in inlineProducts and shoppingCards is usually empty.
  - `include.rawWire` (boolean): Return the engine's own response as received in result.rawWire: the answer stream, the rendered results pages or the RSS feed, without Gemini's detected location or ChatGPT's session tokens; null where it was not captured. Free. See https://answerline.dev/docs/output-formats#raw-wire
  - `include.screenshot` (boolean): Return a full-page PNG screenshot of the engine's page as it showed the finished answer, in result.screenshot: a link, or one link per results page on Google Search. On ChatGPT, Gemini, AI Mode, Google Search, Perplexity and Grok; other engines refuse it with a 400. Absent when the answer was read without a rendered page or its page was not available. Free. See https://answerline.dev/docs/output-formats#screenshots
- `legacy` (boolean): Accepted for compatibility with clients that ask for ChatGPT's older desktop interface. Not served yet: the answer arrives in the same shape whatever its value. Default: false.
- `disableWebSearch` (boolean): Accepted for compatibility. On every answer served today ChatGPT decides by itself whether to search the web, whatever this value, and `result.provenance.searchMode` records `engine-default`. Default: false.
- `state` (string): US state code (e.g. "CA", "DC" included). Sent without a country, the request asks for the US; sent with any country other than "US", it is refused with a 400, uncharged. ChatGPT and Gemini answer as a person in that state sees it; every other engine accepts it and answers for the whole US, at the price of a request without it. provenance.requestedState reports the state asked. See https://answerline.dev/docs/coverage#states
- `answerDepth` ("any" | "full" | "quick"): Accepted so existing requests stay valid; it does not change the answer or the price. Every engine writes one depth: Perplexity answers every request with its Quick Search answer, and provenance.answerDepth says quick. See https://answerline.dev/docs/engine-features/#answer-depth

## Returns

- `result.text` (string): Text of ChatGPT's reply
- `result.searchResults` (object[]): Every page ChatGPT searched for the answer (its "Searched N websites"), cited or not, in the order it lists them. Absent when the answer did not search or ChatGPT does not list them.
- `result.sources` (object[]): Sources the response cites; an empty array if there are none.
- `result.html` (string): Present when include.html is true: the link to the stored copy of the ChatGPT page.
- `result.markdown` (string): ChatGPT's reply as Markdown; returned only if include.markdown is true
- `result.rawResponse` (object[]): The answer as normalized stream events (present when include.rawResponse is true). For the engine's answer as received, use include.rawWire.
- `result.searchQueries` (string[]): The fan-out queries ChatGPT issued while producing the response (present when include.searchQueries is true)
- `result.model` (string): ChatGPT model that produced the answer. Empty when ChatGPT names no model.
- `result.shoppingCards` (object[]): Shopping/product cards parsed from the response. When `include.shopping` is `false` or not set, `result` does not contain this field at all, so treat it as optional instead of relying on an empty array.
- `result.inlineProducts` (object[]): Products shown inline, with their prices and offers. When `include.shopping` is `false` or not set, `result` does not contain this field at all, so treat it as optional instead of relying on an empty array.
- `result.entities` (object[]): Entities parsed from the response (if any). With include.shopping, an entity ChatGPT links to a product also carries `product`.
- `result.map` (object[]): Map entries for businesses or places parsed from the response (if any). Entries originate from the enrichment providers ChatGPT uses (Yelp, Google Business), with field names in camelCase. Only the fields filled in most often appear here; see the [API reference](/docs/reference) for every field.
- `result.citationPills` (object[]): Inline citation pills parsed from the response (if any), i.e. citations shown in the body of the text. Every entry represents a single (pill, source) pair; grouping on `citationPillId` rebuilds each pill.
- `result.ads` (object[]): Ads delivered with the ChatGPT response (present when include.ads is true). Several candidate ads are sent by OpenAI, yet the interface displays one at most; check `rendered` to see which ones were really displayed.
- `result.images` (object[]): The pictures ChatGPT shows in its answer, beside the places and things it names, in answer order: medium image, the page each comes from (url), its title and the picture shown (thumbnail). Absent when the answer shows none.
- `result.screenshot` (string): Present when include.screenshot is true and the answer came from a rendered page: the link to the PNG screenshot of the ChatGPT page once the answer finished.
- `result.links` (object[]): The links in the answer's text, in the order a reader meets them: one entry per web (http or https) link the answer shows, images and code aside, with the words it shows (text), where it goes (url), its domain and its 1-based position. Sources cited by pills are in citationPills; links to the same page appear in both when the answer does both. Empty when the text links nowhere.

## Responses

- 200: ChatGPT monitoring result (success)
- 400: Bad Request - the request failed validation
- 401: Unauthorized - authentication failed
- 403: Forbidden - INSUFFICIENT_CREDITS: the balance does not cover this request
- 404: Not Found - No such route, or the engine is paused
- 409: Conflict - the resource is in a conflicting state
- 429: Too Many Requests - the call could not start now (`CONCURRENT_LIMIT_EXCEEDED`), or the service dropped the request because it was overloaded (`SERVICE_OVERLOADED`); that case returns `Retry-After` without any limit headers. `RATE_LIMIT_EXCEEDED`, with `Retry-After`, is sent only when one address presented too many unknown keys
- 499: Client Closed Request - the client cancelled the request
- 500: Internal Server Error
- 502: Bad Gateway - the engine failed

## Request

curl:

```bash
curl -X POST "https://api.answerline.dev/v1/monitor/chatgpt" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"What are the best running shoes for flat feet?","country":"US","include":{"markdown":true}}'
```

TypeScript:

```ts
import { Client } from "@answerline/sdk";

const client = new Client({ apiKey: process.env.API_KEY! });
const answer = await client.monitor.chatgpt({
  "prompt": "What are the best running shoes for flat feet?",
  "country": "US",
  "include": {
    "markdown": true
  }
});
```

Python:

```python
import os
from answerline import Client

with Client(os.environ["API_KEY"]) as client:
    answer = client.monitor.chatgpt(
        prompt="What are the best running shoes for flat feet?",
        country="US",
        include={
            "markdown": True
        },
    )
```


## Example responses

200:

```json
{
  "success": true,
  "result": {
    "text": "The Hubble Space Telescope is an observatory that has been in orbit since 1990. Here's a short summary:\n\n🔭 Hubble at a Glance\nHubble circles Earth about 540 km up and was built jointly by NASA and ESA; its images have shaped modern astronomy, from galaxy formation to the expansion rate of the universe.",
    "searchResults": [
      {
        "position": 1,
        "url": "https://www.runnersworld.com/gear/a19663621/best-running-shoes/",
        "label": "The Best Running Shoes of 2026",
        "description": "Our testers ran hundreds of miles in these shoes...",
        "domain": "www.runnersworld.com",
        "datePublished": "2026-09-14"
      }
    ],
    "sources": [
      {
        "position": 1,
        "url": "https://www.rippling.com/blog/ai-recruiting?utm_source=chatgpt.com",
        "label": "9 Leading Talent Sourcing Platforms for Recruiters in 2025",
        "description": "Compare leading applicant tracking systems that help small teams screen candidates faster...",
        "footnote": false,
        "datePublished": "May 22, 2025"
      },
      {
        "position": 2,
        "url": "https://www.index.dev/blog/ai-recruiting-software-hiring-managers?utm_source=chatgpt.com",
        "label": "8 Top Interview Scheduling Tools for Recruiting Teams in 2025",
        "description": "An in-depth comparison of applicant tracking systems that recruiting teams can adopt today...",
        "footnote": false,
        "datePublished": "April 10, 2025"
      },
      {
        "position": 3,
        "url": "https://www.selectsoftwarereviews.com/buyer-guide/ai-recruiting?utm_source=chatgpt.com",
        "label": "15 Top Applicant Tracking Systems for 2025: Features and Pricing Compared",
        "description": "Hands-on comparisons and plan prices for popular applicant tracking software...",
        "footnote": true
      }
    ],
    "html": "https://files.answerline.dev/html/c45a5081-808d-4ed3-9c86-e4baf16c8ab8/1/page-1.html",
    "markdown": "The Hubble Space Telescope is an observatory that has been in orbit since 1990. Here's a short summary:\n\n🔭 Hubble at a Glance\nHubble circles Earth about 540 km up and was built jointly by NASA and ESA; its images have shaped modern astronomy, from galaxy formation to the expansion rate of the universe.",
    "rawResponse": [
      {
        "delta": {
          "content": [
            {
              "text_delta": "Northwind Traders appears in…"
            }
          ]
        }
      },
      {
        "type": "citation",
        "citation": {
          "type": "searchResult",
          "sources": [
            {
              "url": "https://example.com/a",
              "label": "A"
            }
          ]
        }
      }
    ],
    "searchQueries": [
      "What is the Hubble Space Telescope?",
      "Globex Inc. company profile",
      "Globex Corporation product catalog"
    ],
    "model": "gpt-5-5",
    "shoppingCards": [
      {
        "tags": [
          "cushioned everyday road shoe",
          "lightweight neutral trainer"
        ],
        "products": [
          {
            "title": "Puma Carina Street",
            "url": "https://www.adidas.com/us/vl-court-3.0-shoes/ID8797.html?utm_source=chatgpt.com",
            "price": "$57.00",
            "featured_tag": "cushioned everyday road shoe",
            "merchant": "Brooks + others",
            "image_urls": [
              "https://images.openai.com/static-rsc-1/example.jpg"
            ],
            "rating": 4.7,
            "num_reviews": 10394,
            "id": "3250714974047560249",
            "offers": [
              {
                "merchant_name": "adidas",
                "product_name": "Brooks Ghost 16 Women's",
                "url": "https://www.adidas.com/us/vl-court-3.0-shoes/ID8797.html?utm_source=chatgpt.com",
                "price": "$57.00",
                "details": "Available online, ships in 2-4 days for $5.95",
                "available": true,
                "checkoutable": false,
                "price_details": {
                  "base": "$57.00",
                  "total": "$57.00"
                },
                "tag": {
                  "text": "Best price"
                }
              }
            ],
            "rating_grouped_citation": {
              "title": "Brooks Ghost 16 Women's",
              "url": "https://www.adidas.com/us/vl-court-3.0-shoes/ID8797.html",
              "supporting_websites": [
                {
                  "title": "Brooks Ghost 16 Women's",
                  "url": "https://www.macys.com/shop/product/adidas-womens-vl-court-3.0-casual-sneakers-from-finish-line?ID=21107988&pla_country=US&CAGPSPN=pla"
                }
              ]
            }
          }
        ]
      }
    ],
    "inlineProducts": [
      {
        "product": {
          "title": "Adidas Grand Court 2.0 Shoes",
          "position": 1,
          "url": "https://www.amazon.in/Nike-Court-Vision-Shoes/dp/B098F6QPLK?utm_source=chatgpt.com",
          "description": "Lightweight trainer with a cushioned everyday sole",
          "price": "$79.99",
          "featured_tag": "cushioned everyday road shoe",
          "rating": 4.5,
          "num_reviews": 8703,
          "image_urls": [
            "string"
          ],
          "id": "prod_12345",
          "variants": null,
          "offers": [
            {
              "merchant_name": "Amazon.in",
              "merchant_subtitle": "string",
              "product_name": "Adidas Men's Grand Court 2.0 Shoes",
              "url": "https://www.amazon.in/dp/B098F6QPLK?utm_source=chatgpt.com",
              "price": "$79.99",
              "details": "Available for pickup, Free shipping",
              "original_price": "string",
              "available": true,
              "checkoutable": false,
              "is_digital": false,
              "checkout_payload": "string",
              "checkout_image_urls": [
                null
              ],
              "shop_id": "string",
              "provider": "p2",
              "price_details": {
                "display_price": null,
                "base": "$79.99",
                "shipping": null,
                "tax": null,
                "total": "$79.99"
              },
              "tag": {
                "text": "Best price",
                "tooltip": null
              }
            }
          ],
          "rating_grouped_citation": {
            "title": "Adidas Men's Grand Court 2.0 Shoes",
            "url": "https://www.amazon.in/dp/B098F6QPLK",
            "supporting_websites": [
              null
            ]
          },
          "provider": "deprecated",
          "providers": [
            "product_info"
          ],
          "product_lookup_key": {
            "data": "string"
          },
          "product_lookup_data": {
            "request_query": "string",
            "all_ids": null,
            "metadata_sources": [
              "string"
            ]
          },
          "showcase_metadata": {
            "image": {
              "url": "string",
              "width": 0,
              "height": 0
            },
            "background": {
              "type": "string",
              "primary": "string",
              "secondary": "string"
            },
            "slots": null,
            "debug": null
          },
          "show_price_disclosure": false,
          "analytics_meta": {
            "product_event_uuid": "string"
          },
          "metadata_sources": [
            "p2"
          ],
          "product_event_uuid": "string",
          "generatedProductQuery": "best cordless vacuum uk 2026 lightweight pet hair stick vacuum"
        },
        "render_as": "hero",
        "details": {
          "rationale": {
            "rationale": "string",
            "citations": [
              null
            ]
          },
          "reviews": {
            "summary": "string",
            "reviews": [
              {
                "source": "Amazon",
                "theme": "Setup and handling",
                "summary": null,
                "sentiment": "positive",
                "cite": null,
                "rating": null,
                "num_reviews": null,
                "cite_url": null
              }
            ]
          }
        }
      }
    ],
    "entities": [
      {
        "type": "product",
        "name": "Nike Court Vision Low"
      },
      {
        "type": "product",
        "name": "Nike Air Force 1 '07"
      },
      {
        "type": "product",
        "name": "New Balance 550 Leather"
      }
    ],
    "map": [
      {
        "id": "rVKID2OBQMyVpraqSjz9sg",
        "provider": "yelp",
        "name": "Harbor Lane Roasters",
        "position": 1,
        "address": "210 Valencia St, San Francisco, CA 94110",
        "latitude": 37.7811,
        "longitude": -122.4076,
        "categories": [
          "Coffee shop"
        ],
        "rating": 4.5,
        "reviewCount": 1234,
        "description": "Family-run bakery famous for its slow-fermented sourdough loaves",
        "phone": "+1-415-555-0123",
        "websiteUrl": "https://bluebottlecoffee.com"
      }
    ],
    "citationPills": [
      {
        "url": "https://example.com/article",
        "label": "Sample Guide Headline",
        "description": "Longer explanation of what the cited material covers",
        "domain": "example.com",
        "datePublished": "2025-01-01",
        "citationPillId": 0,
        "type": "searchResult",
        "position": 1
      }
    ],
    "ads": [
      {
        "brand": {
          "name": "Acme Shoes",
          "url": "https://www.acmeshoes.com?utm_source=chatgpt.com",
          "favicon": "https://images.openai.com/favicon.ico"
        },
        "cards": [
          {
            "title": "Lightweight Trail Sneakers",
            "body": "Responsive trainers with a soft foam midsole for daily miles",
            "url": "https://www.acmeshoes.com/running?utm_source=chatgpt.com",
            "image": "https://images.openai.com/product.jpg"
          },
          {
            "title": "Waterproof Hiking Boots",
            "body": "Rugged trail shoes with deep lugs for loose terrain",
            "url": "https://www.acmeshoes.com/trail?utm_source=chatgpt.com",
            "image": "https://images.openai.com/product2.jpg"
          }
        ]
      }
    ],
    "images": [
      {
        "title": "Lisbon's top hotels, ranked | The Guardian",
        "url": "https://www.independent.co.uk/travel/europe/portugal/lisbon/best-lisbon-portugal-hotels-b1987832.html",
        "thumbnail": "https://d2u1z1lopyfwlx.cloudfront.net/thumbnails/636fbd12-6dee-5f44-a76d-fe7f9cd20e40/75ce41cb-6767-5082-a330-ee97c5866886.jpg",
        "medium": "image",
        "source": "web",
        "image_width": 5600,
        "image_height": 3733,
        "thumbnail_width": 300,
        "thumbnail_height": 200
      }
    ],
    "screenshot": "https://files.answerline.dev/html/c45a5081-808d-4ed3-9c86-e4baf16c8ab8/1/3f9a1c2e8b7d4a6f9e0c1b2a3d4e5f60/page-1.png",
    "links": [
      {
        "position": 1,
        "text": "Nike Pegasus 42",
        "url": "https://www.nike.com/t/pegasus-42-mens-road-running-shoes",
        "domain": "nike.com"
      }
    ]
  }
}
```

400:

```json
{
  "success": false,
  "error": "Request validation failed",
  "details": [
    {
      "field": "prompt",
      "message": "Prompt must not be empty"
    }
  ]
}
```

502:

```json
{
  "error": {
    "code": "EXTERNAL_SERVICE_ERROR",
    "message": "External service error: the service failed",
    "details": {
      "service": "CHATGPT"
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}
```

