# Triggers API

> The triggers endpoints, each in TypeScript, Python, the CLI and curl.

The triggers endpoints, each in TypeScript, Python, the CLI and curl.

## Set up

* TypeScript

  ```bash
  npm install @reminix/sdk
  export REMINIX_API_KEY="<your API key>"
  ```

* Python

  ```bash
  pip install reminix
  export REMINIX_API_KEY="<your API key>"
  ```

* CLI

  ```bash
  npm install -g @reminix/cli
  reminix login
  ```

* curl

  ```bash
  export REMINIX_API_KEY="<your API key>"
  ```

To pass the key yourself, use `createClient({ apiKey: key })` in TypeScript or `Reminix(api_key=key)` in Python.

## List a script’s triggers

`GET /v1/scripts/{slug}/triggers`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/GET/scripts/{slug}/triggers)

Scope: `scripts:read`.

Lists a script’s triggers, which are the events that start it.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const triggers = await reminix.triggers.list("alert-on-failure");
  console.log(triggers);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  triggers = reminix.triggers.list("alert-on-failure")
  print(triggers)
  ```

* CLI

  ```bash
  reminix triggers list alert-on-failure
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/alert-on-failure/triggers" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
      "name": "Nightly sync failed",
      "type": "event",
      "environment": "production",
      "event": "run.failed",
      "filter": {
        "script.slug": "nightly-sync"
      },
      "inputs": {
        "runId": "{{event.data.runId}}",
        "error": "{{event.data.error}}"
      },
      "inputMode": null,
      "lockedInputs": null,
      "signature": null,
      "enabled": true,
      "disabledReason": null,
      "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
      "lastRunAt": "2026-10-05T02:10:00.000Z"
    }
  ],
  "nextCursor": null
}
```

| Field                         | Description                                     |
| ----------------------------- | ----------------------------------------------- |
| `slug` string, path, required | The slug's ID.                                  |
| `limit` number, query         | Items per page, 1–100 (default 25).             |
| `cursor` string, query        | Opaque token from a previous page's nextCursor. |

## Run a script when something happens

`POST /v1/scripts/{slug}/triggers`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/POST/scripts/{slug}/triggers)

Scope: `scripts:write`.

Creates a trigger that starts a run of the script, as you.

This takes a [personal access token](/docs/authentication/), not an API key. In the SDKs, pass it as `token`, with `workspace`.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  const reminix = createClient({ token: process.env.REMINIX_TOKEN, workspace: "<workspace>" });
  const trigger = await reminix.triggers.create("alert-on-failure", {
    type: "event",
    name: "Nightly sync failed",
    event: "run.failed",
    filter: {
      "script.slug": "nightly-sync",
    },
    inputs: {
      runId: "{{event.data.runId}}",
      error: "{{event.data.error}}",
    },
    inputMode: "request",
    lockedInputs: [
      "account",
    ],
    signature: "stripe",
    signingSecret: "whsec_…",
  });
  console.log(trigger);
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"], workspace="<workspace>")
  trigger = reminix.triggers.create(
      "alert-on-failure",
      type="event",
      name="Nightly sync failed",
      event="run.failed",
      filter={"script.slug": "nightly-sync"},
      inputs={
          "runId": "{{event.data.runId}}",
          "error": "{{event.data.error}}",
      },
      input_mode="request",
      locked_inputs=["account"],
      signature="stripe",
      signing_secret="whsec_…",
  )
  print(trigger)
  ```

* CLI

  ```bash
  reminix triggers create \
    alert-on-failure \
    --type event \
    --name 'Nightly sync failed' \
    --event run.failed \
    --filter '{"script.slug":"nightly-sync"}' \
    --inputs '{"runId":"{{event.data.runId}}","error":"{{event.data.error}}"}' \
    --input-mode request \
    --locked-input account \
    --signature stripe \
    --signing-secret 'whsec_…'
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/alert-on-failure/triggers" \
    -H "Authorization: Bearer $REMINIX_TOKEN" \
    -H "X-Workspace: <workspace>" \
    -H "Content-Type: application/json" \
    -d '{"type":"event","name":"Nightly sync failed","event":"run.failed","filter":{"script.slug":"nightly-sync"},"inputs":{"runId":"{{event.data.runId}}","error":"{{event.data.error}}"},"inputMode":"request","lockedInputs":["account"],"signature":"stripe","signingSecret":"whsec_…"}'
  ```

**Returns:**

```json
{
  "id": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  "name": "Nightly sync failed",
  "type": "event",
  "environment": "production",
  "event": "run.failed",
  "filter": {
    "script.slug": "nightly-sync"
  },
  "inputs": {
    "runId": "{{event.data.runId}}",
    "error": "{{event.data.error}}"
  },
  "inputMode": null,
  "lockedInputs": null,
  "signature": null,
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "lastRunAt": "2026-10-05T02:10:00.000Z",
  "secret": "q8Vd3…",
  "url": "https://api.reminix.com/webhooks/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470/q8Vd3…"
}
```

| Field                         | Description                                                                                                                                                                                                                                |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `slug` string, path, required | The slug's ID.                                                                                                                                                                                                                             |
| `type` string, required       | A workspace event starts the runs.                                                                                                                                                                                                         |
| `name` string, required       | A name for the trigger, shown in the app.                                                                                                                                                                                                  |
| `event` string                | The event that starts a run. It can be any webhook event type, such as `run.failed`.                                                                                                                                                       |
| `filter` object               | Event data fields, as dotted paths, that must equal these values.                                                                                                                                                                          |
| `inputs` object               | The script's inputs for each run, by name. A value like "{{event.data.\<path>}}" takes its value from the event.                                                                                                                           |
| `environment` string          | The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment.                                                                                                                     |
| `inputMode` string            | Where each run's inputs come from. `fixed`, the default, uses the saved `inputs` and ignores the body. `call` takes the body's fields that match the script's inputs. `request` gives the script the whole request as its `request` input. |
| `lockedInputs` array          | Saved inputs that a call can't change.                                                                                                                                                                                                     |
| `signature` string            | Check each call's signature: `stripe` (Stripe-Signature) or `github` (X-Hub-Signature-256). The default is `none`.                                                                                                                         |
| `signingSecret` string        | The provider's signing secret, with `signature` `stripe` or `github`. Reminix stores it encrypted and never returns it.                                                                                                                    |

More about this endpoint

With the type `event`, a run starts when an event of `event` happens in the workspace and its data matches `filter`. GET /v1/workspace/event-types lists the event types. The run starts within about a minute of the event, and a chain of triggered runs stops after 3. With the type `webhook`, a run starts when someone calls the trigger’s URL with its secret. The response carries the URL and the secret once. Only the script’s owner, or a workspace owner or admin, can create a webhook trigger, and its runs wait for approval where an agent’s would. For an event trigger, if every run of the script or of the environment needs approval, only workspace owners and admins can create it.

## Get a trigger

`GET /v1/scripts/{slug}/triggers/{triggerId}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/GET/scripts/{slug}/triggers/{triggerId})

Scope: `scripts:read`.

Returns one of a script’s triggers.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const trigger = await reminix.triggers.get("alert-on-failure", "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470");
  console.log(trigger);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  trigger = reminix.triggers.get(
      "alert-on-failure",
      "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  )
  print(trigger)
  ```

* CLI

  ```bash
  reminix triggers get \
    alert-on-failure \
    trg_6a2e4a00-bdcf-4035-85b7-544eab30f470
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/alert-on-failure/triggers/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "id": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  "name": "Nightly sync failed",
  "type": "event",
  "environment": "production",
  "event": "run.failed",
  "filter": {
    "script.slug": "nightly-sync"
  },
  "inputs": {
    "runId": "{{event.data.runId}}",
    "error": "{{event.data.error}}"
  },
  "inputMode": null,
  "lockedInputs": null,
  "signature": null,
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "lastRunAt": "2026-10-05T02:10:00.000Z"
}
```

| Field                              | Description       |
| ---------------------------------- | ----------------- |
| `slug` string, path, required      | The slug's ID.    |
| `triggerId` string, path, required | The trigger's ID. |

More about this endpoint

A webhook trigger’s secret is never returned again after it is made or rotated.

## Change a trigger

`PATCH /v1/scripts/{slug}/triggers/{triggerId}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/PATCH/scripts/{slug}/triggers/{triggerId})

Scope: `scripts:write`.

Changes a trigger’s name, inputs or environment, or whether it’s enabled.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const trigger = await reminix.triggers.update("alert-on-failure", "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470", {
    filter: {
      "script.slug": "nightly-sync",
    },
    inputs: {
      runId: "{{event.data.runId}}",
      error: "{{event.data.error}}",
    },
  });
  console.log(trigger);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  trigger = reminix.triggers.update(
      "alert-on-failure",
      "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
      filter={"script.slug": "nightly-sync"},
      inputs={
          "runId": "{{event.data.runId}}",
          "error": "{{event.data.error}}",
      },
  )
  print(trigger)
  ```

* CLI

  ```bash
  reminix triggers update \
    alert-on-failure \
    trg_6a2e4a00-bdcf-4035-85b7-544eab30f470 \
    --filter '{"script.slug":"nightly-sync"}' \
    --inputs '{"runId":"{{event.data.runId}}","error":"{{event.data.error}}"}'
  ```

* curl

  ```bash
  curl -X PATCH "https://api.reminix.com/v1/scripts/alert-on-failure/triggers/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470" \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"filter":{"script.slug":"nightly-sync"},"inputs":{"runId":"{{event.data.runId}}","error":"{{event.data.error}}"}}'
  ```

**Returns:**

```json
{
  "id": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  "name": "Nightly sync failed",
  "type": "event",
  "environment": "production",
  "event": "run.failed",
  "filter": {
    "script.slug": "nightly-sync"
  },
  "inputs": {
    "runId": "{{event.data.runId}}",
    "error": "{{event.data.error}}"
  },
  "inputMode": null,
  "lockedInputs": null,
  "signature": null,
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "lastRunAt": "2026-10-05T02:10:00.000Z"
}
```

| Field                              | Description                                                                                                      |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `slug` string, path, required      | The slug's ID.                                                                                                   |
| `triggerId` string, path, required | The trigger's ID.                                                                                                |
| `name` string                      | A name for the trigger, shown in the app.                                                                        |
| `filter` object                    | Event data fields, as dotted paths, that must equal these values.                                                |
| `inputs` object                    | The script's inputs for each run, by name. A value like "{{event.data.\<path>}}" takes its value from the event. |
| `enabled` boolean                  | Whether the trigger starts runs. With `false`, it's disabled.                                                    |
| `environment` string               | Another environment for the trigger's runs to use.                                                               |
| `inputMode` string                 | A webhook trigger's input mode.                                                                                  |
| `lockedInputs` array               | A webhook trigger's saved inputs that a call can't change.                                                       |
| `signature` string                 | A webhook trigger's signature check.                                                                             |
| `signingSecret` string             | A new signing secret, with `signature` `stripe` or `github`.                                                     |

More about this endpoint

It also changes an event trigger’s filter, or a webhook trigger’s input mode, locked inputs and signature check. Changing the signature check needs its signing secret again. The creator of an event trigger, a webhook trigger’s script owner, a workspace owner or admin, or a workspace API key can change it.

## Delete a trigger

`DELETE /v1/scripts/{slug}/triggers/{triggerId}`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/DELETE/scripts/{slug}/triggers/{triggerId})

Scope: `scripts:write`.

Deletes a trigger.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  await reminix.triggers.delete("alert-on-failure", "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470");
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  reminix.triggers.delete(
      "alert-on-failure",
      "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  )
  ```

* CLI

  ```bash
  reminix triggers delete \
    alert-on-failure \
    trg_6a2e4a00-bdcf-4035-85b7-544eab30f470 \
    --yes
  ```

* curl

  ```bash
  curl -X DELETE "https://api.reminix.com/v1/scripts/alert-on-failure/triggers/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns** nothing (`204`).

| Field                              | Description       |
| ---------------------------------- | ----------------- |
| `slug` string, path, required      | The slug's ID.    |
| `triggerId` string, path, required | The trigger's ID. |

More about this endpoint

The creator of an event trigger, a webhook trigger’s script owner, a workspace owner or admin, or a workspace API key can delete it.

## Rotate a webhook trigger’s secret

`POST /v1/scripts/{slug}/triggers/{triggerId}/rotate-secret`[ Try it in the API playground (opens in a new tab)](https://api.reminix.com/v1/docs#tag/triggers/POST/scripts/{slug}/triggers/{triggerId}/rotate-secret)

Scope: `scripts:write`.

Gives a webhook trigger a new secret and returns its new URL, this once.

* TypeScript

  ```ts
  import { createClient } from "@reminix/sdk";

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const result = await reminix.triggers.rotateSecret("alert-on-failure", "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470");
  console.log(result);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  result = reminix.triggers.rotate_secret(
      "alert-on-failure",
      "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  )
  print(result)
  ```

* CLI

  ```bash
  reminix triggers rotate-secret \
    alert-on-failure \
    trg_6a2e4a00-bdcf-4035-85b7-544eab30f470 \
    --yes
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/alert-on-failure/triggers/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470/rotate-secret" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "id": "trg_6a2e4a00-bdcf-4035-85b7-544eab30f470",
  "name": "Nightly sync failed",
  "type": "event",
  "environment": "production",
  "event": "run.failed",
  "filter": {
    "script.slug": "nightly-sync"
  },
  "inputs": {
    "runId": "{{event.data.runId}}",
    "error": "{{event.data.error}}"
  },
  "inputMode": null,
  "lockedInputs": null,
  "signature": null,
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "lastRunAt": "2026-10-05T02:10:00.000Z",
  "secret": "q8Vd3…",
  "url": "https://api.reminix.com/webhooks/trg_6a2e4a00-bdcf-4035-85b7-544eab30f470/q8Vd3…"
}
```

| Field                              | Description       |
| ---------------------------------- | ----------------- |
| `slug` string, path, required      | The slug's ID.    |
| `triggerId` string, path, required | The trigger's ID. |

More about this endpoint

The old URL stops working at once. If Reminix disabled the trigger, such as after repeated refused calls, rotating enables it again. The script’s owner, a workspace owner or admin, or a workspace API key can rotate it.
