---
title: "Create an API key"
description: "Requires a verified session and current workspace membership; metadata roles never authorize key access. Existing key ownership and operation checks remain in force. Refuses (400 USE_AI_CONNECTORS_SETTINGS) any permissions object containing \"mcp\"; AI connector keys are created only under /api/workspaces/{workspaceId}/ai-connectors/integration-keys."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Workspaces

`POST /api/api-keys`

Requires a verified session and current workspace membership; metadata roles never authorize key access. Existing key ownership and operation checks remain in force. Refuses (400 USE_AI_CONNECTORS_SETTINGS) any permissions object containing "mcp"; AI connector keys are created only under /api/workspaces/{workspaceId}/ai-connectors/integration-keys.

## Authentication

- `BearerAuth`, http, header `Authorization`, format `JWT`

## Header parameters

- `X-Workspace-Id` (`post/api/api-keys.header.X-Workspace-Id`; string, optional)

## Example request

```json
{}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{}'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/api-keys';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/api-keys"

payload = {}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Operation completed

### 201

Key created

### 400

Invalid input or workspace missing

### 401

Verified session required

### 403

Membership or key authority denied

### 404

Key not found

### 503

Authority verification unavailable


Source: https://developer.channelautomations.com/api/post-api-api-keys/index.md
