---
title: "Create an API key"
method: POST
path: "/admin/projects/{project_id}/api-keys"
tags: ["API Keys"]
---

# Create an API key

`POST /admin/projects/{project_id}/api-keys`

Create a new API key for a project. Developers can use the API key to authenticate requests to Pinecone's Data Plane and Control Plane APIs.

## Path parameters

- `project_id` string, uuid, required

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- AdminCreateAPIKeyRequest
  - `name` string, required — The name of the API key. The name must be 1-80 characters long.
  - `roles` string[] — The roles to create the API key with. Default is `["ProjectEditor"]`.

## Response `201`

API key created successfully.

- AdminAPIKeyWithSecret — The details of an API key, including the secret. Only returned on API key creation.
  - `key` AdminAPIKey, required — The details of an API key, without the secret.
    - `id` string, uuid, required — The unique ID of the API key.
    - `name` string, required — The name of the API key.
    - `project_id` string, uuid, required — The ID of the project containing the API key.
    - `roles` string[], required — The roles assigned to the API key.
  - `value` string, required — The value to use as an API key. New keys will have the format `"pckey_<public-label>_<unique-key>"`. The entire string should be used when authenticating.

## Other responses

- `400` — Bad request. The request body included invalid request parameters.
- `401` — Unauthorized. Possible causes: Invalid API key.
- `403` — Not enough available quota to complete this operation.
- `500` — Internal server error.
- `4XX` — Unexpected error on request.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/revisions/35876583485d/schema)
