> For the complete documentation index, see [llms.txt](https://learn.layerswap.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.layerswap.io/api/api-integration/deprecated-v1-api-reference/create-swap.md).

# Create Swap

In order to initiate the process of bridging assets across blockchains, CEXes, and fiat, a Swap should be created. Swap has all the necessary information required to be able to process transfers from the source to the destination.

<mark style="color:green;">`POST`</mark> `https://api.layerswap.io/api/swaps`

Create swap

#### Headers

| Name                                           | Type   | Description                                                   |
| ---------------------------------------------- | ------ | ------------------------------------------------------------- |
| X-LS-APIKEY<mark style="color:red;">\*</mark>  | String | API Key retrieved from [Partner Setup](/api/partner-setup.md) |
| Content-Type<mark style="color:red;">\*</mark> |        | application/json                                              |

#### Request Body

| Name                                                   | Type   | Description                                                                                                                                                     |
| ------------------------------------------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| destination<mark style="color:red;">\*</mark>          | String | The supported blockchain network name, where the funds should be sent by the user.[ See available values.](/api/data/supported-platforms/supported-networks.md) |
| source<mark style="color:red;">\*</mark>               | String | The supported blockchain network name, where the funds should be sent by the user.[ See available values.](/api/data/supported-platforms/supported-networks.md) |
| amount<mark style="color:red;">\*</mark>               | Number | The predefined amount. Note that this is **NOT** the final amount sent by the user since the user can specify another amount while transferring.                |
| source\_asset<mark style="color:red;">\*</mark>        | String | The swap currency name. [See available assets](broken://pages/OP5GKjebwv1aQjx1fVNx).                                                                            |
| destination\_address<mark style="color:red;">\*</mark> | String | The destination network address, where the user will receive the funds.                                                                                         |
| refuel<mark style="color:red;">\*</mark>               | Bool   | If set to true, the user will receive an additional refuel transaction in the native currency to the specified `destination_address.`                           |
| reference\_id                                          | String | Partner specified ID that could be used for the future reference to retrieve the swap.                                                                          |
| destination\_asset                                     | String | The swap currency name. [See available assets](broken://pages/OP5GKjebwv1aQjx1fVNx).                                                                            |

{% tabs %}
{% tab title="201: Created Newly created swap Id" %}

```json
{
  "data": {
    "swap_id": "28996c7d-ee95-4727-8efe-ba0006aa16d4"
    }
  "error": null
}
```

{% endtab %}
{% endtabs %}

#### Raw request

<pre class="language-bash"><code class="lang-bash">curl -X 'POST' \
'https://api.layerswap.io/api/swaps' \
<strong>  -H 'X-LS-APIKEY: {YOUR_APP_APIKEY}' \
</strong>  -H 'Content-Type: application/json' \
  -d '{
      "source": "ETHEREUM_MAINNET",
      "destination": "ARBITRUM_MAINNET",
      "amount": 0.007,
      "source_asset": "ETH",
      "destination_asset": "ETH",
      "destination_address": "0xe688b84b23f322a994A53dbF8E15FA82CDB71127",
      "refuel": false,
      "reference_id": "1"
  }'
</code></pre>

#### Raw response

```json
{
  "data": {
    "swap_id": "28996c7d-ee95-4727-8efe-ba0006aa16d4"
    }  
  "error": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://learn.layerswap.io/api/api-integration/deprecated-v1-api-reference/create-swap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
