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

# Update script

PATCH https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/{id}
Content-Type: application/json

Changes the fields you send and returns the full updated document.

Send only the fields you want to change, plus `version` with the `num` from your last read and a `change_description`. This is a JSON merge-patch: a field you leave out keeps its stored value, `null` clears it, and nested objects merge field by field. Lists of objects merge row by row instead of being replaced, so read the document first and send the whole list back when you reorder or remove rows. Lists of strings, Data Mapper expressions, JSON schemas, `workflow_steps` and `resolver_methods` are replaced whole. The `id` goes in the URL; if you also send `id` in the body it must match.

Reference: https://docs.moveworks.com/api-reference/configuration-api/tool-studio/scripts/update-script

## Authentication

- `Authorization` header (bearer token, required) — JWT bearer token authentication. Include the Configuration API key in the Authorization header as 'Bearer \<token>'.

## Request

### Path parameters

- `id` (string, required) — The `id` of the script, as returned when it was created or listed.

### Body (application/json)

This endpoint expects a ScriptConfigPatch.

- `version` (ScriptVersionPatch, required) — Document version. On update, send back the num from your last read.
- `signature` (FunctionSignatureSettings, optional) — The script's name, description, input arguments and result schema. The name is the key the script is referenced by.
- `code` (string, optional) — Script code. Inputs are available by their argument names, and the last line must be an expression whose value is returned.
- `secrets` (list of ScriptSecretSettingsPatch, optional) — Secrets the script can read by name.

## Response

### 200

The updated script, at its new version

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

## Errors

### 400 Bad Request Error

Bad request - the body breaks a rule in the schema (a missing required field, an unknown enum value, an invalid DSL or Data Mapper expression), `version.change_description` is missing, or an id in the body doesn't match the URL

- `error` (ErrorResponseError, required)

### 401 Unauthorized Error

Unauthorized - the `Authorization` header is missing or the token is invalid

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

Forbidden - the API key isn't allowed to change this configuration, or the configuration is frozen for your organization

- `error` (ErrorResponseError, required)

### 404 Not Found Error

Not found - no item with this `id` exists in your organization

- `error` (ErrorResponseError, required)

### 409 Conflict Error

Conflict - `version.num` doesn't match the stored version (someone changed it since your last read; read it again and retry), or the item already exists

- `error` (ErrorResponseError, required)

### 429 Too Many Requests Error

Too many requests - the organization exceeded the Configuration API rate limit. Back off and retry.

- `error` (ErrorResponseError, required)

### 500 Internal Server Error

Internal server error - retry the request

- `error` (ErrorResponseError, required)

## Types

### ScriptVersionPatch

- `num` (integer, required) — Version number set by the server. On update, send the num from your last read; a stale num is rejected as a conflict.
- `change_description` (string, required) — A short note describing this change. Required on every create and update.

### FunctionSignatureSettings

- `name` (string, optional) — Technical name used to reference this function. Must start with a letter and contain only letters, digits and underscores; 2 to 64 characters.
- `description` (string, optional) — Description of what this function does. 12 to 1024 characters.
- `arguments` (list of ArgumentSettings, optional) — Input arguments the function accepts.
- `result_schema` (FunctionSignatureSettingsResultSchema, optional) — JSON schema describing the function's output.
- `display_name` (string, optional) — Human-readable name of the function. 2 to 64 characters. If empty, name is shown instead.

### ScriptSecretSettingsPatch

- `name` (string, optional) — Name the script uses to read the secret, as in _SECRETS['name']. Starts with a letter; letters, digits and underscores only; 2 to 64 characters.
- `secret` (string, optional) — The secret value. Reads return a redacted value. Secret: omit it, or send *****, to keep the stored value.

### ScriptSecretSettings

- `name` (string, optional) — Name the script uses to read the secret, as in _SECRETS['name']. Starts with a letter; letters, digits and underscores only; 2 to 64 characters.
- `secret` (string, optional) — The secret value. Reads return a redacted value. Secret: always returned masked as *****.

### Version

- `num` (integer, optional) — Version number set by the server. On update, send the num from your last read; a stale num is rejected as a conflict.
- `change_description` (string, optional) — A short note describing this change. Required on every create and update.

### ErrorResponseError

- `code` (string, optional) — A machine-readable error code.
- `message` (string, optional) — What went wrong, and for a rejected field, which rule it broke.

### ArgumentSettings

- `name` (string, optional) — Name of the argument. Must start with a letter and contain only letters, digits and underscores; 2 to 64 characters.
- `description` (string, optional) — Description of the argument. 2 to 256 characters.
- `type` (TypeSettings, optional) — Data type of the argument, e.g. string, List[User] or a custom type. Required.
- `required` (boolean, optional) — If true, a value must be provided for this argument.
- `default_value` (ArgumentSettingsDefaultValue, optional, nullable) — Value used for this argument when none is provided.
- `example_value` (ArgumentSettingsExampleValue, optional, nullable) — Example value for this argument.

### FunctionSignatureSettingsResultSchema

JSON schema describing the function's output.

### TypeSettings

- `primitive` (enum, optional) — A primitive type. One of: string, integer, number, boolean, array, object.
  - Allowed values: `string`, `integer`, `number`, `boolean`, `array`, `object`
- `native` (enum, optional) — A Moveworks-defined type. One of: User, File, ariba.v1.CatalogItem, workday.v1.JobProfile, Room, Group.
  - Allowed values: `User`, `File`, `ariba.v1.CatalogItem`, `workday.v1.JobProfile`, `Room`, `Group`
- `custom` (string, optional) — Name of a custom type registered in your organization. ID of an existing data_type (GET /configurations/v1alpha1/platform/extensions/data-types).
- `list` (boolean, optional) — If true, the argument is a list of the selected type rather than a single value.

### ArgumentSettingsDefaultValue

Value used for this argument when none is provided.

- string
- double
- integer
- boolean
- map from string to any
- list of any

### ArgumentSettingsExampleValue

Example value for this argument.

- string
- double
- integer
- boolean
- map from string to any
- list of any

## Examples

### Scripts endpoints_updateScript_example

**Response**

```json
{
  "id": "3f6c1e2a-8b4d-4c7e-9a1f-2d5b6c7e8f90",
  "signature": {
    "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"
      }
    ],
    "display_name": "Format User Data"
  },
  "code": "name = (first_name + ' ' + last_name).strip()\n{'full_name': name, 'email': email.lower()}",
  "updated_time": "2026-11-12T18:04:11Z",
  "updated_by": "admin@example.com",
  "version": {
    "num": 3,
    "change_description": "Update the script"
  }
}
```

**SDK Code**

```python Scripts endpoints_updateScript_example
import requests

url = "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id"

headers = {"Authorization": "Bearer <token>"}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript Scripts endpoints_updateScript_example
const url = 'https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id';
const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Scripts endpoints_updateScript_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Scripts endpoints_updateScript_example
require 'uri'
require 'net/http'

url = URI("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Scripts endpoints_updateScript_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Scripts endpoints_updateScript_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Scripts endpoints_updateScript_example
using RestSharp;

var client = new RestClient("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Scripts endpoints_updateScript_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Change a script

**Request**

```json
{
  "version": {
    "num": 2,
    "change_description": "Update the script"
  },
  "code": "name = (first_name + ' ' + last_name).strip()\n{'full_name': name, 'email': email.lower()}"
}
```

**Response**

```json
{
  "id": "3f6c1e2a-8b4d-4c7e-9a1f-2d5b6c7e8f90",
  "signature": {
    "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"
      }
    ],
    "display_name": "Format User Data"
  },
  "code": "name = (first_name + ' ' + last_name).strip()\n{'full_name': name, 'email': email.lower()}",
  "updated_time": "2026-11-12T18:04:11Z",
  "updated_by": "admin@example.com",
  "version": {
    "num": 3,
    "change_description": "Update the script"
  }
}
```

**SDK Code**

```python Change a script
import requests

url = "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id"

payload = {
    "version": {
        "num": 2,
        "change_description": "Update the script"
    },
    "code": "name = (first_name + ' ' + last_name).strip()
{'full_name': name, 'email': email.lower()}"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Change a script
const url = 'https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"version":{"num":2,"change_description":"Update the script"},"code":"name = (first_name + \' \' + last_name).strip()\n{\'full_name\': name, \'email\': email.lower()}"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Change a script
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id"

	payload := strings.NewReader("{\n  \"version\": {\n    \"num\": 2,\n    \"change_description\": \"Update the script\"\n  },\n  \"code\": \"name = (first_name + ' ' + last_name).strip()\\n{'full_name': name, 'email': email.lower()}\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Change a script
require 'uri'
require 'net/http'

url = URI("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"version\": {\n    \"num\": 2,\n    \"change_description\": \"Update the script\"\n  },\n  \"code\": \"name = (first_name + ' ' + last_name).strip()\\n{'full_name': name, 'email': email.lower()}\"\n}"

response = http.request(request)
puts response.read_body
```

```java Change a script
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"version\": {\n    \"num\": 2,\n    \"change_description\": \"Update the script\"\n  },\n  \"code\": \"name = (first_name + ' ' + last_name).strip()\\n{'full_name': name, 'email': email.lower()}\"\n}")
  .asString();
```

```php Change a script
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id', [
  'body' => '{
  "version": {
    "num": 2,
    "change_description": "Update the script"
  },
  "code": "name = (first_name + \' \' + last_name).strip()\\n{\'full_name\': name, \'email\': email.lower()}"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Change a script
using RestSharp;

var client = new RestClient("https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"version\": {\n    \"num\": 2,\n    \"change_description\": \"Update the script\"\n  },\n  \"code\": \"name = (first_name + ' ' + last_name).strip()\\n{'full_name': name, 'email': email.lower()}\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Change a script
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "version": [
    "num": 2,
    "change_description": "Update the script"
  ],
  "code": "name = (first_name + ' ' + last_name).strip()
{'full_name': name, 'email': email.lower()}"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moveworks.ai/configurations/v1alpha1/platform/extensions/scripts/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```