# Create Transfer

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

Transfer funds between your master account and an end user account with `Payment` (user -> master account) or `Payout` (master account -> user) transfers.&#x20;

* `Payment` transfers will be created in a pending state until verified by the end user.&#x20;
* `Payout` transfers will be created and processed immediately.

### Body Parameters

<table><thead><tr><th width="280">Parameter</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>transfer_id</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Partner generated transfer and idempotency ID</td></tr><tr><td><strong><code>description</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Description/memo for the transfer</td></tr><tr><td><strong><code>purpose</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td><p>Transfer purpose. Possible values:</p><ul><li> <code>GOOD</code> </li><li> <code>SERVICE</code></li></ul></td></tr><tr><td><strong><code>type</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td><p>Transfer type. Possible values:</p><ul><li> <code>PAYMENT</code> </li><li> <code>PAYOUT</code></li></ul></td></tr><tr><td><strong><code>user_id</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>The unique ID of the user's account this transfer will be applied to. </td></tr><tr><td><strong><code>currency</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>Transfer currency e.g. <code>ETH</code></td></tr><tr><td><strong><code>quantity</code></strong> <mark style="color:red;">required</mark></td><td>number</td><td>Transfer quantity</td></tr><tr><td><strong><code>rate</code></strong> <mark style="color:red;">required</mark></td><td>number</td><td>USD FX Rate of the transfer. e.g. User pays <code>0.1</code> ETH for <code>$200</code> gift card then <code>RATE</code> = <code>2000</code></td></tr></tbody></table>

### Response Body

<table><thead><tr><th width="280">Key</th><th width="112">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>transfer_id</code></strong></td><td>string</td><td>Partner generated transfer and idempotency ID</td></tr><tr><td><strong><code>transfer_status_code</code></strong></td><td>string</td><td>Status of the transfer</td></tr><tr><td><strong><code>type</code></strong></td><td>string</td><td>Transfer type</td></tr><tr><td><strong><code>quantity</code></strong></td><td>number</td><td>Transfer quantity</td></tr><tr><td><strong><code>currency</code></strong></td><td>string</td><td>Trasfer currency</td></tr><tr><td><strong><code>user_id</code></strong></td><td>string</td><td>The Connect user ID this transfer will apply to</td></tr><tr><td><strong><code>rate</code></strong></td><td>number</td><td>USD FX Rate of the transfer</td></tr><tr><td><strong><code>purpose</code></strong></td><td>string</td><td>Transfer purpose</td></tr><tr><td><strong><code>description</code></strong></td><td>string</td><td>Currency pair that the fee is specifed for</td></tr><tr><td><strong><code>atx_id_charged</code></strong></td><td>int</td><td>ID of the charge account transaction</td></tr><tr><td><strong><code>atx_id_credited</code></strong></td><td>int</td><td>ID of the credit account transaction</td></tr><tr><td><strong><code>atx_status_charged</code></strong></td><td>int</td><td>Status of the charge account transaction</td></tr><tr><td><strong><code>atx_status_credited</code></strong></td><td>int</td><td>Status of the credit account transaction</td></tr><tr><td><strong><code>transfer_date</code></strong></td><td>datetime</td><td>Transfer date</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;"><strong>201</strong></mark><strong> Created</strong></summary>

{% code overflow="wrap" lineNumbers="true" %}

```json
{
    "data": {
        "transfer_id": "7735757c-863e-4e07-9b84-af186424ebae",
        "transfer_status_code": "PENDING",
        "type": "PAYMENT",
        "quantity": 0.1,
        "currency": "eth",
        "user_id": "ClientAccount1",
        "rate": 2000,
        "purpose": "GOOD",
        "description": "Gift card payment",
        "atx_id_charged": 1728524,
        "atx_id_credited": 1728525,
        "atx_status_charged": 1127,
        "atx_status_credited": 1127,
        "transfer_date": "2023-09-07T16:56:56.000Z"
    }
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;"><strong>403</strong></mark><strong> Forbidden</strong></summary>

{% code overflow="wrap" lineNumbers="true" %}

```json
//You do not have permission to create transfers.
{
    "error": "Partner transfer permission not granted."
}
```

{% endcode %}

</details>

<details>

<summary><mark style="color:red;"><strong>422</strong></mark><strong> Unprocessable Entity</strong></summary>

{% code overflow="wrap" lineNumbers="true" %}

```json
//Duplicate request
{
    "error": "A transaction with the same transfer_id already exists."
}

//Transfer currency is restricted for you and/or the end user
{
    "error": "Restricted currency for partner or end user."
}

//Your account and/or the user's account has insufficient balance of this currency for the transfer quantity.
{
    "error": "Insufficient funds."
}
```

{% endcode %}

</details>

### Example Requests

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

```bash
curl -X POST \
  -H 'Content-type: application/json' \
  -H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
  --data '{ "transfer_id": "7735757c-863e-4e07-9b84-af186424ebae",
          "user_id": "ClientAccount1",
          "type": "PAYMENT",
          "purpose": "GOOD",
          "description": "Gift card payment",
          "currency": "eth",
          "quantity": 0.1,
          "rate": 2000 }'  \
  'https://api.sfox.com/v1/enterprise/transfer'
```

{% endtab %}

{% tab title="NodeJS" %}

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

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/enterprise/transfer',
  headers: {
    "Content-Type": "application/json",
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  },
  data: {
    transfer_id: '7735757c-863e-4e07-9b84-af186424ebaeE',
    user_id: 'ClientAccount1',
    type: 'PAYMENT',
    purpose: 'GOOD',
    description: 'Gift card payment',
    currency: 'eth',
    quantity: 0.1,
    rate: 2000
  }
}

axios(config)
    .then((response) => {
      console.log(response.status)
      console.log(response.data)
    })
    .catch((err) => {
      console.error(err.response.status)
      console.error(err.response.data)
    });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/enterprise/transfer",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  },
  json={
    "transfer_id": "7735757c-863e-4e07-9b84-af186424ebae",
    "user_id": "ClientAccount1",
    "type": "PAYMENT",
    "purpose": "GOOD",
    "description": "Gift card payment",
    "currency": "eth",
    "quantity": 0.1,
    "rate": 2000
  }
)
print(data.status_code)
print(data.json())
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sfox.com/connect/rest-api/transfers/create-transfer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
