Request a Conversion Quote

The POST /api/v4/currency_conversions method enables you to request a conversion quote. Before you can execute a conversion of your working capital from one currency to another, you must request a quote, which presents, among others, the conversion rate offered, the amount to spend in the source currency, the amount to receive in the target currency, and the fee charged if the quote is accepted.

Quotes expire in 30 seconds. Hence, you must accept (execute) it within this period. When a quote expires, you can no longer run it and must request a new one.

You can request the quote in two different, mutually exclusive ways:

  • Setting how much you want to convert (spend_amount) from one currency to another.
  • Specifying how much you expect to receive (receive_amount) as a product of the conversion.

In either, you also specify the source and target currencies.

HTTP Request

To request a conversion, complete the following HTTP request using the appropriate body parameters:

POST https://stage.bitso.com/api/v4/currency_conversions

Header Parameters

You must specify the following authentication parameters in your request:

ParameterDescriptionRequired
keySee the section, AuthenticationYes
signatureSee the section, AuthenticationYes
nonceSee the section, AuthenticationYes

Body Parameters

Body parameters must be JSON encoded and precisely the same as the JSON payload used to construct the signature:

ParameterDescriptionTypeRequired
from_currencyThe ticker of the source currency. For example, mxn.StringYes
to_currencyThe ticker of the target currency. For example, btc.StringYes
receive_amountThe amount you expect to receive as a result of the conversion, specified in the target currency. This value should be a positive number.StringNo. See callout below
spend_amountThe amount you are willing to convert, specified in the source currency. This value should be a positive number.StringNo. See callout below

🚧

Mutually exclusive parameters

Recall these amounts are mutually exclusive, so ensure you include only one of them in your request.

πŸ“˜

Supported currencies

For details on supported currencies, see the section, Currency Dictionary.

Request Examples

The next examples show the two ways the endpoint offers to specify the amount in your request.

{
    "from_currency":"mxn",
    "to_currency":"usd",
    "receive_amount":"100"
}
{
    "from_currency":"mxn",
    "to_currency":"usd", 
    "spend_amount":"1000"
}

JSON Response Payload

A successful call returns a JSON object representing a conversion quote. The following response objects exemplify the JSON object returned:

{
    "success": true,
    "payload": {
        "id": "zmAfx2rvNnv1Jn0Q",
        "from_amount": "1854.21860516",
        "from_currency": "mxn",
        "to_amount": "100.00000000",
        "to_currency": "usd",
        "estimated_slippage": {
            "value": "0.0000",
            "level": "normal",
            "message": ""
        },
        "created": 1719862339217,
        "expires": 1719862369217,
        "rate": "18.54",
        "plain_rate": "18.36",
        "rate_currency": "mxn",
        "padding": "0.0098",
        "book": "xrp_mxn",
        "next_recurrent_events": {
            "WEEKLY": 1720467139217,
            "DAILY": 1719948739217,
            "MONTHLY": 1722540739217
        }
    }
}
{
    "success": true,
    "payload": {
        "id": "IJAdSHvtsyGSCnPq",
        "from_amount": "1000.00000000",
        "from_currency": "mxn",
        "to_amount": "53.93125050",
        "to_currency": "usd",
        "estimated_slippage": {
            "value": "0.0000",
            "level": "normal",
            "message": ""
        },
        "created": 1719956986165,
        "expires": 1719957016165,
        "rate": "18.54",
        "plain_rate": "18.36",
        "rate_currency": "mxn",
        "padding": "0.0098",
        "book": "xrp_mxn",
        "next_recurrent_events": {
            "DAILY": 1720043386165,
            "WEEKLY": 1720561786165,
            "MONTHLY": 1722635386165
        }
    }
}

The value of the id variable is the path parameter (quote_id) you need to use when executing-a-conversion-quote.

The fields included in the response object have the following meaning:

Field NameDescriptionType
bookThe book to use.String
createdThe quote's creation epoch in milliseconds.Number
estimated_slippageAn estimation of the difference between the expected execution rate and the actual execution rate.Object
expiresThe quote's expiration epoch in milliseconds.Number
from_amountThe amount you are willing to convert specified in the source currency.String
from_currencyThe ticker of the source currency.String
idThe quote's unique ID.String
next_recurrent_eventsIndicates when the next conversions are to take place in milliseconds. Used when conversions are programmed in the Bitso application to occur at specific periods.Object
paddingThe fee users pay for the conversion.String
plain_rateThe market's exchange rate without the spread value added to rate.String
rateThe exchange rate Bitso offers users for the conversion.String
rate_currencyThe ticker of the currency in which the conversion rate is expressed.String
to_amountThe amount you expect to receive as a product of the conversion specified in the target currency.String
to_currencyThe ticker of the target currency.String