> ## 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.

# Create a Vault session

> Creates a short-lived Vault (hosted card-binding) session for the token's customer and returns its `vault_id`, the hosted page `url`, and the expiry. Requires `portal:write`.

This is the same hosted card-binding ceremony as [Bind a card](https://docs.clinkbill.com/api-reference/agent-portal/bind_card.md), exposed under the `vault_id` contract so a platform settings page can keep one card-management flow: create the session, open the hosted page, then read the card list again. Each call creates a new independent session. No purchase authorization and no instruction is created.

`POST /agent/platform/vault-sessions` and the existing [Bind a card](https://docs.clinkbill.com/api-reference/agent-portal/bind_card.md) `POST /agent/platform/bind-sessions` create the **same** Vault bind session; the only difference is the response field name (`vault_id` here, `session_id` there). Use `vault-sessions` for new integrations; `bind-sessions` stays available for existing integrations and neither endpoint is deprecated.

There are no body fields for choosing a customer. The session is always created for the token's customer.

> [!WARNING]
>
> Treat `vault_id` and `url` as credentials. Do not forward them, screenshot them, or write them to logs; anyone who has either one can complete card binding for that customer while the session is valid. Deliver them only to the intended user.

## Exchange `vault_id` for a page login state

To open the hosted page with a Vault page login state instead of the link, exchange `vault_id` at the existing exchange endpoint:

```http theme={null}
POST {API_BASE_URL}/a/cwallet/vault/session/exchange
Content-Type: application/json

{
  "session_id": "vs_..."
}
```

The exchange returns the Vault page session `token` and its `expire_in`; use that token only for the hosted page. The session lifetime follows Clink's Vault session configuration; after it expires, create a new session. A Vault session is a card-binding session, not a purchase authorization, and it cannot be used to charge the customer.


## OpenAPI

````yaml POST /agent/platform/vault-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/vault-sessions:
    post:
      summary: Create a Vault session
      description: >-
        Creates a short-lived Vault (hosted card-binding) session for the
        token's customer and returns its `vault_id`, the hosted page `url`, and
        the expiry. Requires `portal:write`.
      operationId: createVaultSession
      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/VaultSession'
              example:
                code: 200
                msg: Success
                data:
                  vault_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:
    VaultSession:
      type: object
      properties:
        vault_id:
          type: string
          description: Opaque short-lived Vault session ID.
          example: vs_...
        url:
          type: string
          description: >-
            Hosted card-binding page URL built from Clink's configured page
            template. It contains `vault_id` and does not contain a portal
            token.
          example: https://agent.clinkbill.dev/vault/vs_...
        expires_at:
          type: string
          description: Time after which the session and the link no longer work.
          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.