# REST API reference

The Solidafy REST API is what the CLI and the portal use. This page covers how to authenticate, how requests and errors look, and the endpoints you can use from your own scripts and integrations, with examples for the most common calls.

## Base URL and authentication

All endpoints live under:

```text
https://api.solidafy.com
```

Authenticate with a [personal access token](/docs/access/security#personal-access-tokens) (PAT) in the `Authorization` header:

```text
Authorization: Bearer sk_pat_...
```

Create a token in the portal under **Settings > API Keys > Personal Access Tokens**. A few things follow from how tokens work:

- **A token acts as you.** Every request has your role, your security group and the data policies that apply to you. An endpoint that needs a permission you don't have returns `403`.
- **A token is tied to one environment**, the one you were in when you created it. Every request works in that environment; there is no environment parameter to change it. Use one token per environment.
- The environment API keys on the same page (`sk_live_...`, `sk_test_...`) are a different kind of key and are not accepted by this API.

Send JSON bodies with `Content-Type: application/json`. A quick check that your token works:

```bash
export SOLIDAFY_PAT=sk_pat_...

curl -s https://api.solidafy.com/api/v1/visual-pipelines \
  -H "Authorization: Bearer $SOLIDAFY_PAT"
```

## Errors

Errors come back with a matching HTTP status and a JSON body like this:

```json
{
  "error": {
    "code": "UNAUTHORIZED",
    "status": 401,
    "message": "Invalid or expired personal access token"
  }
}
```

Some errors also carry a `data` object next to `code`, `status` and `message`, with details about what went wrong.

| Status | Code | Typical cause |
| --- | --- | --- |
| `400` | `BAD_REQUEST` | The request is invalid, for example a bad date range. |
| `401` | `UNAUTHORIZED` | Missing, expired or revoked token. |
| `403` | `FORBIDDEN` | Your role or security group doesn't allow this. |
| `403` | `ORG_SUSPENDED` | Your organisation is suspended or cancelled. Every request fails except listing and switching environments. |
| `403` | `AGREEMENTS_REQUIRED` | Your organisation's owner has not yet accepted its agreements. Every request fails except listing and switching environments. |
| `404` | `NOT_FOUND` | The resource doesn't exist in your environment. |
| `409` | `CONFLICT` | The action clashes with the current state, for example a run is already in progress. |
| `422` | | The body or query string doesn't match the endpoint's schema. |
| `422` | `UNPROCESSABLE_ENTITY` | A value fits the schema but the server can't accept it, for example a `schedule` that isn't a valid cron expression. |
| `429` | `TOO_MANY_REQUESTS` | You are asking too often, or have used up an allowance. A `Retry-After` header, when present, says how many seconds to wait. |
| `500` | `INTERNAL_ERROR` | Something failed on our side. |

In the tables below, `{id}` and similar are path parameters.

## Pipelines

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/visual-pipelines` | List the pipelines you can see. |
| `GET` | `/api/v1/visual-pipelines/{id}` | Get one pipeline, including its steps. |
| `PUT` | `/api/v1/visual-pipelines/{id}` | Update the name, description, category, status or schedule. |
| `DELETE` | `/api/v1/visual-pipelines/{id}` | Delete a pipeline with its runs. Needs Admin access to the pipeline. |
| `GET` | `/api/v1/visual-pipelines/by-datasource?data_source_id={id}` | List the pipelines that use a data source. |

To create pipelines and change their steps, use `solidafy pipelines push` with a [pipeline file](/docs/pipelines/overview#the-pipeline-file). The CLI converts the file into the format the API stores and checks it first.

Each pipeline in a response has `id`, `name`, `description`, `category`, `status` (`draft`, `active`, `paused` or `error`), `schedule`, `last_run_at`, `next_run_at`, `last_run_status`, `is_triggered` (another pipeline triggers it), `trigger_chain_scheduled` (a pipeline upstream in its trigger chain has a schedule, so this one runs on that schedule even without one of its own), `created_at`, `updated_at` and `environment_id`, plus its definition.

### Activate a pipeline and set its schedule

```bash
curl -X PUT https://api.solidafy.com/api/v1/visual-pipelines/$PIPELINE_ID \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{"status": "active", "schedule": "0 */6 * * *"}'
```

Every field in the body is optional; fields you leave out keep their value. `"schedule": null` removes the schedule, and a schedule that isn't a valid cron expression (or is longer than 100 characters) is rejected with `422`. Schedules only fire while the status is `active`; see [Schedules](/docs/pipelines/triggers-and-webhooks#schedules).

## Pipeline runs

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/visual-pipelines/{id}/run` | Start a run. Returns `202`, or `409` if a run is already queued or running. |
| `GET` | `/api/v1/visual-pipelines/{id}/runs` | List runs, newest first. Query: `limit` (1 to 100, default 20) and `offset`. |
| `GET` | `/api/v1/visual-pipelines/{id}/runs/stats` | Run counts, success rate and average duration. Query: `since` (a timestamp). |
| `GET` | `/api/v1/visual-pipelines/{id}/runs/{runId}/steps` | The steps of one run, with status, rows written, output table and error. |
| `POST` | `/api/v1/visual-pipelines/{id}/runs/{runId}/cancel` | Cancel a run that is pending, queued or running. |
| `POST` | `/api/v1/visual-pipelines/{id}/backfill` | Create one run per interval over a date range. |

Starting, cancelling and backfilling need Write access to the pipeline.

### Start a run

```bash
curl -X POST https://api.solidafy.com/api/v1/visual-pipelines/$PIPELINE_ID/run \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{}'
```

The body can carry an optional `run_date` (ISO 8601), which sets the date the run's [run variables](/docs/pipelines/overview#run-variables) use. The response is the new run (abridged):

```json
{
  "id": "6f1c2d3e-0000-0000-0000-000000000000",
  "pipeline_id": "0a9b8c7d-0000-0000-0000-000000000000",
  "status": "queued",
  "run_date": "2026-10-01T09:00:00.000Z",
  "started_at": null,
  "completed_at": null,
  "total_steps": 0,
  "completed_steps": 0,
  "error_message": null
}
```

### Wait for a run

Poll the run list until the run reaches `completed`, `failed`, `partial` or `cancelled`:

```bash
curl -s "https://api.solidafy.com/api/v1/visual-pipelines/$PIPELINE_ID/runs?limit=5" \
  -H "Authorization: Bearer $SOLIDAFY_PAT"
```

```json
{
  "runs": [
    {
      "id": "6f1c2d3e-0000-0000-0000-000000000000",
      "status": "running",
      "started_at": "2026-10-01T09:00:04.000Z",
      "completed_at": null,
      "total_steps": 6,
      "completed_steps": 2,
      "records_synced": 0,
      "error_message": null,
      "triggered_by_run_id": null
    }
  ],
  "total": 148,
  "has_more": true
}
```

Each run also has `trigger_depth`, which is `0` for a run started by hand or on a schedule and higher for a run started by a [trigger](/docs/pipelines/triggers-and-webhooks#pipeline-to-pipeline-triggers).

### Backfill

```bash
curl -X POST https://api.solidafy.com/api/v1/visual-pipelines/$PIPELINE_ID/backfill \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{"start_date": "2026-09-01", "end_date": "2026-09-30", "interval": "daily"}'
```

`interval` is `hourly`, `daily`, `weekly` or `monthly`. `skip_existing` (default `true`) skips dates that already have a run. One backfill can create at most 500 runs. The response lists the created runs and how many slots were skipped.

## Webhooks and streams

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/visual-pipelines/{id}/webhook` | Whether the webhook is enabled, and its secret. |
| `POST` | `/api/v1/visual-pipelines/{id}/webhook/enable` | Enable the webhook and issue a new secret. Needs Admin access. |
| `POST` | `/api/v1/visual-pipelines/{id}/webhook/disable` | Disable the webhook and revoke the secret. Needs Admin access. |
| `POST` | `/api/v1/webhooks/{pipelineId}?secret={secret}` | Start a run with a payload. No token; the secret authenticates. |
| `GET` | `/api/v1/visual-pipelines/{id}/stream` | Stream settings and secret. |
| `POST` | `/api/v1/visual-pipelines/{id}/stream/enable` | Enable buffered streaming. Needs Admin access. |
| `POST` | `/api/v1/visual-pipelines/{id}/stream/disable` | Disable streaming and drop buffered events. Needs Admin access. |
| `POST` | `/api/v1/streams/{pipelineId}?secret={secret}` | Send events to a stream. No token; the secret authenticates. |

See [Triggers and webhooks](/docs/pipelines/triggers-and-webhooks#webhooks) for payload formats, responses and how the pipeline reads the data.

## Pipeline triggers

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/pipeline-triggers` | List all triggers in the environment. |
| `GET` | `/api/v1/pipeline-triggers/pipeline/{pipelineId}` | List triggers where a pipeline is the source or the target. |
| `POST` | `/api/v1/pipeline-triggers` | Create a trigger. Body: `source_pipeline_id`, `target_pipeline_id`. |
| `PATCH` | `/api/v1/pipeline-triggers/{triggerId}` | Enable or disable. Body: `{"enabled": true}` or `{"enabled": false}`. |
| `DELETE` | `/api/v1/pipeline-triggers/{triggerId}` | Delete a trigger. |

Creating a trigger that would form a loop returns `400`, and a duplicate returns `409`.

## Dashboards

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/bi/dashboards` | List dashboards. Query: `q` (name search) and `limit` (up to 200). |
| `POST` | `/api/v1/bi/dashboards` | Create a dashboard. Body: `name`, `spec`, and optionally `description`, `is_published`, `pipeline_id`. |
| `GET` | `/api/v1/bi/dashboards/{id}` | Get a dashboard by id or slug, including its spec. |
| `PUT` | `/api/v1/bi/dashboards/{id}` | Update a dashboard. |
| `DELETE` | `/api/v1/bi/dashboards/{id}` | Delete a dashboard. Returns `204`. Needs Admin access. |
| `POST` | `/api/v1/bi/dashboards/{id}/share` | Turn public sharing on or off. Body: `{"enable": true}` or `{"enable": false}`. Returns `is_public`, `share_token` and `share_url`. Needs Admin access. |
| `GET` | `/api/v1/bi/shared/{shareToken}` | Read a publicly shared dashboard. No token needed. |
| `GET` | `/api/v1/bi/favorites` | Your favourite dashboards in this environment. |
| `POST` | `/api/v1/bi/dashboards/{id}/favorite` | Add a dashboard to your favourites, or remove it if it is already one. |
| `POST` | `/api/v1/bi/dashboards/default` | Set the dashboard you see first. Body: `{"dashboard_id": "..."}`, or `{"dashboard_id": null}` to clear it. |

> **Warning:** Anyone with a shared dashboard's `share_url` can read it without signing in. Turn sharing off with `{"enable": false}` when it is no longer needed.

Dashboards built from a pipeline file are kept up to date by `solidafy pipelines push` and `solidafy dashboard push`; see [Dashboards overview](/docs/dashboards/overview).

## Data sources

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/data-sources` | List data sources. |
| `POST` | `/api/v1/data-sources` | Create a data source. |
| `GET` | `/api/v1/data-sources/{id}` | Get a data source. Sensitive config values come back as `[ENCRYPTED]`. |
| `PATCH` | `/api/v1/data-sources/{id}` | Update its name, description or config. |
| `DELETE` | `/api/v1/data-sources/{id}` | Delete a data source. Needs Admin access. |
| `POST` | `/api/v1/data-sources/{id}/test-connection` | Test the connection with the stored credentials. |
| `POST` | `/api/v1/data-sources/validate` | Test the connection of every data source you can read, in one call. Returns a result for each; one failing source doesn't fail the rest. |

### Create a data source

```bash
curl -X POST https://api.solidafy.com/api/v1/data-sources \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "GitHub",
    "connector_type": "github-graphql",
    "config": {"access_token": "ghp_...", "org": "my-org"},
    "streams": {},
    "namespace": "github_graphql"
  }'
```

`config` holds the connector's config fields, all as strings; sensitive fields are encrypted when stored. `namespace` may contain letters, digits, `_`, `.` and `-`. The response includes the new data source's `id`, which is what a pipeline's connector step uses as `data_source_id`. See [Connectors](/docs/pipelines/connectors).

## Connector catalog

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/registry/connectors` | List the connectors you can use. |
| `GET` | `/api/v1/registry/connectors/{name}` | One connector's details: streams, config fields, authentication. |
| `GET` | `/api/v1/registry/connectors/{name}/spec` | The connector's specification. |
| `GET` | `/api/v1/registry/connectors/{name}/config` | The connector's default configuration. |
| `GET` | `/api/v1/registry/pipelines` | List pipeline templates. |
| `GET` | `/api/v1/registry/pipelines/{name}` | One pipeline template. |

## Tables (catalog)

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/catalog/namespaces` | List namespaces. |
| `GET` | `/api/v1/catalog/namespaces/{namespace}/tables` | List the tables in a namespace. |
| `GET` | `/api/v1/catalog/all-tables` | Every table in every namespace, with columns. |
| `GET` | `/api/v1/catalog/namespaces/{namespace}/tables/{table}` | One table's schema and metadata. |
| `DELETE` | `/api/v1/catalog/namespaces/{namespace}/tables/{table}` | Delete a table. Needs Admin access to the table. |
| `DELETE` | `/api/v1/catalog/namespaces/{namespace}` | Delete a namespace. Needs Admin access to the namespace. |

> **Warning:** Deleting a table or namespace removes its data permanently.

## Data policies

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/catalog/policies` | List policies. Query filters: `namespace`, `table_name`, `target_type`, `target_id`, `enabled`. |
| `GET` | `/api/v1/catalog/policies/{id}` | Get one policy. |
| `POST` | `/api/v1/catalog/policies` | Create a policy. |
| `PUT` | `/api/v1/catalog/policies/{id}` | Update a policy. |
| `DELETE` | `/api/v1/catalog/policies/{id}` | Delete a policy. |

```bash
curl -X POST https://api.solidafy.com/api/v1/catalog/policies \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "namespace": "scout",
    "table_name": "pull_requests",
    "filter_dsl": "team == \"Frontend\"",
    "target_type": "security_group",
    "target_id": "SECURITY_GROUP_ID",
    "description": "Frontend sees its own pull requests"
  }'
```

`target_type` is `security_group` (with the group's id) or `user` (with the person's email). See [Data policies](/docs/access/security#data-policies-row-level-security) for the filter syntax and how policies combine.

## Security groups

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/security-groups` | List the environment's groups. |
| `GET` | `/api/v1/security-groups/{id}` | One group with its members and grants. |
| `POST` | `/api/v1/security-groups` | Create a group. Body: `name`, optional `description`. |
| `PUT` | `/api/v1/security-groups/{id}` | Update a group. |
| `DELETE` | `/api/v1/security-groups/{id}` | Delete a group. The default group can't be deleted. |
| `POST` | `/api/v1/security-groups/{id}/members` | Add a member. Body: `user_id`, and `force: true` to move someone who is already in another group. |
| `POST` | `/api/v1/security-groups/{id}/members/remove` | Remove a member. Body: `user_id`. |
| `PUT` | `/api/v1/security-groups/{id}/policies` | Add or change a grant. Body: `resource_type`, `resource_id` (an id, or `*` for all), `access_level` (`read`, `write` or `admin`). |
| `DELETE` | `/api/v1/security-groups/{id}/policies` | Remove a grant. |
| `GET` | `/api/v1/security-groups/resolve` | Your own effective access in the environment. |

`resource_type` is one of `dashboard`, `pipeline`, `data_source`, `notebook`, `namespace`, `table`, `report`, `liveboard` or `mcp_tool` (curated views). Managing groups needs the owner or admin role. See [Security groups](/docs/access/security#security-groups).

## Notification channels

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/notification-channels` | List channels. |
| `GET` | `/api/v1/notification-channels/{id}` | Get one channel. |
| `POST` | `/api/v1/notification-channels` | Create a channel. Body: `name`, `handler`, `type`, `config`. |
| `PUT` | `/api/v1/notification-channels/{id}` | Update a channel. |
| `PATCH` | `/api/v1/notification-channels/{id}/toggle` | Switch a channel between enabled and disabled. |
| `DELETE` | `/api/v1/notification-channels/{id}` | Delete a channel. |

`type` is `email` (`config`: `{"recipients": ["..."]}`), `slack` (`config`: `{"webhook_url": "..."}`) or `internal_users` (`config`: `{"user_ids": ["..."]}`). `handler` is lowercase letters, digits and hyphens, such as `data-alerts`.

## Operators

[Operators](/docs/operators/overview) are AI workers in one environment that answer questions from your curated views. These routes need the Operators permission (owners, admins and engineers by default), and your organisation must have Operators turned on by Solidafy.

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/operators` | List the environment's operators. |
| `POST` | `/api/v1/operators` | Create an operator. It starts paused. |
| `GET` | `/api/v1/operators/{id}` | Get one operator. |
| `PUT` | `/api/v1/operators/{id}` | Update an operator, including `enabled` to turn it on or pause it. |
| `DELETE` | `/api/v1/operators/{id}` | Delete an operator and revoke its key. |
| `POST` | `/api/v1/operators/{id}/ask` | Ask a question and wait for the answer. Body: `question` (up to 4,000 characters), and `session_id` to continue a conversation. |
| `GET` | `/api/v1/operators/{id}/conversations` | The operator's conversations, most recently active first. |
| `GET` | `/api/v1/operators/{id}/runs` | The operator's runs, newest first. Query: `limit` (1 to 100, default 20) and `offset`. |
| `GET` | `/api/v1/operators/runs` | The most recent runs across every operator in the environment. |

`ask` returns `409` while the same conversation is still answering a question, or when the operator is already busy with as many conversations as it can handle at once.

## Operator schedules

Schedules ask one or more operators a standing question on a clock or when pipelines finish. They need the same permission as operators. See [Operators](/docs/operators/overview).

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/operator-schedules` | List the environment's schedules, with the operators they ask and when they next run. |
| `POST` | `/api/v1/operator-schedules` | Create a schedule. A name that is already taken returns `409`. |
| `GET` | `/api/v1/operator-schedules/{id}` | Get one schedule. |
| `PATCH` | `/api/v1/operator-schedules/{id}` | Change a schedule. |
| `DELETE` | `/api/v1/operator-schedules/{id}` | Delete a schedule. The runs it produced are kept. |

## Environments

| Method | Path | Purpose |
| --- | --- | --- |
| `GET` | `/api/v1/environments` | List the environments you belong to. |
| `GET` | `/api/v1/environments/{id}` | Get one environment. |

## Running DSL

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/dsl/query` | Run a read-only query and get the rows back. |
| `POST` | `/api/v1/dsl/write` | Run a query that writes (ends in `.output()`) and wait for it to finish. Needs the engineer role or higher. |
| `POST` | `/api/v1/dsl-jobs` | Queue a write as a background job. Returns `202` with a run id. Needs the engineer role or higher. |
| `GET` | `/api/v1/dsl-jobs/{runId}` | Check on a background job. |

### Query

```bash
curl -X POST https://api.solidafy.com/api/v1/dsl/query \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{"sql": "source(\"gh.pull_requests\").group_by([repo]).agg([count() as prs]).sort([prs: desc]).limit(3)"}'
```

The DSL goes in the `sql` field. `timeout_ms` is optional (default 60000, minimum 1000, maximum 110000); a value outside that range is rejected with `422`. The response:

```json
{
  "columns": ["repo", "prs"],
  "rows": [
    { "repo": "api", "prs": 412 },
    { "repo": "web", "prs": 287 },
    { "repo": "cli", "prs": 95 }
  ],
  "rowCount": 3
}
```

Data policies apply, so the rows are the ones you are allowed to see. When a query fails, the response says why, either in an `error` field or as a `400`.

### Write

`POST /api/v1/dsl/write` takes the DSL in a field named `dsl` (not `sql`), runs it, and answers `{"ok": true}` once it has finished:

```bash
curl -X POST https://api.solidafy.com/api/v1/dsl/write \
  -H "Authorization: Bearer $SOLIDAFY_PAT" \
  -H "Content-Type: application/json" \
  -d '{"dsl": "source(\"gh.pull_requests\").output(\"gh.pull_requests_snapshot\", mode: replace)"}'
```

### Background writes

`POST /api/v1/dsl-jobs` takes `dsl` (up to 100,000 characters) and an optional `name`, and returns the run id to poll:

```json
{ "id": "1b2c3d4e-0000-0000-0000-000000000000", "status": "queued", "created_at": "2026-10-01T09:00:00.000Z" }
```

`GET /api/v1/dsl-jobs/{runId}` returns the job's `status` (it is done at `completed`, `failed`, `cancelled` or `partial`), `error_message`, `rows_written` and `output_tables`. An environment can have up to 5 background jobs in flight; a sixth returns `409`.

Both write endpoints accept an optional `environment_id`. When you send it, the request is refused with `409` unless it matches your token's environment, which protects a script from writing to the wrong place.
