# Read when the keys were last used

URL: https://docs.analytics.remcostoeten.nl/docs/reference/projects/get-v2-projects-project-key-usage

`GET /v2/projects/{project}/key-usage`

When and from which origin the public and the secret key last authorized an ingest batch. For project admins and the debug console's widget token.

Auth: apiToken, or session.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | yes | string | The project id, as listed by `GET /v2/projects`. |

## Responses

### 200

Response for status 200

```json
{
  "examples": [
    {
      "data": {
        "public": {
          "lastUsedAt": "2026-08-02T11:58:00.000Z",
          "lastUsedOrigin": "https://portal.example.nl"
        },
        "secret": {
          "lastUsedAt": null,
          "lastUsedOrigin": null
        }
      }
    }
  ],
  "type": "object",
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "description": "When and from where each key last authorized an ingest batch. Updated at most once a minute, or at once when the origin changes.",
      "type": "object",
      "required": [
        "public",
        "secret"
      ],
      "properties": {
        "public": {
          "description": "Null values mean the key has not been used since it was created or rotated.",
          "type": "object",
          "required": [
            "lastUsedAt",
            "lastUsedOrigin"
          ],
          "properties": {
            "lastUsedAt": {
              "format": "date-time",
              "description": "When the key last authorized a batch.",
              "type": [
                "string",
                "null"
              ]
            },
            "lastUsedOrigin": {
              "description": "The `Origin` of that request. Null when none was sent, as server-side secret key calls usually do.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "secret": {
          "description": "Null values mean the key has not been used since it was created or rotated.",
          "type": "object",
          "required": [
            "lastUsedAt",
            "lastUsedOrigin"
          ],
          "properties": {
            "lastUsedAt": {
              "format": "date-time",
              "description": "When the key last authorized a batch.",
              "type": [
                "string",
                "null"
              ]
            },
            "lastUsedOrigin": {
              "description": "The `Origin` of that request. Null when none was sent, as server-side secret key calls usually do.",
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      }
    }
  }
}
```

### 400, 401, 403, 404, 409, 500, 503

The error envelope every failed request answers with.

Body: `#/components/schemas/ApiError`.

## Schemas

### ApiError

`#/components/schemas/ApiError`

```json
{
  "description": "The error envelope every failed request answers with.",
  "examples": [
    {
      "error": {
        "code": "NOT_FOUND",
        "message": "Project not found",
        "requestId": "req_01J8ZB4K2P",
        "docs": "https://api.analytics.remcostoeten.nl/v2/openapi#errors/NOT_FOUND"
      }
    }
  ],
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "code",
        "message",
        "requestId",
        "docs"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "VALIDATION_FAILED",
            "UNAUTHORIZED",
            "AUTH_REQUIRED",
            "FORBIDDEN_ORIGIN",
            "ORIGIN_NOT_ALLOWED",
            "FORBIDDEN",
            "WIDGET_REPORTS_DISABLED",
            "NOT_FOUND",
            "CONFLICT",
            "PAYLOAD_TOO_LARGE",
            "RATE_LIMITED",
            "INTERNAL",
            "UNAVAILABLE"
          ],
          "description": "- `VALIDATION_FAILED` (400): Body, query or path fails the schema; details lists each field.\n- `UNAUTHORIZED` (401): No or invalid session, token or key.\n- `AUTH_REQUIRED` (401): The widget bootstrap was called without a signed-in session cookie.\n- `FORBIDDEN_ORIGIN` (403): The public key was used from an origin that is not in the project's allowed origins.\n- `ORIGIN_NOT_ALLOWED` (403): The widget bootstrap's Origin is not in any project's allowed origins.\n- `FORBIDDEN` (403): The token scope or the signed-in member's role does not allow the action, or the debug console was opened while the project's debugConsole switch is off.\n- `WIDGET_REPORTS_DISABLED` (403): SDK client reports were sent to a project whose widgetReports switch is off.\n- `NOT_FOUND` (404): Unknown route, project, visitor or session, or a private project without access.\n- `CONFLICT` (409): A project with this id already exists.\n- `PAYLOAD_TOO_LARGE` (413): The ingest body is over 60 KB or has more than 50 events, or a client report body is over 16 KB.\n- `RATE_LIMITED` (429): The per-IP-hash limit was hit; wait for the Retry-After header.\n- `INTERNAL` (500): Unexpected failure; the message never includes internals.\n- `UNAVAILABLE` (503): The database is unreachable, or a feature the route needs is not configured: a job's store, alerts, CRUX_API_KEY, SMTP or Resend; ingest clients retry."
        },
        "message": {
          "minLength": 1,
          "description": "What went wrong, for people. Never includes internals.",
          "type": "string"
        },
        "details": {
          "description": "Extra context for some codes: `fields` with each failed `path` and `message` for `VALIDATION_FAILED`, `retryAfterSeconds` for `RATE_LIMITED`.",
          "type": "object",
          "patternProperties": {
            "^(.*)$": {}
          }
        },
        "requestId": {
          "minLength": 1,
          "description": "The `X-Request-Id` the request sent, or a new `req_<uuid>`; also returned as the `X-Request-Id` header.",
          "type": "string"
        },
        "docs": {
          "format": "uri",
          "description": "Link to this error code in the API reference.",
          "type": "string"
        }
      }
    }
  },
  "$id": "#/components/schemas/ApiError"
}
```
