# Create Transfer

<mark style="color:blue;">**`POST`**</mark> `https://api.sfox.com/v1`**`/account/transfer`**

Transfer funds between your account's trading and collateral wallets.

{% hint style="info" %}
**Hedge long positions:** Transfer funds to your collateral wallet so you can open a short position on the same currency in your trading wallet.
{% endhint %}

{% hint style="warning" %}
Transfers from your collateral wallet to your trading wallet will automatically settle unsettled positions, if applicable, first. The remainder, if any, will be applied to your trading wallet.
{% endhint %}

### Body Parameters

<table><thead><tr><th width="244">Name</th><th width="95">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>currency</code></strong> <mark style="color:red;">required</mark></td><td>String</td><td>Currency to be transferred</td></tr><tr><td><strong><code>quantity</code></strong> <mark style="color:red;">required</mark></td><td>Number</td><td>Quantity to be transferred</td></tr><tr><td><strong><code>from_wallet</code></strong> <mark style="color:red;">required</mark></td><td>String</td><td>Wallet being transferred from. Possible values:<br><code>trading</code>: your account's trading wallet<br><code>collateral</code>: your account's collateral wallet</td></tr><tr><td><strong><code>to_wallet</code></strong> <mark style="color:red;">required</mark></td><td>String</td><td>Wallet being transferred to. Possible values:<br><code>trading</code>: your account's trading wallet<br><code>collateral</code>: your account's collateral wallet</td></tr></tbody></table>

### Response Body

<table><thead><tr><th width="254">Key</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>from_transaction_id</code></strong></td><td>sFOX generated ID of the transaction debiting the source wallet of the transfer</td></tr><tr><td><strong><code>to_transaction_id</code></strong></td><td>sFOX generated ID of the transaction crediting the destination wallet of the transfer</td></tr><tr><td><strong><code>currency</code></strong></td><td>Currency that was transferred</td></tr><tr><td><strong><code>quantity</code></strong></td><td>Quantity of the currency that was transferred</td></tr><tr><td><strong><code>from_wallet</code></strong></td><td>Name of the source wallet (<code>trading</code> or <code>collateral</code>)</td></tr><tr><td><strong><code>to_wallet</code></strong></td><td>Name of the destination wallet (<code>trading</code> or <code>collateral</code>)</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark></summary>

```json
{
    "from_transaction_id": 5467771,
    "to_transaction_id": 5467772,
    "currency": "btc",
    "quantity": 1,
    "from_wallet": "trading",
    "to_wallet": "collateral"
}
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```bash
curl -H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
-X POST \
--data '{"currency": "btc", "quantity": "1", "from_wallet": "trading", "to_wallet": "collateral"}' \
https://api.sfox.com/v1/account/transfer
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'post',
  url: 'https://api.sfox.com/v1/account/transfer',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  },
  data: { 
    currency: 'btc',
    quantity: 1,
    from_wallet: 'trading',
    to_wallet: 'collateral'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.post(
  "https://api.sfox.com/v1/account/transfer",
  headers={
    "Authorization": "Bearer <API_KEY>",
  },
  data={
    "currency": "btc",
    "quantity": 1,
    "from_wallet": "trading",
    "to_wallet": "collateral"
  }
)
print(data)
```

{% endtab %}
{% endtabs %}
