---
title: "Triggers"
description: "REST endpoints for triggers. Bearer-auth required."
section: "API"
group: "REST"
order: 74
---

## GET /api/triggers

List triggers.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `workspace_id` (optional): Filter listeners to this workspace.
- `target_id` (optional): Filter to listeners bound to this target entity ID.
- `include_deleted` (optional): Soft-deleted trigger visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only (trash view).
- `source` (optional): Narrow by source. `workspace` = this workspace's rows plus those visible via installed integrations; `integration` = only rows made visible by installed integrations; omit = union.
- `enabled` (optional): Shorthand: filter where `enabled` equals this value.
- `created_by` (optional): Shorthand: filter where `createdBy` equals this value.
- `runtime_user_id` (optional): Shorthand: filter where `runtimeUserId` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "eventType": "<...>",
      "targetId": "<...>",
      "subjectId": "<...>",
      "filter": "<...>",
      "enabled": "<...>",
      "createdBy": "<...>",
      "runtimeUserId": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/triggers

Create trigger

**Request body**

```json
{
  "workspaceId": "string",
  "eventType": "string",
  "targetId": "any",
  "subjectId?": "string",
  "filter?": {}
}
```

**Response**

```json
{
  "data": {
    "id": "string",
    "workspaceId": "string",
    "eventType": "string",
    "targetId": "any",
    "subjectId": "string",
    "filter": "<...>",
    "enabled": "boolean",
    "createdBy": "string",
    "runtimeUserId": "string",
    "createdAt": "string",
    "updatedAt": "string"
  }
}
```

## GET /api/triggers/{id}

Get a trigger by ID.

**Path parameters**

- `id` (required): Listener to retrieve.

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "eventType": "string",
  "targetId": "any",
  "subjectId": "string",
  "filter": {},
  "enabled": "boolean",
  "createdBy": "string",
  "runtimeUserId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/triggers/{id}

Update trigger

**Path parameters**

- `id` (required): The trigger's prefixed ID.

**Request body**

```json
{
  "eventType?": "string",
  "enabled?": "boolean",
  "filter?": {},
  "runtimeUserId?": "string"
}
```

**Response**

```json
{
  "data": {
    "id": "string",
    "workspaceId": "string",
    "eventType": "string",
    "targetId": "any",
    "subjectId": "string",
    "filter": "<...>",
    "enabled": "boolean",
    "createdBy": "string",
    "runtimeUserId": "string",
    "createdAt": "string",
    "updatedAt": "string"
  }
}
```

## DELETE /api/triggers/{id}

Soft-delete a trigger.

**Path parameters**

- `id` (required): Listener to soft-delete.

**Response**

```json
{
  "success": "boolean"
}
```

## DELETE /api/triggers/{id}/purge

Permanently delete a soft-deleted trigger.

**Path parameters**

- `id` (required): Soft-deleted listener to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/triggers/{id}/restore

Restore a soft-deleted trigger.

**Path parameters**

- `id` (required): Soft-deleted listener to restore.

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "eventType": "string",
  "targetId": "any",
  "subjectId": "string",
  "filter": {},
  "enabled": "boolean",
  "createdBy": "string",
  "runtimeUserId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```
