# Look up a request

> GET /v1/generation returns the metadata of one past request. It never returns prompts or responses.

Source: https://router.africa/docs/generation

`GET /v1/generation?id=<request id>` ([API reference](https://router.africa/docs/api-reference/get-generation)) returns the metadata of one request made with your workspace's keys. Use it to check what a request cost or how long it took, or to give support the facts about one request.

The `id` is the value of the `x-request-id` header on the original response.

**curl**

```bash
curl "https://api.router.africa/v1/generation?id=$REQUEST_ID" \
  -H "Authorization: Bearer $ROUTER_AFRICA_API_KEY"
```

**Python**

```python
import os

r = httpx.get(
    "https://api.router.africa/v1/generation",
    params={"id": os.environ["REQUEST_ID"]},
    headers={"Authorization": f"Bearer {os.environ['ROUTER_AFRICA_API_KEY']}"},
)
print(r.status_code, r.json())
```

**TypeScript**

```typescript
const url = new URL("https://api.router.africa/v1/generation");
url.searchParams.set("id", process.env.REQUEST_ID!);

const res = await fetch(url, {
  headers: { Authorization: `Bearer ${process.env.ROUTER_AFRICA_API_KEY}` },
});
console.log(res.status, await res.json());
```

## What you get

The response has one `data` object. This page lists every field; the [reference page](https://router.africa/docs/api-reference/get-generation) has the full schema.

| Field | Meaning |
|---|---|
| `id` | The request id. |
| `created_at` | When the request was made, as a date-time. |
| `endpoint` | The path that was called, for example `/v1/chat/completions`. |
| `model` | The model the request used. |
| `status_code` | The HTTP status the request returned. |
| `error_code` | The error `reason`, or `null` when the request succeeded. |
| `latency_ms` | How long the request took, in milliseconds. |
| `streamed` | Whether the request was streamed. |
| `input_tokens` | Tokens in the prompt. |
| `output_tokens` | Tokens in the response. |
| `cost` | The charge, in credits, as a string with eight decimal places. |

```json
{
  "data": {
    "id": "0192f0e0-7a1c-7d3e-9f10-2b6c8a4d5e11",
    "created_at": "2026-11-07T09:30:00Z",
    "endpoint": "/v1/chat/completions",
    "model": "openai/gpt-4.1-mini",
    "status_code": 200,
    "error_code": null,
    "latency_ms": 840,
    "streamed": false,
    "input_tokens": 12,
    "output_tokens": 3,
    "cost": "0.00000240"
  }
}
```

## What you don't get

- **No prompts or responses.** There is no way to read stored content through the API. Admins read it in the dashboard, and every read is recorded.
- **No attempt or fallback counts.** These are not recorded.

## Rules

- You can look up only requests from your own workspace. A request from another workspace returns `404`, the same as an id that doesn't exist.
- A request is recorded just after its response is sent. If you look it up straight away you can get `404`. Wait a moment and try again.
