Skip to main content
Use 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

The API returns every active code; the sample list is shortened for readability. 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

Treat 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

For CBSL target behaviour, read CBSL Rates.

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

The result is an application calculation, not a settlement instruction or binding rate. See Convert a currency amount.

Handle Currency errors

Currency methods throw typed SDK exceptions instead of returning an error ApiResponse. Use the Laravel-safe exception pattern in Laravel Overview and setup and the linked REST pages for operation-specific error codes.
Last modified on October 1, 2026