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

# 绑定银行卡

> Creates a short-lived card-binding session for the token's customer and returns a URL that the user opens to add a card. Requires `portal:write`.

该接口不创建指令，也不授权消费。用户只需要添加卡片时使用它；如果要一次完成绑卡和授权，请改用[创建指令](https://docs.clinkbill.com/cn/api-reference/agent-portal/create_instruction.md)并省略 `payment_instrument_id`。请求中没有用于指定其他用户的 body 字段，会话始终为该 token 对应用户创建。

每次调用都会创建一个新的独立会话，有效期较短。用户打开链接并完成绑卡流程后，卡片会加入该用户的支付方式（见[支付方式列表](https://docs.clinkbill.com/cn/api-reference/agent-portal/list_payment_methods.md)）；不会创建指令或授权。会话处于 pending 状态时可以重新打开或重复兑换链接；绑卡流程完成或会话过期后链接失效。

> [!WARNING]
>
> 把绑卡链接当作凭证处理。不要转发、截图或写入日志；拿到链接的人可以在链接有效期内打开它，并为该用户完成绑卡。只把链接发给目标用户。


## OpenAPI

````yaml POST /agent/platform/bind-sessions
openapi: 3.1.0
info:
  title: Clink Agent Portal API
  description: >-
    Agent Portal APIs let an Agent platform read and manage one user's Clink
    account with a portal user token: payment methods, orders, refunds, purchase
    instructions, payment credentials, payment results, and settings.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com
    description: Sandbox
security:
  - PortalToken: []
paths:
  /agent/platform/bind-sessions:
    post:
      summary: Bind a card
      description: >-
        Creates a short-lived card-binding session for the token's customer and
        returns a URL that the user opens to add a card. Requires
        `portal:write`.
      operationId: createBindSession
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    format: int32
                    description: '`200` on success.'
                    example: 200
                  msg:
                    type: string
                    description: Result message.
                    example: Success
                  data:
                    $ref: '#/components/schemas/BindSession'
              example:
                code: 200
                msg: Success
                data:
                  session_id: vs_...
                  url: https://agent.clinkbill.dev/vault/vs_...
                  expires_at: '2026-11-09T10:30:00Z'
        '401':
          description: Missing, expired, or invalid portal token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Wrong token audience, missing `portal:write` scope, or a platform
            client token used instead of a portal token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BindSession:
      type: object
      properties:
        session_id:
          type: string
          description: Opaque short-lived card-binding session ID.
          example: vs_...
        url:
          type: string
          description: >-
            Short-lived card-binding link the user opens in a browser. It
            contains the session ID and does not contain a portal token.
          example: https://agent.clinkbill.dev/vault/vs_...
        expires_at:
          type: string
          description: Time after which the link no longer works.
          format: date-time
          example: '2026-11-09T10:30:00Z'
    ErrorResponse:
      type: object
      description: Business errors use the standard envelope without `data`.
      properties:
        code:
          type: integer
          description: >-
            Numeric business error code. Judge an error by the HTTP status
            together with `code`, not by a string error code.
        msg:
          type: string
          description: Human-readable description.
  securitySchemes:
    PortalToken:
      type: http
      scheme: bearer
      description: >-
        Portal user token from `POST /agent/cwallet/platform/portal/tokens`.
        Reads require `portal:read`; writes require `portal:write`.

````

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