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

# assign_domain_application

> Assign a domain application to a Fabric resource.

Assign a domain application to a Fabric resource.

### Schema

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/fabric/resources/{id}/domain_applications:
    post:
      operationId: subpackageDomainApplications_assign_resource_domain_application
      summary: Assign domain application handler
      description: >-
        Assigns an existing resource as the calling handler for a SIP Domain
        Application, so inbound SIP calls to that Domain Application run the
        resource. Use it when the Domain Application already exists and its
        handler should be a Fabric resource such as an AI Agent, Call Flow, or
        SIP Gateway. Use [Create domain
        application](/docs/apis/rest/domain-applications/create-domain-application)
        to create and configure the SIP-facing Domain Application itself.

        <Note>

        Currently only supports `calling` as a handler and automatically
        defaults to it.

        </Note>


        #### 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_domainApplications
      parameters:
        - name: id
          in: path
          description: Unique ID of the domain application.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
      responses:
        '201':
          description: >-
            The request has succeeded and a new resource has been created as a
            result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FabricDomainApplicationResponse'
        '422':
          description: The request contains invalid parameters. See errors for details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainApplicationCreateStatusCode422'
        '500':
          description: An internal server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode500'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainApplicationAssignRequest'
tags:
  - name: subpackage_domainApplications
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
    DomainApplicationAssignRequest:
      type: object
      properties:
        domain_application_id:
          $ref: '#/components/schemas/uuid'
          description: The id of the domain application you wish to assign a resource to.
      required:
        - domain_application_id
      title: DomainApplicationAssignRequest
    AudioChannel:
      type: object
      properties:
        audio:
          type: string
          description: Audio Channel of Fabric Address
      required:
        - audio
      title: AudioChannel
    MessagingChannel:
      type: object
      properties:
        messaging:
          type: string
          description: Messaging Channel of Fabric Address
      required:
        - messaging
      title: MessagingChannel
    VideoChannel:
      type: object
      properties:
        video:
          type: string
          description: Video Channel of Fabric Address
      required:
        - video
      title: VideoChannel
    AddressChannel:
      oneOf:
        - $ref: '#/components/schemas/AudioChannel'
        - $ref: '#/components/schemas/MessagingChannel'
        - $ref: '#/components/schemas/VideoChannel'
      title: AddressChannel
    FabricAddressAppType:
      type: string
      enum:
        - app
      description: The display type of a fabric address pointing to an application.
      title: FabricAddressAppType
    FabricAddressApp:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the Fabric Address.
        resource_id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the resource the address routes to.
        name:
          type: string
          description: Name of the Fabric Address.
        display_name:
          type: string
          description: Display name of the Fabric Address.
        cover_url:
          type:
            - string
            - 'null'
          description: >-
            Cover URL of the Fabric Address, or `null` when the resource has no
            cover image.
        preview_url:
          type:
            - string
            - 'null'
          description: >-
            Preview URL of the Fabric Address, or `null` when no preview is
            available. Only Conference Room addresses return one, while a
            session with room previews enabled is in progress.
        locked:
          type: boolean
          description: >-
            Locks the Fabric Address. This is used to prevent the Fabric Address
            from accepting calls.
        channels:
          $ref: '#/components/schemas/AddressChannel'
          description: Channels of the Fabric Address.
        canonical_uri:
          type:
            - string
            - 'null'
          description: >-
            The address in canonical form: `/<context>/<name>` for a resource
            address, `sip:<domain>` for a SIP address, or the E.164 number for a
            phone number or WhatsApp number address. `null` when the phone
            number, WhatsApp number, or SIP domain behind the address no longer
            exists.
        type:
          $ref: '#/components/schemas/FabricAddressAppType'
          description: The display type of a fabric address pointing to an application.
      required:
        - id
        - resource_id
        - name
        - display_name
        - cover_url
        - preview_url
        - locked
        - channels
        - canonical_uri
        - type
      title: FabricAddressApp
    FabricAddressRoomType:
      type: string
      enum:
        - room
      description: The display type of a fabric address pointing to a Conference Room.
      title: FabricAddressRoomType
    FabricAddressRoom:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the Fabric Address.
        resource_id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the resource the address routes to.
        name:
          type: string
          description: Name of the Fabric Address.
        display_name:
          type: string
          description: Display name of the Fabric Address.
        cover_url:
          type:
            - string
            - 'null'
          description: >-
            Cover URL of the Fabric Address, or `null` when the resource has no
            cover image.
        preview_url:
          type:
            - string
            - 'null'
          description: >-
            Preview URL of the Fabric Address, or `null` when no preview is
            available. Only Conference Room addresses return one, while a
            session with room previews enabled is in progress.
        locked:
          type: boolean
          description: >-
            Locks the Fabric Address. This is used to prevent the Fabric Address
            from accepting calls.
        channels:
          $ref: '#/components/schemas/AddressChannel'
          description: Channels of the Fabric Address.
        canonical_uri:
          type:
            - string
            - 'null'
          description: >-
            The address in canonical form: `/<context>/<name>` for a resource
            address, `sip:<domain>` for a SIP address, or the E.164 number for a
            phone number or WhatsApp number address. `null` when the phone
            number, WhatsApp number, or SIP domain behind the address no longer
            exists.
        type:
          $ref: '#/components/schemas/FabricAddressRoomType'
          description: The display type of a fabric address pointing to a Conference Room.
      required:
        - id
        - resource_id
        - name
        - display_name
        - cover_url
        - preview_url
        - locked
        - channels
        - canonical_uri
        - type
      title: FabricAddressRoom
    FabricAddressCallType:
      type: string
      enum:
        - call
      description: The display type of a fabric address pointing to call.
      title: FabricAddressCallType
    FabricAddressCall:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the Fabric Address.
        resource_id:
          $ref: '#/components/schemas/uuid'
          description: Unique ID of the resource the address routes to.
        name:
          type: string
          description: Name of the Fabric Address.
        display_name:
          type: string
          description: Display name of the Fabric Address.
        cover_url:
          type:
            - string
            - 'null'
          description: >-
            Cover URL of the Fabric Address, or `null` when the resource has no
            cover image.
        preview_url:
          type:
            - string
            - 'null'
          description: >-
            Preview URL of the Fabric Address, or `null` when no preview is
            available. Only Conference Room addresses return one, while a
            session with room previews enabled is in progress.
        locked:
          type: boolean
          description: >-
            Locks the Fabric Address. This is used to prevent the Fabric Address
            from accepting calls.
        channels:
          $ref: '#/components/schemas/AddressChannel'
          description: Channels of the Fabric Address.
        canonical_uri:
          type:
            - string
            - 'null'
          description: >-
            The address in canonical form: `/<context>/<name>` for a resource
            address, `sip:<domain>` for a SIP address, or the E.164 number for a
            phone number or WhatsApp number address. `null` when the phone
            number, WhatsApp number, or SIP domain behind the address no longer
            exists.
        type:
          $ref: '#/components/schemas/FabricAddressCallType'
          description: The display type of a fabric address pointing to call.
      required:
        - id
        - resource_id
        - name
        - display_name
        - cover_url
        - preview_url
        - locked
        - channels
        - canonical_uri
        - type
      title: FabricAddressCall
    FabricDomainApplicationResponse:
      oneOf:
        - $ref: '#/components/schemas/FabricAddressApp'
        - $ref: '#/components/schemas/FabricAddressRoom'
        - $ref: '#/components/schemas/FabricAddressCall'
      description: >-
        The Address created for the Domain Application on the Resource. Its
        `type` is `app` for most handlers, `room` for a Video Room, and `call`
        for a Resource that connects the call to a SIP endpoint or connector.
      title: FabricDomainApplicationResponse
    Types.StatusCodes.RestApiErrorItem:
      type: object
      properties:
        type:
          type: string
          description: The category of error.
        code:
          type: string
          description: A specific error code.
        message:
          type: string
          description: A description of what caused the error.
        attribute:
          type:
            - string
            - 'null'
          description: The request parameter that caused the error, if applicable.
        url:
          type: string
          description: A link to documentation about this error.
      required:
        - type
        - code
        - message
        - url
      description: Details about a specific error.
      title: Types.StatusCodes.RestApiErrorItem
    DomainApplicationCreateStatusCode422:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Types.StatusCodes.RestApiErrorItem'
          description: List of validation errors.
      required:
        - errors
      description: The request contains invalid parameters. See errors for details.
      title: DomainApplicationCreateStatusCode422
    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 (201)

```json
{
  "canonical_uri": "/public/justice-league",
  "channels": {
    "audio": "/external/resource_name?channel=audio"
  },
  "cover_url": "https://coverurl.com",
  "display_name": "Justice League",
  "id": "691af061-cd86-4893-a605-173f47afc4c2",
  "locked": true,
  "name": "justice-league",
  "preview_url": "https://previewurl.com",
  "resource_id": "993ed018-9e79-4e50-b97b-984bd5534095",
  "type": "app"
}
```

## **Example**

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

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

result = client.fabric.resources.assign_domain_application(
    "resource-id", domain_application_id="app-uuid",
)
print(f"Domain application assigned: {result['id']}")
```