# Create an Internal Transfer Request

This endpoint allows a merchant to transfer funds between two wallets owned by the same merchant within the Tylt ecosystem.

Internal transfers are processed as ledger movements within Tylt and do not involve any on-chain blockchain transaction.

**Endpoint**

<mark style="color:green;">**`POST`**</mark>`https://api.tylt.money/transactions/merchant/transferMerchantBalance`

{% tabs %}
{% tab title="First Tab" %}

<table data-full-width="true"><thead><tr><th width="133">Name</th><th width="79">Type</th><th width="167">Example</th><th>Description</th></tr></thead><tbody><tr><td>X-TLP-APIKEY</td><td>string</td><td>93ee3c5e133697251b5362bcf9cc8532476785t8768075616f58d88</td><td>Your Tylt API Key, used to identify your account in API requests.</td></tr><tr><td>X-TLP-SIGNATURE</td><td>string</td><td>d0afef3853dfc8489c8b9affa5825171fdd7y7685675e4966a05f66ed2b3eaf9462b3c9c0</td><td>HMAC SHA-256 signature generated using the API Secret Key to secure the request.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
When using the API, ensure to include your API Key and generate the signature for the request payload using your API Secret. The tables provided above contain example values for illustration purposes only. Please refer to the code snippets for detailed instructions on how to sign the request and generate the signature properly.
{% endhint %}

**Request Body**

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

<table data-header-hidden><thead><tr><th width="204"></th><th width="121"></th><th></th></tr></thead><tbody><tr><td><strong>Field Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>fromUUID</code></td><td><code>string</code></td><td>Unique identifier of the source wallet (debited wallet)</td></tr><tr><td><code>toUUID</code></td><td><code>string</code></td><td>Unique identifier of the destination wallet (credited wallet)</td></tr><tr><td><code>settledAmount</code></td><td><code>string</code></td><td>Amount to be transferred between wallets</td></tr><tr><td><code>settledCurrency</code></td><td><code>string</code></td><td>Currency of transfer (e.g., USDT, USDC)</td></tr><tr><td><code>comments</code></td><td><code>string</code></td><td>Optional remarks or internal reference for reconciliation</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

**Code Snippet**

{% tabs %}
{% tab title="JavaScript (Axios)" %}

```javascript
import axios from "axios";
import crypto from "crypto";

const apiKey = "your-api-key";
const apiSecret = "your-api-secret";

function createSignature(apiSecret, bodyString) {
    return crypto
        .createHmac("sha256", apiSecret)
        .update(bodyString)
        .digest("hex");
}

const transferMerchantBalanceData = {
    fromUUID: "ybht35h-2a33-11f0-b2d9-42010a28011c",
    toUUID: "bkhe4tt-33cc-11f0-b2d9-42010a28011c",
    settledAmount: 2,
    settledCurrency: "USDT",
    comments: "",
};

try {
    const signature = createSignature(
        apiSecret,
        JSON.stringify(transferMerchantBalanceData),
    );
    console.log("Generated signature: ", signature);

    const apiDomain = "https://api.tylt.money/transactions/merchant";
    const res1 = await axios.request({
        method: "POST",
        url: `${apiDomain}/transferMerchantBalance`,
        headers: {
            "Content-Type": "application/json",
            "X-TLP-APIKEY": apiKey,
            "X-TLP-SIGNATURE": signature,
        },
        data: transferMerchantBalanceData,
    });

    console.log(`Response: ${JSON.stringify(res1.data)}`);
} catch (error) {
    console.log(error);
}
```

{% endtab %}
{% endtabs %}

**Response**

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

```json
{
  "data": {
    "transactionOrderId": "hjbhj-546f-3ff3-cw4t4f3"
  },
  "msg": ""
}
```

{% endtab %}

{% tab title="Response Fields" %}

<table data-header-hidden><thead><tr><th width="236"></th><th width="96"></th><th></th></tr></thead><tbody><tr><td><strong>Field Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td>orderId</td><td>string</td><td>The orderId associated with a successful internal transaction.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
