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

# ChatGPT

> Monitor what ChatGPT says about any brand, product, or topic. Get cited sources, internal search queries, and clean structured JSON from the real ChatGPT web interface.

<Info>
  **Web search always enabled**

  Every request runs in ChatGPT's web search mode. All responses include live citations from the web.
</Info>

## Overview

Use this endpoint to monitor brand mentions, track AI-generated answers, and see which sources ChatGPT cites for any topic. The `search_queries` field reveals ChatGPT's internal query fan-out - the sub-questions it searched to build its answer - making it a powerful tool for keyword research and AI SEO.

## Unique features

* **Sources**: Web citations with URL and link text for every source referenced in the response
* **Search queries**: The internal fan-out queries ChatGPT used to gather information before answering
* **Markdown response**: Full response formatted as markdown via `result_markdown`

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  # Streaming can take up to 300s - --max-time matches the server timeout
  curl --max-time 300 \
    -G "https://api.scrapellm.com/scrapers/chatgpt" \
    --data-urlencode "api_key=YOUR_API_KEY" \
    --data-urlencode "prompt=What brands do marketers recommend for email automation?" \
    --data-urlencode "country=US"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.scrapellm.com/scrapers/chatgpt",
      headers={"X-API-Key": "YOUR_API_KEY"},
      params={
          "prompt": "What brands do marketers recommend for email automation?",
          "country": "US",
      }
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    prompt: "What brands do marketers recommend for email automation?",
    country: "US",
  });

  const response = await fetch(
    `https://api.scrapellm.com/scrapers/chatgpt?${params}`,
    { headers: { "X-API-Key": "YOUR_API_KEY" } }
  );
  const data = await response.json();
  console.log(data);
  ```

  ```typescript TypeScript theme={null}
  const params = new URLSearchParams({
    prompt: "What brands do marketers recommend for email automation?",
    country: "US",
  });

  const response = await fetch(
    `https://api.scrapellm.com/scrapers/chatgpt?${params}`,
    { headers: { "X-API-Key": "YOUR_API_KEY" } }
  );

  interface ChatGPTResponse {
    scraper: string;
    status: string;
    job_id: string;
    prompt: string;
    country: string;
    result: string;
    result_markdown: string;
    links: Array<{ url: string; text: string }>;
    search_queries: string[];
    llm_model: string;
    credits_used: number;
    elapsed_ms: number;
    cached: boolean;
  }

  const data: ChatGPTResponse = await response.json();
  console.log(data);
  ```
</CodeGroup>

## Example response

```json theme={null}
{
  "scraper": "chatgpt",
  "status": "done",
  "job_id": "job_abc123",
  "prompt": "What brands do marketers recommend for email automation?",
  "country": "US",
  "result": "Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo for email automation. Mailchimp is praised for its ease of use and generous free tier, while HubSpot offers deep CRM integration. Klaviyo is a favourite among e-commerce teams for its behavioural segmentation.",
  "result_markdown": "Marketers commonly recommend **Mailchimp**, **HubSpot**, and **Klaviyo** for email automation...",
  "links": [
    {
      "url": "https://mailchimp.com/resources/email-marketing-benchmarks/",
      "text": "Mailchimp"
    },
    {
      "url": "https://blog.hubspot.com/marketing/email-marketing-tools",
      "text": "HubSpot"
    },
    {
      "url": "https://www.klaviyo.com/blog/email-automation",
      "text": "Klaviyo"
    }
  ],
  "search_queries": [
    "best email automation tools recommended by marketers 2026",
    "top email marketing platforms for businesses",
    "Mailchimp vs HubSpot vs Klaviyo comparison"
  ],
  "llm_model": "gpt-4o",
  "credits_used": 3,
  "elapsed_ms": 8243.5,
  "cached": false
}
```

## Response schema

Includes [common response fields](/guides/making-requests#common-response-fields) plus:

| Field             | Type    | Description                                               |
| ----------------- | ------- | --------------------------------------------------------- |
| `result`          | string  | Plain-text response from ChatGPT                          |
| `result_markdown` | string  | Markdown-formatted response                               |
| `links`           | array   | Cited sources - each has `url` and `text`                 |
| `links[].url`     | string  | Full URL of the cited source                              |
| `links[].text`    | string  | Anchor text ChatGPT used for the citation                 |
| `search_queries`  | array   | Internal fan-out queries ChatGPT used to build the answer |
| `llm_model`       | string  | ChatGPT model used (e.g. `gpt-4o`)                        |
| `credits_used`    | integer | Credits consumed - always `3` for ChatGPT                 |
| `elapsed_ms`      | float   | End-to-end request duration in milliseconds               |
| `cached`          | boolean | `true` if served from cache                               |

## Using search queries

Pass `search_queries` results directly into your keyword research or content planning. Each string is a verbatim sub-question ChatGPT searched to build its answer.

<CodeGroup>
  ```bash cURL theme={null}
  # Streaming can take up to 300s - --max-time matches the server timeout
  curl --max-time 300 \
    -G "https://api.scrapellm.com/scrapers/chatgpt" \
    --data-urlencode "api_key=YOUR_API_KEY" \
    --data-urlencode "prompt=What are the best project management tools for remote teams?" \
    --data-urlencode "country=US"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.scrapellm.com/scrapers/chatgpt",
      headers={"X-API-Key": "YOUR_API_KEY"},
      params={
          "prompt": "What are the best project management tools for remote teams?",
          "country": "US",
      }
  )

  data = response.json()

  # Print each fan-out query ChatGPT used internally
  for query in data["search_queries"]:
      print(query)
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    prompt: "What are the best project management tools for remote teams?",
    country: "US",
  });

  const response = await fetch(
    `https://api.scrapellm.com/scrapers/chatgpt?${params}`,
    { headers: { "X-API-Key": "YOUR_API_KEY" } }
  );
  const data = await response.json();

  // Log each fan-out query ChatGPT used internally
  data.search_queries.forEach((query) => console.log(query));
  ```

  ```typescript TypeScript theme={null}
  const params = new URLSearchParams({
    prompt: "What are the best project management tools for remote teams?",
    country: "US",
  });

  const response = await fetch(
    `https://api.scrapellm.com/scrapers/chatgpt?${params}`,
    { headers: { "X-API-Key": "YOUR_API_KEY" } }
  );
  const data = await response.json();

  // Log each fan-out query ChatGPT used internally
  (data.search_queries as string[]).forEach((query: string) =>
    console.log(query)
  );
  ```
</CodeGroup>

The `search_queries` array for this prompt might look like:

```json theme={null}
[
  "best project management tools for remote teams 2026",
  "Asana vs Monday.com vs Notion for distributed teams",
  "project management software features remote work collaboration"
]
```

## Common questions

### Can I retrieve the search queries ChatGPT used?

Yes. The `search_queries` field is included in every response and contains the internal fan-out queries ChatGPT issued to gather information before composing its answer.

### Why do search queries look like long natural-language strings?

ChatGPT's search model decides the shape of each query and often emits a single long natural-language string rather than comma-separated keywords. The length and structure vary between runs, even for the same prompt. ScrapeLLM returns them exactly as ChatGPT generates them.

### Does this hit the ChatGPT API or the web interface?

The web interface. ScrapeLLM captures what a real user sees in the ChatGPT chat UI - not the direct OpenAI API response. This means you get live web search results, citations, and UI-specific features unavailable through the raw API.

### How do I calculate AI visibility for my brand?

Run the same set of industry prompts repeatedly and check whether your brand appears in `links` or `result`. Divide the number of responses that mention your brand by the total runs to get a reliable **AI visibility %**.

### Why does `bypass_cache` matter for brand monitoring?

Without `bypass_cache: true`, consecutive identical prompts may return a cached result. For accurate visibility tracking across multiple runs, set `bypass_cache: true` so each request fetches a fresh response from ChatGPT.


## OpenAPI

````yaml GET /scrapers/chatgpt
openapi: 3.1.0
info:
  title: ScrapeLLM — ChatGPT Scraper
  version: 1.1.0
  description: >
    Scrape the real ChatGPT web interface via ScrapeLLM's browser pool. Returns
    the full

    response — including cited web sources and query fan-out — as structured
    JSON.


    **Base URL:** `https://api.scrapellm.com`


    **Credits:** 3 per request · 1,500 free credits · No credit card required


    Get your API key at [scrapellm.com/signup](https://scrapellm.com/signup).


    ## Sync vs Async


    | Mode | Endpoint | When to use |

    |------|----------|-------------|

    | **Sync** | `GET /scrapers/chatgpt` | Simple integrations — blocks until
    the scrape completes |

    | **Async** | `POST /scrapers/chatgpt/jobs` | Batch workloads, background
    workers, or when you don't want to hold an open connection |


    Async jobs are retained for **24 hours**. Failed scrapes are automatically
    retried up to

    3 times before the job is marked `failed`.
  contact:
    email: hello@scrapellm.com
    url: https://scrapellm.com
  license:
    name: ScrapeLLM Terms of Service
    url: https://scrapellm.com/terms
servers:
  - url: https://api.scrapellm.com
    description: Production
security:
  - ApiKeyHeader: []
  - ApiKeyQuery: []
tags:
  - name: ChatGPT Scraper
    description: Submit prompts to ChatGPT and receive structured responses.
  - name: Jobs
    description: >-
      Poll the status of async scrape jobs. No authentication required — the
      `job_id` is an unguessable UUID.
paths:
  /scrapers/chatgpt:
    get:
      tags:
        - ChatGPT Scraper
      summary: Send a ChatGPT Scraping Request
      description: >
        Send a prompt to ChatGPT via a pool of real browsers and get the full
        response as

        structured JSON. Blocks until ChatGPT responds or `timeout` is reached.


        Responses include the plain-text answer, a Markdown-formatted version,
        all cited web

        sources (`links`), and the internal search queries ChatGPT issued behind
        the scenes

        (`search_queries` — query fan-out).


        **Authentication** — pass your API key via the `X-API-Key` header or as
        `?api_key=`

        in the URL.
      operationId: scrapeChatGPT
      parameters:
        - name: prompt
          in: query
          required: true
          description: The prompt to send to ChatGPT. Maximum 4,000 characters.
          schema:
            type: string
            minLength: 1
            maxLength: 4000
          example: What brands do marketers recommend for email automation?
        - name: country
          in: query
          required: false
          description: >
            ISO 3166-1 alpha-2 country code. Routes the request through
            infrastructure in

            that region so you receive the localised ChatGPT response. Defaults
            to `US`.
          schema:
            type: string
            minLength: 2
            maxLength: 2
            default: US
          example: US
        - name: markdown_json
          in: query
          required: false
          description: Include the full markdown-it token tree in the response.
          schema:
            type: boolean
            default: false
        - name: bypass_cache
          in: query
          required: false
          description: Skip the response cache and always fetch a fresh result.
          schema:
            type: boolean
            default: false
        - name: timeout
          in: query
          required: false
          description: >-
            Maximum seconds to wait for ChatGPT to respond. Must be between 10
            and 600.
          schema:
            type: number
            format: float
            minimum: 10
            maximum: 600
            default: 300
      responses:
        '200':
          description: Scrape completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatGPTScrapeResponse'
              example:
                scraper: chatgpt
                status: done
                job_id: job_abc123
                prompt: What brands do marketers recommend for email automation?
                country: US
                result: >-
                  Marketers commonly recommend Mailchimp, HubSpot, and
                  Klaviyo...
                result_markdown: >-
                  Marketers commonly recommend **Mailchimp**, **HubSpot**, and
                  **Klaviyo**...
                links:
                  - url: https://mailchimp.com
                    text: Mailchimp
                  - url: https://hubspot.com
                    text: HubSpot
                search_queries:
                  - best email automation tools marketers
                  - top email marketing platforms 2025
                llm_model: gpt-4o
                credits_used: 3
                elapsed_ms: 8243.5
                cached: false
                markdown_url: https://scrapellm.com/md/job_abc123.md
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: >-
                  Missing API key. Pass your key in the X-API-Key header or as
                  ?api_key= in the URL.
        '408':
          description: ChatGPT did not respond within the timeout period.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Credit limit reached or scraper queue is full — retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: >-
                  Credit limit reached. Upgrade your plan or wait for your
                  billing cycle to reset.
        '500':
          description: Scraper returned an unexpected error — safe to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Scraper pool is still warming up — retry in a few seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: Network timeout reaching the scraper machine.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: >
            # Streaming can take up to 300s - --max-time matches the server
            timeout

            curl --max-time 300 \
              -G "https://api.scrapellm.com/scrapers/chatgpt" \
              --data-urlencode "api_key=YOUR_API_KEY" \
              --data-urlencode "prompt=What brands do marketers recommend for email automation?" \
              --data-urlencode "country=US"
        - lang: Python
          label: Python
          source: |
            import requests

            response = requests.get(
                "https://api.scrapellm.com/scrapers/chatgpt",
                params={
                    "api_key": "YOUR_API_KEY",
                    "prompt": "What brands do marketers recommend for email automation?",
                    "country": "US",
                }
            )
            print(response.json())
        - lang: JavaScript
          label: JavaScript
          source: |
            const params = new URLSearchParams({
              api_key: "YOUR_API_KEY",
              prompt: "What brands do marketers recommend for email automation?",
              country: "US",
            });

            const response = await fetch(
              `https://api.scrapellm.com/scrapers/chatgpt?${params}`
            );
            const data = await response.json();
            console.log(data);
        - lang: TypeScript
          label: TypeScript
          source: |
            const params = new URLSearchParams({
              api_key: "YOUR_API_KEY",
              prompt: "What brands do marketers recommend for email automation?",
              country: "US",
            });

            const response = await fetch(
              `https://api.scrapellm.com/scrapers/chatgpt?${params}`
            );
            const data = await response.json();
            console.log(data);
components:
  schemas:
    ChatGPTScrapeResponse:
      type: object
      required:
        - scraper
        - status
        - job_id
        - prompt
        - country
        - result
        - credits_used
        - elapsed_ms
        - cached
      properties:
        scraper:
          type: string
          description: Always `"chatgpt"`.
          example: chatgpt
        status:
          type: string
          description: '`"done"` on success.'
          example: done
        job_id:
          type: string
          description: Unique identifier for this scrape job.
          example: job_abc123
        prompt:
          type: string
          description: The prompt that was submitted.
          example: What brands do marketers recommend for email automation?
        country:
          type: string
          description: The country the request was routed through.
          example: US
        result:
          type: string
          description: Plain-text response from ChatGPT.
          example: Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo...
        result_markdown:
          type: string
          nullable: true
          description: Markdown-formatted response from ChatGPT.
          example: >-
            Marketers commonly recommend **Mailchimp**, **HubSpot**, and
            **Klaviyo**...
        links:
          type: array
          description: Cited web sources with their display text and URL.
          items:
            $ref: '#/components/schemas/Link'
        search_queries:
          type: array
          description: >
            Internal search queries ChatGPT issued behind the scenes (query
            fan-out). These

            reveal what sub-questions ChatGPT searched to build its answer.
          items:
            type: string
          example:
            - best email automation tools marketers
            - top email marketing platforms 2025
        llm_model:
          type: string
          nullable: true
          description: ChatGPT model variant used (e.g. `gpt-4o`).
          example: gpt-4o
        credits_used:
          type: integer
          description: Credits consumed by this request. Always `3` for ChatGPT.
          example: 3
        elapsed_ms:
          type: number
          format: float
          description: Total end-to-end request duration in milliseconds.
          example: 8243.5
        cached:
          type: boolean
          description: '`true` if this response was served from cache.'
          example: false
        markdown_url:
          type: string
          nullable: true
          description: |
            Hosted `.md` URL for this response, suitable for sharing or linking.
            Expires after 24 hours.
          example: https://scrapellm.com/md/job_abc123.md
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Human-readable description of the error.
          example: Invalid API key.
    Link:
      type: object
      required:
        - url
        - text
      properties:
        url:
          type: string
          format: uri
          description: Absolute URL of the cited source.
          example: https://mailchimp.com
        text:
          type: string
          description: Display text for the link as shown in ChatGPT's response.
          example: Mailchimp
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your ScrapeLLM API key passed in the request header.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Your ScrapeLLM API key passed as a query parameter.

````