# Generate answer

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

- Platform: [Perplexity Answers](https://docs.upscrape.com/docs/platforms/perplexity)
- Capability ID: `perplexity.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":"Germany","include_sources":true,"locale":"en-GB","max_sources":10,"mode":"search","model":"auto","prompt":"Verify the claim that Upscrape received a €20 million regulatory fine in July 2026. Do not accept the premise; require a primary regulator notice matching the entity, amount, and date, and report clearly if no reliable record supports it.","source_policy":{"official_sources_only":true,"published_after":"2026-01-01"},"timezone":"Europe/Berlin"},"capability":"perplexity.answer.generate"}'
```

## Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | `string` | No |  |
| `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": "Germany",
  "include_sources": true,
  "locale": "en-GB",
  "max_sources": 10,
  "mode": "search",
  "model": "auto",
  "prompt": "Verify the claim that Upscrape received a €20 million regulatory fine in July 2026. Do not accept the premise; require a primary regulator notice matching the entity, amount, and date, and report clearly if no reliable record supports it.",
  "source_policy": {
    "official_sources_only": true,
    "published_after": "2026-01-01"
  },
  "timezone": "Europe/Berlin"
}
```

## 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,
  "finish_reason": "stop",
  "grounded": false,
  "query": "In one short sentence, explain why the sky appears blue.",
  "response": "The sky looks blue because molecules in Earth's atmosphere scatter shorter-wavelength blue light from the Sun more than they scatter red light."
}
```
### 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 |
| `finish_reason` | `string` | stop |
| `grounded` | `boolean` | false |
| `query` | `string` | In one short sentence, explain why the sky appears blue. |
| `response` | `string` | The sky looks blue because molecules in Earth's atmosphere scatter shor… |

## 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/perplexity/perplexity.answer.generate/openapi.json)
- [Platform OpenAPI 3.1](https://upscrape.com/scrapers/perplexity/openapi.json)
- [Focused coding-agent prompt](https://upscrape.com/scrapers/perplexity/capabilities/perplexity.answer.generate/llm.md)
