> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stablepayfi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询单个全球账户

> 按账户编号查询当前 API Key 所属商户的单个 Balance Account 及余额。账户不存在或不属于当前商户时均返回 404 resource_not_found。

账户字段与 `as_of` 位于响应顶层，不使用 `global_account` 外层对象。账户编号是 8 位数字字符串，必须保留前导零。

认证方式沿用[公共认证规范](/zh/api/getting-started)。无需传入 `merchant_id` 或 `X-Merchant-Id`，服务端只查询当前 API Key 所属商户的数据。无请求体。金额示例为虚构数据，使用账本最小单位。



## OpenAPI

````yaml /zh/api/global-accounts.openapi.json get /api/v1/global_accounts/{account_no}
openapi: 3.1.0
info:
  title: StablePay 全球账户查询 API
  version: '2026-09-29'
  summary: 全球账户列表、单账户及商户待结算余额查询。
  description: 全球账户与待结算余额只读查询。认证方式沿用 StablePay 公共认证规范。本文按当前生产实现描述，示例为虚构数据。
servers:
  - url: https://api.stablepay.co
    description: 生产环境
security:
  - bearerAuth: []
    stablepayTimestamp: []
    stablepayNonce: []
    stablepaySignature: []
tags:
  - name: 全球账户
    description: 只读账户和余额查询，不提供资金操作。
paths:
  /api/v1/global_accounts/{account_no}:
    get:
      tags:
        - 全球账户
      summary: 查询单个全球账户
      description: >-
        按账户编号查询当前 API Key 所属商户的单个 Balance Account 及余额。账户不存在或不属于当前商户时均返回 404
        resource_not_found。


        账户字段与 `as_of` 位于响应顶层，不使用 `global_account` 外层对象。账户编号是 8 位数字字符串，必须保留前导零。


        认证方式沿用[公共认证规范](/zh/api/getting-started)。无需传入 `merchant_id` 或
        `X-Merchant-Id`，服务端只查询当前 API Key 所属商户的数据。无请求体。金额示例为虚构数据，使用账本最小单位。
      operationId: getGlobalAccount
      parameters:
        - $ref: '#/components/parameters/XStablePayTimestamp'
        - $ref: '#/components/parameters/XStablePayNonce'
        - $ref: '#/components/parameters/XStablePaySignature'
        - name: account_no
          in: path
          required: true
          description: 8 位数字账户编号。
          schema:
            type: string
            pattern: ^[0-9]{8}$
          example: '00000001'
      responses:
        '200':
          description: 查询成功。
          headers:
            Cache-Control:
              schema:
                type: string
                enum:
                  - no-store
              description: 余额响应不应被缓存。
            X-Request-ID:
              schema:
                type: string
              description: 排障时提供此追踪 ID。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalAccountResponse'
              example:
                account_no: '00000001'
                account_name: Default Account
                currency: USDT
                status: active
                is_system_default: true
                editable: false
                available_amount: 10000
                frozen_amount: 2000
                total_amount: 12000
                created: 1788998400
                as_of: 1789084800
        '400':
          description: 账户号格式不正确；不符合网关匹配规则的路径也可能直接返回 404。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_parameter
                  message: 账户号格式不正确；不符合网关匹配规则的路径也可能直接返回 404。
                request_id: example-request-id
                timestamp: 1789084800
        '404':
          description: 账户不存在或不属于当前商户；网关未匹配的路径也可能返回纯文本 Not Found。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: resource_not_found
                  message: 账户不存在或不属于当前商户；网关未匹配的路径也可能返回纯文本 Not Found。
                request_id: example-request-id
                timestamp: 1789084800
            text/plain:
              schema:
                type: string
              example: Not Found
        '500':
          description: 服务内部错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: 服务内部错误。
                request_id: example-request-id
                timestamp: 1789084800
        '503':
          description: 余额查询服务暂时不可用，请稍后使用新的时间戳、nonce 和签名重试。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: service_unavailable
                  message: 余额查询服务暂时不可用，请稍后使用新的时间戳、nonce 和签名重试。
                request_id: example-request-id
                timestamp: 1789084800
components:
  parameters:
    XStablePayTimestamp:
      name: X-StablePay-Timestamp
      in: header
      required: true
      description: Unix 时间戳（秒）。必须与服务端时间相差不超过 5 分钟。
      schema:
        type: string
      example: '1791878400'
    XStablePayNonce:
      name: X-StablePay-Nonce
      in: header
      required: true
      description: 防重放随机字符串，长度 16-64 个字符，建议每次请求使用新的 UUID。
      schema:
        type: string
        minLength: 16
        maxLength: 64
      example: 550e8400-e29b-41d4-a716-446655440000
    XStablePaySignature:
      name: X-StablePay-Signature
      in: header
      required: true
      description: >-
        使用商户 API Secret 对 `{timestamp}.{nonce}.{requestBody}` 计算
        HMAC-SHA256，结果为小写 hex。GET 请求的 `requestBody` 为空字符串。
      schema:
        type: string
      example: a1b2c3d4e5f6...
  schemas:
    GlobalAccountResponse:
      type: object
      required:
        - account_no
        - account_name
        - currency
        - status
        - is_system_default
        - editable
        - available_amount
        - frozen_amount
        - total_amount
        - created
        - as_of
      properties:
        account_no:
          type: string
          description: 账户编号，8 位数字字符串；保留前导零。
          pattern: ^[0-9]{8}$
          example: '00000001'
        account_name:
          type: string
          description: 账户展示名称。
          example: Default Account
        currency:
          type: string
          description: 大写账本币种或资产代码，例如 USD、USDT、USDC。
          example: USDT
        status:
          type: string
          description: 账户可用状态；受限账户仍可查询，是否允许资金操作由对应业务接口决定。
          enum:
            - active
            - restricted
        is_system_default:
          type: boolean
          description: 是否为系统默认账户。
        editable:
          type: boolean
          description: 是否允许商户修改账户展示名称；本接口不提供修改能力。
        available_amount:
          type: integer
          format: int64
          description: 可用余额，使用账本币种最小单位的整数。
        frozen_amount:
          type: integer
          format: int64
          description: 冻结或预留余额，使用账本币种最小单位的整数。
        total_amount:
          type: integer
          format: int64
          description: 账户总余额，当前版本等于 available_amount + frozen_amount。
        created:
          type: integer
          format: int64
          description: 账户创建时间，Unix 秒。
        as_of:
          type: integer
          format: int64
          description: 本次查询的数据库观察时间，Unix 秒；不是数据版本号，不保证多次请求处于同一快照。
      example:
        account_no: '00000001'
        account_name: Default Account
        currency: USDT
        status: active
        is_system_default: true
        editable: false
        available_amount: 10000
        frozen_amount: 2000
        total_amount: 12000
        created: 1788998400
        as_of: 1789084800
    ErrorResponse:
      type: object
      required:
        - error
        - request_id
        - timestamp
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: 稳定业务错误码。
            message:
              type: string
              description: 可读错误说明。
        request_id:
          type: string
          description: 请求追踪 ID，不限制为纯数字。
        timestamp:
          type: integer
          format: int64
          description: 错误响应时间，Unix 秒。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer API Key，例如 `Bearer sk_live_xxx`。
    stablepayTimestamp:
      type: apiKey
      in: header
      name: X-StablePay-Timestamp
      description: Unix 时间戳（秒）。必须与服务端时间相差不超过 5 分钟。
    stablepayNonce:
      type: apiKey
      in: header
      name: X-StablePay-Nonce
      description: 防重放随机字符串，长度 16-64 个字符。
    stablepaySignature:
      type: apiKey
      in: header
      name: X-StablePay-Signature
      description: 使用商户 API Secret 计算的 HMAC-SHA256 小写 hex 签名。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.