# Creating Payout

This resource allows users to submit cryptocurrency payouts to active recipients. It caters to various use cases such as offering cryptocurrency withdrawals to clients, facilitating payouts for marketplaces or affiliate networks, or managing payroll by creating multiple payouts at once.

<mark style="color:green;">`POST`</mark> `https://api.oxapay.com/api/send`

To use this endpoint, you need to make a POST request to the specified URL with the required parameters. The typical parameters for this request include:

#### Request Body

<table><thead><tr><th width="147">Name</th><th width="100">Type</th><th width="505">Description</th></tr></thead><tbody><tr><td>key<mark style="color:red;">*</mark></td><td>string</td><td>Your payout API key for authentication and authorization.</td></tr><tr><td>callbackUrl</td><td>string</td><td>The URL where payment information and status updates will be sent. You can include additional parameters in the URL if needed.</td></tr><tr><td>network</td><td>string</td><td>The blockchain <a href="/pages/PDPsC6YSkcay1dmWueRA">network</a> to be used for the payout. The field is required for external payment</td></tr><tr><td>memo</td><td>string</td><td>You can set a memo for <a href="/pages/PDPsC6YSkcay1dmWueRA">networks</a> that support this option.</td></tr><tr><td>currency<mark style="color:red;">*</mark></td><td>string</td><td>The <a href="/pages/J7efulCOZC0zGKzpVHol">symbol of the cryptocurrency</a> to be sent (e.g., BTC, ETH, LTC, etc.).</td></tr><tr><td>amount<mark style="color:red;">*</mark></td><td>decimal</td><td>The amount of cryptocurrency to be sent as the payout.</td></tr><tr><td>address<mark style="color:red;">*</mark></td><td>string</td><td>The cryptocurrency address of the recipient where the payout will be sent.</td></tr><tr><td>description</td><td>string</td><td>Provide payout details or any additional information that will be shown in different reports.</td></tr></tbody></table>

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

```json
{
  "result": integer, // The result code indicates the success or failure of the request.
  "message": string, // A message providing additional information about the result.
  "trackId": string, // The unique identifier for the payout request in the OxaPay payment gateway. 
  "status": string // The current status of the payout (Processing, Sending, Complete, or Rejected).
}
```

{% endtab %}
{% endtabs %}

Please ensure that you provide the necessary parameters accurately in the request to create a payout successfully. Additionally, handle the response accordingly based on the \`result\` and \`status\` fields to track the progress and status of your payouts.

Please note that a successful request will return a result code 100. In case of any issues or validation problems, refer to the corresponding [result codes](/legacy/api-reference/result-code-table.md) for further details.

### Example codes

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

```bash
curl -X POST https://api.oxapay.com/api/send \
-d '{
  "key": "YOUR_PAYOUT_API_KEY",
  "address": "RECEIVER_CRYPTO_ADDRESS",
  "amount": 0.5,
  "currency": "BTC",
  "callbackUrl": "https://example.com/callback"
}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://api.oxapay.com/api/send';

$data = array(
  'key' => 'YOUR_PAYOUT_API_KEY',
  'address' => 'RECEIVER_CRYPTO_ADDRESS',
  'amount' => 0.5,
  'currency' => 'BTC',
  'callbackUrl' => 'https://example.com/callback'
);

$options = array(
    'http' => array(
        'header' => 'Content-Type: application/json',
        'method'  => 'POST',
        'content' => json_encode($data),
    ),
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response);
var_dump($result);
?>
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const axios = require('axios');
const url = 'https://api.oxapay.com/api/send';
const data = {
  key: 'YOUR_PAYOUT_API_KEY',
  address: 'RECEIVER_CRYPTO_ADDRESS',
  amount: 0.5,
  currency: 'BTC',
  callbackUrl: 'https://example.com/callback'
};

axios.post(url, data)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error.response.data);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = 'https://api.oxapay.com/api/send'
data = {
  'key': 'YOUR_PAYOUT_API_KEY',
  'address': 'RECEIVER_CRYPTO_ADDRESS',
  'amount': 0.5,
  'currency': 'BTC',
  'callbackUrl': 'https://example.com/callback'
}
response = requests.post(url, data=json.dumps(data))
result = response.json()
print(result)
```

{% endtab %}
{% endtabs %}

Replace `YOUR_PAYOUT_API_KEY` with your actual payout API key, and `RECEIVER_CRYPTO_ADDRESS` with the recipient's cryptocurrency address for the payout.

### Allowed IPs for Transfers

To enhance security, you can configure allowed IPs to control who can initiate payout requests. If you set this restriction, only requests coming from the specified IPs will be permitted. Any transfer requests from other IPs will be failed.

To use this feature, you can receive your server's IP address by using the following endpoint:

<mark style="color:green;">`GET`</mark> `https://api.oxapay.com/api/myip`

To determine which IP version works with the OxaPay endpoint, you can use the API provided.


---

# 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.oxapay.com/legacy/api-reference/creating-payout.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.
