Create Quote

Price an operation before creating the order

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Prices an operation before it is created, so you can show your customer exactly what they will pay or receive and let them accept it.

A quote holds that price until expires_at. Pass its id as quote_id on Create Order and the order is created at the quoted price instead of the market price.

Quoting is optional: an order created without a quote_id is priced at market when it is created.

Request

POST /quotes

FieldTypeRequiredDescription
operationstringYesbuy, sell or send.
assetobjectYesThe crypto asset being bought, sold or sent.
asset.currencystringYesAsset currency, e.g. BTC.
asset.amountstring-Amount of the asset. Send this or the amount on the operation node, never both.
buy / sellobject-Carries settlement.currency and optionally settlement.amount.
sendobjectYes for sendCarries destination and optionally network.
send.destination.typestringYes for sendcrypto_currency_address, lirium_customer or address_book.
send.destination.amountstring-Amount that should reach the destination.

The node key must match operation, and only one node may be sent.

Which amount to send

As on Create Order, you express the operation from either side, and exactly one side carries the amount:

  • buyasset.amount to buy a fixed amount of crypto, or buy.settlement.amount to spend a fixed amount of fiat.
  • sellasset.amount to sell a fixed amount of crypto, or sell.settlement.amount to receive a fixed amount of fiat.
  • sendasset.amount to take a fixed amount out of the customer's balance, or send.destination.amount to make a fixed amount arrive.

See Buy and Sell amounts and Send amounts for the same choice on orders.

📘

A send quote needs no address

To quote a send only destination.type is required — the address itself (destination.value) is sent when the order is created. The quote prices the network and service fees for that kind of destination.

Example Requests

{
    "operation": "buy",
    "asset": {
        "currency": "BTC",
        "amount": "1"
    }
}
{
    "operation": "buy",
    "asset": {
        "currency": "BTC"
    },
    "buy": {
        "settlement": {
            "currency": "USD",
            "amount": "10000"
        }
    }
}
{
    "operation": "send",
    "asset": {
        "currency": "BTC",
        "amount": "0.00119145"
    },
    "send": {
        "destination": {
            "type": "crypto_currency_address"
        }
    }
}

Response

FieldTypeDescription
idstringPass this as quote_id when creating the order.
operationstringThe operation quoted.
created_atstringWhen the quote was created, ISO 8601.
assetobjectThe crypto side, with currency, amount and operation.
buy / sell / sendobjectThe node matching operation.

Both sides come back with an operation of credit or debit, read from the customer's point of view: on a buy the customer is credited the asset and debited the settlement, and on a sell it is the other way round.

Each node carries expires_at — the price holds until then. A send node also carries fees, the network and service fees included in the quote, in the asset currency; send.destination.amount is what actually arrives once those fees are taken off.

Example Response

{
    "id": "cb2af049b9cf4642947436df461486c2",
    "operation": "buy",
    "created_at": "2020-11-02T22:49:02.000000+00:00",
    "asset": {
        "currency": "BTC",
        "amount": "0.97087378",
        "operation": "credit"
    },
    "buy": {
        "expires_at": "2020-11-02T22:50:02.000000+00:00",
        "settlement": {
            "currency": "ARS",
            "amount": "1566685.4",
            "operation": "debit"
        }
    }
}
{
    "id": "52fcddd60e0140558dce3de971094950",
    "operation": "send",
    "created_at": "2021-12-02T18:09:39.432938+00:00",
    "asset": {
        "currency": "BTC",
        "amount": "0.00119145",
        "operation": "debit"
    },
    "send": {
        "expires_at": "2021-12-02T18:14:39.432938+00:00",
        "fees": "0.00002",
        "destination": {
            "type": "crypto_currency_address",
            "amount": "0.00117145"
        }
    }
}

Using the quote

{
    "reference_id": "Abc123ed-F456Gh",
    "quote_id": "cb2af049b9cf4642947436df461486c2",
    "operation": "buy",
    "asset": {
        "currency": "BTC",
        "amount": "0.97087378"
    }
}
⚠️

Quotes expire

Once expires_at has passed the price is no longer held. Quote again rather than reusing an expired quote_id.

Limits

  • swap cannot be quoted. operation only takes buy, sell and send, and a swap order carrying a quote_id is refused with Quote cannot be provided for this operation.
  • A quote cannot be combined with asset.full_amount on order creation: the amount is only resolved when the order is created, so there is nothing to quote beforehand. See Create Order.

Error Responses

Error responses include error_code, error_msg, and a request_id field for tracking.

StatusError CodeDescription
400invalid_parametersMissing, unknown, or malformed request fields (see error_msg for specifics)
403forbiddenThe application does not hold the write scope

Examples of invalid_parameters conditions surfaced by error_msg:

  • {'operation': ['This field is required but was not found in the request.']}operation is missing.
  • Only one operation node is allowed — more than one of buy/sell/send was supplied.
  • The operation node name must match the operation value (<operation>) — the operation value does not match the node key in the body.
  • asset.amount or settlement.amount is required / asset.amount or destination.amount is required — neither side carried an amount.
  • Either asset.amount or settlement.amount can be sent, but not both / Either asset.amount or destination.amount can be sent, but not both — both sides carried an amount.
Body Params
string
enum
required

The operation to quote.

Allowed:
asset
object
required

The crypto asset being bought, sold or sent. Send its amount here, or the amount on the operation node, never both.

buy
object
sell
object
send
object
Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json