curl --request GET \
--url https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount} \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-SECRET: <api-key>'const options = {
method: 'GET',
headers: {'X-API-KEY': '<api-key>', 'X-API-SECRET': '<api-key>'}
};
fetch('https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-SECRET: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"request_id": "01f00000-0000-4000-8000-000000000005",
"data": {
"base": "USD",
"target": "LKR-SELL",
"rate": 305,
"amount": 100,
"conversion_result": 30500,
"last_updated": "2026-01-15 09:30:00"
}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "invalid_currency_code",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "validation_failed",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "rate_limit_exceeded",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "project_paused",
"message": "<string>",
"details": {}
},
"meta": {}
}Convert a currency amount
Calculate a conversion for one positive amount using the current pair rate.
curl --request GET \
--url https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount} \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-SECRET: <api-key>'const options = {
method: 'GET',
headers: {'X-API-KEY': '<api-key>', 'X-API-SECRET': '<api-key>'}
};
fetch('https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-SECRET: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"request_id": "01f00000-0000-4000-8000-000000000005",
"data": {
"base": "USD",
"target": "LKR-SELL",
"rate": 305,
"amount": 100,
"conversion_result": 30500,
"last_updated": "2026-01-15 09:30:00"
}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "invalid_currency_code",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "unauthorized",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "validation_failed",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "rate_limit_exceeded",
"message": "<string>",
"details": {}
},
"meta": {}
}{
"success": false,
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": {
"code": "project_paused",
"message": "<string>",
"details": {}
},
"meta": {}
}amount, and conversion_result. AvraAPI calculates rate × amount and rounds the result to six decimal places.
API endpoint
https://avraapi.com/api/v1/utility/currency/pair/{base}/{target}/{amount}
Request
curl "https://avraapi.com/api/v1/utility/currency/pair/USD/LKR/100.50" \
-H "X-API-KEY: YOUR_PROJECT_CLIENT_ID" \
-H "X-API-SECRET: YOUR_PROJECT_CLIENT_SECRET" \
-H "X-ENV: development" \
-H "Accept: application/json"
Response
{
"success": true,
"request_id": "f6bd3df0-c642-446c-ba2b-345bbb3fd0e9",
"data": {
"base": "USD",
"target": "LKR",
"rate": 319.752,
"amount": 10,
"conversion_result": 3197.52,
"last_updated": "2026-05-06 00:00:01"
}
}
Error codes
| HTTP | error.code | When it happens |
|---|---|---|
400 | invalid_currency_code | {base} or {target} is unknown, inactive, or invalid. Retrieve the active list from List supported currency codes. |
401 | unauthorized | The Project Client ID or Client Secret is missing, invalid, inactive, or does not match the selected environment. |
422 | validation_failed | {amount} is not numeric or is less than or equal to zero. The response includes error.details.amount. |
422 | provider_selection_failed | The Currency provider cannot be selected for the project environment. |
429 | rate_limit_exceeded | The project has exceeded the Currency service request limit. Wait for Retry-After before retrying. |
503 | project_paused | The project is paused and cannot make API requests. |
request_id when contacting support; see the REST API guide for the shared response format.
amount is a path value, not a JSON body. It must be numeric and greater than zero. Invalid values, including 0 and negative numbers, return 422 with error.code: validation_failed and an error.details.amount message.
To apply a CBSL rate type, replace {target} with LKR-SELL, LKR-BUY, or LKR-CBSL. See CBSL Rates for the three rate types, full request examples, and their response structure.
The response is an application calculation, not a binding financial quote. Apply your own rounding, tax, pricing, and approval rules before using it in a customer-facing transaction.
Playground resources
The generated reference below lists this endpoint’s API standard details: request fields, authorizations, and response schema. The complete integration guide, request and response examples, and endpoint-specific error handling are above.Authorizations
Your Development project's Client ID. Enter your own value in the Documentation Playground.
Your Development project's Client Secret. Mintlify does not proxy these requests; the browser sends them directly to AvraAPI. Never enter a Production secret in the Documentation Playground.
Headers
Selects the Development credential environment. The Documentation Playground exposes Development values only; normal backend integrations may use their documented Production credentials outside this tool.
dev, development Requests a JSON response where the selected operation supports JSON.
"application/json"
Optional privacy override. Turn this on to request that AvraAPI suppress request-payload storage in observability logs for this request.
true
Path Parameters
An active three-letter currency code. Input is normalised to uppercase before it is checked against the active Currency code list.
^[A-Za-z]{3}$"USD"
An active three-letter currency code, or one of LKR-SELL, LKR-BUY, and LKR-CBSL for a CBSL request.
^(?:[A-Za-z]{3}|LKR-(?:SELL|BUY|CBSL))$"LKR"
Numeric amount greater than zero.
"100.50"
Was this page helpful?
