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

# 登录



## OpenAPI

````yaml /openapi.zh.yaml post /v1/auth/login
openapi: 3.1.0
info:
  title: CBPay API
  version: '1.89'
  description: >
    CBPay 是一个多币种支付平台:覆盖拉美的法币付款(payout)与收款(payin)、内部转账、链上充值与提现,以及 KYC
    筛查。每个账户持有四个相互独立的虚拟余额——USDT(运营货币)、USDC、BTC 和 GOLD(纯金克数)——它们绝不混合也不会自动兑换。

    payout 和服务费可从四个余额中的任意一个支付:

    用 `PUT /v1/settlement` 设置默认值,或在单笔 payout 中用

    `settlement_asset` 覆盖。


    所有金额均为十进制字符串,遵循各货币的精度(USDT/USDC/GOLD 为 6 位小数,BTC 为 8 位)。错误始终返回

    `{"error": "<code>", "message": "<detail>"}`。
servers:
  - url: https://api.qbank.cl/platform
    description: Live（生产环境，真实资金）
  - url: https://cryptobank.qbank.cl/platform
    description: Test（沙盒，模拟资金 — pk_test_ 密钥）
security:
  - bearerAuth: []
tags:
  - name: 凭证
    description: >-
      每笔操作的品牌化 PDF 凭证,附带公开的签名 QR 真伪校验、每个响应/webhook 中的
      receipt_url,以及最终状态时的自动邮件发送。
  - name: 身份认证
    description: 注册与登录账户成员。会话有效期 24 小时。
  - name: 账户
    description: 调用账户的档案、成员与 API key。
  - name: 余额
    description: 余额、流水历史与外汇汇率。
  - name: 付款(Payouts)
    description: 从你选择的结算余额扣款的法币派发(默认 USDT)。
  - name: 收款(Payins)
    description: 入账到 USDT 余额的法币充值。
  - name: 转账
  - name: 联系人
  - name: 兑换(Swaps)
    description: CBPay 账户之间的免费内部转账(个人或企业,任意组合)。
  - name: 加密货币
    description: 链上充值与提现(TRON、Ethereum 和 Bitcoin)。
  - name: 隔离钱包
    description: 拥有自身余额的链上钱包(企业不限数量;个人每个网络+资产组合 1 个)——创建、导入、发送、导出私钥与自动转发。余额存在于链上,从不进入账本。
  - name: QR Crypto POS
    description: >-
      面向拥有实体 POS 终端的处理商（企业账户）的定额加密货币二维码收款：已验证商户、每笔收款专属地址 +
      二维码、支付早期检测、按商户对账，以及经加密货币提现通道的退款。
  - name: KYC / KYB
  - name: AML 筛查
    description: 身份验证:个人 KYC、企业 KYB,含 AML 筛查、重新筛查与持续监控。
  - name: 钱包筛查
    description: 区块链地址的 AML 风险评估(制裁、非法资金暴露),按次收费;另附提现与充值的免费自动防护。
  - name: 分析
  - name: Webhooks
    description: 接收签名事件通知的订阅。
  - name: 状态
    description: 服务可用性。
  - name: 银行服务
    description: 真实银行账户:通过国际银行通道接收、持有与发送资金。
  - name: 卡片
    description: 以 Just-In-Time 方式从账户 USDT 余额消费的虚拟卡与实体卡,支持按卡设置消费限额。
  - name: 安全(OTP)
    description: >-
      通过 SMS/WhatsApp/email 发送的一次性验证码,保护敏感操作;并提供自助 2FA 偏好设置。仅适用于用户会话——API key
      豁免。
  - name: 通行密钥
    description: >-
      通过 WebAuthn 使用设备生物识别(Face ID、Touch ID、Windows
      Hello、安全密钥)的无密码登录、带备份码的验证器应用(TOTP),以及会话/设备管理。
  - name: 社交登录
    description: >-
      通过令牌交换以 Google、Apple、Microsoft 和 Facebook 实现无密码注册与登录。前端获取提供方凭证;API 验证后签发
      CBPay 会话。
paths:
  /v1/auth/login:
    post:
      tags:
        - 身份认证
      summary: 登录
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - org
                - email
                - password
              properties:
                org:
                  type: string
                  description: CBPay 组织 slug(`cbpay`)。
                email:
                  type: string
                  format: email
                password:
                  type: string
            example:
              org: cbpay
              email: ana@example.com
              password: a-secure-password
      responses:
        '200':
          description: >-
            已签发会话——或者,当账户策略要求登录 OTP 时,返回带 `otp_required` true 和 `pending_token`
            的中间响应,在 `POST /v1/auth/login/otp` 交换。
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  expires_at:
                    type: string
                    format: date-time
                  refresh_token:
                    type: string
                    description: 一次性轮换刷新令牌(`rt_…`),可在 `POST /v1/auth/refresh` 免重新登录续期会话。
                  refresh_expires_at:
                    type: string
                    format: date-time
                  account_id:
                    type: string
                    format: uuid
                  role:
                    type: string
                    enum:
                      - owner
                      - operator
                      - viewer
                  otp_required:
                    type: boolean
                    description: 当登录需要第二步时为 true。
                  pending_token:
                    type: string
                    description: 用于 `POST /v1/auth/login/otp` 的中间令牌。它无法对 API 请求进行认证。
                  challenge_id:
                    type: string
                    format: uuid
                  channel:
                    type: string
                    enum:
                      - sms
                      - whatsapp
                      - email
                      - totp
                    description: >-
                      登录质询的实际渠道。手机号处于绑定冷却期时，质询会自动改用更强的因素（身份验证器应用，其次登录邮箱）——验证码绝不会发送到最近绑定且未验证的号码。
                  phone:
                    type: string
                    description: 验证码发送到的打码手机号。
              examples:
                session:
                  summary: 已签发会话(无 OTP 策略)
                  value:
                    access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…
                    expires_at: '2026-07-08T12:00:00Z'
                    refresh_token: >-
                      rt_6a1e6c22-93a1-4f0e-a7d1-1f2e3c4b5a69.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                    refresh_expires_at: '2026-08-06T12:00:00Z'
                    account_id: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d
                    role: owner
                otpRequired:
                  summary: 两步登录(OTP 策略生效)
                  value:
                    otp_required: true
                    pending_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…
                    challenge_id: 6f1c02aa-93a1-4f0e-a7d1-1f2e3c4b5a69
                    channel: sms
                    phone: '********5678'
                    expires_at: '2026-07-08T21:10:00Z'
                    note: >-
                      verify the code with POST /v1/auth/login/otp to receive
                      the session token
        '401':
          description: 邮箱或密码不正确(`invalid_credentials`)。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: invalid_credentials
                message: email or password is incorrect
        '403':
          description: >-
            登录策略解析为 SMS/WhatsApp，但手机号在 24
            小时内绑定且未验证，账户也没有替代因素（`phone_binding_cooldown`）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: phone_binding_cooldown
                message: >-
                  the phone number was linked recently without verification;
                  SMS/WhatsApp login codes unlock 24 hours after the change and
                  no alternative factor (authenticator app or login email) is
                  available
      security: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
          description: 机器可读的错误代码(snake_case)。
          example: insufficient_funds
        message:
          type: string
          description: 人类可读的说明。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        会话 JWT(来自注册/登录)或 API key(`pk_...`)。
        也接受 `X-API-Key: <token>` 作为替代请求头。

````