# 查询支付授权列表

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

查询账户最近创建的支付授权，最多返回 1000 条。

```text
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/payment-authorizations
```

## 调用前准备

1. 准备计费账户所属用户的有效[个人访问令牌](../../../../../guides/genesis/api-keys.md#创建和管理个人访问令牌)。
2. 调用[查询当前账户](../accounts/current.md)接口，获取目标账户的 ID。

## 请求示例

将示例中的 `$MOI_PERSONAL_ACCESS_TOKEN` 和 `$ACCOUNT_ID` 分别替换为个人访问令牌和所选账户的 ID。

```bash
curl -X GET \
  "https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/payment-authorizations" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
```

## 路径参数

::::{div} mo-api-parameter-table

| 参数 | 类型 | 是否必填 | 说明 |
| --- | --- | --- | --- |
| `accountID` | string | 是 | 目标账户的 ID，取自“查询当前账户”响应中的 `items[].billing_account_id`。 |

::::

## 成功响应

请求成功时返回 HTTP `200` 和账户的支付授权列表；尚无授权时，列表为空。

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "items": [],
  "total": 0
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `items` | array of object | 按创建时间从新到旧返回的记录，最多 1000 条。 |
| `items[].payment_authorization_id` | string | 支付授权 ID。 |
| `items[].billing_account_id` | string | Billing 账户 ID。 |
| `items[].provider` | string | 支付服务商。 |
| `items[].channel` | string | 支付渠道。 |
| `items[].authorization_type` | string | 支付授权类型。 |
| `items[].payment_method_ref` | string | 支付方式引用。 |
| `items[].status` | string | 授权状态。 |
| `items[].provider_status` | string | 支付服务商侧的授权状态。 |
| `items[].authorization_version` | integer | 授权版本号。 |
| `items[].max_single_amount` | string | 单笔支付上限，以十进制字符串返回，单位为 currency。 |
| `items[].max_daily_amount` | string | 每日支付上限，以十进制字符串返回，单位为 currency。 |
| `items[].currency` | string | 支付币种。 |
| `items[].created_at` | integer | 创建时间，Unix 秒。 |
| `items[].revoked_at` | integer | 撤销时间，Unix 秒；未撤销时可能省略。 |
| `total` | integer | 本次返回的记录数，最多 1000。 |

字段路径中的 `[]` 表示数组中的每一项。例如，`items[].payment_authorization_id` 表示数组中每一项的对应字段。

:::::
::::::
:::::::

## 错误响应

缺少认证信息时返回 HTTP `401`，请提供有效的个人访问令牌。

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "code": "unauthenticated",
  "message": "missing bearer token",
  "error": "missing bearer token"
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `code` | string | 错误代码。 |
| `message` | string | 错误说明。 |
| `error` | string | 兼容错误说明，与 message 内容相同。 |

:::::
::::::
:::::::
