Pre-request for exchange [Private]
A pre-request for a exchange operations is required only in case when exchange is combined with deposit or withdraw.
Method name: | /v2/exchange/external/pre-request |
Request type: | POST |
To call private endpoints, you need to get a JWT token or an API key for authentication.
Here you can learn in detail how to successfully authenticate.
A pre-request for a exchange operations is required only in case when exchange is combined with deposit (/v2/exchange/external/deposit-with-exchange
) or withdraw ( /v2/exchange/external/withdraw-with-exchange
) to obtain deposits and/or withdrawals payment methods available for use, as well as the necessary details for each of them.
Unlike other pre-requests, where all possible payment methods are returned for one asset, the /v2/exchange/external/pre-request
works with unique combination of currency pair and operation type. End-point return available deposit methods for the source asset and/or available withdrawal methods for the target asset considering selected operation type.
The payment methods describe which fields need to be transmitted to ensure the success of the fiat deposit/withdrawal by the payment provider.
In addition, the minimum and maximum value of an source- and target-amount (also considering selected operation type) are returned from the endpoint. The minimum and maximum values in a pair of assets may differ from the minimum and maximum values for a single asset.
Data dictionary
Name | Type | Parameter type | Required | Range | Description |
---|---|---|---|---|---|
sourceAsset | string | BODY | YES | - | Source or base Asset code. |
targetAsset | string | BODY | YES | - | Target or quote Asset code. |
operationType | string | BODY | YES | DepositWithExchange, WithdrawWithExchange, CryptoExchange, BuyToSendCrypto | The type of operation for which you are requesting a pre-request. |
Exemplary request
const url = BASE_URL;
const path = "/v2/exchange/external/pre-request";
const body = {
operationType: "DepositWithExchange",
sourceAsset: "EUR",
targetAsset: "USDT",
};
const options = {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ${data.accessToken}` // data.accessToken - generated a JWT token via /v2/auth/login.
},
body: JSON.stringify(body),
};
fetch(url + path, options)
.then((response) => response.json())
.then((showResponse) => console.log(showResponse.data));
import requests
url = BASE_URL
path = "/v2/exchange/external/pre-request"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer " + data.accessToken # data.accessToken - generated a JWT token via /v2/auth/login.
}
body = {
"operationType": "DepositWithExchange",
"sourceAsset": "EUR",
"targetAsset": "USDT",
}
request = requests.post(url + path, headers=headers, json=body)
print(request.json())
How to call private endpoints here
Response
// Example for {operationType: "DepositWithExchange", sourceAsset: "EUR", targetAsset: "USDT"} body.
{
"data": {
"sourceAsset": "EUR", // Source or base asset code. Asset that a customer sends as a deposit.
"targetAsset": "USDT", // Target or quote asset code. Asset that a customer receives in return.
"depositPaymentMethods": [ // Array of fields to deposit.
{
"asset": "EUR", // Asset name.
"code": "payment_card_eur_hpp_europe", // Method code.
"name": { // Text name of the method.
"en": "Visa/Mastercard Europe",
"ru": "Visa/Mastercard Europe",
"uk": "Visa/Mastercard Europe"
},
"position": 0, // Field positions.
"type": "Deposit", // Transaction type.
"fields": [ // Description of the fields that must be specified for the deposit. Each asset has its own fields.
{
"name": "email", // Key name.
"description": null, // Field description.
"group": null, // null - must be filled out by the customer; "technical" - this information must be filled out from the customer's metadata.
"isRequired": true, // Whether the field is mandatory or not (false).
"label": { "en": "Email", "ru": "Email", "uk": "Email" }, // The text name of the field.
"position": 0, // Field position.
"type": "string", // Value type.
"validators": [] // Rules for value.
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "description",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Payment description",
"ru": "Назначение платежа",
"uk": "Payment description"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
}
]
},
{
"asset": "EUR",
"code": "payment_card_eur_hpp_world",
"name": {
"en": "Visa/Mastercard World",
"ru": "Visa/Mastercard World",
"uk": "Visa/Mastercard World"
},
"position": 0,
"source": "payment_card_eur_hpp",
"type": "Deposit",
"fields": [
{
"name": "email",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Email", "ru": "Email", "uk": "Email" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "description",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Payment description",
"ru": "Назначение платежа",
"uk": "Payment description"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
}
]
}
],
"withdrawPaymentMethods": null,
"sourceAssetMaxAmount": "1000", // Maximum amount of the source or base asset.
"sourceAssetMinAmount": "2", // Minimum amount of the source or base asset.
"targetAssetMaxAmount": "1000", // Maximum amount of the target or quote asset.
"targetAssetMinAmount": "3", // Minimum amount of the target or quote asset.
"operationType": "DepositWithExchange" // Operation type.
}
}
// Example for {operationType: "WithdrawWithExchange", sourceAsset: "USDT", targetAsset: "EUR"} body.
{
"data": {
"sourceAsset": "USDT",
"targetAsset": "EUR",
"depositPaymentMethods": null,
"withdrawPaymentMethods": [
{
"asset": "EUR",
"code": "payment_card_eur_europe",
"name": {
"en": "Visa/Mastercard Europe",
"ru": "Visa/Mastercard Europe",
"uk": "Visa/Mastercard Europe"
},
"position": 0,
"source": "payment_card_eur",
"type": "Withdraw",
"fields": [
{
"name": "email",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Email", "ru": "Email", "uk": "Email" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardNumber",
"description": {
"en": "Enter card number",
"ru": "Введите номер карты",
"uk": "Введіть номер карти"
},
"group": null,
"isRequired": true,
"label": {
"en": "Card number",
"ru": "Номер карты",
"uk": "Номер карти"
},
"position": 0,
"type": "string",
"validators": [
{
"type": "regex",
"message": {
"en": "Invalid card number",
"ru": "Неверный номер карты",
"uk": "Невірний номер карти"
},
"regex": "\\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14})\\b"
},
{
"type": "regex",
"message": {
"en": "Invalid card number",
"ru": "Неверный номер карты",
"uk": "Невірний номер карти"
},
"regex": "^\\d{16,16}$"
}
]
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "expiryDate",
"description": {
"en": "Enter card number MM/YY",
"ru": "Введите номер карты ММ/ГГ",
"uk": "Введіть номер карти ММ/РР"
},
"group": null,
"isRequired": true,
"label": {
"en": "Expiry date",
"ru": "Срок годности карты",
"uk": "Термін дії картки"
},
"position": 0,
"type": "string",
"validators": [
{
"type": "regex",
"message": {
"en": "Invalid value MM/YY",
"ru": "Недействительное значение MM/YY",
"uk": "Недійсне значення MM/YY"
},
"regex": "^(0[1-9]|1[0-2])\\/([0-9]{4}|[0-9]{2})$"
}
]
}
]
},
{
"asset": "EUR",
"code": "payment_card_eur_world",
"name": {
"en": "Visa/Mastercard World",
"ru": "Visa/Mastercard World",
"uk": "Visa/Mastercard World"
},
"position": 0,
"source": "payment_card_eur",
"type": "Withdraw",
"fields": [
{
"name": "email",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Email", "ru": "Email", "uk": "Email" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardNumber",
"description": {
"en": "Enter card number",
"ru": "Введите номер карты",
"uk": "Введіть номер карти"
},
"group": null,
"isRequired": true,
"label": {
"en": "Card number",
"ru": "Номер карты",
"uk": "Номер карти"
},
"position": 0,
"type": "string",
"validators": [
{
"type": "regex",
"message": {
"en": "Invalid card number",
"ru": "Неверный номер карты",
"uk": "Невірний номер карти"
},
"regex": "\\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14})\\b"
},
{
"type": "regex",
"message": {
"en": "Invalid card number",
"ru": "Неверный номер карты",
"uk": "Невірний номер карти"
},
"regex": "^\\d{16,16}$"
}
]
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "expiryDate",
"description": {
"en": "Enter card number MM/YY",
"ru": "Введите номер карты ММ/ГГ",
"uk": "Введіть номер карти ММ/РР"
},
"group": null,
"isRequired": true,
"label": {
"en": "Expiry date",
"ru": "Срок годности карты",
"uk": "Термін дії картки"
},
"position": 0,
"type": "string",
"validators": [
{
"type": "regex",
"message": {
"en": "Invalid value MM/YY",
"ru": "Недействительное значение MM/YY",
"uk": "Недійсне значення MM/YY"
},
"regex": "^(0[1-9]|1[0-2])\\/([0-9]{4}|[0-9]{2})$"
}
]
}
]
}
],
"sourceAssetMaxAmount": "1000",
"sourceAssetMinAmount": "1.5",
"targetAssetMaxAmount": "1000",
"targetAssetMinAmount": "1",
"operationType": "WithdrawWithExchange"
}
}
// Example for {operationType: "WithdrawWithExchange", sourceAsset: "BTC", targetAsset: "ETH"} body.
{
"data": {
"sourceAsset": "BTC",
"targetAsset": "ETH",
"depositPaymentMethods": null,
"withdrawPaymentMethods": null,
"sourceAssetMaxAmount": "1000000",
"sourceAssetMinAmount": "0.000001",
"targetAssetMaxAmount": "1000000",
"targetAssetMinAmount": "0.000001",
"operationType": "CryptoExchange"
}
}
// Example for {operationType: "BuyToSendCrypto", sourceAsset: "EUR", targetAsset: "ETH"} body.
{
"data": {
"sourceAsset": "EUR",
"targetAsset": "ETH",
"depositPaymentMethods": [
{
"asset": "EUR",
"code": "payment_card_eur_hpp_europe",
"name": {
"en": "Visa/Mastercard Europe",
"ru": "Visa/Mastercard Europe",
"uk": "Visa/Mastercard Europe"
},
"position": 0,
"source": "payment_card_eur_hpp",
"type": "Deposit",
"fields": [
{
"name": "email",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Email", "ru": "Email", "uk": "Email" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "description",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Payment description",
"ru": "Назначение платежа",
"uk": "Payment description"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
}
]
},
{
"asset": "EUR",
"code": "payment_card_eur_hpp_world",
"name": {
"en": "Visa/Mastercard World",
"ru": "Visa/Mastercard World",
"uk": "Visa/Mastercard World"
},
"position": 0,
"source": "payment_card_eur_hpp",
"type": "Deposit",
"fields": [
{
"name": "email",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Email", "ru": "Email", "uk": "Email" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "phone",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Phone", "ru": "Phone", "uk": "Phone" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "cardHolder",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Card holder",
"ru": "Card holder",
"uk": "Card holder"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "country",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Country", "ru": "Country", "uk": "Country" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "region",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Region", "ru": "Region", "uk": "Region" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "city",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "City", "ru": "City", "uk": "City" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "street",
"description": null,
"group": null,
"isRequired": true,
"label": { "en": "Street", "ru": "Street", "uk": "Street" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "postCode",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Post Code",
"ru": "Post Code",
"uk": "Post Code"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "description",
"description": null,
"group": null,
"isRequired": true,
"label": {
"en": "Payment description",
"ru": "Назначение платежа",
"uk": "Payment description"
},
"position": 0,
"type": "string",
"validators": []
},
{
"name": "ip",
"description": null,
"group": "technical",
"isRequired": true,
"label": { "en": "Ip", "ru": "Ip", "uk": "Ip" },
"position": 0,
"type": "string",
"validators": []
},
{
"name": "userAgent",
"description": null,
"group": "technical",
"isRequired": true,
"label": {
"en": "UserAgent",
"ru": "UserAgent",
"uk": "UserAgent"
},
"position": 0,
"type": "string",
"validators": []
}
]
}
],
"withdrawPaymentMethods": [
{
"asset": "ETH",
"code": "crypto_withdraw_eth",
"name": {
"en": "On wallet Ethereum",
"ru": "На кошелек Ethereum",
"uk": "На гаманець Ethereum"
},
"position": 0,
"source": "ETH",
"type": "Withdraw",
"fields": [
{
"name": "address",
"description": { "en": "Address", "ru": "Адрес", "uk": "Адреса" },
"group": null,
"isRequired": true,
"label": { "en": "Address", "ru": "Адрес", "uk": "Адреса" },
"position": 0,
"type": "string",
"validators": [
{
"type": "regex",
"message": {
"en": "Address is not valid",
"ru": "Адрес не действителен",
"uk": "Адреса не дійсний"
},
"regex": "^0x[a-fA-F0-9]{40}$"
}
]
}
]
}
],
"sourceAssetMaxAmount": "1000",
"sourceAssetMinAmount": "2",
"targetAssetMaxAmount": "0.45",
"targetAssetMinAmount": "0.0009",
"operationType": "BuyToSendCrypto"
}
}
Updated 6 months ago