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

# ChatGPT API reference

> ChatGPT API: ask chatgpt.com a question and get the answer people see and every site it cites, as JSON. For brand and AI visibility tracking.

One endpoint, one key. It asks chatgpt.com one question signed out, with web
search on, and returns the answer a person would read and the sites it links.
This is not OpenAI's model API: it measures what ChatGPT tells people.

See the [ChatGPT API: overview, pricing, and free tier](https://clair.im/apis/chatgpt).

## Answer

`GET /v1/chatgpt` · **1 request**

```sh theme={null}
curl -G https://api.clair.im/v1/chatgpt \
  -H "Authorization: Bearer YOUR_KEY" \
  --data-urlencode "q=best project management software for small teams"
```

| Parameter | Required | Contract |
| - | - | - |
| `q` | yes | The question, as a person would type it, up to 500 characters. |
| `country` | no | Two-letter country code the question is asked from, such as `us` or `gb`. Defaults to `us`. |

ChatGPT streams its reply for 10 to 30 seconds, and the request waits for all
of it. Set your client timeout to two minutes.

```json theme={null}
{
  "engine": "chatgpt",
  "family": "ai",
  "query": {
    "q": "best project management software for small teams",
    "country": "us"
  },
  "answer": {
    "text": "For most small teams (3–20 people), I'd recommend Asana, ClickUp, or monday.com. They offer the best balance of task management, collaboration, project visibility, and scalability.\nThe right choice depends on whether you prioritize simplicity, affordability, or customization.\nTop 7 project management tools for small teams\n...",
    "citations": [
      {
        "position": 1,
        "title": "Visit Asana",
        "url": "https://asana.com/",
        "domain": "asana.com"
      },
      {
        "position": 2,
        "title": "Visit ClickUp",
        "url": "https://clickup.com/",
        "domain": "clickup.com"
      },
      {
        "position": 3,
        "title": "Visit monday.com",
        "url": "https://monday.com/",
        "domain": "monday.com"
      }
    ]
  }
}
```

| Field | Contents |
| - | - |
| `answer.text` | The answer as the page shows it, a line per paragraph, heading, or list item. |
| `answer.citations` | The sources the answer links, in the order it shows them, each once: `position`, `title`, `url`, `domain`. |
| `url` | The page ChatGPT links, without its `utm_source=chatgpt.com` tag. `null` when ChatGPT names only the site; `domain` is still set. |

Answers change from one asking to the next, so nothing is cached. To measure
visibility, ask each question several times and count how often a brand is
named in `text` or its domain appears in `citations`.

## Errors

A page that loads with no answer, after every scraping vendor has tried, is
`502` `scrape_failed`; the request is not billed. A missing `q`, a `q` over
500 characters, or a `country` that is not two letters is `400`.

## What this API does not do

* It does not sign in, so it does not read answers personalized to an account,
  or ChatGPT's paid models.
* It does not ask follow-up questions in the same conversation.
* It does not return the ads or shopping cards shown with an answer.

Auth, plans, rate limits, and error codes: [Authentication](https://clair.im/docs/authentication.md).


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