# Requesting a Quote

## Get Asset List

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

#### Query Parameters

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

#### 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:**

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

**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"
        }
      ]
    }
  ]
}
```

## Get Available Networks for an Asset

<mark style="color:blue;">`GET`</mark> `https://live.betaapp.com/network/asset/{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 or when the user changes the asset parameters.

#### Headers

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

#### Request Body

| Name                                            | Type   | Description                                                                                      |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------ |
| source\_asset<mark style="color:red;">\*</mark> | String | *Asset that user wants to provide in the transaction. It could be any Fiat or Crypto.*           |
| target\_asset<mark style="color:red;">\*</mark> | String | *Asset that user wants to receive in the transaction. It could be any supported Fiat or Crypto.* |
| target\_amount                                  | Number | Amount to be delivered                                                                           |
| source\_amount                                  | String | Amount to be collected                                                                           |
| network<mark style="color:red;">\*</mark>       | String | *Crypto network of the transaction*                                                              |
| product<mark style="color:red;">\*</mark>       | String | "exchange"                                                                                       |

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

```json
{
  "asset": {
    "name": "string",
    "medium_image_url": "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": "exchange",
  "source_amount": 1,
  "source_asset": "BTC",
  "target_amount": 0,
  "target_asset": "MXN"
}'
```

{% endcode %}

**Response Example:**

```json
{
  "target_amount_estimate": 627271.28,
  "source_asset": "BTC",
  "source_amount": 1,
  "target_asset": "MXN",
  "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": "BTCMXN",
    "price": 627271.28
  }
}
```

{% hint style="info" %}
You may receive **`target_amount_estimate`** or **`source_amount_estimate`**&#x77;hen requesting quote.\
\
If the user provides values for the Source Asset, Beta will provide a quote for the Target asset, and vice versa.
{% endhint %}
