# Server endpoints

These endpoints describe the server itself: whether it is up, what it allows,
who is signed in, whether a newer version exists, and what it has logged.
Settings and profiles are on
[Settings and profiles endpoints](https://mirli.app/docs/api-settings/index.md).

Each endpoint lists the errors it returns itself. Any endpoint can also return
the [common errors](https://mirli.app/docs/api-errors/index.md#common-errors).

## Get health

`GET /api/health`

Returns the version, the backend device, the loaded model and the queue
length. This endpoint takes no parameters and needs no access token.

This request reads the server's health:

```bash
curl http://127.0.0.1:17494/api/health
```

A successful response is `200 OK` with the health report:

```json
{
  "status": "ok",
  "version": "0.6.4",
  "device": "cuda",
  "gpu_name": "NVIDIA GeForce RTX 3080",
  "vram_total_mb": 10240,
  "vram_free_mb": 9800,
  "loaded_model": "audiocpp-stable-audio-3-sfx",
  "queue_length": 0
}
```

| Field | Type | Description |
|---|---|---|
| `status` | string | Always `ok` |
| `version` | string | The server's version |
| `device` | string | The audio.cpp backend: `cuda`, `metal` or `cpu`, from the same detection the model runner uses, or the value of `MIRLI_AUDIOCPP_BACKEND` when set |
| `gpu_name`, `vram_total_mb`, `vram_free_mb` | string or null, integer or null | The first GPU in `CUDA_VISIBLE_DEVICES`, or GPU 0 when that is unset, read from `nvidia-smi`. `null` without `nvidia-smi` (Metal, AMD, Intel, CPU) and when the `gpu_status` capability is off |
| `loaded_model` | string or null | The model id in memory, or `null` |
| `queue_length` | integer | Jobs waiting in the queue |

This endpoint returns only the common errors.

## Get capabilities

`GET /api/capabilities`

Returns what this server lets its user do. The app shows only what is
allowed, and the server refuses the rest. This endpoint takes no parameters.

This request reads the capabilities:

```bash
curl http://127.0.0.1:17494/api/capabilities
```

A successful response is `200 OK` with the capabilities. On a desktop with the
full setup every flag is `true`:

```json
{
  "sandboxed": false,
  "settings_locked": [],
  "filesystem": true,
  "reveal": true,
  "downloads": true,
  "local_models": true,
  "custom_endpoints": true,
  "updates": true,
  "gpu_status": true,
  "agent_connect": true,
  "skills_install": true,
  "logs": true,
  "setup_wizard": true,
  "setup": "full",
  "setup_locked": false
}
```

| Field | Type | Description |
|---|---|---|
| `filesystem` | boolean | Browse folders, set folder paths, see where a profile's data lives, and create or delete profiles |
| `reveal` | boolean | Show a sound's file in the system file manager |
| `downloads` | boolean | Download model weights, engines and sample packs |
| `local_models` | boolean | Run models on this machine. Off: only models that run elsewhere |
| `custom_endpoints` | boolean | Add and edit custom endpoints |
| `updates` | boolean | The daily update check and the update notice |
| `gpu_status` | boolean | Report this machine's GPU and memory |
| `agent_connect` | boolean | Hand out an MCP endpoint and stdio command |
| `skills_install` | boolean | Install the bundled agent skills on this machine |
| `logs` | boolean | Read the server's log |
| `setup_wizard` | boolean | The first-run setup dialog |
| `sandboxed` | boolean | `true` when the server runs with `MIRLI_SANDBOXED=1` |
| `settings_locked` | string[] | Settings that need a capability the server has turned off (a path on the host, a local engine, or a URL the server would fetch). [Update settings](https://mirli.app/docs/api-settings/index.md#update-settings) ignores them |
| `setup` | string | `full` (models on this machine plus any from elsewhere) or `simple` (only models that run elsewhere) |
| `setup_locked` | boolean | `true` when the server cannot run models itself, which makes `setup` always `simple` |

The flags change with how the server runs:

- With `MIRLI_SANDBOXED=1`, every flag is `false`.
- `MIRLI_DISABLE` turns off single flags, for example
  `MIRLI_DISABLE=reveal,updates`.
- A profile on the simple setup has `downloads` and `gpu_status` off, and
  `local_models` off unless the profile keeps its installed models
  (`setup_include_local`).

A request to an endpoint that a flag turns off gets `403` with
`{"detail": "This server doesn't allow that."}`. The capabilities are read
per request, so switching the setup changes what is allowed at once. See
[Sandboxed mode](https://mirli.app/docs/install-access/index.md#sandboxed-mode).

This endpoint returns only the common errors.

## Get sign-in status

`GET /api/auth/status`

Says whether the server needs an access token and whether this request
carries a valid one. This endpoint takes no parameters and needs no access
token. A wrong token or stale cookie sent with it counts as a wrong guess.

This request reads the sign-in status:

```bash
curl http://127.0.0.1:17494/api/auth/status
```

A successful response is `200 OK` with the status. Without `MIRLI_API_TOKEN`,
`required` is `false` and `signed_in` is `true`:

```json
{
  "required": true,
  "signed_in": false
}
```

| Status | Cause |
|---|---|
| `429` | This address sent 30 wrong access tokens in ten minutes. The response carries `Retry-After` in seconds |

## Sign in

`POST /api/auth/login`

Exchanges the access token for a session cookie. This endpoint needs no
access token. Without `MIRLI_API_TOKEN` it does nothing and answers `204`.

| Name | Type | Required | Description |
|---|---|---|---|
| `token` | string | Yes | The server's access token. Surrounding spaces are ignored |

This request signs in:

```bash
curl -X POST "http://127.0.0.1:17494/api/auth/login" \
  -H 'Content-Type: application/json' \
  -d '{"token": "<TOKEN>"}'
```

A successful response is `204 No Content` with a `Set-Cookie` header for the
`soundbox_session` cookie: `Path=/`, `HttpOnly`, `SameSite=Strict`, a 30-day
`Max-Age`, and `Secure` when the request arrived over HTTPS (directly or with
`X-Forwarded-Proto: https`). The cookie holds an HMAC of the token, not the
token, so changing the token signs every browser out.

| Status | Cause |
|---|---|
| `401` | The token is wrong. `detail` is `That is not this Mirli's access token.` The attempt counts as a wrong guess |
| `429` | This address sent 30 wrong access tokens in ten minutes. The response carries `Retry-After` in seconds, and a right token is refused too until the window ends |

## Sign out

`POST /api/auth/logout`

Clears the session cookie. This endpoint takes no parameters and needs no
access token.

This request signs out:

```bash
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/auth/logout"
```

A successful response is `204 No Content` with a `Set-Cookie` header that
expires the cookie.

This endpoint returns only the common errors.

## Get update status

`GET /api/update`

Returns what the daily update check last learned. This endpoint takes no
parameters.

This request reads the update status:

```bash
curl http://127.0.0.1:17494/api/update
```

A successful response is `200 OK` with the update status:

```json
{
  "enabled": true,
  "disabled_by": null,
  "current": "0.6.4",
  "latest": "0.7.0",
  "available": true,
  "url": "https://github.com/HamSanders/soundbox/releases/tag/v0.7.0",
  "checked_at": "2026-11-29T09:12:44.000Z",
  "stars": 1284,
  "endpoint": "https://mirli.app/api/update",
  "error": null
}
```

| Field | Type | Description |
|---|---|---|
| `enabled` | boolean | Whether a check will happen |
| `disabled_by` | string or null | `env` when `MIRLI_UPDATE_CHECK=0` turned it off, `setting` when the `update_check` setting did, else `null` |
| `current` | string | The running version |
| `latest` | string or null | The newest published version, from the last answer |
| `available` | boolean | `true` when `latest` is newer than `current`. Always `false` while the check is off |
| `url` | string or null | The release page for `latest`. `null` while the check is off |
| `checked_at` | string or null | ISO 8601 time of the last answer |
| `stars` | number or null | The repository's GitHub star count, refreshed every 15 minutes from `/api/stars` while the check is on. `null` while the check is off or before the first answer |
| `endpoint` | string | The address asked: `https://mirli.app/api/update`, or `MIRLI_UPDATE_URL` when set |
| `error` | string or null | Why the last check failed |

This endpoint returns only the common errors.

## Check for updates

`POST /api/update/check`

Asks the update endpoint now, like **Check now** in Settings. The request
carries only the version and the platform. When the check is off, nothing is
sent and the current status comes back. A failed check is reported in
`error`, not as an HTTP error. This endpoint takes no parameters.

This request checks for a newer version:

```bash
curl -X POST -H 'X-Soundbox: 1' \
  "http://127.0.0.1:17494/api/update/check"
```

A successful response is `200 OK` with the
[update status](#get-update-status).

| Status | Cause |
|---|---|
| `403` | The server's capabilities turn `updates` off |

## Get logs

`GET /api/logs`

Returns the last lines of the server's log file, oldest first. The file is
`<DATA_DIR>/soundbox-<PORT>.log`; see
[Find the server log](https://mirli.app/docs/install-troubleshooting/index.md#find-the-server-log). With
no log file the list is empty.

| Name | Type | Required | Description |
|---|---|---|---|
| `?lines` | integer | No | 1 to 5,000. Default 200 |

This request reads the last 50 lines:

```bash
curl "http://127.0.0.1:17494/api/logs?lines=50"
```

A successful response is `200 OK` with the lines. The example is abridged:

```jsonc
{
  "lines": [
    "09:12:44 INFO    mirli.update: update check: running 0.6.4"
    // ...more lines
  ]
}
```

| Status | Cause |
|---|---|
| `403` | The server's capabilities turn `logs` off |
| `422` | `lines` is not an integer from 1 to 5,000 |
