# Keys API

The Uptizm API has 2 endpoints on this resource, one section each.

## Get a claim url for an anonymous workspace

`POST /claim-code`

Replaces the calling anonymous key's claim code and returns `claim_url` plus `claim_expires_at`. Hand the url to a human: opening it while signed in makes the temporary workspace a permanent team. Only anonymous keys carry `claim:create`. Any earlier claim url stops working.

- URL: `https://api.uptizm.com/v1/claim-code`
- Auth: `Authorization: Bearer upz_...`
- Required ability (`x-required-ability`): `claim:create`
- Tag: Keys
- operationId: `v1.claim-code.store`

### Response 200

Content type: `application/json`.

- `data` (object, required)
  - `claim_url` (string, required)
  - `claim_expires_at` (string, required)

### Errors

- 401: Unauthenticated
- 403: The key lacks the ability this endpoint requires (`required_ability` names it), or the action is not allowed for the team.
- 409: Conflict
- 429: Rate limited. Each key may make 120 reads (GET) and 30 writes per minute; wait for `Retry-After` seconds.

Error bodies: https://uptizm.com/docs/errors.md. Rate limits: https://uptizm.com/docs/rate-limits.md. Idempotency: https://uptizm.com/docs/idempotency.md

## Describe the calling key

`GET /me`

Returns the key's team, the team's plan and limits, and the key itself (name, abilities, expiry, kind). Any valid key may call it, whatever abilities it carries; use it to check a key works and what it can do.

- URL: `https://api.uptizm.com/v1/me`
- Auth: `Authorization: Bearer upz_...`
- Required ability (`x-required-ability`): `self` (any valid key)
- Tag: Keys
- operationId: `v1.me`

### Response 200

Content type: `application/json`.

- `data` (object, required)
  - `team` (object, required)
    - `id` (string, required)
    - `name` (string, required)
  - `plan` (string, one of `"anonymous"`, `"free"`, `"starter"`, `"pro"`, `"enterprise"`, required)
  - `limits` (object, required)
  - `key` (object or null, required)
    - `name` (string, required)
    - `abilities` (string, required)
    - `expires_at` (string or null, required)
    - `kind` (string, one of `"team"`, `"anonymous"`, required)

### Errors

- 401: Unauthenticated
- 403: The key lacks the ability this endpoint requires (`required_ability` names it), or the action is not allowed for the team.
- 404: Not found
- 429: Rate limited. Each key may make 120 reads (GET) and 30 writes per minute; wait for `Retry-After` seconds.

Error bodies: https://uptizm.com/docs/errors.md. Rate limits: https://uptizm.com/docs/rate-limits.md. Idempotency: https://uptizm.com/docs/idempotency.md
