---
title: "OpenAI API answer with citations"
method: POST
path: "/v1/data/seo/chatgpt-api-answer"
tags: ["SEO: AI visibility"]
---

# OpenAI API answer with citations

`POST /v1/data/seo/chatgpt-api-answer`

## Request

- Base URL: `https://api.superagnt.com`
- URL: `https://api.superagnt.com/v1/data/seo/chatgpt-api-answer`
- Auth: API key in header `Authorization`

Asks an OpenAI model through its API (not the consumer app) and returns its answer with citations: the `result[0].items[]` element with `type: "message"` holds the answer in `sections[].text` and its citations in `sections[].annotations[]` (each with `url` and `title`). Token counts are on `result[0]`. Numbers measured this way are API answers, which can differ from what the OpenAI app shows. A live answer can take up to 95 seconds; one that runs longer fails with an error and is not charged. An answer with no sources is a valid answer, not an error.

## Request body

- object
  - `user_prompt` string, required: The question to ask the model.
  - `model_name` 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-mini': The model to ask: gpt-4o-mini, gpt-4o, gpt-5-mini (default gpt-4o-mini).
  - `max_output_tokens` integer: Cap on the answer's length in tokens, 16-2048 (default 1024). Web search can push a model slightly past it. gpt-5-mini needs at least 1024.
  - `web_search` boolean: Let the model search the web and cite sources (default true). Citations are still not guaranteed.
  - `force_web_search` boolean: Push the model to search the web before answering. Needs `web_search`; citations are still not guaranteed.
  - `web_search_country_iso_code` string: Two-letter country code the web search runs from, e.g. 'US'.

## Response `200`

The OpenAI model's answer in `result[0].items[]` (`type: "message"`), with citations in its `sections[].annotations[]`.

- object

## Other responses

- `400`: Bad request or upstream task error.
- `401`: Unauthorized.
- `429`: Too many requests, or every live slot for this engine is busy: retry after `Retry-After` seconds.
- `5XX`: Upstream error.

---

[API](https://skmtc.dev/superagnt/apis/superagnt-api.md) · [All operations](https://skmtc.dev/superagnt/apis/superagnt-api/llms.txt) · [OpenAPI document](https://skmtc.dev/superagnt/apis/superagnt-api/revisions/b2d8de30ccf0?raw)
