v2
You are reading v1 & v2. v1 and v2 are deprecated. They keep working and are still supported, but new integrations should use v3.

Generate a buy quote

Buy

POST/api/v1/buy/quote

Send two credentials: your own, and the customer's.

How authentication works
Either
Authorization: BearerorUser-Authorization: Bearer

Language

Environment

Credentials

Your credential, or the customer's

Choose an environment first.

cURL request
curl -X POST https://api.btcdirect.eu/api/v1/buy/quote \  -H "Authorization: Bearer $BTCD_PARTNER_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "currencyPair": "BTC-EUR",    "paymentMethod": "creditCard",    "fiatAmount": 50,    "cryptoAmount": null,    "fee": "1.5"  }'
Choose an environment to run this.

Response

Returns a quote and appropriate data.
{  "quote": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMzQ1NjcsImV4cCI6MTU1NDU0N",  "currencyPair": "BTCEUR",  "fiatAmount": 50,  "cryptoAmount": "0.5",  "paymentMethodCost": "2.5",  "networkFeeCost": "1.5",  "btcdirectFee": "0.75",  "btcdirectFeePercentage": "0.75",  "partnerFee": "1.00",  "partnerFeePercentage": "1.00",  "totalCost": 50,  "singleCoinEstimate": "96779.04",  "paymentMethod": "creditCard",  "expiryDate": "2019-06-06T16:16:16Z",  "userLimitExceeded": false,  "currencyLimitExceeded": false,  "paymentMethodLimitExceeded": false,  "quoteUnconfirmableReasons": [    "currencyLimitExceeded",    "paymentMethodLimitExceeded",    "paymentMethodDisabled",    "userLimitExceeded",    "userRegistrationNotCompleted"  ],  "sourceCurrency": {},  "targetCurrency": {},  "quote_token": "string"}

Request

currencyPairstringrequired

The currency pair that is used for the quote.

ExampleBTC-EUR

paymentMethodstringrequired

The payment method that the user wants to use to make the payment.

ExamplecreditCard

fiatAmountnumber

The amount at which the user wants to buy cryptos.

cryptoAmountnumber

The amount of cryptos that the user wants to buy.

feenumber

The profit in terms of a percentage for this order. If not present or null, your default fee is used. The default fee is also used for DCA and the widgets and can be set by your accountmanager.

Example1.5

Responses

200Returns a quote and appropriate data.
400A list of possible errors for this endpoint.

Body of the success response

quotestringrequired

The quote that is generated based on the submitted data.

ExampleeyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjEyMzQ1NjcsImV4cCI6MTU1NDU0N

currencyPairstringrequired

The currency pair that is used for the quote.

ExampleBTCEUR

fiatAmountnumber

The amount that the user will have to pay.

cryptoAmountnumber

The amount of cryptos that the user will receive.

Example0.5

paymentMethodCostnumberrequired

The cost for using the selected payment method.

Example2.5

networkFeeCostnumberrequired

The cost for the on-chain network fees.

Example1.5

btcdirectFeenumberrequired

The fee charged by BTC Direct in fiat.

Example0.75

btcdirectFeePercentagenumber

The fee charged in percentage by BTC Direct.

Example0.75

partnerFeenumberrequired

The fee earned by the partner in fiat.

Example1.00

partnerFeePercentagenumber

The fee earned in percentage by the partner.

Example1.00

totalCostnumberrequired

The amount that the user will have to pay.

singleCoinEstimatenumberrequired

The estimated value of a single coin.

Example96779.04

paymentMethodstringrequired

The payment method for the payment.

ExamplecreditCard

expiryDatestringrequired

The date and time when this quote expires.

Example2019-06-06T16:16:16Z

userLimitExceededbooleanrequired

Replaced by `quoteUnconfirmableReasons`. Whether the user has exceeded their personal limit.

currencyLimitExceededbooleanrequired

Replaced by `quoteUnconfirmableReasons`. Whether the currency limit has been exceeded.

paymentMethodLimitExceededbooleanrequired

Replaced by `quoteUnconfirmableReasons`. Whether the payment method limit has been exceeded.

quoteUnconfirmableReasonsstring[]required

Reasons why this quote can not be confirmed.

sourceCurrencyone of

The source (fiat) currency with CAIP-19 identifier.

targetCurrencyone of

The target (crypto) currency with CAIP-19 identifier.

quote_tokenstring

Every failure answers with a message and a code. Switch on the code — messages are written for people and can change.