API Reference
RESTful API for accessing AFXO FX rates, confidence scores, and historical data. All endpoints require authentication via API key.
Quick Start
All API requests require an API key passed in the X-API-Key header.
curl -X GET "https://api.afxo.ai/v1/rates/KES/USD" \ -H "X-API-Key: your_api_key_here"
Base URL
Authentication
Include your API key in every request header:
Get your API key from the API Access page.
Endpoints
/v1/rates/{base}/{quote}Get current exchange rate for a currency pair
/v1/rates/{base}/{quote}/historyGet historical rates with optional date range
/v1/currenciesList all supported currencies
/v1/currencies/{code}Get details for a specific currency
/v1/confidence/{base}/{quote}Get confidence score and quality metrics
Response Format
All responses are returned in JSON format:
{
"success": true,
"data": {
"base": "KES",
"quote": "USD",
"rate": 0.00775,
"inverse": 129.032,
"confidence": 94,
"sources": 5,
"timestamp": "2026-01-19T10:30:00Z",
"updated_at": "2026-01-19T10:30:00Z"
},
"meta": {
"request_id": "req_abc123",
"latency_ms": 42
}
}Confidence Scores
Each rate includes a confidence score (0-100) reflecting overall data reliability and quality:
Note: On-chain oracles enforce a minimum confidence threshold (default: 70%). Updates below this threshold are rejected to protect downstream applications.
Rate Limits
Rate limits are designed to accommodate each plan's update frequency with buffer for weekends and high-activity periods.
| Plan | Update Frequency | Requests/min | Requests/day |
|---|---|---|---|
| Sandbox | Daily (1x) | 5 | 100 |
| Starter | Hourly (24x) | 30 | 1,000 |
| Builder | 5-minute (288x) | 60 | 10,000 |
| Growth | 1-minute (1,440x) | 300 | 100,000 |
| Enterprise | Sub-minute | Custom | Unlimited |
Daily limits apply across all 7 days including weekends. Exceeding rate limits returns a 429 status code.
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request — Invalid parameters |
| 401 | Unauthorized — Invalid or missing API key |
| 403 | Forbidden — Insufficient permissions for this resource |
| 404 | Not Found — Currency pair not supported |
| 429 | Too Many Requests — Rate limit exceeded |
| 500 | Internal Server Error — Please retry or contact support |
SDKs & Libraries
Official client libraries are available for popular languages:
npm install @afxo/sdkpip install afxoSee SDK Documentation for detailed usage.