
# Find and inspect a request

Look a request up by its request ID and see who sent it, which provider and model answered, what it cost and what went wrong.

**Dashboard**

1. Open **Observability**.
2. On the **Requests** tab, paste the request ID, or the whole error message that holds it, into **Search requests**.
3. Press Enter, or choose **Open request**.

The request opens in a drawer, with its provider, model, status, key, finish reason, tokens and **Estimated cost**.

![A request open in Observability, showing its provider, model, status, cost and tokens](/images/dashboard/trace.png)

You need: an account that can see the key's requests. An organisation Owner, Admin or Viewer sees every request, a Workspace admin or Workspace viewer those of their workspace, and a Developer those of their own keys. Give someone who only investigates requests a Viewer or Workspace viewer role, which reads without changing anything.

**HTTP API**

```bash
curl -sS "$TOKEDEX_URL/observability/v1/calls?requestId=<request-id>" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
```

```json
{
  "data": [{
    "id": "0c570d31-d4fa-463b-ab14-626096b51c5e",
    "trajectoryId": "0c570d31-d4fa-463b-ab14-626096b51c5e",
    "provider": "anthropic",
    "model": "anthropic/claude-haiku-5.5",
    "status": "ok",
    "durationMs": 9,
    "costUsd": 0.0000024,
    "error": null,
    "keyId": "01M7V8SE8TMJ773PVSMM5ZANGJ",
    "workspaceId": "ws_default"
  }]
}
```

You need: an admin key with the `admin` or `operator` preset in `TOKEDEX_ADMIN_KEY`, and `export TOKEDEX_URL='http://127.0.0.1:4000'`. A key with only `usage.read`, such as the `viewer` preset, also reads requests; give a script that only reads requests that preset, the smallest that works.

The request ID is in every response's `x-request-id` header, and the OpenAI and Anthropic SDKs show it on an error as `request_id`. [Errors, limits and request IDs](/gateway/errors-and-limits#make-a-request-easy-to-find) shows callers how to send it to you. Ask the caller for the request ID first: one search finds the request by it, and search never matches prompt text.

## Request details

**Dashboard**

| Tab | Shows |
| --- | --- |
| **Summary** | The number of requests, cost, response time, tool calls and tokens, with a breakdown by model |
| **Requests** | Each request's provider, model, status, key, finish reason, tokens and error |
| **Timeline** | When each request started and how long it took |
| **Raw** | The stored record as JSON |

A request sent to a router shows the model that answered, with the router ID as its **Model alias**. A request's text shows only if the gateway captured it; otherwise it reads **Text not captured**. See [What the gateway records](/gateway/recording-and-retention).

**HTTP API**

For everything the gateway stored, request the whole trace by the `trajectoryId`:

```bash
curl -sS "$TOKEDEX_URL/observability/v1/traces/<trajectory-id>" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
```

It holds the totals, every request in `calls`, with its tokens, cost, finish reason and error, and the gateway's routing steps in `events`. `title` is the model ID the caller sent. A request's `request` and `response` text appear only if the gateway captured them; see [What the gateway records](/gateway/recording-and-retention).

The failed attempts before a router's fallback are not listed; the request shows the model that answered.

## Failed requests

**Dashboard**

A request the gateway refused, or that failed at the provider with an authentication, rate-limit or server error, shows **What to do**: what the error means and a button to each page where you can fix it. Choose **Errors only** to list only failed requests.

**HTTP API**

A failed request has `status` `error` and an `error` object with its code and type. `GET /observability/v1/traces?status=error` lists failed requests.

For what each error code means to a caller, see [Errors, limits and request IDs](/gateway/errors-and-limits).

## Follow a whole session

A session groups the requests of one run, such as a coding agent's task. Claude Code, Codex, OpenCode and goose send a session ID themselves. So does any client that sends LiteLLM's `x-litellm-session-id`, Helicone's `helicone-session-id` or a plain `x-session-id` header, and any client can send the `x-tokedex-trajectory-id` header. Have your own agents and batch jobs send it, so a failed request is found with the run it belongs to. A session belongs to the key that sent it.

**Dashboard**

Open the **Sessions** tab and choose a session. The same tabs cover all its requests. In **Playground**, **View trace in Observability** opens the run as a session.

**HTTP API**

Search for the session ID the client sent, then request that trace:

```bash
curl -sS "$TOKEDEX_URL/observability/v1/traces?search=nightly-eval-42" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
```

```json
{ "data": [{ "id": "ses_cdbaf2bcf3be0c38bb1e2ec4bb5c04d6", "title": "openai/gpt-6-luna", "callCount": 2 }] }
```

## List recent requests

**Dashboard**

**Requests** lists every request you can see, newest first. Narrow it with the time range, the provider list and **Errors only**, or search by model, provider, project or tag. **Export** downloads what is listed; export requests you must keep longer than the gateway keeps traces, since it deletes the oldest.

![The Observability page listing requests with their model, key, tokens, duration and cost](/images/dashboard/observability.png)

**HTTP API**

`GET /observability/v1/traces` lists traces newest first. Filter with `since` and `until` (ISO times), `status`, `provider`, `model`, `tag`, `project`, `keyId`, `workspaceId` and `search`, and page with `limit` and the `cursor` from `page.next`.

Search matches IDs, models, providers, projects, tags and session IDs, never prompt or response text.

## A request cannot be found

**Dashboard**

The page says **No request** with the ID, and lists the reasons:

**HTTP API**

An empty `data` list means the gateway has no record of it, for one of these reasons:

- it is older than the gateway keeps; see [What the gateway records](/gateway/recording-and-retention#trace-retention);
- it was sent with `x-tokedex-trace: false`, or while recording was off;
- it was sent a moment ago and is still being written;
- it was sent in another workspace, or with a key whose requests you cannot see;
- another replica served it, and the replicas share no database.

To find every request in one place, give several replicas a shared database, as [Deploy to production](/gateway/deploy) does.

Next: [What the gateway records](/gateway/recording-and-retention), [Spend and usage](/gateway/spend-and-usage) or [Export traces with OpenTelemetry](/gateway/export-traces).
