# Get a document answer

Poll a queued document question for its status and checked result.

Documentation index: https://webcite.co/llms.txt
Canonical page: https://webcite.co/api-docs/ask-result
API origin: https://api.webcite.co
Authentication: x-api-key header. Keep keys on your server.

## When to use it

Keep the ID returned by [Ask a document](/api-docs/ask). Poll with a delay and a bounded timeout. Stop polling on `done` or `failed`.

## Request

GET /api/v1/ask/{id}

0 credits.

### curl

```curl
curl --fail-with-body -X GET 'https://api.webcite.co/api/v1/ask/YOUR_ID' \
  -H "x-api-key: $WEBCITE_API_KEY"
```

### Node.js

```javascript
const response = await fetch("https://api.webcite.co/api/v1/ask/YOUR_ID", {
  method: "GET",
  headers: {
    "x-api-key": process.env.WEBCITE_API_KEY,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
```

### python

```python
import os
import requests

response = requests.get(
    "https://api.webcite.co/api/v1/ask/YOUR_ID",
    headers={"x-api-key": os.environ["WEBCITE_API_KEY"]},
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response

Status is queued, running, done, or failed. When done, inspect the result and warnings; a completed job can still have a null answer.

## Errors

For 400, check the request fields and source identifiers. For 401, check your API key. For 429, wait for the retry interval. See the errors guide before retrying a billable request.

## OpenAPI operation

```json
{
  "path": "/api/v1/ask/{id}",
  "method": "GET",
  "operation": {
    "description": "Job view with status (queued, running, done, failed) and,\nwhen done, the checked result or a null answer with warnings.\n\n**Cost: 0 credits** — this is a read of a result you already generated.",
    "operationId": "ApiV1Controller_askStatus",
    "parameters": [
      {
        "description": "Ask job ID",
        "in": "path",
        "name": "id",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    ],
    "responses": {
      "200": {
        "description": "Ask job view."
      },
      "401": {
        "description": "Unauthorized - API key required"
      },
      "404": {
        "description": "Ask job not found."
      }
    },
    "security": [
      {
        "x-api-key": []
      },
      {
        "bearer": []
      }
    ],
    "summary": "Poll an ask job",
    "tags": [
      "Public API"
    ]
  },
  "schemas": {}
}
```
