# Create a key

> Each user can hold at most 10 active keys; creating an 11th (without revoking one first) returns 400 with error.code badrequest, error.message toomanykeys and…

Source: https://warmerly.com/docs/keys/create-a-key

```text
POST /keys
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string (1-120 chars) | Yes | A label to help you identify the key later. |
| `rateLimitPerMin` | integer (1-120) | No | Requests per minute allowed for this key. Defaults to `60`, capped at `120` regardless of plan. |

Each user can hold at most **10 active keys**; creating an 11th (without revoking one first) returns `400` with `error.code` `bad_request`, `error.message` `too_many_keys` and `error.details` `{ "max": 10 }`.

```bash
curl -X POST https://app.warmerly.com/api/v1/keys \
  -H "X-Api-Key: wmv_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "name": "CI pipeline", "rateLimitPerMin": 100 }'
```

```json
{
  "key": "wmv_7f3a2cdb9e1a4f0c8b6d2e5f7a1c3b9d",
  "id": "3b1f6e2a-9c4d-4e2a-8b5f-6a2c1d9e0f7b",
  "prefix": "wmv_7f3a2c",
  "name": "CI pipeline"
}
```

**The `key` field is the only time the raw secret is ever returned.** Warmerly stores only a hash of the key, copy it and store it securely immediately. If you lose it, there is no way to recover it; revoke the key and create a new one instead.

A response with HTTP status `201` confirms the key was created.

## Validation errors

An invalid body (missing `name`, `name` over 120 characters, or `rateLimitPerMin` outside `1` to `120`) returns `400`:

```json
{ "error": { "code": "bad_request", "message": "invalid_body", "details": { /* field errors */ } } }
```

## More from API Keys

- [List keys](https://warmerly.com/docs/keys/list-keys): Returns all of your active (non-revoked) keys, newest first. The raw secret is never returned, only the id,…
- [Revoke a key](https://warmerly.com/docs/keys/revoke-a-key): Revokes (soft-deletes) the key. Revoked keys fail authentication immediately on their next request, there is…
