> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# get

> Retrieve a single cXML script resource.

Retrieve a single cXML script resource.

### Schema

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/fabric/resources/cxml_scripts/{id}:
    get:
      operationId: get_cxml_script
      summary: Get cXML Script
      description: >-
        Returns a cXML Script by ID


        #### 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_cXmlScripts
      parameters:
        - name: id
          in: path
          description: Unique ID of a cXML Script.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CXMLScriptResponse'
        '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'
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
    CxmlScriptResponseType:
      type: string
      enum:
        - cxml_script
      description: Type of the Fabric Resource
      title: CxmlScriptResponseType
    CxmlScriptScriptType:
      type: string
      enum:
        - calling
        - messaging
      description: The script type the cXML Script is used for
      title: CxmlScriptScriptType
    RequestUrlMethodType:
      type: string
      enum:
        - GET
        - POST
      description: The method type to use for the URL
      title: RequestUrlMethodType
    CXMLScript:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of a cXML Script.
        contents:
          type: string
          description: The cXML script contents
        request_count:
          type: integer
          description: The amout of times the cXML script has been requested
        last_accessed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The date and time when the cXML script was last accessed
        request_url:
          type: string
          format: uri
          description: The URL where the cXML script can be accessed
        script_type:
          $ref: '#/components/schemas/CxmlScriptScriptType'
          description: The script type the cXML Script is used for
        display_name:
          type: string
          description: Display name of the cXML Script Fabric Resource
        status_callback_url:
          type:
            - string
            - 'null'
          format: uri
          description: The url that will send status updates for the cXML Script
        status_callback_method:
          $ref: '#/components/schemas/RequestUrlMethodType'
          description: HTTP method for status callback URL
      required:
        - id
        - contents
        - request_count
        - last_accessed_at
        - request_url
        - script_type
        - display_name
      title: CXMLScript
    CXMLScriptResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the cXML Script.
        project_id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the Project.
        name:
          type: string
          description: Display name of the cXML Script Fabric Resource
        type:
          $ref: '#/components/schemas/CxmlScriptResponseType'
          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.
        cxml_script:
          $ref: '#/components/schemas/CXMLScript'
          description: cXML Script data.
      required:
        - id
        - project_id
        - name
        - type
        - created_at
        - updated_at
        - cxml_script
      title: CXMLScriptResponse
    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
{
  "id": "993ed018-9e79-4e50-b97b-984bd5534095",
  "project_id": "1313fe58-5e14-4c11-bbe7-6fdfa11fe780",
  "name": "Reception Script",
  "type": "cxml_script",
  "created_at": "2024-05-06T12:20:00Z",
  "updated_at": "2024-05-06T12:20:00Z",
  "cxml_script": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "contents": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Say>Hello World</Say></Response>",
    "request_count": 5,
    "last_accessed_at": "2023-10-01T12:00:00Z",
    "request_url": "https://example.signalwire.com/laml-bins/2537c89e-2606-48c2-b3c2-bb601d863d1e",
    "script_type": "calling",
    "display_name": "Booking Assistant Script",
    "status_callback_url": "https://example.com/cxml/status",
    "status_callback_method": "POST"
  }
}
```

## **Example**

```typescript {9}
import { RestClient } from "@signalwire/sdk";

const client = new RestClient({
  project: "your-project-id",
  token: "your-api-token",
  host: "your-space.signalwire.com",
});

const item = await client.fabric.cxmlScripts.get("resource-id");
console.log(`Cxml Script: ${item.name}, ID: ${item.id}`);
```