---
title: "Update an ingest key's label, origin allowlist, or rate limit."
method: PATCH
path: "/projects/{project_id}/analytics/ingest-keys/{key_id}"
tags: ["Analytics Ingest Keys"]
---

# Update an ingest key's label, origin allowlist, or rate limit.

`PATCH /projects/{project_id}/analytics/ingest-keys/{key_id}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/analytics/ingest-keys/{key_id}`
- Auth: HTTP bearer

`allowed_origins` and `rate_limit_per_minute` are three-state: omit to leave
unchanged, send `null` to clear, send a value to replace. Clearing
`allowed_origins` allows any origin; clearing `rate_limit_per_minute`
removes the limit.

## Path parameters

- `project_id` integer, required
- `key_id` integer, required

## Request body

- UpdateAnalyticsIngestKeyRequest: Request body for a partial update. `allowed_origins` and `rate_limit_per_minute` use the three-state double-`Option` encoding: field absent = leave unchanged, explicit `null` = clear, value = set. Plain `Option<Option<T>>` alone cannot express this because serde collapses an explicit JSON `null` into the outer `None`.
  - `allowed_origins` string[], nullable: Absent = unchanged, `null` = clear (any origin allowed), array = replace.
  - `name` string, nullable: New operator-facing label. Absent leaves it unchanged. The column is `NOT NULL`, so there is no "clear" state — send a new label instead.
  - `rate_limit_per_minute` integer, nullable: Absent = unchanged, `null` = clear (unlimited), value = replace.

## Response `200`

Ingest key updated

- AnalyticsIngestKey: An analytics ingest key as returned by the admin API. `public_key` is present in full on every response — see the module docs.
  - `allowed_origins` string[], nullable: Exact origins (`scheme://host[:port]`) permitted to use this key from a browser. `None` or `[]` means any origin. This is a browser-enforced convenience control, not authentication — a non-browser client ignores `Origin` entirely.
  - `created_at` string, date-time, required
  - `created_by_user_id` integer, nullable
  - `environment_id` integer, nullable: `None` means the key is scoped to the whole project. An environment-scoped key additionally attributes ingested data to that environment's current deployment, when it has one.
  - `event_count` integer, required
  - `id` integer, required
  - `is_active` boolean, required
  - `last_used_at` string, date-time, nullable
  - `name` string, required: Operator-facing label.
  - `project_id` integer, required
  - `public_key` string, required: The ingest key itself, `pa_` + 64 hex characters. **Not a secret.** It is designed to ship in client-side JavaScript and is returned unmasked so operators can copy it. See the module docs.
  - `rate_limit_per_minute` integer, nullable: `None` or `<= 0` means unlimited.
  - `revoked_at` string, date-time, nullable
  - `updated_at` string, date-time, required

## Other responses

- `400`: Validation error
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Ingest key not found in this project
- `500`: Internal server error

## Changes

- **2026-09-07** `c2a1f69745e7`: 1 info
  - endpoint added
- **2026-09-07** `7a3103561bd0`: 1 breaking
  - api path removed without deprecation
- **2026-09-07** `7fcff272f099`: 1 info
  - endpoint added
- **2026-09-07** `c1fa498b6377`: 1 breaking
  - api path removed without deprecation
- **2026-09-07** `c43de0e360be`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/analytics/ingest-keys/:key_id/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
