API Reference
Build with
Build with
exchange rates
Three endpoints, zero friction. Pay per quote via the x402 protocol.
GET
/api/v1/latest/{base}/{quote}
Get Single Exchange Rate
Fetch the latest exchange rate for a specific currency pair.
Parameters
| Name | Type | Description |
|---|---|---|
base |
path | Base currency code (e.g., USD) |
quote |
path | Quote currency code (e.g., EUR) |
Example Request
Terminal — zsh
➜ ~ curl https://currex.fouroh.xyz/api/v1/latest/USD/EUR
Example Response
200 OK — json
{
"base": "USD",
"quote": "EUR",
"rate": 0.92,
"validFrom": "2024-10-24T14:30:01Z",
"path": "USD -> EUR",
"hope": 1
}
GET
/api/v1/convert/{base}/{quote}/{amount}
Convert Currency
Convert a specific amount from a base currency to a quote currency using the latest exchange rate.
Parameters
| Name | Type | Description |
|---|---|---|
base |
path | Base currency code (e.g., USD) |
quote |
path | Quote currency code (e.g., EUR) |
amount |
path | Amount to convert (e.g., 100.50) |
Example Request
Terminal — zsh
➜ ~ curl https://currex.fouroh.xyz/api/v1/convert/USD/EUR/100
Example Response
200 OK — json
"92.00"
GET
/api/v1/latest/{base}?quotes=EUR,GBP
Get Multiple Exchange Rates
Fetch exchange rates from a base currency to one or more quote currencies. Pass multiple quotes as a comma-separated list.
Parameters
| Name | Type | Description |
|---|---|---|
base |
path | Base currency code (e.g., USD) |
quotes |
query | Comma-separated quote currencies (e.g., EUR,GBP,JPY) |
Example Request
Terminal — zsh
➜ ~ curl https://currex.fouroh.xyz/api/v1/latest/USD?quotes=EUR,GBP
Example Response
200 OK — json
[
{
"base": "USD",
"quote": "EUR",
"rate": 0.92,
"validFrom": "2024-10-24T14:30:01Z",
"path": "USD -> EUR",
"hope": 1
},
{
"base": "USD",
"quote": "GBP",
"rate": 0.79,
"validFrom": "2024-10-24T14:30:01Z",
"path": "USD -> EUR -> GBP",
"hope": 2
}
]
Payment Flow
All requests are authenticated via the x402 protocol. Pay-per-request with no API keys.
1
Request Rate
Make your API request
2
Receive 402
Get invoice with payment header
3
Settle & Retry
Pay and retry with preimage