# Issue a workspace master key

**`POST https://myagentmail.com/v1/workspaces/{id}/keys`**

Group: Workspaces
Operation ID: `createWorkspaceKey`

Returns a `wk_...` key scoped to this workspace. The key is only shown in the response body — store it securely.

## Path parameters

- `id` (string, required) — Workspace UUID

## Request body

Content-Type: `application/json`

```json
{
  "name": "string"
}
```

## Responses

### 201 — Created

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "key": "wk_REDACTED_EXAMPLE_KEY_DO_NOT_USE",
  "prefix": "wk_REDACT",
  "name": "string",
  "workspaceId": "00000000-0000-0000-0000-000000000000",
  "createdAt": "2026-05-01T08:11:44.619Z"
}
```

## Code samples

### TypeScript

```typescript
import { MyAgentMail } from "myagentmail";

const client = new MyAgentMail({ apiKey: process.env.MYAGENTMAIL_API_KEY! });

// POST /v1/workspaces/{id}/keys
const result = await client.request("post", "/v1/workspaces/{id}/keys", { params: { id: "00000000-0000-0000-0000-000000000000" } }, { body: {
  "name": "string"
} });
```

### curl

```bash
curl -X POST 'https://myagentmail.com/v1/workspaces/00000000-0000-0000-0000-000000000000/keys' \
  -H 'X-API-Key: $MYAGENTMAIL_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```

### Python

```python
import os, requests

r = requests.post(
    "https://myagentmail.com/v1/workspaces/00000000-0000-0000-0000-000000000000/keys",
    headers={"X-API-Key": os.environ["MYAGENTMAIL_API_KEY"]},
    json={
        "name": "string"
    },
)
r.raise_for_status()
print(r.json())
```
