# Schedules API

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

The schedules 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 schedules

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

Scope: `scripts:read`.

Lists a script’s schedules, with when each one runs next.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const schedules = await reminix.schedules.list("monthly-report");
  console.log(schedules);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  schedules = reminix.schedules.list("monthly-report")
  print(schedules)
  ```

* CLI

  ```bash
  reminix schedules list monthly-report
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/monthly-report/schedules" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
      "name": "First of the month",
      "environment": "production",
      "cron": "0 8 1 * *",
      "timezone": "Europe/Berlin",
      "inputs": {},
      "enabled": true,
      "disabledReason": null,
      "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
      "nextRunAt": "2026-11-01T07:00:00.000Z",
      "lastRunAt": "2026-10-01T06:00:00.000Z",
      "lastRunId": "run_a381c8e3-9778-494f-84a4-7529ebd8009a"
    }
  ],
  "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. |

## Schedule a script

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

Scope: `scripts:write`.

Schedules the script’s published version to run on a cron in a timezone, with these inputs.

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 schedule = await reminix.schedules.create("monthly-report", {
    name: "First of the month",
    cron: "0 8 1 * *",
    timezone: "Europe/Berlin",
  });
  console.log(schedule);
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"], workspace="<workspace>")
  schedule = reminix.schedules.create(
      "monthly-report",
      name="First of the month",
      cron="0 8 1 * *",
      timezone="Europe/Berlin",
  )
  print(schedule)
  ```

* CLI

  ```bash
  reminix schedules create \
    monthly-report \
    --name 'First of the month' \
    --cron '0 8 1 * *' \
    --timezone Europe/Berlin
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/monthly-report/schedules" \
    -H "Authorization: Bearer $REMINIX_TOKEN" \
    -H "X-Workspace: <workspace>" \
    -H "Content-Type: application/json" \
    -d '{"name":"First of the month","cron":"0 8 1 * *","timezone":"Europe/Berlin"}'
  ```

**Returns:**

```json
{
  "id": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
  "name": "First of the month",
  "environment": "production",
  "cron": "0 8 1 * *",
  "timezone": "Europe/Berlin",
  "inputs": {},
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "nextRunAt": "2026-11-01T07:00:00.000Z",
  "lastRunAt": "2026-10-01T06:00:00.000Z",
  "lastRunId": "run_a381c8e3-9778-494f-84a4-7529ebd8009a"
}
```

| Field                         | Description                                                                                                            |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `slug` string, path, required | The slug's ID.                                                                                                         |
| `name` string, required       | A name for the schedule, shown in the app.                                                                             |
| `cron` string, required       | When it runs, as a cron expression (minute hour day month weekday).                                                    |
| `timezone` string             | The timezone the cron is read in. The default is UTC.                                                                  |
| `inputs` object               | The script's inputs for each run, by name.                                                                             |
| `environment` string          | The environment the runs use. The default is the request's X-Environment, or else the workspace's default environment. |

More about this endpoint

The runs act as you. The cron has 5 fields, and its runs must be at least 5 minutes apart. If every run of the script, or every run in the environment, needs approval, only workspace owners and admins can create a schedule. If you can no longer run the script, Reminix disables the schedule and sets `disabledReason`.

## Get a schedule

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

Scope: `scripts:read`.

Returns one of a script’s schedules, with when it runs next.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const schedule = await reminix.schedules.get("monthly-report", "sch_037f4852-dc5e-40c8-82a9-852a44410c85");
  console.log(schedule);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  schedule = reminix.schedules.get(
      "monthly-report",
      "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
  )
  print(schedule)
  ```

* CLI

  ```bash
  reminix schedules get \
    monthly-report \
    sch_037f4852-dc5e-40c8-82a9-852a44410c85
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/monthly-report/schedules/sch_037f4852-dc5e-40c8-82a9-852a44410c85" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "id": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
  "name": "First of the month",
  "environment": "production",
  "cron": "0 8 1 * *",
  "timezone": "Europe/Berlin",
  "inputs": {},
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "nextRunAt": "2026-11-01T07:00:00.000Z",
  "lastRunAt": "2026-10-01T06:00:00.000Z",
  "lastRunId": "run_a381c8e3-9778-494f-84a4-7529ebd8009a"
}
```

| Field                               | Description        |
| ----------------------------------- | ------------------ |
| `slug` string, path, required       | The slug's ID.     |
| `scheduleId` string, path, required | The schedule's ID. |

## Change a schedule

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

Scope: `scripts:write`.

Changes a schedule’s name, cron, timezone, 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 schedule = await reminix.schedules.update("monthly-report", "sch_037f4852-dc5e-40c8-82a9-852a44410c85", {
    cron: "0 8 1 * *",
    timezone: "Europe/Berlin",
  });
  console.log(schedule);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  schedule = reminix.schedules.update(
      "monthly-report",
      "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
      cron="0 8 1 * *",
      timezone="Europe/Berlin",
  )
  print(schedule)
  ```

* CLI

  ```bash
  reminix schedules update \
    monthly-report \
    sch_037f4852-dc5e-40c8-82a9-852a44410c85 \
    --cron '0 8 1 * *' \
    --timezone Europe/Berlin
  ```

* curl

  ```bash
  curl -X PATCH "https://api.reminix.com/v1/scripts/monthly-report/schedules/sch_037f4852-dc5e-40c8-82a9-852a44410c85" \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"cron":"0 8 1 * *","timezone":"Europe/Berlin"}'
  ```

**Returns:**

```json
{
  "id": "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
  "name": "First of the month",
  "environment": "production",
  "cron": "0 8 1 * *",
  "timezone": "Europe/Berlin",
  "inputs": {},
  "enabled": true,
  "disabledReason": null,
  "createdByUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "nextRunAt": "2026-11-01T07:00:00.000Z",
  "lastRunAt": "2026-10-01T06:00:00.000Z",
  "lastRunId": "run_a381c8e3-9778-494f-84a4-7529ebd8009a"
}
```

| Field                               | Description                                                         |
| ----------------------------------- | ------------------------------------------------------------------- |
| `slug` string, path, required       | The slug's ID.                                                      |
| `scheduleId` string, path, required | The schedule's ID.                                                  |
| `name` string                       | A name for the schedule, shown in the app.                          |
| `cron` string                       | When it runs, as a cron expression (minute hour day month weekday). |
| `timezone` string                   | The timezone the cron is read in. The default is UTC.               |
| `inputs` object                     | The script's inputs for each run, by name.                          |
| `enabled` boolean                   | Whether the schedule runs. With `false`, it's disabled.             |
| `environment` string                | Another environment for the schedule's runs to use.                 |

More about this endpoint

The schedule’s creator, a workspace owner or admin, or a workspace API key can change it.

## Delete a schedule

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

Scope: `scripts:write`.

Deletes a schedule.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  await reminix.schedules.delete("monthly-report", "sch_037f4852-dc5e-40c8-82a9-852a44410c85");
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  reminix.schedules.delete(
      "monthly-report",
      "sch_037f4852-dc5e-40c8-82a9-852a44410c85",
  )
  ```

* CLI

  ```bash
  reminix schedules delete \
    monthly-report \
    sch_037f4852-dc5e-40c8-82a9-852a44410c85 \
    --yes
  ```

* curl

  ```bash
  curl -X DELETE "https://api.reminix.com/v1/scripts/monthly-report/schedules/sch_037f4852-dc5e-40c8-82a9-852a44410c85" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

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

| Field                               | Description        |
| ----------------------------------- | ------------------ |
| `slug` string, path, required       | The slug's ID.     |
| `scheduleId` string, path, required | The schedule's ID. |

More about this endpoint

The schedule’s creator, a workspace owner or admin, or a workspace API key can delete it.
