---
title: REST API
description: Reference for the pipedash-web REST API and WebSocket. Covers auth, the cross-origin check, every route by group and curl examples.
---

The `pipedash-web` server exposes every Pipedash operation under `/api/v1` and streams events on `/api/v1/ws`. The web UI calls the same routes. This page lists all of them.

All paths below are relative to `/api/v1`. Request and response bodies use JSON unless noted otherwise. Some successful actions return no body. Log downloads return plain text. Behind a sub-path proxy, the proxy strips the prefix, so the paths stay the same. The [Reverse proxy](/docs/deployment/reverse-proxy) page covers it.

## Authentication

The server holds an API token in memory. At startup it copies the value of `PIPEDASH_VAULT_PASSWORD` into the token. A successful vault open, a first setup with a vault password and a migration with a token password set it as well. The [Token storage](/docs/configuration/token-storage) page covers the rules.

A protected route accepts the vault API token or a paired-device token:

```text
Authorization: Bearer <vault-password-or-device-token>
```

A web server with no API token permits anonymous requests. A sharing desktop requires authentication even without a vault API token.

The comparison with the vault token runs in constant time. A missing or wrong header returns status `401` with no body. Locking the vault or a failed open attempt does not change the token, so the rule stays in force.

Routes for the current device's push registration require a device token. Host-managed routes reject a paired device with `409` and `HOST_MANAGED`.

These paths skip the check:

- **Outside the API:** any path that does not start with `/api/v1/`, such as the embedded frontend.
- **Prefixes:** `/api/v1/health` and `/api/v1/setup`.
- **Exact paths:** `/api/v1/vault/status`, `/api/v1/ws` and `/api/v1/plugins`.
- **Downloads:** `GET /api/v1/downloads/{ticket}`. The single-use ticket replaces the token. Other methods on this path need the header.

### Access levels

The `Auth` column of each table uses these levels:

- **Public:** skips the bearer check.
- **Protected:** accepts the vault API token or a paired-device token. A web server without an API token permits anonymous requests. A desktop host still requires authentication.
- **Operator:** a protected host-managed route. A recognized paired device gets `409` with `HOST_MANAGED`. Desktop sharing also blocks these routes, except the open status routes.
- **Device:** requires a recognized paired-device identity. The vault token gets `403` with `DEVICE_ONLY`.
- **Patch:** protected, with the preference fallback described under [Device notification preferences](#device-notification-preferences).
- **Ticket:** no bearer check. A valid single-use ticket is required.
- **Socket:** no HTTP bearer check. Authentication happens in WebSocket frames.

All write methods and WebSocket upgrades also pass the cross-origin check below unless CORS allows all origins. Demo-mode restrictions apply after authentication.

## Cross-origin requests

The server rejects a `POST`, `PUT`, `PATCH` or `DELETE` request that a browser sends from another origin. It also rejects a WebSocket upgrade from another origin. The answer is status `403`. This keeps other websites from changing an instance through the browser of a user.

A request with `Sec-Fetch-Site` is allowed when the value is `same-origin` or `none`. A request without that header is allowed when `Origin` matches `Host` and the scheme from `X-Forwarded-Proto`. A request without an `Origin` header, such as `curl` or a script, passes. `GET`, `HEAD` and `OPTIONS` requests pass the check.

`PIPEDASH_CORS_ALLOW_ALL=true` or `server.cors_allow_all = true` turns the check off and allows any origin, method and header. The [Reverse proxy](/docs/deployment/reverse-proxy) page covers the setup.

## Errors

Handled errors return a JSON body with `code`, `message` and an optional `details`.

| Status | `code` | Cause |
|---|---|---|
| 400 | `BAD_REQUEST` | Invalid config, provider type or request field |
| 401 | `UNAUTHORIZED` | Vault authentication failed |
| 403 | `PROVIDER_AUTH_FAILED` | The provider rejected the credentials |
| 403 | `FORBIDDEN` | The token lacks a permission |
| 404 | `NOT_FOUND` | Unknown provider, pipeline, subscription, job or log revision |
| 409 | `CONFLICT` | Setup already done |
| 404 | `DEVICE_NOT_FOUND` | No paired device has this id |
| 422 | `PUSH_RELAY_NOT_CONFIGURED` | The server has no push relay |
| 422 | `INVALID_SERVER_URL` | The `server_url` of a pairing request is not a valid address |
| 429 | `RATE_LIMITED` | The push relay refused a test notification |
| 429 | `TOO_MANY_DOWNLOADS` | 32 log downloads are already pending |
| 429 | `TOO_MANY_PAIRING_CODES` | 8 pairing codes are already open |
| 409 | `HOST_MANAGED` | A paired device tried to change the vault, setup, storage, push or the factory reset of its host |
| 503 | `HOST_LOCKED` | A sharing desktop is locked. Devices reconnect after the vault opens |
| 503 | `SERVER_NOT_READY` | The server cannot resolve the paired-device identity yet |
| 403 | `DEMO_READ_ONLY` | A change on a server in demo mode |
| 501 | `NOT_SUPPORTED` | The provider does not support the action |
| 502 | `PUSH_RELAY_ERROR` | The push relay did not accept the notification |
| 403 | `DEVICE_ONLY` | A route that needs a device identity got the vault token instead of a device token |
| 404 | `ALERT_NOT_FOUND` | The alert expired or never existed |
| 409 | `PUSH_NOT_REGISTERED` | A test push came from a device with no push registration |
| 409 | `PUSH_RELAY_FROM_ENV` | `PIPEDASH_PUSH_RELAY_URL` sets the relay, so the switch can't change it |
| 410 | `PUSH_SUBSCRIPTION_GONE` | The relay no longer knows the device. Pipedash deleted its registration |
| 422 | `INVALID_SUBSCRIPTION` | The `subscription_id` is empty, longer than 128 characters or has other characters than letters, digits, `-` and `_` |
| 503 | `NOT_INITIALIZED` | Setup is still required |
| 500 | `INTERNAL_ERROR` | Any other failure |

A `401` from the auth check has no body. A `403` from the cross-origin check has no body either.

## Health and setup

The health and setup routes skip authentication.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/health` | Public | Server status, version and provider count |
| GET | `/setup/status` | Public | Config and setup state |
| POST | `/setup/draft` | Public | Validates a first-setup draft and returns the proposed config |
| POST | `/setup/apply` | Public | Saves first setup and starts services |

`GET /health` answers `503` with `status` set to `database_error` when the provider query fails. The [Docker](/docs/deployment/docker) page lists the other states.

Both POST routes take the same body:

```json
{
  "backend": "sqlite",
  "data_dir": "/data",
  "postgres_url": "",
  "vault_password": "<vault-password>",
  "vault_password_confirm": "<vault-password>",
  "transfer_data": true
}
```

All six fields are required. `backend` accepts `sqlite`, `postgres` or `postgresql`. A PostgreSQL backend needs a valid `postgres://` or `postgresql://` URL.

Without `PIPEDASH_VAULT_PASSWORD`, server setup requires a matching vault password and confirmation, with at least 8 characters.

The draft response holds `config`, `errors`, `password_warnings` and `needs_migration`. The apply response holds `saved`, `migration_stats` and `restart_required`.

Both routes return `409` once setup is complete. They skip bearer authentication, so this guard also applies without a token.

## Providers

All routes in this group are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/providers` | Protected | Lists providers |
| GET | `/providers/export` | Protected | Exports providers as TOML text without tokens |
| POST | `/providers/import` | Protected | Imports providers from TOML text |
| GET | `/providers/{id}` | Protected | Reads a provider for editing |
| DELETE | `/providers/{id}` | Protected | Deletes a provider |
| POST | `/providers/{id}/refresh` | Protected | Refreshes the pipelines of one provider now |
| PUT | `/providers/{id}/refresh-interval` | Protected | Changes the stored refresh interval |
| GET | `/providers/{id}/table-schema` | Protected | Reads the table schema |
| POST | `/providers/{id}/sign-in` | Protected | Starts sign-in for a saved provider |
| POST | `/providers/{id}/sign-in/complete` | Protected | Saves a completed sign-in for that provider |
| POST | `/providers/organizations` | Protected | Discovers organizations |
| POST | `/providers/permissions/check` | Protected | Checks supplied credentials and feature availability |
| POST | `/providers/preview` | Protected | Previews discoverable pipelines |
| POST | `/providers/preview/ids` | Protected | Lists matching pipeline IDs |
| POST | `/providers/field-options` | Protected | Loads dynamic config choices |
| POST | `/providers/draft/validate` | Protected | Validates a provider draft |
| POST | `/providers/draft` | Protected | Creates or updates a provider from a draft |

The draft routes take `provider_type`, `name`, `auth_mode`, `values`, optional `selected_pipeline_ids` and optional `provider_id`. `auth_mode` is `none`, `token`, `sign_in` or `kubeconfig`. A mode that the provider does not offer gets the error "Choose one of this provider's connection methods" under the `auth_mode` key. `values` maps config keys to strings.

Omit `provider_id`, or set it to `null`, to create a provider. Set it to a saved provider ID to update one. The save response is the numeric provider ID.

The validation response holds `errors`, `active_field_keys`, `missing_field_labels`, `credentials_complete`, `selection_required` and `selection_needs_refresh`.

```bash
curl -X POST http://localhost:8080/api/v1/providers/draft \
  -H "Authorization: Bearer <vault-password>" \
  -H "Content-Type: application/json" \
  -d '{
    "provider_type": "github",
    "name": "GitHub OSS",
    "auth_mode": "token",
    "values": {
      "token": "<github-token>",
      "base_url": "https://github.com"
    },
    "selected_pipeline_ids": ["hcavarsan/pipedash"],
    "provider_id": null
  }'
```

`POST /providers/{id}/sign-in` takes no body. `POST /providers/{id}/sign-in/complete` takes `{ "flow_id": "<completed-flow-id>" }`.

Organization discovery and permission checks take `provider_type` and `config`. Preview also takes optional `org`, `search`, `page` and `page_size`. Matching IDs takes `provider_type`, optional `config`, `organization` and `search`. Field options takes `provider_type`, `field_key` and optional `config`. Each [provider page](/docs/providers) lists its `config` keys.

`PUT /providers/{id}/refresh-interval` takes `{ "refresh_interval": 30 }` and answers `400` for a value below 5.

`GET /providers/export` returns the TOML text as a JSON string. `POST /providers/import` takes `{ "content": "<toml>" }` and returns `{ "added": [], "skipped": [] }`. The [Import and export](/docs/configuration/import-export) page covers both.

## Pipelines

All routes in this group are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/pipelines/cached` | Protected | Lists pipelines from the cache |
| GET | `/pipelines/cctray.xml` | Protected | Every cached pipeline as a CCTray XML feed for build monitors |
| POST | `/pipelines/cancellation-targets` | Protected | Finds cancellable runs for selected pipelines |
| POST | `/pipelines/cancel-runs` | Protected | Cancels a batch of runs |
| POST | `/pipelines/{id}/runs/query` | Protected | Queries run history with filters and sorting |
| GET | `/pipelines/{id}/runs/{run_number}` | Protected | One run in detail |
| POST | `/pipelines/{id}/trigger` | Protected | Starts a run |
| POST | `/pipelines/{id}/trigger/prepare` | Protected | Prepares trigger parameters, values and validation |
| POST | `/pipelines/{id}/runs/{run_number}/cancel` | Protected | Cancels a run |
| POST | `/pipelines/{id}/runs/{run_number}/force-cancel` | Protected | Force cancels a GitHub run after normal cancellation fails to stop it |
| POST | `/pipelines/{id}/runs/{run_number}/review` | Protected | Approves or rejects a run that waits for a review |
| POST | `/pipelines/{id}/runs/{run_number}/rerun` | Protected | Reruns a run |
| POST | `/pipelines/{id}/runs/{run_number}/rerun-failed-jobs` | Protected | Reruns only the failed jobs of a run |
| POST | `/pipelines/{id}/runs/{run_number}/jobs/{job_id}/rerun` | Protected | Reruns one job of a run. A `job_id` that is not a job of that run gets `404`. |
| POST | `/pipelines/{id}/enable` | Protected | Enables a disabled GitHub workflow without starting a run |

`GET /pipelines/cached` takes optional `provider_id` in the query.

`POST /pipelines/{id}/runs/query` takes a JSON object. Its fields are `page` (default `1`), `page_size` (default `20`), `search`, `statuses` (default `[]`), `branch`, `actor`, `date_range`, `utc_offset_minutes` (default `0`), `sort_column` (default `run_number`), `direction` (default `desc`) and `scan_depth` (default `1`).

The history response holds `runs`, `total_count`, `has_more`, `can_scan_deeper`, `is_complete`, `scan_notice`, `page`, `page_size`, `total_pages`, `branches` and `actors`.

`POST /pipelines/{id}/trigger` takes `workflow_id` (required) and `inputs` (optional JSON). The server reads the target from `workflow_id` and ignores the `{id}` in the path, so the pipeline ID goes in both places. The response is a `TriggerResult` with `run_id` (string or `null`) and `run_number` (integer or `null`).

```bash
curl -X POST "http://localhost:8080/api/v1/pipelines/<pipeline-id>/trigger" \
  -H "Authorization: Bearer <vault-password>" \
  -H "Content-Type: application/json" \
  -d '{ "workflow_id": "<pipeline-id>", "inputs": { "ref": "main" } }'
```

```json
{ "run_id": "<run-id>", "run_number": 42 }
```

Both fields can be `null`. `run_id` is a string and `run_number` is an integer. A provider that cannot report the new run at once returns `null`.

`POST /pipelines/{id}/trigger/prepare` takes `{}` or an object with optional `rerun_of` and `inputs`. `rerun_of` is a run number. `inputs` is an object. The response holds `parameters`, `values`, `fields`, `errors`, `availability` and `copy`.

`POST /pipelines/cancellation-targets` takes `{ "pipeline_ids": ["<pipeline-id>"] }`. It returns `groups`, `batches`, `failed_pipeline_ids`, `skipped` and `run_count`. `batches` holds the same runs as `groups` as lists of `{ "pipeline_id", "run_number" }` targets, at most 1000 per list.

`POST /pipelines/cancel-runs` takes `{ "targets": [{ "pipeline_id": "<pipeline-id>", "run_number": 42 }] }`. It returns `results`, `requested_count` and `failed_count`. More than 1000 targets returns an error with the message "Cancel at most 1000 runs at a time". Send each list from `batches` as its own request.

`POST .../review` takes `{ "decision": "approve" }` or `{ "decision": "reject" }`. Trigger preparation returns the parameters and current values for the trigger form. The [trigger and cancel](/docs/features/trigger-and-cancel) page covers the UI flow.

`POST .../force-cancel` takes no body and targets one GitHub run. GitHub bypasses conditions such as `always()`. It needs the same permissions as normal cancellation. The [Force cancel guide](/docs/features/trigger-and-cancel#force-cancel-on-github) covers when to use it.

`POST /pipelines/{id}/enable` takes no body and turns a disabled GitHub workflow's triggers back on. The [GitHub Actions guide](/docs/providers/github-actions#disabled-workflows) covers the Disabled label and its reasons.

### Build monitor feed

`GET /pipelines/cctray.xml` returns every cached pipeline in the CCTray format, the `cc.xml` feed that build monitors such as CCMenu and Nevergreen read. The answer has the content type `application/xml`, with one `<Project>` per pipeline inside `<Projects>`. The feed reads the cache and does not call the providers.

| Attribute | Value |
|---|---|
| `name` | `<repository> · <pipeline>`, or the pipeline name when it has no repository. When two pipelines get the same name, each one adds ` · ` and its workflow file, or its pipeline ID when it has none. |
| `activity` | `Building` while the pipeline is running, or pending with a previous run. `Sleeping` otherwise. |
| `lastBuildStatus` | `Success` for success. `Failure` for failed and degraded. `Unknown` for running, pending, cancelled and skipped. |
| `lastBuildTime` | The time of the last run in RFC 3339, or the time of the last update when the pipeline has never run. |
| `webUrl` | The pipeline page in Pipedash, `<scheme>://<host><base path>/pipelines/<pipeline-id>`. |

The server builds `webUrl` from the `Host` header of the request and the first value of `X-Forwarded-Proto`, with `http` when that header is missing. It keeps the [base path](/docs/deployment/reverse-proxy#serve-under-a-sub-path) of the web UI. Behind a proxy that passes both headers, as the [Forwarded headers](/docs/deployment/reverse-proxy#forwarded-headers) section asks, the links point at the public address.

The route follows the same bearer rule as the other protected routes. On a server with an API token, a request without the header gets `401`. In the build monitor, add the feed URL `https://<host>/api/v1/pipelines/cctray.xml` and set the header `Authorization: Bearer <token>` with the vault password or a paired device token.

```bash
curl "http://localhost:8080/api/v1/pipelines/cctray.xml" \
  -H "Authorization: Bearer <vault-password>"
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Projects>
  <Project name="acme/api · CI" activity="Sleeping" lastBuildStatus="Success" lastBuildTime="2026-11-16T21:04:12+00:00" webUrl="http://localhost:8080/pipelines/<pipeline-id>"/>
</Projects>
```

## Run logs

These routes serve the [Run logs](/docs/features/run-logs) viewer. They exist for providers with the `logs` capability, which every built-in provider declares. A plugin without it answers `501` with `NOT_SUPPORTED`. The server compresses the answers of the `/logs` routes with gzip when the client accepts it.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/pipelines/{id}/runs/{run_number}/logs` | Protected | Jobs and steps of the run |
| GET | `/pipelines/{id}/runs/{run_number}/logs/{node_id}` | Protected | Opens a job log and starts its download when needed |
| GET | `/pipelines/{id}/runs/{run_number}/logs/{node_id}/lines` | Protected | A page of lines |
| POST | `/pipelines/{id}/runs/{run_number}/logs/{node_id}/search` | Protected | Searches the whole log |
| POST | `/pipelines/{id}/runs/{run_number}/logs/{node_id}/download-ticket` | Protected | Creates a download link |
| GET | `/downloads/{ticket}` | Ticket | Streams the log as a text file |

- **Jobs:** the response holds `nodes`, `default_node_id`, `complete`, `groups` and `step_ids_by_node`. Each group has `stage`, `node_ids` and `failed_first_node_ids`. `step_ids_by_node` maps a node id to the ids of its steps. Each node has an `id`, a `parent_id`, a `kind` (`stage`, `job` or `step`), a `name` and a `status`. Its `log` value is `ready`, `partial`, `pending` or `null`. It also has `started_at`, `finished_at`, `duration_seconds`, `web_url`, `depth` and `navigable` when they apply.
- **Open:** returns `{ "state": "ready", ... }` with the line count, styles, sections and error lines, or `loading` with `received_bytes`, `pending`, or `unavailable` with a `message`. A `ready` answer for a log that is still running holds `complete: false`, `updated_at_ms`, `stable_lines` and `previous_revision`. Lines below `stable_lines` stay the same in the next revision. `?retry=true` skips the 5 minute wait after a failed download.
- **Events:** the `run-log-progress` event reports a download. `run-log-ready` fires for each new revision of a running log, with the `revision`, and `run-log-failed` reports a failure. `run-log-tree-changed` (`pipelineId`, `runNumber`) says the job list or the state of a job changed. `run-updated` (`pipelineId`, `runNumber`, `run`) carries the changed run, at most every 5 seconds. The server sends the last two only while a client has the log or the job list of that run open. Opening them renews the watch for 45 seconds.
- **Lines:** takes `revision`, `start`, `count` (up to 2000) and `max_line_units`. Each line has `text`, and `kind`, `ts`, `spans` and `omitted` when they apply. A revision that no longer exists returns `404`.
- **Search:** takes `revision` and `session` in the query and `{ "text": "...", "regex": false, "case_sensitive": false }` as the body. A newer search with the same `session` cancels the older one. The response holds `matches` as `[line, start, end]`, `total` and `capped`. An invalid pattern returns `400`.
- **Download:** the ticket route takes `{ "revision": 1, "file_name": "build.log" }` and returns `{ "ticket": "..." }`. The ticket works once and expires after 60 seconds. The download sends `Cache-Control: no-store` and `Referrer-Policy: no-referrer`. Server logs replace the ticket with `[redacted]`.

## Pipeline views

The routes behind [Views](/docs/features/views), pins and hidden pipelines. The `{id}` of a view is a number, `all`, `pinned` or `config:<key>`, URL-encoded. All routes are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/pipeline-views` | Protected | Lists the views |
| POST | `/pipeline-views` | Protected | Creates a custom view. Answers `201`. |
| GET | `/pipeline-views/page` | Protected | Builds the page of a view |
| PUT | `/pipeline-views/order` | Protected | Sets the order of the movable views |
| PUT | `/pipeline-views/hidden` | Protected | Hides or shows a pipeline |
| GET | `/pipeline-views/pins` | Protected | Lists the pins of views and repositories |
| PUT | `/pipeline-views/pins` | Protected | Pins or unpins a view or a repository |
| GET | `/pipeline-views/menu` | Protected | Pipeline-menu snapshot |
| POST | `/pipeline-views/selection` | Protected | View membership summary for selected pipelines |
| GET | `/pipeline-views/editor-options` | Protected | Eligible parents and sub-view availability |
| GET | `/pipeline-views/navigation` | Protected | Views, pins and providers for navigation |
| POST | `/pipeline-views/legacy-import` | Protected | Imports the pins and hidden pipelines that older versions kept in the browser |
| PUT | `/pipeline-views/{id}` | Protected | Updates a custom view |
| DELETE | `/pipeline-views/{id}` | Protected | Deletes a custom view |
| GET | `/pipeline-views/{id}/members` | Protected | Lists the pipelines added by hand |
| PUT | `/pipeline-views/{id}/membership` | Protected | Adds or removes a pipeline |
| PUT | `/pipeline-views/{id}/memberships` | Protected | Changes membership for several pipelines |

- **Create and update:** the body takes `name`, `rules`, `display`, `members` (pipeline ids) and `parent` (a view id, or `null` for the top level). The `rules` fields are `provider_ids`, `repositories`, `name_contains` and `statuses`. The `display` fields are `sort`, `direction`, `sections` and `layout`. An update leaves out the fields it keeps. A request for a config view returns `400` with "Views from config.toml can't be changed here. Edit config.toml instead."
- **Page:** the query takes `view` (default `all`), `provider_id`, `search`, `statuses`, `organization`, `date_range` (`today`, `24h`, `7d`, `30d`, `60d` or `90d`), `show_hidden` and `utc_offset_minutes`. `statuses` is a comma list such as `running,pending`, and an unknown status returns `400`. An unknown view returns `404`. The response holds `view`, `pinned`, `pinned_blocks`, `sections`, `total`, `hidden_count`, `filters_active`, `section_count`, `facets` and `presentation`.
- **Order:** `PUT /pipeline-views/order` takes `{ "order": ["pinned", 1] }`.
- **Hidden:** `PUT /pipeline-views/hidden` takes `pipeline_id` and `hidden`.
- **Pins:** the body takes `kind` (`view` or `repository`), `ref` and `pinned`. A pipeline pin is a membership of the `pinned` view.
- **Legacy import:** `POST /pipeline-views/legacy-import` takes optional `pinned` and `hidden` pipeline-ID lists.
- **Menu:** no body or query. The response holds `pipelines` and `shortcuts`.
- **Selection:** `POST /pipeline-views/selection` takes `{ "pipeline_ids": ["<pipeline-id>"] }`. Each result holds `view`, `depth`, `selected_count`, `direct_count`, `included_by_rule` and `included_by_sub_view`.
- **Editor options:** optional query field `view`. The response holds `eligible_parents` and `can_add_sub_view`.
- **Navigation:** optional query field `search`. The response holds `views`, `pins`, `providers` and `total_pipelines`.
- **Membership:** the body takes `pipeline_id` and `member`.
- **Batch membership:** `PUT .../memberships` takes `pipeline_ids` and `member`. It returns the updated selection entries.
- **Event:** every change sends `pipeline-views-changed` over the WebSocket.

## Provider sign-in

Providers with single sign-on, such as ArgoCD, use these routes. They are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | `/sign-in` | Protected | Starts a sign-in from `provider_type` and `config` |
| GET | `/sign-in/{id}` | Protected | Reads the state of a sign-in |
| POST | `/sign-in/{id}/complete` | Protected | Finishes it with the `redirect_url` of the page after the sign-in |
| DELETE | `/sign-in/{id}` | Protected | Cancels it |

On the web server the browser can be on another machine, so the start response asks for manual completion. The user pastes the address of the page after sign-in. The [ArgoCD](/docs/providers/argocd#single-sign-on) page covers the flow.

## Plugins

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/plugins` | Public | Full plugin metadata, without authentication |

Each plugin includes its config schema, table schema, capabilities, permissions, features, run-history policy, token prefixes and presentation data.

## Cache

All routes in this group are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/cache/stats` | Protected | Cache statistics |
| DELETE | `/cache/run-history` | Protected | Clears all history caches |
| DELETE | `/cache/pipelines` | Protected | Clears the pipeline cache |
| DELETE | `/cache/workflow-params` | Protected | Clears the parameter cache |
| DELETE | `/cache/run-logs` | Protected | Clears the run log cache |
| DELETE | `/cache` | Protected | Clears every cache |

## Metrics

All routes in this group are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/metrics/config` | Protected | Reads the global metrics config |
| PUT | `/metrics/config` | Protected | Updates it |
| GET | `/metrics/pipelines/{id}/config` | Protected | Reads a pipeline metrics config |
| PUT | `/metrics/pipelines/{id}/config` | Protected | Updates it |
| POST | `/metrics/dashboard` | Protected | Queries metrics, statistics and table ordering |
| GET | `/metrics/storage/stats` | Protected | Metric storage statistics |
| POST | `/metrics/flush` | Protected | Deletes metrics |

`PUT /metrics/config` takes `enabled` and `default_retention_days`. The pipeline route takes `enabled` and `retention_days`. `POST /metrics/flush` takes an optional `pipeline_id`. The [metrics](/docs/features/metrics) page covers it.

`POST /metrics/dashboard` requires `metric_type`, `aggregation_period` and `date_range`. It also takes optional `pipeline_id`, `aggregation_type`, `utc_offset_minutes` (default `0`), `limit` and `table_sort`.

`metric_type` is `run_duration`, `success_rate` or `run_frequency`. `aggregation_period` is `hourly`, `daily`, `weekly` or `monthly`. `aggregation_type` is `avg`, `sum`, `min`, `max`, `p95` or `p99`.

`date_range` is `today`, `24h`, `7d`, `30d`, `60d` or `90d`. `table_sort` holds `field` (`timestamp`, `value`, `count`, `min` or `max`) and `direction` (`asc` or `desc`).

The response holds `data`, `observed`, `stats`, `table_indices`, `ranges`, `widest_range` and `aggregation_type`.

## Notification center

| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | `/notifications/center` | Protected | Applies a change to a supplied notification-center snapshot |

The route takes `snapshot` and `change` and returns the updated snapshot.

`snapshot` holds `revision`, `items` and optional `unread`. It accepts at most 50 items. The server recalculates `unread`.

`change.type` is `push`, `insert_missed`, `read` or `clear`. `push` and `insert_missed` include `notice`. `read` includes `key`, or `null` to mark every item read.

```json
{
  "snapshot": { "revision": 0, "items": [], "unread": 0 },
  "change": { "type": "clear" }
}
```

## Preferences

All routes in this group are protected.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/preferences/table/{provider_id}/{table_id}` | Protected | Reads table preferences |
| PUT | `/preferences/table/{provider_id}/{table_id}` | Protected | Saves table preferences |
| GET | `/preferences/table/{provider_id}/{table_id}/default` | Protected | Reads the defaults |

`PUT /preferences/table/{provider_id}/{table_id}` takes `{ "preferences_json": "<serialized JSON>" }`. The GET route returns the saved JSON string, or `null` when none is saved.

## Refresh

| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | `/refresh/all` | Protected | Refreshes all providers now and returns one result per provider |

Each result holds `provider_id`, `state`, `kind` and `message`. The [refresh](/docs/features/refresh) page covers polling and intervals.

## Settings

| Method | Path | Auth | Purpose |
|---|---|---|---|
| PUT | `/settings/general` | Protected | Saves the `[general]` settings |

The body holds `metrics_enabled`, `default_refresh_interval`, `status_pages_enabled` and `proxy_url`. The route answers `204`. It answers `400` when `default_refresh_interval` lies outside 5 to 300 or when `proxy_url` is not an `http://` or `https://` URL without credentials. A new proxy applies at once.

## Storage

All routes in this group are host-managed. A paired device gets `409` with `HOST_MANAGED`.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | `/storage/draft` | Operator | Validates a storage draft |
| POST | `/storage/apply` | Operator | Applies the draft and reloads storage |
| GET | `/storage/config` | Operator | Reads the storage config and summary |
| GET | `/storage/config/content` | Operator | Reads the TOML text |
| PUT | `/storage/config/content` | Operator | Saves TOML and applies provider blocks |
| POST | `/storage/config/analyze` | Operator | Analyzes proposed TOML |
| GET | `/storage/paths` | Operator | Effective file paths |
| GET | `/storage/default-data-dir` | Operator | Default data directory |
| POST | `/storage/test-connection` | Operator | Tests the supplied config |
| GET | `/storage/vault-password-status` | Operator | Reports whether the password variable is set |
| POST | `/storage/migration/execute` | Operator | Executes a supplied migration plan |

The draft and apply routes take the same six fields as the [setup draft](#health-and-setup): `backend`, `data_dir`, `postgres_url`, `vault_password`, `vault_password_confirm` and `transfer_data`.

Draft returns `config`, `errors`, `password_warnings` and `needs_migration`. Apply returns `saved`, `migration_stats` and `restart_required`. A successful web-server apply reloads storage and sets `restart_required` to `false`.

`PUT /storage/config/content` takes `{ "content": "<toml>" }`. Analyze takes `{ "new_content": "<toml>" }`.

Test connection takes a complete Pipedash config object. Migration execute takes `plan` and `options`. A successful migration reloads storage. If that reload fails, the server logs that a manual restart is required. The [storage backends](/docs/configuration/storage-backends) page covers what a migration moves.

## Vault

`GET /vault/status` skips authentication. The two other routes are host-managed and need the bearer token whenever the server holds one.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/vault/status` | Public | Lock state and password source |
| POST | `/vault/unlock` | Operator | Opens the vault with a password |
| POST | `/vault/lock` | Operator | Closes the session |

`GET /vault/status` returns `is_unlocked`, `password_source` (`env_var`, `session` or `none`), `backend`, `requires_password` and `is_first_time`. In [demo mode](/docs/deployment/docker#read-only-demo-mode) it adds `demo_password`, the password for the sign-in screen.

`POST /vault/unlock` takes `password` and returns `success` and `message`.

```bash
curl -X POST http://localhost:8080/api/v1/vault/unlock \
  -H "Authorization: Bearer <vault-password>" \
  -H "Content-Type: application/json" \
  -d '{ "password": "<vault-password>" }'
```

```json
{ "success": true, "message": "Vault unlocked successfully" }
```

A failed attempt still returns status `200`, with `"success": false`. The message is `Incorrect vault password` for a wrong password, or `Invalid password or storage error: ...` for another storage failure. If the vault is already open, the message is `Vault is already unlocked`.

A successful call sets `PIPEDASH_VAULT_PASSWORD` in the server process and sets the API token to that password. `POST /vault/lock` returns `Vault locked`, deletes the variable, shuts down the core and clears pending download tickets. It keeps the API token, so protected routes still need the bearer token. A restart is not needed.

## Alerts

A host records alerts for pipeline failures, degraded pipelines, long runs, provider outages and provider recoveries. It records alerts only while at least one device is paired. Phones read them in the background and from the push notification service extension. Both the vault token and a device token can call these routes.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/alerts` | Protected | Lists alerts after a sequence number |
| GET | `/alerts/{id}` | Protected | Reads one alert |

`GET /alerts` takes `after` (default `0`) and `limit` (default `50`, clamped to 1 to 100). It returns the alerts in ascending `seq` order and the newest sequence number, which counts alerts of every kind. Test alerts are not in the list.

A device token returns only alerts allowed by that device's saved notification preferences. The vault token returns the unfiltered list. `latest_seq` still counts all recorded alerts, including alerts filtered out for that device.

`GET /alerts/{id}` reads an alert directly and does not apply the list filter.

```json
{
  "alerts": [
    {
      "id": "0f3a9c2e8b7d4a61b5c0d9e8f7a6b5c4",
      "seq": 42,
      "key": "pipeline:github__1__hcavarsan/pipedash/ci.yml",
      "kind": "failed",
      "tone": "danger",
      "title": "ci.yml failed",
      "body": "hcavarsan/pipedash · GitHub",
      "pipeline_id": "github__1__hcavarsan/pipedash/ci.yml",
      "provider_id": 1,
      "created_at": "2026-11-04T09:30:00Z"
    }
  ],
  "latest_seq": 42
}
```

- **`kind`:** `failed`, `degraded`, `long_run`, `outage`, `recovered`, `finished` or `test`.
- **`tone`:** `danger` for `failed` and `degraded`, `warning` for `long_run` and `outage`, and `success` for `recovered`, `finished` and `test`. The host supplies the tone.
- **`key`:** the same key the in-app notification list uses, so a newer alert replaces an older one with the same key.
- **Retention:** the host keeps alerts for 7 days and at most 500. A factory reset deletes them.
- **`GET /alerts/{id}`:** returns one alert, including a `test` alert. It answers `404` with `ALERT_NOT_FOUND` once the alert is gone.
- **Event:** each new alert sends `alert-recorded` (`id`, `seq`) over the WebSocket.

## Push relay

Both routes are host-managed.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/push/relay` | Operator | Reads the relay switch of the server |
| PUT | `/push/relay` | Operator | Turns it on or off |

Both answer `{ "enabled": true, "relay_url": "https://relay.pipedash.app", "from_env": false, "official_url": "https://relay.pipedash.app" }`. `enabled` says the server has a relay URL. `from_env` is `true` while a non-empty `PIPEDASH_PUSH_RELAY_URL` sets it. `PUT` takes `{ "enabled": true }`, writes or removes `push.relay_url` in `config.toml`, and answers `409` with `PUSH_RELAY_FROM_ENV` while `from_env` is `true`. A paired device gets `409` with `HOST_MANAGED`. Demo mode permits GET and refuses PUT.

This is the "Background notifications" switch in Settings, Notifications on the web UI. It starts off on a new web server and on a computer that never shared. A computer that was already sharing before the upgrade keeps push on once, and later choices stick. A non-empty `PIPEDASH_PUSH_RELAY_URL` overrides `push.relay_url` and disables the switch ("Set by PIPEDASH_PUSH_RELAY_URL."). A blank value selects no relay and leaves the switch enabled.

## Push registration of a device

These routes belong to the paired device that calls them. They answer `403` with `DEVICE_ONLY` for the vault token. A server with no relay URL answers `422` with `PUSH_RELAY_NOT_CONFIGURED` to `PUT` and to the test route.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/devices/current/push` | Device | Reads the relay URL and whether this device has a registration |
| PUT | `/devices/current/push` | Device | Registers the relay subscription of this device. Answers `204`. |
| DELETE | `/devices/current/push` | Device | Removes the registration. Answers `204`, also when none exists. |
| POST | `/devices/current/push/test` | Device | Records a test alert and pushes it to this device. Answers `202`. |
| POST | `/devices/current/push/ack` | Device | Confirms that the device showed the alerts it missed. Answers `204`. |

`GET` returns `{ "relay_url": "https://relay.pipedash.app", "enabled": true, "undelivered_after": null }`, with `relay_url` set to `null` when the host has no relay. `PUT` takes `{ "subscription_id": "<id from the relay>" }`. The test route has these errors:

- `409` with `PUSH_NOT_REGISTERED` before a `PUT`.
- `410` with `PUSH_SUBSCRIPTION_GONE` when the relay no longer knows the device.
- `429` with `RATE_LIMITED` and `502` with `PUSH_RELAY_ERROR`.

For each alert, the host sends the relay `POST /v1/notifications` with `{ "subscription_id": "...", "alert_id": "..." }` and nothing else. The relay answers Apple with a generic text, and the app fetches the real text from `GET /alerts/{id}`. The [Security](/docs/resources/security#push-relay) page covers the trust model.

When the relay fails or rate-limits a push, the host remembers the first and the last alert it could not push to that device. `undelivered_after` is then the `seq` immediately before the first one. The device fetches `GET /alerts?after=<undelivered_after>` in its next background check, shows up to 20 alerts, and sends `POST /devices/current/push/ack` with `{ "through": <last seq shown> }`. The host clears the marker once the ack covers the last failed alert. Otherwise `undelivered_after` moves to the acked `seq`, and the next background check continues from there.

## Device notification preferences

A paired device saves its alert choices on the host. GET and PUT require the device token. The vault token returns `403` with `DEVICE_ONLY`. PATCH also supports a supplied preference object for callers without a device identity.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/devices/current/notification-preferences` | Device | Returns `{ "preferences": null }` before the device saves choices, or its saved preference object |
| PUT | `/devices/current/notification-preferences` | Device | Saves the preference object and returns `{ "fired": [...] }` with one-time watches that already fired |
| PATCH | `/devices/current/notification-preferences` | Patch | Applies one preference change and returns preferences and pipeline states |

`PUT` takes the preference object directly:

```json
{
  "failed": true,
  "degraded": true,
  "long_run": true,
  "outage": true,
  "recovered": true,
  "muted_providers": [],
  "muted_pipelines": [],
  "watched_pipelines": [],
  "watch_once": []
}
```

Provider lists contain numeric IDs. Pipeline lists contain pipeline ID strings. A `watch_once` entry holds `pipeline_id`, `since` and an optional `fired_at`, with RFC 3339 timestamps. Saving preserves a stored `fired_at` for the same request. The [Notifications](/docs/features/notifications#pipeline-mutes-and-watches) page explains mute and watch precedence.

`PATCH` takes a tagged change:

```json
{ "type": "pipeline_muted", "pipeline_id": "<pipeline-id>", "muted": true }
```

Its change types are `kind`, `provider_muted`, `pipeline_muted`, `pipeline_watched`, `watch_next_finish` and `cancel_next_finish`.

- `kind` takes `kind` and `enabled`.
- `provider_muted` takes `provider_id` and `muted`.
- `pipeline_muted` takes `pipeline_id` and `muted`.
- `pipeline_watched` takes `pipeline_id` and `watched`.
- `watch_next_finish` and `cancel_next_finish` take `pipeline_id`.

For a paired device, the server saves the change. Without a device identity, include `preferences` in the same body. The server changes that supplied object without saving it for a device. A caller with neither gets `403` with `DEVICE_ONLY`.

The response holds `preferences` and `pipeline_states`. A pipeline state is `muted`, `watching`, `pending` or `default`.

## Push subscriptions

These host-managed routes list, remove and test push subscriptions saved by older app versions. New subscriptions use the current-device registration routes. The server no longer registers an older subscription through `POST /push/subscriptions`.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/push/subscriptions` | Operator | Lists subscriptions and reports `relay_configured` |
| DELETE | `/push/subscriptions/{id}` | Operator | Deletes a device. Answers `204`. |
| POST | `/push/subscriptions/{id}/test` | Operator | Sends a test notification. Answers `202`. |

## Devices

These routes pair other Pipedash apps with this server or desktop host. They need the bearer token like the rest. The [Mobile](/docs/deployment/mobile#connect-to-a-server) and [Desktop app](/docs/deployment/desktop#share-with-other-devices) pages cover the UI.

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/devices` | Protected | Lists the paired devices |
| POST | `/devices/pairing` | Protected | Creates a single-use pairing code |
| DELETE | `/devices/{id}` | Protected | Removes a device. Answers `204`. |

`GET /devices` returns `{ "devices": [...] }`. Each device holds `id`, `name`, `platform`, `created_at`, `last_seen_at`, `current`, `removable` and `push`. `current` is `true` for the device that asks. `removable` says whether the caller may remove that device. `push` is `true` when the device has a push registration.

`POST /devices/pairing` takes `{ "server_url": "<address the new device reaches>" }`. It answers `422` with `INVALID_SERVER_URL` for a bad address and `429` with `TOO_MANY_PAIRING_CODES` while 8 codes are open.

```json
{
  "code": "ABCD-EFGH",
  "link": "pipedash://pair?url=...&code=...",
  "server_url": "http://192.168.1.20:8080",
  "expires_at": "...",
  "loopback": false,
  "qr_svg": "<svg>...</svg>"
}
```

The code works once and expires after 5 minutes. `loopback` says whether the address only works on the host itself. `DELETE /devices/{id}` answers `404` with `DEVICE_NOT_FOUND` for an unknown id. The host closes the connection of a removed device at once.

In [demo mode](/docs/deployment/docker#read-only-demo-mode), creating a pairing code is allowed and the server stores a device under a generic name such as "Demo iPhone or iPad". A paired device can remove only its own entry and change only its own push registration and notification preferences, and every device has `removable` set to `false`.

## System

| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | `/factory-reset` | Operator | Deletes all providers, caches, tokens, views, pins, metrics, recorded alerts, push registrations and paired devices |

Providers that `config.toml` defines leave the file too. The reset also deletes all custom views, their members and pins. The response holds `providers_removed`, `caches_cleared`, `tokens_cleared` and `metrics_cleared`.

## WebSocket

| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | `/ws` | Socket | Upgrades to the event and request socket |

Live events stream on `/api/v1/ws`. A cross-origin upgrade gets `403` unless CORS allows all origins. When the server holds an API token, the first message from the client must be:

```json
{ "type": "auth", "token": "<vault-password>" }
```

Before authentication, the socket accepts only an `auth` frame or a `claim` frame (a pairing code, see below). The server closes the socket on any other first frame, on invalid JSON, or on invalid credentials. On success the server answers with an `auth-ok` frame. Without a token there is no handshake. After that, every event arrives as a text frame with this envelope:

```json
{ "type": "pipeline-status-changed", "payload": {} }
```

`type` is the event name and `payload` is the event data. After the handshake, the server accepts `request` and `notification-preferences` frames. It also accepts later `auth` or `claim` frames. Unrecognized text frames after authentication are ignored.

The server keeps a buffer of 1024 events per socket. A client that falls behind the buffer gets a close frame, so it can reconnect and load the current state again. The event names are:

| Group | Events |
|---|---|
| Providers | `providers-changed`, `provider-added`, `provider-updated`, `provider-removed`, `provider-status-updated`, `provider-health-alert` |
| Pipelines | `pipelines-updated`, `pipeline-status-changed`, `pipelines-failed` |
| Runs | `run-triggered`, `run-cancelled`, `run-log-progress`, `run-log-ready`, `run-log-failed`, `run-log-tree-changed`, `run-updated` |
| Views | `pipeline-views-changed` |
| Metrics | `metrics-generated`, `metrics-global-config-changed`, `metrics-config-changed`, `metrics-flushed` |
| Migration | `migration-progress`, `migration-complete` |
| Cache | `pipeline-cache-invalidated`, `run-history-cache-invalidated` |
| Vault | `vault-unlocked`, `vault-locked` |
| Devices | `device-paired` (`id`, `name`), `device-revoked` (`id`) |
| Alerts | `alert-recorded` (`id`, `seq`) |
| Notifications | `notification` |

### Notification preferences and replay

A browser or operator client can send its notification preferences for this socket:

```json
{
  "type": "notification-preferences",
  "preferences": { "muted_pipelines": ["<pipeline-id>"] },
  "after": 42
}
```

`after` is optional. It asks the server to replay retained observed notifications after that ID. The server applies the supplied preferences and avoids sending the same notification twice on that connection.

Admitted notifications arrive as `{ "type": "notification", "payload": { ... } }`. The payload holds the shown notification, including its ID and tone.

A paired-device connection ignores this preference frame. It uses the preferences saved for that device instead.

### Device connection

A paired app uses this socket for everything. It follows a different handshake than the vault token above. Native apps send no `Origin` header. A sharing desktop rejects cross-origin browser requests.

The client sends one of these as its first frame within 10 seconds. `auth` carries the token of a paired device. `claim` trades a pairing code for a new token.

```json
{ "type": "auth", "token": "<device-token>" }
{ "type": "claim", "code": "ABCD-EFGH", "name": "My iPhone", "platform": "ios" }
```

The server answers `auth-ok` with `host` (`server` or `desktop`), `name` and `deviceId`. After a `claim` it also sends `token`, which the client stores. Otherwise the server sends `auth-error` with a `code` and a `message`, then closes the socket.

| `code` | Meaning |
|---|---|
| `AUTH_FAILED` | Unknown or wrong token |
| `DEVICE_REMOVED` | The host removed this device |
| `PAIRING_CODE_INVALID` | The code is wrong, used or expired |
| `INVALID_DEVICE_NAME` | The trimmed device name is not 1 to 100 characters |
| `INVALID_PLATFORM` | Platform is not `macos`, `windows`, `linux`, `ios` or `android` |
| `PAIRING_FAILED` | The server could not save the pairing |
| `HOST_LOCKED` | The host is locked |
| `SERVER_NOT_READY` | The host has not finished starting |
| `AUTH_TIMEOUT` | No first frame arrived within 10 seconds |

After `auth-ok`, the client sends API calls as `request` frames and the server answers each with a `response` frame that has the same `id`.

```json
{ "type": "request", "id": 1, "method": "GET", "path": "/pipelines/cached" }
{ "type": "response", "id": 1, "status": 200, "body": "[]" }
```

A `request` may carry a `body`. A `response` carries `body`, or `bodyBase64` for binary data, up to 64 MiB. The host runs 16 requests at once and accepts 64. Extra requests get status `429`.
