请求头信息:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Accept: application/json
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
from | string | 是 | 源货币代码(如 GBP) |
to | string | 是 | 目标货币代码 |
amount | number | 否 | 兑换金额 |
curl -X GET "https://cross.cybermagi.space/api/v1/rates?from=GBP&to=CNY&amount=100" \
-H "Authorization: Bearer YOUR_API_KEY"
# Python example
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://cross.cybermagi.space"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
params = {
"query": "example"
}
response = requests.get(
f"{BASE_URL}/api/v1/rates",
params=params,
headers=headers
)
result = response.json()
print(result)
{
"success": true,
"data": {
"from": "GBP",
"to": "CNY",
"rate": 7.1234,
"amount": 100.0,
"result": 712.34,
"updated_at": "2026-07-17T08:00:00Z"
},
"request_id": "req_rates_gbp_en_1"
}
点击返回主页,获取API密钥并在线测试