---
title: "Create Project API Key"
method: POST
path: "/v1/projects/{projectId}/api-keys"
tags: ["Project API Keys"]
---

# Create Project API Key

`POST /v1/projects/{projectId}/api-keys`

## Request

- Base URL: `https://api.confident-ai.com`
- URL: `https://api.confident-ai.com/v1/projects/{projectId}/api-keys`
- Auth: none declared
- TypeScript: <https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/docs/v1/projects/:projectId/api-keys/post.ts> (a function with typed inputs; its response is checked against the schema)

Mints a new project-scoped API key. The raw `value` is returned **exactly once** in this response and can never be retrieved again — store it securely. This is the key your application uses to send traces and run evaluations against the project.

## Path parameters

- `projectId` string, required

## Request body

- CreateApiKey
  - `name` string, required: Human-readable label for the API key

## Response `200`

- ApiKeyResponse
  - `success` boolean, required: Indicates if the request was successful
  - `data` object, required
    - `apiKey` ApiKey
      - `id` integer, required: Unique identifier for the API key
      - `name` string, nullable: Human-readable label for the API key
      - `valid` boolean, required: Whether the key is active. A deactivated key is rejected on authentication.
      - `value` string, required: The API key value. This is redacted (only the last 6 characters are shown, prefixed with asterisks) on every response **except** the create response, where the full value is returned exactly once.
      - `created_at` string, date-time, required: ISO 8601 timestamp of when the key was created
      - `lastUsed` string, date-time, nullable: ISO 8601 timestamp of when the key was last used to authenticate, or `null` if never used

## Changes

> 54 revisions in range; 3 not diffed.

- **2026-05-31** `173563ada468`: 2 info
  - api tag `Project API Keys` added
  - api tag `API Keys` removed
- **2026-05-31** `78a7dd1b6b48`: 1 info
  - endpoint added
- **2026-05-31** `d493eef38a58`: 1 breaking
  - api path removed without deprecation
- **2026-05-31** `78a7dd1b6b48`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/changes/v1/projects/:projectId/api-keys/post.md)

---

[API](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api.md) - [All operations](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/revisions/95cdde71b65e?raw)
