API
列出官方货币
GET /currencies — 列出官方货币
操作
GET /currencies
行为
返回平台维护的官方货币及其当前的 USD 汇率。官方费率表中的货币换算使用的就是这些货币。
- 结果按
code排序。 search将列表缩小到包含指定文本的代码(不区分大小写)。usd_rate是一单位该货币对应的美元价值,以十进制字符串表示(例如价值 1/8 美元的货币为0.125)。- 只列出官方货币。
用量
{
"authentication": "public",
"credit_cost": 0,
"premium": false,
"recommended_interval_seconds": 300,
"rate_limit": null,
"unit_pricing": null
}请求
{
"parameters": [
{
"name": "search",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "对货币代码进行不区分大小写的子串匹配。省略则列出所有货币。",
"title": "Search"
},
"description": "对货币代码进行不区分大小写的子串匹配。省略则列出所有货币。"
}
]
}响应
{
"200": {
"description": "请求成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Envelope_list_CurrencyOut__"
}
}
}
},
"422": {
"description": "参数或请求体无效",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
}
},
"503": {
"description": "服务暂时不可用;请稍后重试",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorEnvelope"
}
}
}
}
}模型
{
"CreditMeta": {
"properties": {
"cost": {
"type": "integer",
"title": "Cost",
"description": "本次请求花费的点数。"
},
"remaining": {
"type": "integer",
"title": "Remaining",
"description": "本次请求后的预估剩余点数。仅作参考而非账目:并发请求可能导致其略有偏差。"
}
},
"type": "object",
"required": [
"cost",
"remaining"
],
"title": "CreditMeta",
"description": "计费请求的点数结算信息。"
},
"CurrencyOut": {
"properties": {
"id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Id",
"description": "货币的唯一 ID。"
},
"code": {
"type": "string",
"title": "Code",
"description": "货币代码,例如 `USD`。"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Name",
"description": "显示名称。"
},
"kind": {
"type": "string",
"title": "Kind",
"description": "货币种类,例如 `fiat`。"
},
"usd_rate": {
"type": "string",
"title": "Usd Rate",
"description": "一单位该货币对应的美元价值,以十进制字符串表示。用于 `auto` 换算。"
},
"owner_user_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Owner User Id",
"description": "所有者用户的 ID;平台货币(包括所有官方货币)为 `null`。"
},
"is_official": {
"type": "boolean",
"title": "Is Official",
"description": "该货币是否属于平台维护的官方目录。"
},
"ref_count": {
"type": "integer",
"title": "Ref Count",
"description": "使用该货币的换币算子数量。"
},
"is_deleted": {
"type": "boolean",
"title": "Is Deleted",
"description": "货币是否已删除。已删除的货币不会被列出,因此只有在删除操作的响应中才为 `true`。"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"id",
"code",
"name",
"kind",
"usd_rate",
"owner_user_id",
"is_official",
"ref_count",
"is_deleted"
],
"title": "CurrencyOut",
"description": "一种货币及其美元价值。"
},
"Envelope_list_CurrencyOut__": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/CurrencyOut"
},
"type": "array",
"title": "Data",
"description": "端点返回的数据。"
},
"meta": {
"$ref": "#/components/schemas/Meta",
"description": "请求元数据。"
}
},
"type": "object",
"required": [
"data",
"meta"
],
"title": "Envelope[list[CurrencyOut]]"
},
"ErrorBody": {
"properties": {
"code": {
"type": "string",
"title": "Code",
"description": "稳定的机器可读错误代码。请根据此值进行分支处理,而不是 `message`。"
},
"message": {
"type": "string",
"title": "Message",
"description": "面向人类阅读的说明。措辞可能变化。"
},
"details": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Details",
"description": "可选的结构化上下文,例如校验错误列表;对于 `credit_insufficient`,则为所需点数和剩余点数。"
}
},
"type": "object",
"required": [
"code",
"message"
],
"title": "ErrorBody",
"description": "失败请求的详细信息。"
},
"ErrorEnvelope": {
"properties": {
"error": {
"$ref": "#/components/schemas/ErrorBody",
"description": "出了什么问题。"
},
"meta": {
"$ref": "#/components/schemas/Meta",
"description": "请求元数据。"
}
},
"type": "object",
"required": [
"error",
"meta"
],
"title": "ErrorEnvelope",
"description": "错误响应:`error` 中为错误信息,`meta` 中为请求元数据。"
},
"Meta": {
"properties": {
"request_id": {
"type": "string",
"title": "Request Id",
"description": "本次请求的唯一标识符,与响应头 `X-Request-ID` 相同。联系支持时请提供。"
},
"billable": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Billable",
"description": "该请求是否以点数计费。仅出现在计量端点上;`false` 表示该请求免费,例如因为它本身不收费,或已被你的订阅覆盖。"
},
"credit": {
"anyOf": [
{
"$ref": "#/components/schemas/CreditMeta"
},
{
"type": "null"
}
],
"description": "本次请求的费用和你的预估剩余余额。仅在 `billable` 为 `true` 时出现。"
}
},
"type": "object",
"required": [
"request_id"
],
"title": "Meta",
"description": "每个带信封的响应中都包含的请求元数据。"
}
}