# Crypto and Fiat Withdrawal

## Withdrawal to an external Wallet

<mark style="color:green;">`POST`</mark> `https://live.betaapp.com/v1/order/withdrawal`

#### Headers

| Name                                               | Type   | Description            |
| -------------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark>    | String | Bearer {access\_token} |
| x-sub-account-id<mark style="color:red;">\*</mark> | String | Sub Account ID         |
| accept<mark style="color:red;">\*</mark>           | String | application/json       |

#### Request Body

| Name                                                  | Type   | Description                                                           |
| ----------------------------------------------------- | ------ | --------------------------------------------------------------------- |
| target\_asset<mark style="color:red;">\*</mark>       | String | Crypto asset                                                          |
| network<mark style="color:red;">\*</mark>             | String | Crypto asset's network                                                |
| target\_destination<mark style="color:red;">\*</mark> | String | Crypto wallet                                                         |
| target\_amount<mark style="color:red;">\*</mark>      | String | Amount to be processed                                                |
| target\_destination\_tag                              | String | Crypto wallet tag (If applicable)                                     |
| instant\_payment\_type                                | String | <p>Only for Fiat Withdrawal</p><p>Brazil: PIX </p><p>Mexico: SPEI</p> |

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

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}
{% endtabs %}

**Request Example for Crypto Withdrawal:**

```json
curl -X 'POST' \
  'https://live.betaapp.com/v1/order/withdrawal' \
  -H 'accept: application/json' \
  -H 'X-sub-account-id: 22376b76...43083b' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InJlaEF1NURPY...ctfx2I4g' \
  -H 'Content-Type: application/json' \
  -d '{
  "instant_payment_type": "",
  "network": "bitcoin",
  "target_amount": 1,
  "target_asset": "BTC",
  "target_destination": "014027...57", 
  "target_destination_tag": "" 
}'
```

{% hint style="info" %}
For Fiat Withdrawals you only need to inform the `instant_payment_type, asset, and target_amount` fields. The withdrawal will be processed to the registered subaccount's bank account details.
{% endhint %}

**Request Example for Fiat Withdrawal:**

```json
curl -X 'POST' \
  'https://live.betaapp.com/v1/order/withdrawal' \
  -H 'accept: application/json' \
  -H 'X-sub-account-id: 22376b76...43083b' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InJlaEF1NURPY...ctfx2I4g' \
  -H 'Content-Type: application/json' \
  -d '{
  "instant_payment_type": "PIX",
  "network": "",
  "target_amount": 100,
  "target_asset": "BRL",
  "target_destination": "", 
  "target_destination_tag": "" 
}'
```

**Response Example for both Fiat and Crypto:**

{% code overflow="wrap" %}

```json
{
  "amount": 1,
  "asset": {
    "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/BTC-69.png",
    "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/BTC-35.png",
    "name": "Bitcoin",
    "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/BTC-20.png",
    "type": "crypto"
  },
  "date_time": "2023-11-22T13:09:33.079445313Z",
  "deposit": false,
  "exp_time": 1200,
  "message": "Success",
  "network": "bitcoin"
}
```

{% endcode %}


---

# 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.betaramps.com/documentation-beta-ramps/exchange-crypto-to-fiat/crypto-and-fiat-withdrawal.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.
