This endpoint should be used to fetch the BRL balance in the account.
GET
https://api.exchangecopter.com/BRL-balance
import axios from 'axios';
const recipientId = "DEFAULT"; // Always use that value.
const accessToken = 'your_access_token_here'; // Bearer token for authentication
const userId = 'your_userId_here';
const callGetBRLBalance = async () => {
try {
// Define the base URL
const url = 'https://api.exchangecopter.com/BRL-balance';
// Make the GET request to the API with the recipientId as a query parameter
const result = await axios.get(url, {
headers: {
Authorization: `Bearer ${accessToken}`, // Include the Bearer token
Accept: 'application/json',
'Content-Type': 'application/json',
},
params: {
recipientId: recipientId, // Pass recipientId as a query parameter
userId: userId
},
});
// If the request is successful, log the response data
console.log('Server response:', result.data);
} catch (error) {
// Handle errors, if any
if (error.response) {
console.error('Server error response:', error.response.data);
} else {
console.error('Unknown error:', error);
}
}
};
// Call the function to get the balance
callGetBRLBalance();
Response 200
{
"data": {
"available": 70
}
}
Response 400 or 500
{
"data": {
"message": "There is a problem with the service."
}
}