# API overview

> Authenticate with an API key or OAuth, call the endpoints and handle errors.

The Pulso API lets your systems send events to Pulso and work with an account as its members do: triage signals, complete tasks, build monitors, their playbooks, forms and webhook sources, and query data sources. AI assistants reach the same actions through [MCP](https://pulso.run/docs/api/mcp.md).

| Endpoints | Page |
|---|---|
| `POST /webhooks/:id/:token` (token in the URL) | [Data source webhooks](https://pulso.run/docs/api/data-source-webhooks.md) |
| `/api/v1/signals…` | [Signals](https://pulso.run/docs/api/signals.md) |
| `/api/v1/tasks…` | [Tasks](https://pulso.run/docs/api/tasks.md) |
| `/api/v1/monitors…` | [Monitors](https://pulso.run/docs/api/monitors.md) |
| `/api/v1/monitors/:id/playbook`, `/playbook_templates…`, `/playbook_step_types` | [Playbooks](https://pulso.run/docs/api/playbooks.md) |
| `/api/v1/data_sources…` | [Data source queries](https://pulso.run/docs/api/data-source-queries.md) |
| `/api/v1/forms…` | [Forms](https://pulso.run/docs/api/forms.md) |
| `/api/v1/webhook_sources…` | [Data source webhooks](https://pulso.run/docs/api/data-source-webhooks.md) |
| `/api/v1/members`, `/teams`, `/categories` | [Account](https://pulso.run/docs/api/account.md) |

`https://pulso.run/api/v1/openapi.json` describes every endpoint as OpenAPI 3.1, for generating a client or importing into Postman.

## Base URL

The API lives under `https://pulso.run/api/v1`, for example `https://pulso.run/api/v1/signals`.

## Who a call acts as

Every call acts as a member of the account, and can do no more than their role allows: a viewer's key reads but can't resolve a signal, as in the app. `for_me` filters mean that member, and the audit log (**Settings → Audits**) records the changes under their name, with the key or app they came through.

There are two ways to authenticate:

- **An API key**, for scripts and tools you set up yourself. It acts as the member who created it.
- **OAuth**, for apps that act for whoever connects them, such as an [AI assistant](https://pulso.run/docs/api/mcp.md). Each member connects in their own name, and picks the account.

If that member leaves the account, the key or connection stops working.

## Permissions

Keys and connections carry permissions. Each reaches every record of its kind in the account, within what the member's role allows.

| Permission | Lets it |
|---|---|
| `signals:read` | List and read signals, with their playbook and comments. |
| `signals:write` | Change a signal's status and priority, assign it and comment on it. |
| `tasks:read` | List and read tasks. |
| `tasks:write` | Complete and assign tasks. |
| `monitors:read` | List and read monitors, their playbooks and playbook templates. |
| `monitors:write` | Create and change monitors, their playbooks and playbook templates, switch monitors on and off, and try playbook scripts. |
| `data_sources:list` | List the account's data sources and read their forms. |
| `data_sources:write` | Create and change forms and webhook sources. |
| `data_sources:read_queries` | Read the SQL and fields that the data sources' monitors and saved queries use. |
| `data_sources:query` | Read a SQL data source's schema and run read-only queries on it. |
| `account:read` | List the account's members, teams and categories. |

## API keys

Keys are under **Settings → API keys**, or **Create an API key** on **Settings → Connected apps**. Admins can create them, and so can other members when an admin ticks **Members who aren't admins can connect apps and create API keys** in the account's settings; unticking it stops their keys. Each member sees and manages their own keys; admins see and revoke everyone's.

### Create a key

1. Click **Add API key** and fill in:
   - **Name**: who uses it, for example "the CI of the payments database".
   - **Permissions**: what the key can do. Give it only what the script needs.
   - **Expires at** (optional): the key stops working on this date. Leave it blank to keep it working.
2. Click **Create API key**.
3. Copy the key. It starts with `ak_` and is shown only once.

The key's page shows its masked prefix, when it was last used and when it expires. From there you can:

- **Edit** its name, permissions and expiry.
- **Regenerate** it: the current key stops working and you get a new one to copy.
- **Revoke** it: anything using it stops working.

### Authenticate

Send the key as a bearer token:

```bash
curl https://pulso.run/api/v1/signals \
  -H "Authorization: Bearer ak_..."
```

## OAuth

Pulso is an OAuth 2.1 authorization server: authorization code with PKCE (`S256`), for public clients. Apps find it from `https://pulso.run/.well-known/oauth-authorization-server`, and can register themselves at `POST /oauth/register` ([RFC 7591](https://www.rfc-editor.org/rfc/rfc7591)), which is how MCP clients connect without anyone creating an app first.

On the consent screen the member picks the account and sees where Pulso will send them back. Access tokens last an hour and come with a refresh token. Requested scopes are the permissions above; without any, the app asks for all of them.

Each member sees the apps they connected under **Settings → Connected apps**, and can disconnect them there. Admins see and disconnect everyone's.

[Connect an app with OAuth](https://pulso.run/docs/api/oauth.md) goes through it step by step.

## Lists

Lists come newest first, 25 at a time, under the resource's name, with a `next_cursor`:

```json
{ "signals": [ … ], "next_cursor": "01M806EYYCSC4EC2WVX27CJV50" }
```

Pass it as `cursor` for the next page, until `next_cursor` is `null`. `limit` sets the page size, up to 100.

Times are ISO 8601 in UTC, and ids are strings.

## Writes

Writes take a JSON body (`Content-Type: application/json`) and answer with the record as it is afterwards.

A `POST` may carry an `Idempotency-Key` header, any string up to 255 characters, such as a UUID. Retrying the request with the same key within a day returns the first response instead of acting twice. The same key with a different request answers `422`.

## Errors

Errors come as JSON with an `error` message:

```json
{ "error": "Unauthorized" }
```

| Status | When |
|---|---|
| `401` | The key or token is missing, wrong, revoked or expired, or its member left the account. |
| `403` | The key or connection lacks the permission, for example `This key or connection lacks the signals:write permission`, or the member's role doesn't allow it. |
| `404` | The path or the record doesn't exist, or belongs to another account. |
| `409` | The record's state doesn't allow it, for example completing a task that is already done. |
| `422` | A parameter isn't valid. `errors` says which: `{ "error": "Invalid parameters", "errors": { "status": ["must be one of …"] } }`. |
| `429` | Too many requests. The limit is 60 requests per minute per key or token, for the API and MCP each. |
