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

# SWML inbound call webhook

POST 

Payload sent by SignalWire to a SWML calling webhook URL when SWML is fetched for a call. This includes inbound calls arriving on a phone number configured with a SWML calling handler, and outbound REST-initiated calls that point at a SWML URL. The same payload shape is also used when the SWML calling `transfer` or `execute` method targets an external URL — in those cases, the `params` object carries the values supplied to that step.

The webhook URL is expected to respond with the SWML document to execute for the call.

Reference: https://signalwire.com/docs/apis/rest/swml-webhook/webhooks/inbound-call-webhook

## OpenAPI 3.1 Webhook Specification

```yaml
openapi: 3.1.0
info:
  title: signalwire-rest
  version: 1.0.0
paths: {}
webhooks:
  inbound-call-webhook:
    post:
      operationId: inbound-call-webhook
      summary: SWML inbound call webhook
      description: >-
        Payload sent by SignalWire to a SWML calling webhook URL when SWML is
        fetched for a call. This includes inbound calls arriving on a phone
        number configured with a SWML calling handler, and outbound
        REST-initiated calls that point at a SWML URL. The same payload shape is
        also used when the SWML calling `transfer` or `execute` method targets
        an external URL — in those cases, the `params` object carries the values
        supplied to that step.


        The webhook URL is expected to respond with the SWML document to execute
        for the call.
      responses:
        '200':
          description: Webhook received successfully
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                call:
                  $ref: >-
                    #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCall
                  description: The call that triggered this fetch.
                vars:
                  $ref: >-
                    #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaVars
                  description: >-
                    Script-scope variables for this call session. Empty on the
                    initial document fetch.
                envs:
                  $ref: >-
                    #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaEnvs
                  description: >-
                    Environment variables configured at the account or project
                    level.
                params:
                  $ref: >-
                    #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaParams
                  description: >-
                    Parameters passed via a SWML calling `execute` or `transfer`
                    step. An empty object on the initial document fetch.
              required:
                - call
                - vars
                - envs
                - params
components:
  schemas:
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallDirection:
      type: string
      enum:
        - inbound
        - outbound
      description: The direction of the call.
      title: >-
        WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallDirection
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallType:
      type: string
      enum:
        - sip
        - phone
        - webrtc
      description: The type of call.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallType
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallHeadersItems:
      type: object
      properties:
        name:
          type: string
          description: The name of the header.
        value:
          type: string
          description: The value of the header.
      required:
        - name
        - value
      description: A single header associated with the call.
      title: >-
        WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallHeadersItems
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipDataSipContactParams:
      type: object
      properties: {}
      description: Additional parameters from the SIP Contact header.
      title: >-
        WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipDataSipContactParams
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipData:
      type: object
      properties:
        sip_req_host:
          type: string
          description: The host portion of the SIP request URI.
        sip_req_uri:
          type: string
          description: The full SIP request URI.
        sip_req_user:
          type: string
          description: The user portion of the SIP request URI.
        sip_from_host:
          type: string
          description: The host portion of the SIP From header.
        sip_from_uri:
          type: string
          description: The full URI from the SIP From header.
        sip_from_user:
          type: string
          description: The user portion of the SIP From header.
        sip_to_host:
          type: string
          description: The host portion of the SIP To header.
        sip_to_uri:
          type: string
          description: The full URI from the SIP To header.
        sip_to_user:
          type: string
          description: The user portion of the SIP To header.
        sip_contact_user:
          type: string
          description: The user portion of the SIP Contact header.
        sip_contact_port:
          type: string
          description: The port from the SIP Contact header.
        sip_contact_uri:
          type: string
          description: The full URI from the SIP Contact header.
        sip_contact_host:
          type: string
          description: The host portion of the SIP Contact header.
        sip_contact_params:
          $ref: >-
            #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipDataSipContactParams
          description: Additional parameters from the SIP Contact header.
      required:
        - sip_req_host
        - sip_req_uri
        - sip_req_user
        - sip_from_host
        - sip_from_uri
        - sip_from_user
        - sip_to_host
        - sip_to_uri
        - sip_to_user
        - sip_contact_user
        - sip_contact_port
        - sip_contact_uri
        - sip_contact_host
        - sip_contact_params
      description: SIP-specific data. Present only when `type` is `sip`.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipData
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCall:
      type: object
      properties:
        call_id:
          type: string
          description: A unique identifier for the call.
        node_id:
          type: string
          description: A unique identifier for the node handling the call.
        segment_id:
          type: string
          description: A unique identifier for the current call segment.
        call_state:
          type: string
          description: The current state of the call.
        direction:
          $ref: >-
            #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallDirection
          description: The direction of the call.
        type:
          $ref: >-
            #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallType
          description: The type of call.
        from:
          type: string
          description: The number/URI that initiated this call.
        to:
          type: string
          description: The number/URI of the destination of this call.
        headers:
          type: array
          items:
            $ref: >-
              #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallHeadersItems
          description: The headers associated with this call.
        sip_data:
          $ref: >-
            #/components/schemas/WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCallSipData
          description: SIP-specific data. Present only when `type` is `sip`.
        project_id:
          type: string
          format: uuid
          description: The Project ID this call belongs to.
        space_id:
          type: string
          format: uuid
          description: The Space ID this call belongs to.
      required:
        - call_id
        - node_id
        - segment_id
        - call_state
        - direction
        - type
        - from
        - to
        - headers
        - project_id
        - space_id
      description: The call that triggered this fetch.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaCall
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaVars:
      type: object
      properties: {}
      description: >-
        Script-scope variables for this call session. Empty on the initial
        document fetch.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaVars
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaEnvs:
      type: object
      properties: {}
      description: Environment variables configured at the account or project level.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaEnvs
    WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaParams:
      type: object
      properties: {}
      description: >-
        Parameters passed via a SWML calling `execute` or `transfer` step. An
        empty object on the initial document fetch.
      title: WebhooksInboundCallWebhookPayloadContentApplicationJsonSchemaParams

```