Skip to main content

List Cryptocurrencies

This endpoint returns all available cryptocurrencies for your account. Use this route to query the necessary data to create withdrawal order requests.


Endpoint​

  • Method: GET
Endpoint URL
https://api.xgateglobal.com/withdraw/company/cryptocurrencies

Test Integration​

Use the form below to simulate listing cryptocurrencies.

🪙

Test: List Withdrawal Cryptocurrencies

1. Your Credentials

Request​

The request does not require a body, only authentication Headers.

Required Headers​

HeaderValueDescription
AuthorizationBearer <your_token>The JWT token obtained at login.

Responses​

Success (200 OK)​

Returns a list (array) of objects, where each object is a cryptocurrency.

[
{
"_id": "6733a2a900**************",
"name": "USDT",
"symbol": "USDT",
"coinGecko": "tether",
"updatedDate": "2024-1**************",
"createdDate": "2024-1**************",
"__v": 0,
"uid": "01KH7K88HZ**************"
},
{
"_id": "6733a2a000**************",
"name": "USDC",
"symbol": "USDC",
"coinGecko": "usdc",
"updatedDate": "2024-1**************",
"createdDate": "2024-1**************",
"__v": 0,
"uid": "01KH7K4C0BZ**************"
}
]

Common Errors​

StatusMessageLikely Reason
401Unauthorized• Invalid or expired token.
• Invalid or missing header.
• IP not allowed.
500Internal Server ErrorInternal server error. Contact support.

How to Use​

The main purpose of listing cryptocurrencies is to allow selection of the correct cryptocurrency to create a withdrawal order (Withdraw Order).

The response from this endpoint provides the Complete Object of the cryptocurrency, enabling the construction of the order creation payload.

The Integration Flow​

  1. List cryptocurrencies: Call this endpoint (GET /withdraw/company/cryptocurrencies).
  2. Selection: Identify the desired cryptocurrency in the list (usually by filtering by name or symbol, e.g., "USDT").
  3. Sending: You must pass the object within the cryptocurrency property in the order creation payload. In the documentation for creating crypto withdrawal the required values are shown.

Practical Example​

1. What you receive when listing cryptocurrencies:

[
{
"_id": "6733a2a900**************",
"name": "USDT",
"symbol": "USDT",
"coinGecko": "tether",
"updatedDate": "2024-1**************",
"createdDate": "2024-1**************",
"__v": 0,
"uid": "01KH7K88HZ**************"
},
{
"_id": "6733a2a000**************",
"name": "USDC",
"symbol": "USDC",
"coinGecko": "usdc",
"updatedDate": "2024-1**************",
"createdDate": "2024-1**************",
"__v": 0,
"uid": "01KH7K4C0BZ**************"
}
]

2. How you should send in the withdrawal (POST /withdraw):

You will take the object above and inject it into cryptocurrency:

{
"amount": 2,
"customerId": "6759a16f20***************",
"cryptocurrency": {
"_id": "67c0dd903***************",
"name": "USDT",
"symbol": "USDT"
},
"blockchainNetwork": {
"_id": "69ea849098**************",
"chain": "Solana",
"name": "Solana",
"symbol": "SOL"
},
"wallet": "0x7A00e4a***************",
"externalId": "6dd37763a2***************"
}

Each piece of information in this JSON will be explained at the page for creating crypto withdrawal to FIAT.


Integration​

The integration example uses the Axios library in Node.js.

Installing Axios:

npm install axios

JavaScript Example:

const axios = require("axios");

(async () => {
const email = "your_email@domain.com";
const password = "**********";
const customerId = "************";
const amount = 10.90;

try {
const url_api = "https://api.xgateglobal.com"
const login = await axios.post(`${url_api}/auth/token`, { email, password });
const cryptocurrencies = await axios.get(`${url_api}/withdraw/company/cryptocurrencies`, {
headers: {
"Authorization": `Bearer ${login.data.token}`
}
});
const currencies = await axios.get(`${url_api}/withdraw/company/currencies`, {
headers: {
"Authorization": `Bearer ${login.data.token}`
}
});
const pixKey = await axios.get(`${url_api}/pix/customer/${customerId}/key`, {
headers: {
"Authorization": `Bearer ${login.data.token}`
}
});
const { data } = await axios.post(`${url_api}/withdraw/conversion/brl/pix`, {
amount,
customerId,
currency: currencies.data[0],
cryptocurrency: cryptocurrencies.data[0],
pixKey: pixKey.data[0]
}, {
headers: {
"Authorization": `Bearer ${login.data.token}`
}
});
console.log(data); // Response
} catch (error) {
console.log(error.response.data.message) // Error
}
})()