# Create auto-withdrawal

The method create auto-withdrawal request

Amount limits apply to creation:

* the amount must be **more than $20 in equivalent**
* the amount must be **twice the commission of the network of the final coin/network** (*see the method of obtaining available coins*)

## Description of the request parameters

| Parameter     | Type      | Required | Description                                           |
| ------------- | --------- | -------- | ----------------------------------------------------- |
| `address`     | `string`  | yes      | Destination address                                   |
| `currency`    | `string`  | yes      | The coin you want to receive                          |
| `network`     | `string`  | yes      | The network where you want to receive coins           |
| `amountFrom`  | `string`  | no       | Outgoing amount                                       |
| `amountTo`    | `string`  | no       | The final amount                                      |
| `feeInAmount` | `boolean` | no       | Include the network commission in the swap amount     |
| `webhookUrl`  | `string`  | no       | URL for sending notifications when the status changes |

> It is necessary to send one of the parameters: `amountFrom` or `amountTo`\
> When specifying two parameters, the priority will be `amountFrom`

### Include the network's commission in the swap amount

By specifying the `feeInAmount` parameter in the value `true`, the specified **amount + network** commission will be debited from the address

* If you specify `amountFrom`, the final amount `amountTo` may slip (it may differ from the one specified after the creation request)
* If you specify `amountTo`, the estimated amount of the debit from the address will be blocked + a percentage to cover the insurance of slippage.\
  After the exchange is completed, the amount will be corrected to the amount that was spent for the swap.\
  \&#xNAN;*There may be a slight slippage (≈ 0.1%) of the final amount due to the imposition of swap filters on the amount to be received*

### Additional confirmation

When creating a withdrawal from the payment acceptance widget, a webhook will be sent to the URL specified for withdrawal confirmation when creating the widget.

The webhook body will indicate the user who requested the withdrawal, the requested amount, the requested coins, and the conversion to the coin selected for withdrawal.

You can confirm or reject the withdrawal by sending the corresponding value in the request

Additional fields in the response body:

| Name                              | Description                                                 |
| --------------------------------- | ----------------------------------------------------------- |
| `approveUrl`                      | URL for sending the webhook for confirmation                |
| `approveResult`                   | Confirmation data                                           |
| `approveResult.apiKey`            | API key data                                                |
| `approveResult.apiKey.public`     | Public part of the API key from which the confirmation came |
| `approveResult.request`           | Request data                                                |
| `approveResult.request.ip`        | IP address from which the request came                      |
| `approveResult.request.userAgent` | User-Agent from which the request came                      |
| `approveResult.approve`           | Approved or rejected                                        |
| `approveResult.time`              | Request time                                                |
| `requestedClientId`               | User ID in the merchant system who requested the withdrawal |
| `requestedCurrency`               | Requested coin when creating the withdrawal                 |
| `requestedAmount`                 | Requested amount when creating the withdrawal               |

{% openapi src="<https://615678623-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa1TzfeK1Z0GLFNxiNpMW%2Fuploads%2Fgit-blob-8361e5ac3780661a20a51ec0d96901ce1db69b92%2Fopenapi.json?alt=media>" path="/api-gateway/auto-withdrawals/create" method="post" %}
[openapi.json](https://615678623-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa1TzfeK1Z0GLFNxiNpMW%2Fuploads%2Fgit-blob-8361e5ac3780661a20a51ec0d96901ce1db69b92%2Fopenapi.json?alt=media)
{% endopenapi %}
