Currency Rate API¶
Mythradon supports multiple currencies, allowing businesses to manage operations across different regions with ease. Each system is configured with a base currency, and administrators can optionally enable additional currencies. Once enabled, these currencies are available in all currency fields, ensuring consistent selection and display.
All exchange rates are maintained in relation to the base currency defined in system settings. This ensures accuracy in conversions, reporting, and analysis.
The Mythradon API provides endpoints to retrieve and update currency exchange rates. To access these endpoints, the API User must have the Currency scope enabled in their role.
Retrieve Currency Rates¶
Use the following request to fetch all configured currency rates:
Example
curl -X GET https://<your-Mythradon-domain>/api/v1/CurrencyRate \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: <Your API Key>'
Response
Update Currency Rates¶
Use the following request to update one or more rates. Provide a JSON payload where each value represents the rate relative to the base currency specified in Settings.
Example
curl -X PUT https://<your-Mythradon-domain>/api/v1/CurrencyRate \
-H 'X-Api-Key: <Your API Key>' \
-H 'Content-Type: application/json' \
-d '{"USD": 1.53,"EUR": 1.80}'
Payload Example
Error Handling¶
When using the Currency Rate API, the following errors may occur:
| Status Code | Cause | Example Message |
|---|---|---|
| 400 Bad Request | Malformed JSON payload or missing body. | "Invalid JSON payload." |
| 401 Unauthorized | API key missing or invalid. | "Invalid API key." |
| 403 Forbidden | API user does not have Currency scope in their role. | "Access denied. Currency scope required." |
| 500 Internal Server Error | Unexpected server error. | "An unexpected error occurred or Invalid JSON payload." |
Note
- Rates must be positive numbers. Negative or zero values will result in a validation error.
- Only currencies that are enabled in Mythradon can be updated. Attempting to update disabled or unknown currencies will not be processed.
See also¶
- Currency
- API User Accounts
- Metadata API
- Mythradon Marketing
- Mythradon Sales
- Mythradon Service
- Mythradon System Administration
- Mythradon Tools