PostZen
API Keys

Create an API key

POST
/v1/api-keys

Creates an API key and returns the full key value exactly once. This endpoint requires a read-write API key with access to all profiles; profile-scoped keys receive a 403. Store the returned key securely — it cannot be retrieved again after this response.

Authorization

bearerAuth
AuthorizationBearer <token>

PostZen API key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/api-keys" \  -H "Content-Type: application/json" \  -d '{    "name": "Production key",    "scope": "full",    "permission": "read-write"  }'
{  "message": "API key created successfully",  "apiKey": {    "id": "jk91m3xw7ktr5v2n8q4zs0b6hf1yg3pd",    "name": "Production key",    "keyPreview": "pzn_live_3f8c1b7d4...",    "createdAt": "2026-07-23T16:00:00.000Z",    "lastUsedAt": null,    "scope": "full",    "profileIds": [],    "permission": "read-write",    "key": "pzn_live_3f8c1b7d4e90a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8091a2b3c4d5e6f770"  }}
{  "error": "JSON body is required"}
{  "error": "Unauthorized"}
{  "error": "API key requires read_write permission"}
{  "error": "Failed to create post"}