> This page is for API Reference & Tools.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.moveworks.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.moveworks.com/_mcp/server.

# Scripts

> Create, read and update scripts through the Moveworks Configuration API.

`platform.extensions.scripts`

A script action runs Python code. Use it when a Data Mapper expression can't do the transformation.

To learn what scripts do, see [Scripts](/tool-studio/actions/script-actions) in the Tool Studio docs.

* **Endpoint:** `/platform/extensions/scripts`  |  **Methods:** GET, PATCH, POST
* **Request shape:** fields go at the top level of the JSON body, with no `resource` wrapper. The item's `id` goes in the URL for reads and updates, not in the body.
* **Updates:** a JSON merge-patch with `version: {num, change_description}` from your last read. Lists of objects merge row by row, so read first and send the whole list when you remove or reorder rows. See [Tool Studio](/api-reference/configuration-api/tool-studio/overview#how-updates-work).
* **References:** Conversational processes, data types and plugins call the script by its `id`; compound actions call it by `signature.name`.

### Endpoints

All paths are relative to `https://api.moveworks.ai/configurations/v1alpha1`. Each endpoint page lists the request and response schema, an example, and the errors it can return.

| Method  | Path                                | Endpoint reference                                                                  |
| ------- | ----------------------------------- | ----------------------------------------------------------------------------------- |
| `GET`   | `/platform/extensions/scripts`      | [List scripts](/api-reference/configuration-api/tool-studio/scripts/list-scripts)   |
| `POST`  | `/platform/extensions/scripts`      | [Create script](/api-reference/configuration-api/tool-studio/scripts/create-script) |
| `GET`   | `/platform/extensions/scripts/{id}` | [Get script](/api-reference/configuration-api/tool-studio/scripts/get-script)       |
| `PATCH` | `/platform/extensions/scripts/{id}` | [Update script](/api-reference/configuration-api/tool-studio/scripts/update-script) |

### Rules the API checks

* `code` is required. The script's inputs are available as plain variable names.
* The last line must be an expression, which becomes the result. Assign inside `if`, `for` or `try` blocks, then put the variable alone on the last line.
* Read a secret with `_SECRETS['name']`. Secrets come back redacted.
* `language` is always Python and can't be changed.

### Fields

| Field          | Type                         | Required  | Notes                                                                                                                       |
| -------------- | ---------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- |
| `id`           | string                       | read-only | Unique identifier of the script, assigned by the server.                                                                    |
| `signature`    | FunctionSignatureSettings    | ✅         | The script's name, description, input arguments and result schema. The name is the key the script is referenced by.         |
| `language`     | string                       | read-only | Programming language of the script. Set to PYTHON for scripts created through this API.                                     |
| `code`         | string                       | ✅         | Script code. Inputs are available by their argument names, and the last line must be an expression whose value is returned. |
| `secrets`      | array\<ScriptSecretSettings> |           | Secrets the script can read by name.                                                                                        |
| `updated_time` | string                       | read-only | When the configuration was last updated.                                                                                    |
| `updated_by`   | string                       | read-only | Who last updated the configuration.                                                                                         |
| `version`      | Version                      | ✅         | Document version. On update, send back the num from your last read.                                                         |

### Example create body

```json
{
  "signature": {
    "name": "format_user_data",
    "display_name": "Format User Data",
    "description": "Formats a user's name and lowercases the email.",
    "arguments": [
      {
        "name": "first_name",
        "description": "First name",
        "type": {
          "primitive": "string"
        },
        "required": true,
        "example_value": "John"
      },
      {
        "name": "last_name",
        "description": "Last name",
        "type": {
          "primitive": "string"
        },
        "required": true,
        "example_value": "Doe"
      },
      {
        "name": "email",
        "description": "Email",
        "type": {
          "primitive": "string"
        },
        "required": true,
        "example_value": "john.doe@example.com"
      }
    ]
  },
  "code": "name = first_name + ' ' + last_name\n{'full_name': name, 'email': email.lower()}",
  "version": {
    "change_description": "Initial version."
  }
}
```