# Overview

Authentication, the response envelope and error codes.

The API is JSON over HTTPS. Every endpoint lives under one base address.

```text
https://api.ultanimus.com/v1
```

The [API reference](https://api.ultanimus.com/v1/reference) lists every endpoint with its fields and answers, and sends a test request with your key. Code generators and tools like Postman can import `https://api.ultanimus.com/v1/openapi.json`.

## Authentication

Send an API key as a bearer token. Create keys under **Integrations → API keys** in your organization settings, tick the permissions each one needs, and keep them on your server.

```text
Authorization: Bearer YOUR_API_KEY
```

### Check a key

`GET https://api.ultanimus.com/v1/key`

Answers with the key's name, permissions and creator, its organization and its plan. Every key can call it, on every plan. `plan.api` is `false` on Glance, where a key can only add sites and send their sitemaps. `ultanimus whoami` in the [CLI](/docs/cli) reads it.

```bash
curl https://api.ultanimus.com/v1/key -H "Authorization: Bearer $API_KEY"
```

```json
{
  "status_code": 200,
  "data": {
    "key": {
      "id": "0b6f1c2e-5a7d-4c1b-9f43-2d8e6a1b7c90",
      "name": "CLI on studio-mac",
      "prefix": "ult_sk_7e3cx",
      "scopes": ["stats:read", "sites:write", "dashboards:write"],
      "via": "cli",
      "created_by": "Ada Lovelace",
      "last_used_at": "2026-10-24T20:34:19Z",
      "created_at": "2026-10-12T09:15:02Z"
    },
    "org": { "slug": "acme", "name": "Acme" },
    "plan": { "key": "insight", "name": "Insight", "api": true }
  },
  "message": "OK"
}
```

## Responses

Every answer is a JSON envelope. A success carries `data`.

```json
{
  "status_code": 200,
  "data": {},
  "message": "OK"
}
```

A failure carries a code, a message written for people, and a request ID to quote if you contact us.

```json
{
  "status_code": 422,
  "error": "ULT-1900",
  "message": "Some fields need your attention.",
  "request_id": "YOUR_REQUEST_ID",
  "validation_errors": [{ "field": "name", "message": "Name the event, like signup." }]
}
```

Codes never change meaning once they ship, so you can branch on `error`. Show `message` to people as it is.

## Errors

| Status | Code | When |
|---|---|---|
| 401 | `ULT-1220` | The API key is missing, wrong or revoked. |
| 403 | `ULT-1203` | The organization's plan does not include API access. |
| 403 | `ULT-1219` | The organization is suspended. An owner can read why in the dashboard. |
| 403 | `ULT-1221` | The key lacks the permission the call needs. |
| 404 | `ULT-1210` | The site is not in the key's organization. |
| 404 | `ULT-1901` | The address does not exist. |
| 413 | `ULT-1904` | The body is too large. |
| 422 | `ULT-1900` | A field failed a check. `validation_errors` says which. |
| 429 | `ULT-1902` | Too many requests. Wait a moment, then retry. |
| 500 | `ULT-9000` | Something failed on our side. Retry, and quote the request ID if it keeps happening. |
| 503 | `ULT-9003` | A service is unavailable right now. Retry with backoff. |
| 504 | `ULT-9001` | The request took too long. Retry, or ask for less data. |

## Rate limits

Requests are rate limited. A limited request gets `429` with `ULT-1902`; wait a moment and send it again, backing off if it repeats.
