AvraAPI::currency() for the four released Currency operations. Every
method returns ApiResponse; read the operation result from data and retain
requestId for support and troubleshooting.
Every Currency operation supports the shared one-request privacy control:
AvraAPI::currency()->withPrivacyMode()->getCodes(). It sends
X-Privacy-Mode: 1 only for the next request, then clears automatically.
Privacy Mode keeps normal routing, billing, and usage tracking while
suppressing request and response payload storage.The SDK trims and uppercases
base and target before sending a request.
They must still be active Currency codes. Call getCodes() rather than
maintaining a hard-coded currency list.Get supported currency codes
getCodes(): ApiResponse returns active Currency codes, including CBSL target
codes when available.
SDK function
Copy the SDK call
Read the active code list in a Laravel controller
Response
LKR-SELL, LKR-BUY, and LKR-CBSL are target-only CBSL codes,
not ordinary base currencies. See CBSL Rates.
Get latest rates from one base currency
getLatestRates(string $base): ApiResponse returns the available rate map for
one active base currency. The base is not repeated in data.rates.
SDK function
Copy the SDK call
Read a rate map
Response
last_updated as a freshness value, not a binding financial quote.
Apply your own pricing, approval, and rounding rules before displaying a price.
Get one currency-pair rate
getPairRate(string $base, string $target): ApiResponse returns one rate. The
target can be LKR-SELL, LKR-BUY, or LKR-CBSL for a CBSL rate type.
SDK function
Copy the SDK call
Read one pair rate
Response
Convert a currency amount
convert(string $base, string $target, float $amount): ApiResponse calculates
the current conversion for one positive amount.
SDK function
Copy the SDK call
Convert and use a positive amount
Response
Handle Currency errors
Currency methods throw typed SDK exceptions instead of returning an errorApiResponse. Use the Laravel-safe exception pattern in
Laravel Overview and setup
and the linked REST pages for operation-specific error codes.