# Requesting a Crypto Quote

## Get Asset List

<mark style="color:blue;">`GET`</mark> `https://live.betaapp.com/asset`

#### Query Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| type | String | "fiat" or "crypto" |

#### Headers

| Name                                     | Type   | Description      |
| ---------------------------------------- | ------ | ---------------- |
| accept<mark style="color:red;">\*</mark> | String | application/json |

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

```json
{
  "assets": [
    {
      "active": true,
      "id": "string",
      "large_image_url": "string",
      "medium_image_url": "string",
      "name": "string",
      "networks": [
        {
          "id": "string",
          "name": "string"
        }
      ],
      "small_image_url": "string",
      "symbol": "string",
      "type": "string"
    }
  ],
  "message": "string"
}
```

{% endtab %}

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

```json
{
  "message": "string"
}
```

{% endtab %}
{% endtabs %}

**Request Example:**

<pre class="language-json" data-overflow="wrap"><code class="lang-json"><strong>curl -X 'GET' \
</strong>  'https://live.betaapp.com/v1/asset' \
  -H 'accept: application/json'
</code></pre>

**Response Example:**

```json
{
  "assets": [
    {
      "id": "fc7066e7-669e-4d5e-8f39-a93c4be4df64",
      "name": "Bitcoin",
      "symbol": "BTC",
      "type": "crypto",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/BTC-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/BTC-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/BTC-69.png",
      "networks": [
        {
          "id": "7251cbcb-bb27-4ab1-8213-833205727103",
          "name": "bitcoin"
        }
      ]
    },
    {
      "id": "2f4b229f-3626-458a-9604-db3959d2cb7f",
      "name": "Ethereum",
      "symbol": "ETH",
      "type": "crypto",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/ETH-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/ETH-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/ETH-69.png",
      "networks": [
        {
          "id": "c9921534-4523-4e0c-9745-53228c1c90e4",
          "name": "erc-20"
        }
      ]
    },
    {
      "id": "df16912a-6f7a-493b-a4d7-967a6ccf19d2",
      "name": "Ripple",
      "symbol": "XRP",
      "type": "crypto",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/XRP-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/XRP-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/XRP-69.png",
      "networks": [
        {
          "id": "ad532c74-0aab-480f-ada4-c7e3949a2f2f",
          "name": "ripple"
        }
      ]
    },
    {
      "id": "70b7016d-c2c4-4829-bceb-530fe512446d",
      "name": "USD Tether",
      "symbol": "USDT",
      "type": "crypto",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/USDT-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/USDT-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/USDT-69.png",
      "networks": [
        {
          "id": "3efae459-e2c2-4b0d-9a2f-0ac4cbc68e8b",
          "name": "tron"
        }
      ]
    },
    {
      "id": "3c3152a7-c2da-4ce1-a1b9-2206e7ed07da",
      "name": "Brazilian Real",
      "symbol": "BRL",
      "type": "fiat",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/BRL-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/BRL-20.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/BRL-69.png",
      "networks": null
    },
    {
      "id": "87d859d1-ffb8-4f0c-b53e-47d7059f3f15",
      "name": "United States Dollar",
      "symbol": "USD",
      "type": "fiat",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/USD-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/USD-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/USD-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Argentine Peso",
      "symbol": "ARS",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/ARS-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/ARS-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/ARS-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Colombian Peso",
      "symbol": "COP",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/COP-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/COP-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/COP-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Euro",
      "symbol": "EUR",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/EUR-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/EUR-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/EUR-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "British Pound Sterling",
      "symbol": "GBP",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/GBP-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/GBP-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/GBP-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Mexican Peso",
      "symbol": "MXN",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/MXN-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/MXN-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/MXN-69.png",
      "networks": null
    },
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "CFA Franc BCEAO",
      "symbol": "XOF",
      "type": "exotic",
      "active": true,
      "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/XOF-20.png",
      "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/XOF-35.png",
      "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/XOF-69.png",
      "networks": null
    }
  ]
}
```

## Get Available Networks for an Asset

<mark style="color:blue;">`GET`</mark> `https://live.betaapp.com/v1/network/asset/`

#### Query Parameters

| Name                                    | Type   | Description                             |
| --------------------------------------- | ------ | --------------------------------------- |
| asset<mark style="color:red;">\*</mark> | String | Check Crypto coverage for more details. |

#### Headers

| Name                                     | Type   | Description      |
| ---------------------------------------- | ------ | ---------------- |
| accept<mark style="color:red;">\*</mark> | String | application/json |

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

```json
{
  "message": "string",
  "networks": [
    {
      "id": "string",
      "name": "string"
    }
  ]
}
```

{% endtab %}

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

```json
{
  "message": "string"
}
```

{% endtab %}
{% endtabs %}

**Request Example:**

{% code overflow="wrap" %}

```json
curl -X 'GET' \
  'https://live.betaapp.com/v1/network/asset/BTC' \
  -H 'accept: application/json'
```

{% endcode %}

**Response Example:**

```json
{
  "networks": [
    {
      "id": "7251cbcb-bb27-4ab1-8213-833205727103",
      "name": "bitcoin"
    }
  ]
}
```

## Get the quote for a specific asset&#x20;

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

The quote is updated every 20 seconds in our back-end.

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {access\_token} |
| accept<mark style="color:red;">\*</mark>        | String | application/json       |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json       |

#### Request Body

| Name                                            | Type   | Description                       |
| ----------------------------------------------- | ------ | --------------------------------- |
| network<mark style="color:red;">\*</mark>       | String | Network based on the crypto asset |
| source\_asset<mark style="color:red;">\*</mark> | String | *Asset to be deposited*           |
| target\_asset<mark style="color:red;">\*</mark> | String | *Asset for Settlement*            |
| target\_amount                                  | Number | Amount for Target Asset           |
| product\_id                                     | String | "payments"                        |
| source\_amount                                  | Number | Amount for Source Asset           |

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

```json
{
  "asset": {
    "large_image_url": "string",
    "medium_image_url": "string",
    "name": "string",
    "small_image_url": "string",
    "symbol": "string",
    "type": "string"
  },
  "message": "string",
  "price": {
    "price": 0,
    "symbol": "string"
  },
  "source_amount_estimate": 0,
  "source_asset": "string",
  "target_amount": 0,
  "target_asset": "string"
}
```

{% endtab %}

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

```json
{
  "message": "string"
}
```

{% endtab %}
{% endtabs %}

**Request Example:**

{% code overflow="wrap" %}

```json
curl -X 'POST' \
  'https://live.betaapp.com/v1/quote' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InJlaEF1NURPY...ctfx2I4g' \
  -H 'Content-Type: application/json' \
  -d '{
  "network": "bitcoin",
  "product": "payments",
  "source_amount": 0,
  "source_asset": "BTC",
  "target_amount": 500,
  "target_asset": "BRL"
}'
```

{% endcode %}

{% hint style="warning" %}
When requesting a quote for the **Payments Product**, do not inform **`source_amount`**.
{% endhint %}

**Response Example:**

```json
{
  "source_amount_estimate": 0.002878,
  "source_asset": "BTC",
  "target_amount": 500,
  "target_asset": "BRL",
  "asset": {
    "name": "Bitcoin",
    "type": "crypto",
    "small_image_url": "https://storage.googleapis.com/cryptoassets_images/20px/BTC-20.png",
    "medium_image_url": "https://storage.googleapis.com/cryptoassets_images/35px/BTC-35.png",
    "large_image_url": "https://storage.googleapis.com/cryptoassets_images/69px/BTC-69.png"
  },
  "price": {
    "symbol": "BTCBRL",
    "price": 173712.96
  }
}
```

{% hint style="info" %}
The **`source_amount_estimate`** is the parameter that returns how much Crypto the payer should deposit.
{% endhint %}

**Here is how the Quote should be displayed on the front end:**

<figure><img src="https://1939399964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYtMUiMaFCmvrN6kCUbMe%2Fuploads%2FG9MZtOq165KWmiauctF5%2FScreenshot%202023-08-10%20at%2016.04.10.png?alt=media&#x26;token=f595f221-b7cb-4063-b54d-52b6aef8d517" alt=""><figcaption><p>Example of how the Quote being displayed in the front end</p></figcaption></figure>
