Skip to main content
Use $avraapi->currency() for the four released Currency operations. Every method returns an ApiResponse; read its operation result from data and keep requestId for support and troubleshooting.
Every Currency operation can use the shared one-request privacy control: $avraapi->currency()->withPrivacyMode()->getCodes(). It sends X-Privacy-Mode: 1 only for that 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 the base and target arguments before sending a request. They must still be active Currency codes. Retrieve the current set with getCodes() instead of maintaining a hard-coded list.

Get supported currency codes

getCodes(): ApiResponse returns the active Currency codes, including CBSL target codes when they are available. SDK function
Copy the SDK call
Read the active code list

Response

The API returns every active code; the sample list is shortened only for readability. LKR-SELL, LKR-BUY, and LKR-CBSL are target-only CBSL codes, not ordinary base currencies. See CBSL Rates for their meanings.

Get latest rates from one base currency

getLatestRates(string $base): ApiResponse returns the available rate map for one active base currency. The base currency 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 as a binding financial quote. Apply your own pricing, approval, and rounding rules before displaying a customer-facing price.

Get one currency-pair rate

getPairRate(string $base, string $target): ApiResponse returns one rate. For a standard pair, both values are active currency codes. The target can also 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 and response details, read CBSL Rates.

Convert a currency amount

convert(string $base, string $target, float $amount): ApiResponse calculates the current conversion for one positive amount. The amount argument must be greater than zero. SDK function
Copy the SDK call
Convert and use a positive amount

Response

The result is an application calculation, not a settlement instruction or a binding rate. The Currency REST API Reference has the full validation and error contract.

Handle Currency errors

Currency methods throw typed SDK exceptions instead of returning an error ApiResponse. See PHP Overview and setup for the common exception pattern, and use the linked REST pages for each operation’s error codes.
Last modified on October 1, 2026