exchangeRate
Requires an authenticated session.
Returns the exchange rate between two currencies for a date. The organization's own rate in force on that day wins over the platform-wide rate. It is a rate for documents, not a price.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query ExchangeRate($fromCurrency: String!, $toCurrency: String!) {
exchangeRate(fromCurrency: $fromCurrency, toCurrency: $toCurrency) {
id
createdAt
fromCurrency
inverseRate
lastUpdated
rate
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ExchangeRate($fromCurrency: String!, $toCurrency: String!) {\n exchangeRate(fromCurrency: $fromCurrency, toCurrency: $toCurrency) {\n id\n createdAt\n fromCurrency\n inverseRate\n lastUpdated\n rate\n }\n}",
"variables": {
"fromCurrency": "string",
"toCurrency": "string"
}
}
EOF
Variables:
{
"fromCurrency": "string",
"toCurrency": "string"
}
Response:
{
"data": {
"exchangeRate": {
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"fromCurrency": "string",
"inverseRate": 0,
"lastUpdated": "2025-01-15T00:00:00Z",
"rate": 0
}
}
}
exchangeRate(
date: String
fromCurrency: String!
toCurrency: String!
): ExchangeRate!
Arguments
exchangeRate.date ● String scalar
The document's date (YYYY-MM-DD or ISO). The tenant's rate in force on that day wins over the global feed; omitted = today.
exchangeRate.fromCurrency ● String! non-null scalar
The currency code to convert from.
exchangeRate.toCurrency ● String! non-null scalar
The currency code to convert to.
Type
ExchangeRate object
The current exchange rate between two currencies.