---
title: "Mint a workspace key"
description: "A workspace key for one of the organization's workspaces: it reaches only that workspace, can't manage keys, and is revoked with the organization key that minted it. `POST /api/v1/organizations/{id}/workspaces/{workspace_id}/api-keys`"
url: https://www.unitpost.com/docs/platform/post-organizations-id-workspaces-workspace-id-api-keys
section: "Platform API reference"
updated: 2026-11-02
---
# Mint a workspace key

`POST /api/v1/organizations/{id}/workspaces/{workspace_id}/api-keys`

A workspace key for one of the organization's workspaces: it reaches only that workspace, can't manage keys, and is revoked with the organization key that minted it. The secret is returned once. Takes an organization key (`ok_live_…`) with `organizations:write`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The organization's id (`org_…`), from `GET /whoami` or Organization → API. |
| `workspace_id` | path | string | yes | The workspace's id (`ws_…`). |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | — |
| `scope` | enum | no | One of: `full`, `sending`, `read_only`. |

## Response fields (201)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | enum | yes | One of: `api_key`. |
| `id` | string | yes | `key_…` |
| `key` | string | yes | The secret, shown once. |
| `prefix` | string | yes | — |
| `scope` | enum | yes | One of: `full`, `sending`, `read_only`. |
| `capabilities` | string[] | yes | — |
| `workspace_id` | string | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 201 | The key, with its secret. |
| 401 | Missing or invalid organization key (a workspace key is refused). |
| 403 | API access not approved for the organization, the key lacks the capability, or no User-Agent. |
| 404 | Not this key's organization, or not one of its workspaces. |
| 422 | Invalid body. |
| 429 | The organization's rate limit. |

## Example request

```bash
# API: no generated example for POST https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id/api-keys
```

## Example response (201)

```json
{
  "object": "api_key",
  "id": "id_123",
  "key": "string",
  "prefix": "string",
  "scope": "full",
  "capabilities": [
    "string"
  ],
  "workspace_id": "workspace_123"
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/platform/post-organizations-id-workspaces-workspace-id-api-keys
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
