---
title: "Create API key"
canonical_url: https://docs.zvid.io/docs/endpoints/create-api-key/
source: docs/endpoints/create-api-key.api.mdx
content_revision: 6338386a1dd87e4a
---

# Create API key

`POST /api/api-keys`

Generate a new API key for the authenticated user

## Authentication

- Option 1: `x-api-key: YOUR_API_KEY` (header). API key for authentication. Create one in your dashboard.
- Option 2: `Authorization: Bearer YOUR_ACCESS_TOKEN`. Dashboard JWT in Authorization: Bearer &lt;token>, only on operations that explicitly list this scheme. Prefer x-api-key for REST integrations. OAuth for hosted MCP is a separate connection at https://mcp.zvid.io/mcp.

Create API keys at [app.zvid.io/api-keys](https://app.zvid.io/api-keys). Keep credentials on your server.

## Parameters

This operation has no path, query, or additional header parameters.

## Request

The shell examples read credentials from `ZVID_API_KEY` (or `ZVID_ACCESS_TOKEN` for Bearer authentication). Set that variable in your environment. Replace sample project, template, job, and asset identifiers with values from your own account.

A request body is required.


### application/json

Required properties: `name`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `body.name` | string | Yes | Name for the API key Minimum length: `1`. Maximum length: `100`. |


### Request example: Example


```bash
curl --request POST 'https://api.zvid.io/api/api-keys' \
  --header "x-api-key: $ZVID_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Production automation"
}'
```

## Responses


### HTTP 201

API key created successfully

Content type: `application/json`.

Unknown properties are rejected. Required properties: `id`, `apiKey`, `name`, `keyPrefix`, `created`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `response.id` | integer | Yes |  |
| `response.apiKey` | string | Yes | Full API key (only shown once) |
| `response.name` | string | Yes |  |
| `response.keyPrefix` | string | Yes | Stored prefix derived from the key |
| `response.created` | boolean | Yes |  |


**Example response**

```json
{
  "id": 789,
  "apiKey": "zvid_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
  "name": "Production API Key",
  "keyPrefix": "zvid_d3f4a1b2c3d",
  "created": true
}
```

### HTTP 400

Validation error or business error (e.g. duplicate name)

Content type: `application/json`.

Exactly one of the listed alternatives must match.

**oneOf alternative 1**

Schema: [ValidationError](#schema-validation-error).

**oneOf alternative 2**

Schema: [Error](#schema-error).


### HTTP 401

Unauthorized

Content type: `application/json`.

Unknown properties are rejected. Required properties: `error`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `response.error` | string | Yes | Error type |
| `response.message` | string | No | Human-readable error message |


## Schema definitions

The following definitions describe the fields referenced above. Expand a definition to inspect its complete contract.


### schema api key created

**ApiKeyCreated**


Unknown properties are rejected. Required properties: `id`, `apiKey`, `name`, `keyPrefix`, `created`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `ApiKeyCreated.id` | integer | Yes |  |
| `ApiKeyCreated.apiKey` | string | Yes | Full API key (only shown once) |
| `ApiKeyCreated.name` | string | Yes |  |
| `ApiKeyCreated.keyPrefix` | string | Yes | Stored prefix derived from the key |
| `ApiKeyCreated.created` | boolean | Yes |  |


### schema validation error

**ValidationError**


Required properties: `error`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `ValidationError.error` | string | Yes |  |
| `ValidationError.message` | string | No |  |
| `ValidationError.details` | array of object | No |  |
| `ValidationError.planLimits` | object | No | Present on render validation errors; contains the authenticated user's current render limits. |

**Nested field: `ValidationError.details`**

**Array item: `ValidationError.details[]`**

Unknown properties are rejected. Required properties: `field`, `message`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `ValidationError.details[].field` | string | Yes |  |
| `ValidationError.details[].message` | string | Yes |  |


### schema error

**Error**


Required properties: `error`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `Error.error` | string | Yes | Error type |
| `Error.message` | string | No | Human-readable error message |


### schema authentication error

**AuthenticationError**


Unknown properties are rejected. Required properties: `error`.

| Field | Type | Required | Description and constraints |
| --- | --- | --- | --- |
| `AuthenticationError.error` | string | Yes | Error type |
| `AuthenticationError.message` | string | No | Human-readable error message |


## Related resources

- [OpenAPI specification](https://docs.zvid.io/openapi.yaml)
- [Project payload schema](https://docs.zvid.io/schemas/render-payload.schema.json)
- [Quick Start](https://docs.zvid.io/docs/quick-start/)
- [Authentication guide](https://docs.zvid.io/docs/authentication/)
