---
title: "Mint a new analytics ingest key."
method: POST
path: "/projects/{project_id}/analytics/ingest-keys"
tags: ["Analytics Ingest Keys"]
---

# Mint a new analytics ingest key.

`POST /projects/{project_id}/analytics/ingest-keys`

## 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`
- Auth: HTTP bearer

The returned `public_key` is **not a secret**: it is designed to be embedded
in client-side JavaScript and sent as `X-Temps-Analytics-Key` or
`?temps_key=`. It is returned in full here and on every subsequent read, so
an operator can copy it at any time; there is no "reveal" step because there
is nothing to conceal.

## Path parameters

- `project_id` integer, required

## Request body

- CreateAnalyticsIngestKeyRequest: Request body for minting a new ingest key.
  - `allowed_origins` string[], nullable: Exact origins permitted to use this key from a browser. Omit or send an empty array to allow any origin.
  - `environment_id` integer, nullable: Scope the key to a single environment. Recommended: it lets Temps attribute ingested data to that environment's current deployment. Omit for a project-wide key.
  - `name` string, nullable: Operator-facing label. Defaults to "Default ingest key".
  - `rate_limit_per_minute` integer, nullable: Requests per minute for this key. Omit for the 600/min default; send a non-positive value for unlimited.

## Response `201`

Ingest key created

- 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`: Project or environment not found
- `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/post.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)
