> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# list

> List SWML script resources.

List SWML script resources in the project.

### Schema

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/fabric/resources/swml_scripts:
    get:
      operationId: subpackageSwmlScripts_list_swml_scripts
      summary: List SWML Scripts
      description: >-
        Returns the project's SWML Script resources, which store calling or
        messaging SWML in SignalWire. Use it to discover scripts before
        retrieving or changing one. Use [SWML
        Webhooks](/docs/apis/rest/swml-webhook/list-swml-webhooks) when your
        server must return SWML for each request, or [cXML
        Scripts](/docs/apis/rest/cxml-scripts/list-cxml-scripts) for
        applications written in cXML.


        #### 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).
      tags:
        - subpackage_swmlScripts
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SwmlScriptListResponse'
        '401':
          description: Access is unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode401'
        '404':
          description: The server cannot find the requested resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode404'
        '500':
          description: An internal server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode500'
tags:
  - name: subpackage_swmlScripts
servers:
  - url: https://%7BYour_Space_Name%7D.signalwire.com
    description: SignalWire API
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    SwmlScriptResponseType:
      type: string
      enum:
        - swml_script
      description: Type of the Fabric Resource
      title: SwmlScriptResponseType
    CallingSwmlScriptScriptType:
      type: string
      enum:
        - calling
      description: Set to `calling` for SWML Scripts that handle inbound or outbound calls.
      title: CallingSwmlScriptScriptType
    CallingSwmlScriptContents:
      type: object
      properties: {}
      description: >-
        The calling SWML document executed when this script runs. Uses [calling
        SWML methods](/docs/swml/reference/calling).
      title: CallingSwmlScriptContents
    CallingSwmlScriptStatusCallbackMethod:
      type: string
      enum:
        - POST
      description: HTTP method used for status callbacks.
      title: CallingSwmlScriptStatusCallbackMethod
    CallingSwmlScript:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of a SWML Script.
        display_name:
          type: string
          description: The displayed name of the SWML script.
        script_type:
          $ref: '#/components/schemas/CallingSwmlScriptScriptType'
          description: >-
            Set to `calling` for SWML Scripts that handle inbound or outbound
            calls.
        request_url:
          type: string
          format: uri
          description: URL where this SWML Script is hosted.
        contents:
          $ref: '#/components/schemas/CallingSwmlScriptContents'
          description: >-
            The calling SWML document executed when this script runs. Uses
            [calling SWML methods](/docs/swml/reference/calling).
        status_callback_url:
          type: string
          format: uri
          description: >-
            URL that receives status callbacks for messages sent or calls made
            by this script.
        status_callback_method:
          $ref: '#/components/schemas/CallingSwmlScriptStatusCallbackMethod'
          description: HTTP method used for status callbacks.
      required:
        - id
        - display_name
        - script_type
        - request_url
        - contents
      description: >-
        A SWML Script that handles inbound or outbound calls. The `contents`
        field carries a [calling SWML document](/docs/swml/reference/calling).
      title: CallingSwmlScript
    MessagingSwmlScriptScriptType:
      type: string
      enum:
        - messaging
      description: >-
        Set to `messaging` for SWML Scripts that handle inbound SMS or MMS
        messages.
      title: MessagingSwmlScriptScriptType
    MessagingSwmlScriptContents:
      type: object
      properties: {}
      description: >-
        The messaging SWML document executed when this script runs. Uses
        [messaging SWML methods](/docs/swml/reference/messaging).
      title: MessagingSwmlScriptContents
    MessagingSwmlScript:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of a SWML Script.
        display_name:
          type: string
          description: The displayed name of the SWML script.
        script_type:
          $ref: '#/components/schemas/MessagingSwmlScriptScriptType'
          description: >-
            Set to `messaging` for SWML Scripts that handle inbound SMS or MMS
            messages.
        request_url:
          type: string
          format: uri
          description: URL where this SWML Script is hosted.
        contents:
          $ref: '#/components/schemas/MessagingSwmlScriptContents'
          description: >-
            The messaging SWML document executed when this script runs. Uses
            [messaging SWML methods](/docs/swml/reference/messaging).
      required:
        - id
        - display_name
        - script_type
        - request_url
        - contents
      description: >-
        A SWML Script that handles inbound SMS or MMS messages. The `contents`
        field carries a [messaging SWML
        document](/docs/swml/reference/messaging).
      title: MessagingSwmlScript
    SwmlScript:
      oneOf:
        - $ref: '#/components/schemas/CallingSwmlScript'
        - $ref: '#/components/schemas/MessagingSwmlScript'
      description: >-
        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.
      title: SwmlScript
    SwmlScriptResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the SWML Script.
        project_id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the Project.
        display_name:
          type: string
          description: Display name of the SWML Script Fabric Resource
        type:
          $ref: '#/components/schemas/SwmlScriptResponseType'
          description: Type of the Fabric Resource
        created_at:
          type: string
          format: date-time
          description: Date and time when the resource was created.
        updated_at:
          type: string
          format: date-time
          description: Date and time when the resource was updated.
        swml_script:
          $ref: '#/components/schemas/SwmlScript'
          description: SWML Script data.
      required:
        - id
        - project_id
        - display_name
        - type
        - created_at
        - updated_at
        - swml_script
      title: SwmlScriptResponse
    SwmlScriptPaginationresponse:
      type: object
      properties:
        self:
          type: string
          format: uri
          description: Link to the current page
        first:
          type: string
          format: uri
          description: Link to the first page
        next:
          type: string
          format: uri
          description: Link to the next page
        prev:
          type: string
          format: uri
          description: Link to the previous page
      required:
        - self
        - first
      title: SwmlScriptPaginationresponse
    SwmlScriptListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/SwmlScriptResponse'
          description: An array of objects that contain a list of SWML Script data
        links:
          $ref: '#/components/schemas/SwmlScriptPaginationresponse'
          description: Object containing pagination links
      required:
        - data
        - links
      title: SwmlScriptListResponse
    TypesStatusCodesStatusCode401Error:
      type: string
      enum:
        - Unauthorized
      title: TypesStatusCodesStatusCode401Error
    Types.StatusCodes.StatusCode401:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode401Error'
      required:
        - error
      description: Access is unauthorized.
      title: Types.StatusCodes.StatusCode401
    TypesStatusCodesStatusCode404Error:
      type: string
      enum:
        - Not Found
      title: TypesStatusCodesStatusCode404Error
    Types.StatusCodes.StatusCode404:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode404Error'
      required:
        - error
      description: The server cannot find the requested resource.
      title: Types.StatusCodes.StatusCode404
    TypesStatusCodesStatusCode500Error:
      type: string
      enum:
        - Internal Server Error
      title: TypesStatusCodesStatusCode500Error
    Types.StatusCodes.StatusCode500:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error'
      required:
        - error
      description: An internal server error occurred.
      title: Types.StatusCodes.StatusCode500

```

## **Response Example**

### Response (200)

```json
[
  {
    "data": [
      {
        "id": "993ed018-9e79-4e50-b97b-984bd5534095",
        "project_id": "1313fe58-5e14-4c11-bbe7-6fdfa11fe780",
        "display_name": "Welcome Script",
        "type": "swml_script",
        "created_at": "2024-05-06T12:20:00Z",
        "updated_at": "2024-05-06T12:25:00Z",
        "swml_script": {
          "contents": {
            "sections": {
              "main": [
                {
                  "play": {
                    "url": "https://cdn.signalwire.com/swml/audio.mp3"
                  }
                }
              ]
            },
            "version": "1.0.0"
          },
          "display_name": "Welcome Script",
          "id": "993ed018-9e79-4e50-b97b-984bd5534095",
          "request_url": "https://example.com/swml_script",
          "script_type": "calling"
        }
      }
    ],
    "links": {
      "self": "https://example.signalwire.com/api/fabric/resources/swml_scripts?page_number=0&page_size=50",
      "first": "https://example.signalwire.com/api/fabric/resources/swml_scripts?page_number=0&page_size=50"
    }
  }
]
```

## **Example**

```python {9}
from signalwire.rest import RestClient

client = RestClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
)

response = client.fabric.swml_scripts.list()
for item in response.get("data", []):
    print(f"{item['display_name']}: {item['id']}")
```