实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】
实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| from | string | 是 | 源货币代码(大写),如:CNY、USD、EUR | |
| to | string | 是 | 目标货币代码(大写),如:USD、JPY、GBP | |
| money | string | 否 | 需要换算的金额,默认为 1。必须大于 0 |
[
{
"name": "from",
"type": "string",
"required": true,
"description": "源货币代码(大写),如:CNY、USD、EUR",
"example": ""
},
{
"name": "to",
"type": "string",
"required": true,
"description": "目标货币代码(大写),如:USD、JPY、GBP",
"example": ""
},
{
"name": "money",
"type": "string",
"required": false,
"description": "需要换算的金额,默认为 1。必须大于 0",
"example": ""
}
]{"openapi":"3.1.1","info":{"title":"实时汇率查询换算","description":"实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】","version":"1.0.0"},"paths":{"/apis/gateway?api=exchange":{"get":{"summary":"实时汇率查询换算","description":"实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string"},"description":"源货币代码(大写),如:CNY、USD、EUR"},{"name":"to","in":"query","required":true,"schema":{"type":"string"},"description":"目标货币代码(大写),如:USD、JPY、GBP"},{"name":"money","in":"query","required":false,"schema":{"type":"string"},"description":"需要换算的金额,默认为 1。必须大于 0"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"实时汇率查询换算","description":"实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string"},"description":"源货币代码(大写),如:CNY、USD、EUR"},{"name":"to","in":"query","required":true,"schema":{"type":"string"},"description":"目标货币代码(大写),如:USD、JPY、GBP"},{"name":"money","in":"query","required":false,"schema":{"type":"string"},"description":"需要换算的金额,默认为 1。必须大于 0"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"servers":[{"url":"https://api.souxiaocha.com","description":"当前访问入口(https)"}]}
{"success":true,"data":{"from":"CNY","from_name":"人民币","to":"USD","to_name":"美元","exchange":"0.147796","money":"0.147796","updatetime":"2026-07-29 18:28:02"},"input":{"from":"CNY","to":"USD","money":"1"},"generated_at":"2026-07-29 19:12:18"}https://api.souxiaocha.com/apis/gateway?api=exchangeGET https://api.souxiaocha.com/apis/gateway?api=exchange apikey=你的API密钥&from=请填写from&to=请填写to&money=请填写money
GET 参数放在查询字符串中。参数值请替换为实际有效值。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
from | string | 是 | 源货币代码(大写),如:CNY、USD、EUR | |
to | string | 是 | 目标货币代码(大写),如:USD、JPY、GBP | |
money | string | 否 | 需要换算的金额,默认为 1。必须大于 0 |
{"success":true,"data":{"from":"CNY","from_name":"人民币","to":"USD","to_name":"美元","exchange":"0.147796","money":"0.147796","updatetime":"2026-07-29 18:28:02"},"input":{"from":"CNY","to":"USD","money":"1"},"generated_at":"2026-07-29 19:12:18"}实时汇率查询换算API提供全球主要货币之间的实时汇率查询和金额换算服务。数据每分钟更新一次。【注意:汇率行情仅供参考,旨在提供市场动态和信息,不构成任何形式的投资建议。】
https://api.souxiaocha.com/apis/gateway?api=exchange
GET / POST(业务参数 GET 通过 URL 传递,POST 支持表单或 JSON)
调用需携带平台密钥(用户中心「令牌管理」获取,SK- 开头):
key=SK-你的密钥X-API-Key: SK-你的密钥| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| from | string | 是 | 源货币代码(大写),如:CNY、USD、EUR |
| to | string | 是 | 目标货币代码(大写),如:USD、JPY、GBP |
| money | string | 否 | 需要换算的金额,默认为 1。必须大于 0 |
[
{"name": "from", "type": "string", "required": true, "description": "源货币代码(大写),如:CNY、USD、EUR"},
{"name": "to", "type": "string", "required": true, "description": "目标货币代码(大写),如:USD、JPY、GBP"},
{"name": "money", "type": "string", "required": false, "description": "需要换算的金额,默认为 1。必须大于 0"}
]
成功返回示例:
{"success":true,"data":{"from":"CNY","from_name":"人民币","to":"USD","to_name":"美元","exchange":"0.147796","money":"0.147796","updatetime":"2026-07-29 18:28:02"},"input":{"from":"CNY","to":"USD","money":"1"},"generated_at":"2026-07-29 19:12:18"}
失败返回示例:
HTTP/1.1 400 Bad Request
{
"success": false,
"error": "missing_currency",
"message": "请提供源货币(from)和目标货币(to)参数"
}
| 参数名 | 类型 | 说明 |
|---|---|---|
| success | boolean | 请求是否成功 |
| data.from | string | 源货币代码 |
| data.from_name | string | 源货币名称 |
| data.to | string | 目标货币代码 |
| data.to_name | string | 目标货币名称 |
| data.exchange | string | 当前汇率(1 源货币 = X 目标货币) |
| data.updatetime | string | 汇率更新时间 |
| data.money | string | 换算后的金额 |
| input | object | 请求时的输入参数回显 |
| generated_at | string | 接口响应时间 |
curl "https://api.souxiaocha.com/apis/gateway?api=exchange?key=SK-你的密钥&from=CNY&to=USD&money=1"
上游业务级错误:
| code | msg | 描述 |
|---|---|---|
| 400 | missing_currency | 缺少 from 或 to 参数 |
| 400 | invalid_money | 金额参数无效 |
| 401 | invalid_api_key | API密钥无效或未提供 |
| 500 | config_error | 服务配置异常 |
| 500 | api_request_failed | 第三方接口请求异常 |
| 500 | api_parse_failed | 第三方接口响应解析失败 |
| 502 | query_failed | 汇率查询失败 |
平台级错误(errcode):11001 缺少密钥 / 11002 密钥无效或已禁用 / 11005 接口禁用 / 11006 接口维护 / 11010 积分不足 / 11018 请求方式不允许。
失败时请以响应体中的 code / errcode 与 msg 判断。
2026-09-24
curl "https://api.souxiaocha.com/apis/gateway?api=exchange?key=SK-你的密钥&from=CNY&to=USD&money=1"
// 结果将在此处显示