# Request logs

The API requests made on your account, with redacted bodies, an errors summary and a live tail.

Related guide: [Logs and events](https://provenanceauth.com/docs/integrate/logs-and-events.md)

## Endpoints

- `GET /v1/request_logs/{id}`: [Retrieve a request log](#get-v1-request-logs-id)
- `GET /v1/request_logs`: [List request logs](#get-v1-request-logs)
- `GET /v1/request_logs/errors_summary`: [Summarize errors](#get-v1-request-logs-errors-summary)
- `GET /v1/devtools/stream`: [Stream requests and events](#get-v1-devtools-stream)

## The request log object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | no | Unique identifier for the object. |
| `object` | enum | no | The type of object. One of `request_log`. |
| `request_id` | string | no | The request's `X-Request-Id` (the `request_id` in an error body). |
| `created_at` | timestamp | no | When the request arrived. |
| `method` | string | no | The HTTP method. |
| `route` | string | no | The route template, such as `/v1/webhook_endpoints/:id`. |
| `path` | string | no | The path, without its query string. |
| `status_code` | integer | no | The HTTP status the API answered. |
| `duration_ms` | integer | no | How long the API took, in milliseconds. |
| `source` | enum | no | Whether an API key or a console session made it. One of `api_key`, `console`. |
| `api_key` | object \| null | no | The key that made it; null for a console session. |
| `api_key.id` | string | no | The key's ID. |
| `api_key.last4` | string \| null | no | The key's last four characters. |
| `idempotency_key` | string \| null | no | The `Idempotency-Key` sent, if any. |
| `api_version` | string \| null | no | The `Provenance-Version` the request used. |
| `error_code` | string \| null | no | The error's `code` on a 4xx or 5xx; null otherwise. |
| `object_ids` | array of strings | no | IDs the request touched (path parameters and the response's top-level IDs). |
| `request_bytes` | integer | no | The request body's size. |
| `response_bytes` | integer | no | The response body's size. |
| `truncated` | boolean | no | A body was longer than the log keeps (16 KB request, 32 KB response) and was cut. |

### Example

```json
{
  "id": "rlog_01M7X3QSX4Y8Z8SDCQ3DWBB511",
  "object": "request_log",
  "request_id": "req_01M7X3QSX1K3FNS2KQXVHQV265",
  "created_at": "2026-11-20T18:33:12.353Z",
  "method": "GET",
  "route": "/v1/webhook_endpoints",
  "path": "/v1/webhook_endpoints",
  "status_code": 200,
  "duration_ms": 2,
  "source": "api_key",
  "api_key": {
    "id": "key_01M7X3QSFEAMKSSXJTZSN29P4D",
    "last4": "1kR5"
  },
  "idempotency_key": null,
  "api_version": "2026-11-30",
  "error_code": null,
  "object_ids": [],
  "request_bytes": 0,
  "response_bytes": 63,
  "truncated": false
}
```

## Retrieve a request log

`GET /v1/request_logs/{id}`

One request with its request and response bodies, redacted before they were stored (secrets dropped, personal data masked). Pass a request log ID or a request's `X-Request-Id`.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The request log's ID (`rlog_…`) or the request's ID (`req_…`). |

### Returns

The request log with its bodies, or why they aren't shown.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > /dev/null
curl -s "$PROVENANCE_API/v1/request_logs?limit=1" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > step.json
export REQUEST_LOG_ID=$(jq -r '.data[0].id' step.json)
curl "$PROVENANCE_API/v1/request_logs/$REQUEST_LOG_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/request_logs?limit=1`, {
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5" },
})).json();
const requestLogId = step2.data[0].id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/request_logs/${requestLogId}`, {
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
step2 = httpx.get(f"{api}/v1/request_logs?limit=1", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}).json()
request_log_id = step2["data"][0]["id"]
data = httpx.get(f"{api}/v1/request_logs/{request_log_id}", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}).json()
```

### Response 200

```json
{
  "id": "rlog_01M7X3QW86H9FB7GQSR7TG6GXE",
  "object": "request_log",
  "request_id": "req_01M7X3QW82HATW9FKJ7BJWRYYT",
  "created_at": "2026-11-20T18:33:14.754Z",
  "method": "POST",
  "route": "/v1/webhook_endpoints",
  "path": "/v1/webhook_endpoints",
  "status_code": 201,
  "duration_ms": 2,
  "source": "api_key",
  "api_key": {
    "id": "key_01M7X3QVV2CM0EE8A5S1Y29N3Y",
    "last4": "1kR5"
  },
  "idempotency_key": null,
  "api_version": "2026-11-30",
  "error_code": null,
  "object_ids": [
    "we_01M7X3QW83DR9QZT35BVJ4JCA5"
  ],
  "request_bytes": 84,
  "response_bytes": 313,
  "truncated": false,
  "body_status": "available",
  "request": {
    "headers": {
      "content-type": "application/json",
      "content-length": "84",
      "user-agent": "node",
      "accept": "*/*",
      "authorization": "[redacted]"
    },
    "query": {},
    "body": {
      "url": "http://localhost:4242/webhooks",
      "event_types": [
        "mandate.approval.approved"
      ]
    }
  },
  "response": {
    "body": {
      "id": "we_01M7X3QW83DR9QZT35BVJ4JCA5",
      "object": "webhook_endpoint",
      "url": "http://localhost:4242/webhooks",
      "event_types": [
        "mandate.approval.approved"
      ],
      "status": "active",
      "disabled_reason": null,
      "api_version": "2026-11-30",
      "created_at": "2026-11-20T18:33:14.755Z",
      "secret": "[redacted]"
    }
  },
  "retention_days": 90,
  "bodies_recorded": true
}
```

## List request logs

`GET /v1/request_logs`

Lists the API requests made on your account, newest first, with filters. Each item is metadata only; retrieve one for its redacted bodies. Kept 7, 30 or 90 days by plan. With an API key, only an All products key reads the log; a key limited to some products gets 403 `insufficient_scope`.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid. |
| `cursor` | query | string | no | Opaque; pass a response's `next_cursor` back to get the next page. |
| `created_gte` | query | timestamp | no | Only requests at or after this time. |
| `created_lte` | query | timestamp | no | Only requests at or before this time. |
| `status_class` | query | enum | no | Only this class of status. One of `2xx`, `3xx`, `4xx`, `5xx`. |
| `status_code` | query | integer | no | Only this HTTP status. |
| `method` | query | enum | no | Only this method. One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. |
| `route` | query | string | no | Only this route template, such as `/v1/webhook_endpoints/:id`. |
| `api_key_id` | query | string | no | Only requests made with this key. |
| `idempotency_key` | query | string | no | Only requests that sent this `Idempotency-Key`. |
| `request_id` | query | string | no | The request with this `X-Request-Id`. |
| `object_id` | query | string | no | Only requests that touched this object. |

### Returns

A page of request logs, newest first.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5
curl -s "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" > /dev/null
curl "$PROVENANCE_API/v1/request_logs?limit=2" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/request_logs?limit=2`, {
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.get(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.get(f"{api}/v1/request_logs?limit=2", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "rlog_01M7X3QSX4Y8Z8SDCQ3DWBB511",
      "object": "request_log",
      "request_id": "req_01M7X3QSX1K3FNS2KQXVHQV265",
      "created_at": "2026-11-20T18:33:12.353Z",
      "method": "GET",
      "route": "/v1/webhook_endpoints",
      "path": "/v1/webhook_endpoints",
      "status_code": 200,
      "duration_ms": 2,
      "source": "api_key",
      "api_key": {
        "id": "key_01M7X3QSFEAMKSSXJTZSN29P4D",
        "last4": "1kR5"
      },
      "idempotency_key": null,
      "api_version": "2026-11-30",
      "error_code": null,
      "object_ids": [],
      "request_bytes": 0,
      "response_bytes": 63,
      "truncated": false
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## Summarize errors

`GET /v1/request_logs/errors_summary`

The most frequent 4xx and 5xx error codes in a window, with counts, when each was last seen and up to three example requests.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `window` | query | enum | no | How far back to look. One of `1h`, `24h`, `7d`. |

### Returns

The top error codes, most frequent first.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5
curl -s "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" > /dev/null
curl "$PROVENANCE_API/v1/request_logs/errors_summary?window=24h" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/request_logs/errors_summary?window=24h`, {
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.get(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.get(f"{api}/v1/request_logs/errors_summary?window=24h", headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"}).json()
```

### Response 200

```json
{
  "object": "errors_summary",
  "window": "24h",
  "since": "2026-12-01T10:04:04.346Z",
  "total": 8,
  "scanned_all": true,
  "codes": [
    {
      "error_code": "resource_missing",
      "status_code": 404,
      "count": 5,
      "last_seen_at": "2026-12-02T10:04:03.430Z",
      "example_request_log_ids": [
        "rlog_01M8V3C4Z7Y8ZME2ERFFWY85TE",
        "rlog_01M8V3C4Z39FYBQS91ZDN2CDRF",
        "rlog_01M8V3C4Z39FYBQS91ZDN2CDRE"
      ]
    },
    {
      "error_code": "risk_score_not_ready",
      "status_code": 409,
      "count": 2,
      "last_seen_at": "2026-12-02T10:04:03.423Z",
      "example_request_log_ids": [
        "rlog_01M8V3C4YZPSZ46ZQS2QDZCW31",
        "rlog_01M8V3C4YX15SMG40B3KT6QNK1"
      ]
    },
    {
      "error_code": "parameter_invalid",
      "status_code": 400,
      "count": 1,
      "last_seen_at": "2026-12-02T10:04:03.422Z",
      "example_request_log_ids": [
        "rlog_01M8V3C4YY8BA7ZB94E1VSG2ZN"
      ]
    }
  ]
}
```

## Stream requests and events

`GET /v1/devtools/stream`

The console's live tail: Server-Sent Events of new requests (`event: request`, metadata only) and events (`event: event`) in the current environment. A signed-in console session only; with a key, list request logs and events instead.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `events` | query | string | no | Only these event types, comma-separated. |

### Returns

An event stream (`text/event-stream`).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`dashboard_session_required`](https://provenanceauth.com/docs/platform/errors.md#dashboard_session_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/devtools/stream" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/devtools/stream`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/devtools/stream", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```
