# Request logs

See every request made with your API keys in the last 30 days, with the key, the endpoint, the method, the status and the source IP.

The request logs are the history of the public API itself: one row for each request made with an API key. Use them to see which key called what, from where, and how the API answered. They cover the last 30 days.

There are two views of the same history:

| Path | What it returns |
| --- | --- |
| `GET /public-api/request-logs/` | The requests made with any key of your account. |
| `GET /public-api/organizations/{org_public_id}/request-logs/` | The requests made with the keys of the members to the domains of the organization. |

- [Read](#read-the-history): Your own keys, or every key used on an organization.
- [Filter](#filter-the-history): By time, key, domain, endpoint, method or status.
- [Rows](#what-a-row-holds): What is kept for each request, and what is not.

The examples on this page use these shell variables:

```bash
export DIAMWALL_API_KEY="your key"
export REQUEST_LOGS="https://api.diamwall.com/public-api/request-logs/"
```

For the organization view, use `https://api.diamwall.com/public-api/organizations/your-organization-public-id/request-logs/` instead. Everything else on this page is the same for both.

## Read the history

[`GET /public-api/request-logs/` in the API reference](https://docs.diamwall.com/api/#tag/domains/GET/public-api/request-logs/)

```bash
curl "$REQUEST_LOGS" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

```json
{
  "results": [
    {
      "public_id": "0d8f3c1e-5b7a-4c1d-9e2f-6a4b8c0d1e2f",
      "occurred_at": "2026-11-23T14:02:11Z",
      "api_key_public_id": "7c2e9a40-1f3b-4d5c-8e6f-9a0b1c2d3e4f",
      "endpoint": "/v2/cdn/dns/{domain_public_id}/records/",
      "method": "POST",
      "response_status": 201,
      "client_ip": "203.0.113.10"
    }
  ],
  "next_cursor": "eyJvIjoxMDB9"
}
```

A page has 100 rows unless you set `limit`, up to 200. To read the next page, send `next_cursor` back as `cursor`, with the same filters. On the last page `next_cursor` is `null`.

```bash
curl "$REQUEST_LOGS?cursor=eyJvIjoxMDB9" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

## What a row holds

| Field | What it is |
| --- | --- |
| `public_id` | The id of the row. |
| `occurred_at` | When the request happened, in ISO 8601, UTC. |
| `api_key_public_id` | The key that made the request. |
| `endpoint` | The path as a template, for example `/v2/cdn/dns/{domain_public_id}/records/`. The ids in the path are not kept. |
| `method` | The HTTP method. |
| `response_status` | The HTTP status the API answered. |
| `client_ip` | The address the request came from. |

A row never holds the body, the query string, the headers or any events.

## Filter the history

Add any of these to the query string:

| Parameter | Keeps the requests |
| --- | --- |
| `from`, `until` | Inside that time range. |
| `api_key_public_id` | Made with that key. |
| `domain_public_id` | Made to that domain. |
| `endpoint` | To that endpoint. |
| `method` | With that HTTP method. |
| `response_status` | That got that HTTP status. |

For example, every request of one key that was refused with `403`:

```bash
curl "$REQUEST_LOGS?api_key_public_id=7c2e9a40-1f3b-4d5c-8e6f-9a0b1c2d3e4f&response_status=403&limit=200" \
  -H "Authorization: Api-Key $DIAMWALL_API_KEY"
```

## Find the key behind a change

A change made with an API key now carries `api_key_public_id` in two more places:

- The `audit_cdn` event of the [events feed](https://docs.diamwall.com/products/events/#event-types).
- The audit log of the organization in the dashboard.

The field is absent on changes made in the dashboard, and on changes from before it was added. Use it as the `api_key_public_id` filter here to see what else that key did.

## Limits

- Only the last 30 days are returned.
- A page has at most 200 rows.

## Errors you are likely to see

The code is in the `message` field of the answer.

| Status | Code | What happened |
| --- | --- | --- |
| `400` | `PUBLIC_API_LOG_FILTER_INVALID` | A filter is not valid. |
| `400` | `PUBLIC_API_LOG_CURSOR_INVALID` | The cursor cannot be used. Start again without `cursor`. |
| `403` | `AUDIT_LOGS_ACCESS_DENIED` | Organization view only: you lack the `audit_logs.view` permission in the organization. |
| `429` | `PUBLIC_API_LOG_RATE_LIMITED` | Too many requests. Wait for the time in `Retry-After`. |
| `503` | `PUBLIC_API_LOGS_UNAVAILABLE` | The history cannot be read right now. Try again later. |

The errors that come from the key itself, such as `API_KEY_IP_NOT_ALLOWED`, are on the [Errors](https://docs.diamwall.com/reference/errors/) page.
