# Request logs

One API or MCP request. IP addresses, user agents, headers and bodies are never included.

## Endpoints

- `GET /platform/projects/{projectId}/request-logs`: [List project request logs](https://docs.polymorfa.com/api/request-logs/list-project-request-logs)

## The request log object

One API or MCP request. IP addresses, user agents, headers and bodies are never included.

### Attributes

- `id` (string (uuid), required, format uuid). Identifier for this resource.
- `projectId` (string (uuid), required, format uuid). Identifier of the Polymorfa project that owns this resource.
- `createdAt` (string (date-time), required, format date-time). When the request was recorded.
- `method` (string, required). HTTP method.
- `route` (string, required). Matched route pattern, for example `/messaging/:session/messages`. Path values are not included.
- `status` (integer, required, nullable). HTTP response status.
- `durationMs` (integer, required, nullable). Specifies duration ms for this management request log.
- `result` (string, required). `failure` for any status of 400 or above. Values: `success`, `failure`.
- `source` (string, required). Specifies source for this management request log. Values: `api`, `mcp`.
- `requestId` (string, required, nullable). Value of the `X-Request-Id` response header.
- `traceId` (string, required, nullable, pattern ^[0-9a-f]{32}$). W3C trace ID, also returned in the `X-Trace-Id` response header. When you send a valid `traceparent` header, this is your trace ID.
- `errorCode` (string, required, nullable). Error code from the response body of a failed request.
- `mcpTool` (string, required, nullable). MCP tool name for requests made through MCP.
- `credential` (object, required, nullable). Credential that made the request. Client tokens have no listed record, so their `id` and `last4` are null. Null when the key or token no longer exists.
  - `type` (string, required). Type discriminator for this object. Values: `team_key`, `project_token`, `client_token`.
  - `id` (string (uuid), required, nullable, format uuid). Identifier for this resource.
  - `last4` (string, required, nullable). Specifies last4 for this credential.
```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "projectId": "00000000-0000-4000-8000-000000000000",
  "createdAt": "2026-09-22T12:00:00Z",
  "method": "string",
  "route": "string",
  "status": 0,
  "durationMs": 0,
  "result": "success",
  "source": "api",
  "requestId": "string",
  "traceId": "string",
  "errorCode": "string",
  "mcpTool": "string",
  "credential": {
    "type": "team_key",
    "id": "00000000-0000-4000-8000-000000000000",
    "last4": "string"
  }
}
```

## List project request logs

`GET https://api.polymorfa.com/platform/projects/{projectId}/request-logs` (Platform API)

Required permission: `logs:read`

Lists API and MCP requests made to the exact project in the route from the last 30 days. Without `after`, requests are newest first and `page.nextCursor` returns older requests. Pass `page.followCursor` as `after` to receive only newer requests, oldest first; this is how you tail the log. A request appears about two seconds after it completes. Reads of the request log are not listed.

Requires `logs:read`. Project tokens only access resources in their own project.

### Path parameters

- `projectId` (string (uuid), required, format uuid). Identifier of the Polymorfa project that owns this resource.

### Query parameters

- `limit` (integer, range 1–100). Requests per page, from 1 to 100. Default: `25`.
- `cursor` (string, length 1–2048). `page.nextCursor` from an earlier page. Lists older requests with the same filters. Cannot be combined with filters or `after`.
- `after` (string, length 1–2048). `page.followCursor` from an earlier page. Lists newer requests, oldest first, with the same filters. Cannot be combined with filters or `cursor`.
- `since` (string (date-time), format date-time). Earliest request time. Requests older than 30 days are never listed.
- `until` (string (date-time), format date-time). Latest request time.
- `status` (string, pattern ^[1-5]([0-9]{2}|[xX]{2})(,[1-5]([0-9]{2}|[xX]{2})){0,9}$). Comma-separated HTTP status codes or classes, for example `404,5xx`.
- `method` (string, pattern ^(GET|POST|PUT|PATCH|DELETE)(,(GET|POST|PUT|PATCH|DELETE)){0,9}$). Comma-separated HTTP methods, for example `POST,DELETE`.
- `route` (string, length 1–256). Exact route pattern, for example `/messaging/:session/messages`.
- `source` (string). `api` for direct API requests or `mcp` for requests made through MCP. Values: `api`, `mcp`.
- `credentialId` (string (uuid), format uuid). ID of the team API key or project token that made the request.
- `requestId` (string, pattern ^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$). Request ID from the `X-Request-Id` response header.
- `traceId` (string, pattern ^[0-9a-fA-F]{32}$). W3C trace ID from the `X-Trace-Id` response header or your own `traceparent`. Matched case-insensitively.

### Request

```bash
curl "https://api.polymorfa.com/platform/projects/<projectId>/request-logs" \
  -H "Authorization: Bearer <POLYMORFA_API_KEY>" \
  -H "Polymorfa-Version: 2026-09-22"
```

### Responses

#### 200

Success
- `data` (array of object, required). Structured data carried by this object.
  - `id` (string (uuid), required, format uuid). Identifier for this resource.
  - `projectId` (string (uuid), required, format uuid). Identifier of the Polymorfa project that owns this resource.
  - `createdAt` (string (date-time), required, format date-time). When the request was recorded.
  - `method` (string, required). HTTP method.
  - `route` (string, required). Matched route pattern, for example `/messaging/:session/messages`. Path values are not included.
  - `status` (integer, required, nullable). HTTP response status.
  - `durationMs` (integer, required, nullable). Specifies duration ms for this management request log.
  - `result` (string, required). `failure` for any status of 400 or above. Values: `success`, `failure`.
  - `source` (string, required). Specifies source for this management request log. Values: `api`, `mcp`.
  - `requestId` (string, required, nullable). Value of the `X-Request-Id` response header.
  - `traceId` (string, required, nullable, pattern ^[0-9a-f]{32}$). W3C trace ID, also returned in the `X-Trace-Id` response header. When you send a valid `traceparent` header, this is your trace ID.
  - `errorCode` (string, required, nullable). Error code from the response body of a failed request.
  - `mcpTool` (string, required, nullable). MCP tool name for requests made through MCP.
  - `credential` (object, required, nullable). Credential that made the request. Client tokens have no listed record, so their `id` and `last4` are null. Null when the key or token no longer exists.
    - `type` (string, required). Type discriminator for this object. Values: `team_key`, `project_token`, `client_token`.
    - `id` (string (uuid), required, nullable, format uuid). Identifier for this resource.
    - `last4` (string, required, nullable). Specifies last4 for this credential.
- `page` (object, required). Specifies page for this schema.
  - `nextCursor` (string, required, nullable). Pass as `cursor` to list older requests.
  - `hasMore` (boolean, required). Whether more.
  - `followCursor` (string, required). Pass as `after` to list requests newer than this page. Valid for 24 hours.

Headers:

- `X-Request-Id` (string). Stable request correlation identifier.
- `X-Trace-Id` (string, pattern ^[0-9a-f]{32}$). W3C trace ID of this request. Your `traceparent` trace ID when you sent a valid one.
- `Polymorfa-Version` (string). API version applied to this response.

```json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000000",
      "projectId": "00000000-0000-4000-8000-000000000000",
      "createdAt": "2026-09-22T12:00:00Z",
      "method": "string",
      "route": "string",
      "status": 0,
      "durationMs": 0,
      "result": "success",
      "source": "api",
      "requestId": "string",
      "traceId": "string",
      "errorCode": "string",
      "mcpTool": "string",
      "credential": {
        "type": "team_key",
        "id": "00000000-0000-4000-8000-000000000000",
        "last4": "string"
      }
    }
  ],
  "page": {
    "nextCursor": "string",
    "hasMore": true,
    "followCursor": "string"
  }
}
```

#### 400

A path, query, or request-body value did not pass validation.
- `error` (object, required). Error details returned when the operation fails.
  - `type` (string, required). Type discriminator for this object. Values: `invalid_request_error`, `authentication_error`, `permission_error`, `billing_error`, `conflict_error`, `rate_limit_error`, `api_error`, `upstream_error`.
  - `code` (string, required). Stable failure code. Use this value for programmatic handling.
  - `message` (string, required). Safe explanation of the failure.
  - `param` (string, required, nullable). Invalid request field, or null when no field applies.
  - `request_id` (string, required). Matches the X-Request-Id response header. Include it when you contact support.
  - `request_log_url` (string (uri), format uri). Console page that shows this request. Returned only to team and project credentials whose request was logged.
- `data` (string, required, nullable). Always null for a failed request.
- `docs` (string (uri), required, format uri). Documentation link to this failure code.

Headers:

- `X-Request-Id`, `X-Trace-Id`, `Polymorfa-Version`: described under 200.

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_parameter",
    "message": "Correct the invalid request field.",
    "param": null,
    "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
  },
  "data": null,
  "docs": "https://docs.polymorfa.com/api/errors#invalid-parameter"
}
```

#### 401

Missing/invalid credential for this audience.
Same fields as 400.

Headers:

- `X-Request-Id`, `X-Trace-Id`, `Polymorfa-Version`: described under 200.

```json
{
  "error": {
    "type": "authentication_error",
    "code": "invalid_credential",
    "message": "Supply a valid credential.",
    "param": null,
    "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
  },
  "data": null,
  "docs": "https://docs.polymorfa.com/api/errors#invalid-credential"
}
```

#### 403

Authenticated but lacks the required scope/role/audience.
Same fields as 400.

Headers:

- `X-Request-Id`, `X-Trace-Id`, `Polymorfa-Version`: described under 200.

```json
{
  "error": {
    "type": "permission_error",
    "code": "permission_denied",
    "message": "The credential does not have access to this resource.",
    "param": null,
    "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
  },
  "data": null,
  "docs": "https://docs.polymorfa.com/api/errors#permission-denied"
}
```

#### 404

The requested resource was not found inside the authenticated team or project scope.
Same fields as 400.

Headers:

- `X-Request-Id`, `X-Trace-Id`, `Polymorfa-Version`: described under 200.

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "resource_not_found",
    "message": "The resource is unavailable to this caller.",
    "param": null,
    "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
  },
  "data": null,
  "docs": "https://docs.polymorfa.com/api/errors#resource-not-found"
}
```

#### 429

A limit was reached. Wait for `Retry-After` before retrying.
Same fields as 400.

Headers:

- `Retry-After` (integer, min 1). Seconds to wait before retrying.
- `Polymorfa-RateLimit-Reason` (string). The limit that was reached. See the rate-limit reasons in the error reference.
- `X-Request-Id`, `X-Trace-Id`, `Polymorfa-Version`: described under 200.

```json
{
  "error": {
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded",
    "message": "The request limit was reached. Follow Retry-After when supplied.",
    "param": null,
    "request_id": "5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30"
  },
  "data": null,
  "docs": "https://docs.polymorfa.com/api/errors#rate-limit-exceeded"
}
```
