# Create a New API Key

> Mint a new WorkOS-managed sk_* key + INSERT canonical mirror row.

POST /api/v1/connect-keys

Mint a new WorkOS-managed `sk_*` key + INSERT canonical mirror row.

Body shape — all fields optional except `name`::

{ "name": "label string", # required "permissions": ["topics:read"], # optional, default [] "workspace_id": "<uuid>", # optional, pins key to a workspace "rate_limit_per_minute": 60, # optional, per-key override "description": "free text" # optional }

Mirror INSERT is part of the success contract — if it fails, we rollback by deleting the just-created WorkOS key. The caller never sees a key that exists in WorkOS but not in our mirror.

Response includes the full `value` (sk_…) **once** — caller MUST surface it to the developer and never store it. WorkOS will not return it again. Response also includes the full merged shape (mirror fields populated with whatever the body set).

`expires_in_days` (optional): when present and > 0 the mirror row's `expires_at` is stamped `now() + N days` so the reaper revokes the key on schedule. Omit (or 0/null) for a **non-expiring** key — the product surface's "permanent" / permakey-style key. `expires_at IS NULL` is the reaper's untouched state.

Returns

Successful Response

[Previous ← Get a Single API Key](https://heyarchie.com/en-gb/developers/api-reference/connect-keys/get-a-single-api-key/)[Next Rotate an API Key →](https://heyarchie.com/en-gb/developers/api-reference/connect-keys/rotate-an-api-key/)

```
curl https://uk.heyarchie.com/api/v1/connect-keys \
  -X POST \
  -H "Authorization: Bearer sk_..."
```

```
import requests

headers = {"Authorization": "Bearer sk_..."}

r = requests.post("https://uk.heyarchie.com/api/v1/connect-keys", headers=headers)
print(r.json())
```

```
const r = await fetch("https://uk.heyarchie.com/api/v1/connect-keys", {
  method: "POST",
  headers: { "Authorization": "Bearer sk_..." },
});
const data = await r.json();
console.log(data);
```

Response

Every response also carries X-Request-ID. Quote it if you write to us about a call.
