---
title: "Update SWML Script"
method: PUT
path: "/api/fabric/resources/swml_scripts/{id}"
tags: ["SWML Scripts"]
---

# Update SWML Script

`PUT /api/fabric/resources/swml_scripts/{id}`

Changes a stored SWML Script while preserving the same Fabric resource and addresses. Use [Update SWML webhook](/docs/apis/rest/swml-webhook/update-swml-webhook) when the resource points to server-generated SWML instead.

#### Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: _Voice_, _Messaging_, _Fax_, or _Video_.

[Learn more about API scopes](/docs/platform/your-signalwire-api-space).

## Path parameters

- `id` string, uuid, required — Universal Unique Identifier.

## Request body

- union — Body shape for updating an existing SWML Script. All fields are optional — include only what you want to change. Choose a [Calling Script](#schema/CallingSwmlScriptUpdateRequest) for inbound or outbound calls or a [Messaging Script](#schema/MessagingSwmlScriptUpdateRequest) for inbound SMS or MMS messages.
  - CallingSwmlScriptUpdateRequest — Request body to update an existing calling SWML Script. All fields are optional — include only what you want to change.
    - `display_name` string — Display name of the SWML Script
    - `script_type` 'calling' — Set to `calling` for a Calling Script.
    - `contents` object — The calling SWML document. Uses [calling SWML methods](/docs/swml/reference/calling).
    - `status_callback_url` string, uri — URL that receives status callbacks for messages sent or calls made by this script.
  - MessagingSwmlScriptUpdateRequest — Request body to update an existing messaging SWML Script. All fields are optional — include only what you want to change.
    - `display_name` string — Display name of the SWML Script
    - `script_type` 'messaging' — Set to `messaging` for a Messaging Script.
    - `contents` object — The messaging SWML document. Uses [messaging SWML methods](/docs/swml/reference/messaging).

## Response `200`

The request has succeeded.

- SwmlScriptResponse
  - `id` string, uuid, required — Universal Unique Identifier.
  - `project_id` string, uuid, required — Universal Unique Identifier.
  - `display_name` string, required — Display name of the SWML Script Fabric Resource
  - `type` 'swml_script', required — Type of the Fabric Resource
  - `created_at` string, date-time, required — Date and time when the resource was created.
  - `updated_at` string, date-time, required — Date and time when the resource was updated.
  - `swml_script` union, required — A SWML Script — either a [Calling Script](#schema/CallingSwmlScript) for inbound or outbound calls, or a [Messaging Script](#schema/MessagingSwmlScript) for inbound SMS or MMS messages. The `script_type` field on each script (`"calling"` or `"messaging"`) identifies which kind it is.
    - CallingSwmlScript — A SWML Script that handles inbound or outbound calls. The `contents` field carries a [calling SWML document](/docs/swml/reference/calling).
      - `id` string, uuid, required — Universal Unique Identifier.
      - `display_name` string, required — The displayed name of the SWML script.
      - `script_type` 'calling', required — Set to `calling` for SWML Scripts that handle inbound or outbound calls.
      - `request_url` string, uri, required — URL where this SWML Script is hosted.
      - `contents` object, required — The calling SWML document executed when this script runs. Uses [calling SWML methods](/docs/swml/reference/calling).
      - `status_callback_url` string, uri — URL that receives status callbacks for messages sent or calls made by this script.
      - `status_callback_method` 'POST' — HTTP method used for status callbacks.
    - MessagingSwmlScript — A SWML Script that handles inbound SMS or MMS messages. The `contents` field carries a [messaging SWML document](/docs/swml/reference/messaging).
      - `id` string, uuid, required — Universal Unique Identifier.
      - `display_name` string, required — The displayed name of the SWML script.
      - `script_type` 'messaging', required — Set to `messaging` for SWML Scripts that handle inbound SMS or MMS messages.
      - `request_url` string, uri, required — URL where this SWML Script is hosted.
      - `contents` object, required — The messaging SWML document executed when this script runs. Uses [messaging SWML methods](/docs/swml/reference/messaging).

## Other responses

- `401` — Access is unauthorized.
- `404` — The server cannot find the requested resource.
- `422` — The request contains invalid parameters. See errors for details.
- `500` — An internal server error occurred.

## Changes

> 137 revisions in range; 3 could not be searched.

- **2026-08-20** `e79dcc8b2150` — 6 breaking, 2 warning, 4 info
  - the `oneOf[subschema #1: Update Calling Script]/contents` request property type changed from no type to `object`
  - the `oneOf[subschema #2: Update Messaging Script]/contents` request property type changed from no type to `object`
  - added 'unevaluatedProperties' constraint to the request property `oneOf[subschema #1: Update Calling Script]/contents`
  - added 'unevaluatedProperties' constraint to the request property `oneOf[subschema #2: Update Messaging Script]/contents`
  - …8 more
- …earlier changes not shown

[Full history](https://skmtc.dev/signalwire/apis/signalwire-rest-api/changes/api/fabric/resources/swml_scripts/:id/put.md)

---

[API](https://skmtc.dev/signalwire/apis/signalwire-rest-api.md) · [All operations](https://skmtc.dev/signalwire/apis/signalwire-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/signalwire/signalwire-rest-api/revisions/792d5b8e2970/schema)
