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

# transfer

> Tail-call to a new SWML document fetched from a URL.

Fetch and execute a new SWML document from a URL. This is a **tail call** — it replaces the current
document and does not return. Steps after `transfer`, including steps in calling sections, are
skipped.

In the messaging context, `transfer.dest` must be a URL — it does not accept a section name or an
inline document.

## **Properties**

An object that accepts the following properties.

URL (`http` or `https`) to fetch the new SWML document from. Authentication can be set in the URL in
the format `username:password@url`.

HTTP method for the fetch request. One of `GET`, `POST`, `PUT`, `PATCH`, or `DELETE`.

Parameters to include in the request body of the fetch. Available as `params.*` in the transferred
document.

## **Webhook payload sent to `dest`**

When `transfer` fetches an external document, SignalWire `POST`s the
[inbound message webhook payload](/docs/apis/rest/swml-webhook/webhooks/inbound-message-webhook)
to `dest`:

* `message` — the original inbound message that triggered this SWML document.
* `params` — the values supplied to this `transfer` step.
* `vars` — runtime variables propagated from the current document (`request_result`,
  `reply_result`, `request_response`, `request_response_code`, `request_response_body`,
  `reply_message_id`). Present on transfer-driven fetches; absent on the initial inbound fetch.

## **Examples**

### Transfer to an external SWML handler

```yaml
version: 1.0.0
sections:
  main:
    - transfer:
        dest: "https://example.com/messaging-handler"
        params:
          reason: "escalation"
```

```json
{
  "version": "1.0.0",
  "sections": {
    "main": [
      {
        "transfer": {
          "dest": "https://example.com/messaging-handler",
          "params": {
            "reason": "escalation"
          }
        }
      }
    ]
  }
}
```

### Route to different handlers based on keyword

```yaml
version: 1.0.0
sections:
  main:
    - switch:
        variable: message.body
        transform: lowercase_trim
        case:
          sales:
            - transfer:
                dest: "https://example.com/sales-handler"
                params:
                  source: "sms"
          support:
            - transfer:
                dest: "https://example.com/support-handler"
                params:
                  source: "sms"
        default:
          - reply:
              body: "Reply SALES or SUPPORT to be routed to the right team."
```

```json
{
  "version": "1.0.0",
  "sections": {
    "main": [
      {
        "switch": {
          "variable": "message.body",
          "transform": "lowercase_trim",
          "case": {
            "sales": [
              {
                "transfer": {
                  "dest": "https://example.com/sales-handler",
                  "params": {
                    "source": "sms"
                  }
                }
              }
            ],
            "support": [
              {
                "transfer": {
                  "dest": "https://example.com/support-handler",
                  "params": {
                    "source": "sms"
                  }
                }
              }
            ]
          },
          "default": [
            {
              "reply": {
                "body": "Reply SALES or SUPPORT to be routed to the right team."
              }
            }
          ]
        }
      }
    ]
  }
}
```