# Generate answer

Submit a prompt with locale, country, search, and source-policy controls in a fresh ChatGPT context; return a complete answer, citations, and execution evidence.

- Platform: [ChatGPT Answers](https://docs.upscrape.com/docs/platforms/chatgpt)
- Capability ID: `chatgpt.answer.generate`
- Cost: 1 credit per request
- Maximum runtime: 180 seconds
- Execute endpoint: `POST https://data.upscrape.com/execute`

## Request

Use the exact public capability ID in the shared execute envelope.

```bash
curl -X POST https://data.upscrape.com/execute \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"country":"United States","country_mode":"best_effort","include_sources":true,"locale":"en-US","max_sources":6,"mode":"search","model":"auto","prompt":"As of 2026-08-03, explain how the official MCP Streamable HTTP transport handles session creation, subsequent protocol headers, and expired sessions. Separate protocol requirements from client design choices.","source_policy":{"official_sources_only":true,"preferred_domains":["modelcontextprotocol.io"],"published_after":"2025-01-01"},"timezone":"America/New_York"},"capability":"chatgpt.answer.generate"}'
```

## Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | `string` | No |  |
| `country_mode` | `string` | No | best_effort keeps ChatGPT usable and reports whether geotargeting was applied; strict requires a verified country exit and fails closed. |
| `include_sources` | `boolean` | No |  |
| `locale` | `string` | No |  |
| `max_sources` | `integer` | No |  |
| `mode` | `string` | No |  |
| `model` | `string` | No |  |
| `prompt` | `string` | Yes |  |
| `source_policy` | `object` | No |  |
| `source_policy.excluded_domains` | `array<string>` | No |  |
| `source_policy.official_sources_only` | `boolean` | No |  |
| `source_policy.preferred_domains` | `array<string>` | No |  |
| `source_policy.published_after` | `string` | No |  |
| `source_policy.published_before` | `string` | No |  |
| `timezone` | `string` | No |  |

### Example input

```json
{
  "country": "United States",
  "country_mode": "best_effort",
  "include_sources": true,
  "locale": "en-US",
  "max_sources": 6,
  "mode": "search",
  "model": "auto",
  "prompt": "As of 2026-08-03, explain how the official MCP Streamable HTTP transport handles session creation, subsequent protocol headers, and expired sessions. Separate protocol requirements from client design choices.",
  "source_policy": {
    "official_sources_only": true,
    "preferred_domains": [
      "modelcontextprotocol.io"
    ],
    "published_after": "2025-01-01"
  },
  "timezone": "America/New_York"
}
```

## Response

Successful output is returned in `results[0].data`. Raw platform output is intentionally open-ended and may evolve with the upstream source.

### Illustrative sample output

This redacted fixture is an example, not a fixed response schema.

```json
{
  "completed": true,
  "grounded": false,
  "query": "In one short sentence, explain why the sky appears blue.",
  "response": "The sky appears blue because air molecules scatter shorter blue wavelengths of sunlight more strongly than longer wavelengths."
}
```
### Illustrative output fields

Derived from the sample above for orientation only. These fields are not a fixed response schema.

| Path | Observed type | Example |
| --- | --- | --- |
| `completed` | `boolean` | true |
| `grounded` | `boolean` | false |
| `query` | `string` | In one short sentence, explain why the sky appears blue. |
| `response` | `string` | The sky appears blue because air molecules scatter shorter blue wavelen… |

## Execution behavior

A `200` response completed inline. A `202` response was queued; poll `GET /jobs/{id}` until the job reaches `completed` or `failed`. Use an `Idempotency-Key` when retrying must not create a duplicate logical job.

See [jobs and results](https://docs.upscrape.com/docs/api/jobs), [errors and retries](https://docs.upscrape.com/docs/api/errors), and [idempotency](https://docs.upscrape.com/docs/api/idempotency).

## Machine-readable contract

- [Capability OpenAPI 3.1](https://docs.upscrape.com/docs/platforms/chatgpt/chatgpt.answer.generate/openapi.json)
- [Platform OpenAPI 3.1](https://upscrape.com/scrapers/chatgpt/openapi.json)
- [Focused coding-agent prompt](https://upscrape.com/scrapers/chatgpt/capabilities/chatgpt.answer.generate/llm.md)
