---
title: "Create API Key"
method: POST
path: "/public/v1/workspaces/{workspace_id}/api-keys"
tags: ["User and Workspace management"]
---

# Create API Key

`POST /public/v1/workspaces/{workspace_id}/api-keys`

Generate a new API key for the workspace.
Check out [API Key Authentication article](https://developers.pandadoc.com/reference/api-key-authentication-process) for detailed API Keys description.

> 📘 
> - Only an **Org Admin** can generate an API keys.
> - To make another user a key's owner, pass `user_id` of this user. The user should has an **Admin** role in the workspace.
> - Generating a new key invalidates existing key with the same type. Using this request, you can deactivate the key you're using for the request.

## Path parameters

- `workspace_id` string, required

## Request body

- CreateApiKeyRequest
  - `user_id` string
  - `type` 'production' | 'sandbox', required — A type of API key.

## Response `200`

OK

- CreateApiKeyResponse
  - `user_id` string — A unique identifier of the user.
  - `type` 'production' | 'sandbox' — A type of API key.
  - `workspace_id` string — A unique identifier of the workspace.
  - `key` string — A New Public API key.

## Other responses

- `400` — Bad Request
- `401` — Authentication error
- `403` — Permission error
- `429` — Too Many Requests

---

[API](https://skmtc.net/pandadoc/apis/pandadoc-public-api.md) · [All operations](https://skmtc.net/pandadoc/apis/pandadoc-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pandadoc/pandadoc-public-api/versions/0c2b70be3fb0/schema)
