---
title: "Start a swap."
method: GET
path: "/swap"
tags: ["Swap"]
---

# Start a swap.

`GET /swap`

## Request

- Base URL: `https://chainflip-broker.io`
- URL: `https://chainflip-broker.io/swap`
- Auth: one of:
  - API key in query parameter `apiKey`
  - API key in header `X-API-Key`

Opens a deposit channel and returns the deposit address the user sends
`sourceAsset` to. Once the deposit arrives the swap runs and pays out to
`destinationAddress`, with your broker fee taken. `minimumPrice`,
`refundAddress` and `retryDurationInBlocks` protect against slippage: if the
price cannot be met within that time, the deposit is refunded.
`livePriceSlippageTolerancePercent` adds a limit against Chainflip's oracle price. Optional
parameters add Boost (Bitcoin), DCA, a commission override and up to four affiliates. Follow the
swap with `getStatusById` or `getStatusByDepositChannel`.

## Query parameters

- `apiKey` string
- `sourceAsset` string, required
- `destinationAsset` string, required
- `destinationAddress` string, required
- `commissionBps` integer
- `boostFee` integer
- `minimumPrice` number, double, required
- `refundAddress` string, required
- `retryDurationInBlocks` integer, required
- `livePriceSlippageTolerancePercent` number, double
- `numberOfChunks` integer
- `chunkIntervalBlocks` integer
- `affiliate1` string
- `affiliate1CommissionBps` integer
- `affiliate2` string
- `affiliate2CommissionBps` integer
- `affiliate3` string
- `affiliate3CommissionBps` integer
- `affiliate4` string
- `affiliate4CommissionBps` integer
- `platform` string

## Response `200`

A deposit address for the given swap.

- ChainflipBaasSwapDepositAddress: The deposit channel opened for the swap. Send the source asset to `address` on `network` before the channel expires at `sourceExpiryBlock`, then follow the swap with `getStatusById` (using `id`) or `getStatusByDepositChannel`.
  - `id` integer, nullable: The BaaS swap id: pass it as `swapId` to `getStatusById`. Absent in the rare case the swap could not be recorded right away; follow it with `getStatusByDepositChannel` then.
  - `address` string, required: The deposit address to send source assets to.
  - `issuedBlock` integer, required: The block in which the deposit address was issued.
  - `network` string, required: The network to send the source assets over.
  - `channelId` integer, required: The channel id to monitor the deposit.
  - `sourceExpiryBlock` integer, required: The block (on the source network) in which the deposit address will expire.
  - `explorerUrl` string, required: The explorer url to monitor the deposit.
  - `channelOpeningFee` number, double, required: Fee in $FLIP to open the deposit channel.
  - `channelOpeningFeeNative` string, required: Fee in $FLIP flipperinos to open the deposit channel.
  - `destinationAddress` string, required: The destination address the swap was accepted for, exactly as you sent it (no change of case, prefix or encoding). Always present.

## Other responses

- `400`: The request has invalid information.
- `401`: The partner does not have access.
- `403`: Swaps between these assets are not enabled for the partner.
- `500`: An error occurred.
- `503`: A temporary upstream condition, such as maintenance, a disabled asset or the network channel cap. Retry with backoff.

---

[API](https://skmtc.dev/chainflip-broker/apis/chainflip-broker-as-a-service.md) · [All operations](https://skmtc.dev/chainflip-broker/apis/chainflip-broker-as-a-service/llms.txt) · [OpenAPI document](https://skmtc.dev/chainflip-broker/apis/chainflip-broker-as-a-service/revisions/3c819d79d6b9?raw)
