跳转到主要内容
GET
Convert exchange rates

快速开始

基础 URL

验证端点

convert 端点需要您的 API 密钥、基础货币和目标参数来执行货币转换。
此成功请求使用最新汇率将 1 EUR 转换为 USD:

请求参数

String
必填
您的唯一 API 密钥。请注意,每个用户为每个 Cleariflow API 拥有 独立的 API 密钥,因此您的汇率 API 密钥无法用于 IP 地理定位 API,例如。
String
必填
用于获取最新汇率的基础货币。使用 ISO 4217 货币标准(例如 USD 表示美元),与本 API 中所有货币参数相同。
String
必填
相对于基础货币要获取汇率的目标货币。与 base 参数一样,此处传递的任何货币均遵循 ISO 4217 标准。请注意,与其他端点不同,convert 一次仅接受一个目标货币。
String
您要获取汇率的历史日期,格式为 YYYY-MM-DD。若留空,将使用最新可用汇率。
Float
您要转换为目标货币的基础货币金额。

响应参数

API 响应以通用、轻量的 JSON 格式 返回。
String
用于获取汇率的基础货币。
String
base_amount 被转换到的目标货币。
String
根据成功请求提取货币的日期。
Float
请求中的基础货币金额。
Float
base_amount 转换后的目标货币金额。
Float
用于将 base_amount 从基础货币转换为目标货币的汇率。

查询参数

api_key
string
必填

Your unique API key for authentication

base
string
默认值:EUR

The base currency used to get the latest exchange rate(s) for. Uses the ISO 4217 currency standard

target
string
必填

The target currency to convert to. Only one currency is allowed for conversion.

base_amount
number
默认值:1

The amount of the base currency you would like to convert to the target currency

date
string<date>

The historical date you'd like to get rates from, in the format of YYYY-MM-DD. If not specified, the latest available rates will be used.

响应

Successful response

base
string
必填

The base currency used to get the exchange rates

示例:

"EUR"

target
string
必填

The target currency that the base_amount was converted into

示例:

"USD"

date
string<date>
必填

The date the currencies were pulled from, per the successful request

示例:

"2024-01-01"

base_amount
number
必填

The amount of the base currency from the request

示例:

1

converted_amount
number
必填

The amount of the target currency that the base_amount has been converted into

示例:

0.85

exchange_rate
number
必填

The exchange rate used to convert the base_amount from the base currency to the target currency

示例:

0.85

last_updated
integer
必填

The Unix timestamp of when the returned data was last updated

示例:

1704067200