# Versions API

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

The versions 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.

## Upload a version

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

Scope: `scripts:write`.

Uploads a new draft version of a script.

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 scriptVersion = await reminix.scriptVersions.upload("unlock-account", {
    command: "python unlock.py {email}",
    source: "H4sIAAAAAAAAA…",
    hosts: [
      "api.yourapp.com",
    ],
    secrets: {
      ADMIN_KEY: {
        host: "api.yourapp.com",
        header: "Authorization",
        format: "Bearer {secret}",
      },
    },
    timeoutSeconds: 30,
    tags: [
      "support",
      "accounts",
    ],
    name: "Unlock an account",
  });
  console.log(scriptVersion);
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"], workspace="<workspace>")
  script_version = reminix.script_versions.upload(
      "unlock-account",
      command="python unlock.py {email}",
      source="H4sIAAAAAAAAA…",
      hosts=["api.yourapp.com"],
      secrets={
          "ADMIN_KEY": {
              "host": "api.yourapp.com",
              "header": "Authorization",
              "format": "Bearer {secret}",
          },
      },
      timeout_seconds=30,
      tags=["support", "accounts"],
      name="Unlock an account",
  )
  print(script_version)
  ```

* CLI

  Day to day: `reminix upload [dir...]`. This endpoint’s own command:

  ```bash
  reminix script-versions upload \
    unlock-account \
    --command 'python unlock.py {email}' \
    --source 'H4sIAAAAAAAAA…' \
    --host api.yourapp.com \
    --secrets '{"ADMIN_KEY":{"host":"api.yourapp.com","header":"Authorization","format":"Bearer {secret}"}}' \
    --timeout-seconds 30 \
    --tag support \
    --tag accounts \
    --name 'Unlock an account'
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/unlock-account/versions" \
    -H "Authorization: Bearer $REMINIX_TOKEN" \
    -H "X-Workspace: <workspace>" \
    -H "Content-Type: application/json" \
    -d '{"command":"python unlock.py {email}","source":"H4sIAAAAAAAAA…","hosts":["api.yourapp.com"],"secrets":{"ADMIN_KEY":{"host":"api.yourapp.com","header":"Authorization","format":"Bearer {secret}"}},"timeoutSeconds":30,"tags":["support","accounts"],"name":"Unlock an account"}'
  ```

**Returns:**

```json
{
  "id": "ver_a100a559-a087-4830-8f43-2d8195030d1e",
  "version": 3,
  "command": "python unlock.py {email}",
  "install": null,
  "installLog": "pip install -r requirements.txt\nCollecting requests==2.32.3\nSuccessfully installed requests-2.32.3",
  "inputSchema": {
    "type": "object",
    "required": [
      "email"
    ],
    "properties": {
      "email": {
        "type": "string"
      }
    }
  },
  "outputSchema": null,
  "buildBytes": 1843200,
  "buildSha256": "4d7a1e9c3b5f7092e6c8a0b2d4f6183a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d",
  "timeoutSeconds": 30,
  "hosts": [
    "api.yourapp.com"
  ],
  "secrets": {
    "ADMIN_KEY": {
      "hosts": [
        "api.yourapp.com"
      ],
      "header": "Authorization",
      "format": "Bearer {secret}"
    }
  },
  "envVars": [],
  "via": "api",
  "published": false,
  "publishedAt": null,
  "createdAt": "2026-09-30T10:01:00.000Z"
}
```

| Field                         | Description                                                                                                                                                                                                                                                                                    |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `slug` string, path, required | The slug's ID.                                                                                                                                                                                                                                                                                 |
| `command` string              | The command a run executes. Each `{name}` in it is an input, and Reminix drops a part inside `[ … ]` when its inputs are empty. Reminix runs the command as arguments, never through a shell. If you leave it out, Reminix works it out from the folder, or returns 400 saying what to add.    |
| `install` string              | A command that replaces the usual install. The usual install puts Python packages from requirements.txt, or else pyproject.toml, into .deps, and installs package.json with npm. Your command runs in the folder, and it can reach the package registries.                                     |
| `inputSchema` object          | The inputs, as JSON Schema. If you leave it out, each `{name}` in the command becomes a required text input, or an optional one inside `[ … ]`. A text input with `"format": "multiline"` gets a box of several lines in the run form.                                                         |
| `outputSchema` object         | What the script returns on standard output, as JSON Schema.                                                                                                                                                                                                                                    |
| `source` string, required     | The script's folder as a .tar.gz file in base64, at most 10 MB. Leave out its dependencies, because Reminix installs them during the upload.                                                                                                                                                   |
| `hosts` array                 | The only hosts the script can reach, over HTTPS. If you leave it out, the script has no network access.                                                                                                                                                                                        |
| `secrets` object              | The secrets to attach to requests to some of `hosts`, by name. In each environment, the secret's value must allow at least one of those hosts.                                                                                                                                                 |
| `envVars` array               | Secrets the script reads as environment variables. Each secret must allow this with `allowEnvVar`.                                                                                                                                                                                             |
| `timeoutSeconds` number       | How long a run can take, in seconds. The default is 30. With more than 30, the script's runs are long runs. A long run returns 202 at once. It shows a live log and progress, and you can cancel it. Long runs need the Pro plan or above.                                                     |
| `readme` string               | The README, in Markdown. The script's page shows it while this version is the published one.                                                                                                                                                                                                   |
| `tags` array                  | If given, these become the script's tags.                                                                                                                                                                                                                                                      |
| `via` string                  | Where the upload came from, kept in the history. The default is `api`.                                                                                                                                                                                                                         |
| `create` boolean              | With `true`, creates the script if no script has this slug. The new script's name comes from `name` if you send one. Otherwise it comes from pyproject.toml or package.json, or else from the slug. By default an unknown slug returns 404 instead, which keeps a typo from creating a script. |
| `name` string                 | If given, this becomes the script's name. It applies to every upload that sends it.                                                                                                                                                                                                            |
| `description` string          | If given, this becomes the script's description, in the same way as `name`.                                                                                                                                                                                                                    |
| `publish` boolean             | With `true`, also publishes this version in the same call, exactly as Publish a version does. If publishing needs a person's approval, the response carries `approval`, and Reminix publishes the version once a person approves it.                                                           |

More about this endpoint

Send the version’s source, the command that runs it and the JSON Schema of its inputs. The source is the script’s folder as a .tar.gz file in base64, and the CLI makes it for you. If you leave out the command, Reminix works it out from the folder: the one script in pyproject.toml, the `bin`, `start` or `main` in package.json, or the folder’s one .py, .js, .ts or .sh file. If you leave out the input schema, each `{name}` in the command becomes a text input. If you leave out the README, Reminix uses the folder’s README.md. Reminix installs the dependencies from requirements.txt, pyproject.toml or package.json once, during the upload. If the install fails, the request returns 400 with what the install printed. Runs keep using the published version until you publish this one. To upload and publish in one call, pass `publish: true`, and add `create: true` for a new script.

## List a script’s versions

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

Scope: `scripts:read`.

Lists a script’s versions, newest first, and marks the published one.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const scriptVersions = await reminix.scriptVersions.list("unlock-account");
  console.log(scriptVersions);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  script_versions = reminix.script_versions.list("unlock-account")
  print(script_versions)
  ```

* CLI

  ```bash
  reminix script-versions list unlock-account
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/unlock-account/versions" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "items": [
    {
      "id": "ver_a100a559-a087-4830-8f43-2d8195030d1e",
      "version": 3,
      "command": "python unlock.py {email}",
      "install": null,
      "installLog": "pip install -r requirements.txt\nCollecting requests==2.32.3\nSuccessfully installed requests-2.32.3",
      "inputSchema": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          }
        }
      },
      "outputSchema": null,
      "buildBytes": 1843200,
      "buildSha256": "4d7a1e9c3b5f7092e6c8a0b2d4f6183a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d",
      "timeoutSeconds": 30,
      "hosts": [
        "api.yourapp.com"
      ],
      "secrets": {
        "ADMIN_KEY": {
          "hosts": [
            "api.yourapp.com"
          ],
          "header": "Authorization",
          "format": "Bearer {secret}"
        }
      },
      "envVars": [],
      "via": "api",
      "published": true,
      "publishedAt": "2026-09-30T10:02:00.000Z",
      "createdAt": "2026-09-30T10:01: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. |

More about this endpoint

Paginate with the opaque `nextCursor` token.

## Get a version

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

Scope: `scripts:read`.

Returns one version of a script, and whether it’s the published one.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const scriptVersion = await reminix.scriptVersions.get("unlock-account", 3);
  console.log(scriptVersion);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  script_version = reminix.script_versions.get("unlock-account", 3)
  print(script_version)
  ```

* CLI

  ```bash
  reminix script-versions get unlock-account 3
  ```

* curl

  ```bash
  curl -X GET "https://api.reminix.com/v1/scripts/unlock-account/versions/3" \
    -H "Authorization: Bearer $REMINIX_API_KEY"
  ```

**Returns:**

```json
{
  "id": "ver_a100a559-a087-4830-8f43-2d8195030d1e",
  "version": 3,
  "command": "python unlock.py {email}",
  "install": null,
  "installLog": "pip install -r requirements.txt\nCollecting requests==2.32.3\nSuccessfully installed requests-2.32.3",
  "inputSchema": {
    "type": "object",
    "required": [
      "email"
    ],
    "properties": {
      "email": {
        "type": "string"
      }
    }
  },
  "outputSchema": null,
  "buildBytes": 1843200,
  "buildSha256": "4d7a1e9c3b5f7092e6c8a0b2d4f6183a5c7e9b1d3f5a7c9e1b3d5f7a9c1e3b5d",
  "timeoutSeconds": 30,
  "hosts": [
    "api.yourapp.com"
  ],
  "secrets": {
    "ADMIN_KEY": {
      "hosts": [
        "api.yourapp.com"
      ],
      "header": "Authorization",
      "format": "Bearer {secret}"
    }
  },
  "envVars": [],
  "via": "api",
  "published": true,
  "publishedAt": "2026-09-30T10:02:00.000Z",
  "createdAt": "2026-09-30T10:01:00.000Z"
}
```

| Field                            | Description       |
| -------------------------------- | ----------------- |
| `slug` string, path, required    | The slug's ID.    |
| `version` number, path, required | The version's ID. |

## Publish a version

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

Scope: `scripts:write`.

Makes a version the one every run of the script uses, however the run starts.

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 result = await reminix.scriptVersions.publish("unlock-account", 3);
  console.log(result);
  ```

* Python

  ```python
  import os

  from reminix import Reminix

  reminix = Reminix(token=os.environ["REMINIX_TOKEN"], workspace="<workspace>")
  result = reminix.script_versions.publish("unlock-account", 3)
  print(result)
  ```

* CLI

  ```bash
  reminix script-versions publish unlock-account 3
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/unlock-account/versions/3/publish" \
    -H "Authorization: Bearer $REMINIX_TOKEN" \
    -H "X-Workspace: <workspace>"
  ```

**Returns:**

```json
{
  "id": "scr_6a7e78ca-5ef5-4c68-80cb-09aec047f7a3",
  "slug": "unlock-account",
  "name": "Unlock an account",
  "description": "Unlocks a customer's account after too many failed sign-ins.",
  "status": "published",
  "ownerUserId": "usr_1e21afeb-a999-46d6-8874-ae1c97c88418",
  "publishedVersion": 3,
  "access": "workspace",
  "teamIds": [],
  "approvalPolicy": "agents",
  "inputSchema": {
    "type": "object",
    "required": [
      "email"
    ],
    "properties": {
      "email": {
        "type": "string"
      }
    }
  },
  "tags": [
    "support",
    "accounts"
  ],
  "setInFile": [
    "name",
    "tags"
  ],
  "stats": {
    "runsLast30Days": 42,
    "successRate": 0.95,
    "lastRunAt": "2026-10-02T14:05:00.000Z",
    "peopleLast30Days": 6,
    "via": {
      "app": 20,
      "api": 12,
      "agent": 10
    }
  },
  "createdAt": "2026-08-19T12:00:00.000Z",
  "updatedAt": "2026-09-30T10:02:00.000Z"
}
```

| Field                            | Description       |
| -------------------------------- | ----------------- |
| `slug` string, path, required    | The slug's ID.    |
| `version` number, path, required | The version's ID. |

More about this endpoint

Publishing an older version again rolls the script back. The script owner or a workspace owner or admin can publish. When an agent connected through MCP publishes, it becomes a request that a person approves, and the call returns 202. If the workspace requires a second person to publish, everyone’s publish becomes a request like this.

## Test-run a version

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

Scope: `runs:write`.

Test-runs one version of a script with these inputs, such as a draft before it’s published.

* TypeScript

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

  // Uses the REMINIX_API_KEY environment variable.
  const reminix = createClient();
  const result = await reminix.scriptVersions.testRun("unlock-account", 3, {
    inputs: {
      email: "jane@example.com",
    },
  });
  console.log(result);
  ```

* Python

  ```python
  from reminix import Reminix

  # Uses the REMINIX_API_KEY environment variable.
  reminix = Reminix()
  result = reminix.script_versions.test_run(
      "unlock-account",
      3,
      inputs={"email": "jane@example.com"},
  )
  print(result)
  ```

* CLI

  ```bash
  reminix script-versions test-run \
    unlock-account \
    3 \
    --inputs '{"email":"jane@example.com"}'
  ```

* curl

  ```bash
  curl -X POST "https://api.reminix.com/v1/scripts/unlock-account/versions/3/runs" \
    -H "Authorization: Bearer $REMINIX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"inputs":{"email":"jane@example.com"}}'
  ```

**Returns:**

```json
{
  "id": "run_620f14ad-32e8-4f5e-89fd-1c80de7e9124",
  "script": {
    "id": "scr_6a7e78ca-5ef5-4c68-80cb-09aec047f7a3",
    "slug": "unlock-account"
  },
  "version": 3,
  "environment": "production",
  "status": "succeeded",
  "inputs": {
    "email": "jane@example.com"
  },
  "output": {
    "unlocked": true
  },
  "error": null,
  "startedBy": {
    "userId": "usr_276b6c46-92e7-4d47-89c1-2ada515bc3e4",
    "name": "Ana Lopez",
    "credential": {
      "type": "pat",
      "name": "ci"
    }
  },
  "via": "api",
  "automationName": null,
  "approvalRequestId": null,
  "scheduleId": null,
  "triggerId": null,
  "progress": null,
  "progressMessage": null,
  "test": false,
  "logLines": 3,
  "startedAt": "2026-10-02T14:05:00.000Z",
  "finishedAt": "2026-10-02T14:05:02.400Z",
  "durationMs": 1850,
  "files": []
}
```

| Field                            | Description                                                                                                                    |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `slug` string, path, required    | The slug's ID.                                                                                                                 |
| `version` number, path, required | The version's ID.                                                                                                              |
| `inputs` object                  | The script's inputs, by name. The default is no inputs.                                                                        |
| `via` string                     | Where the run came from, for the history. The default is `api`. Reminix records an agent's runs as `agent` whatever this says. |

More about this endpoint

Reminix records a test run with `test: true` and leaves it out of the script’s stats. A test run sends no run events, so no webhooks or triggers fire. The version’s uploader, the script owner, a workspace owner or admin, or a workspace API key can test-run a version. The script’s approval policy still applies. Use a test run to prove a draft works before asking a person to publish it.
