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

# Refresh the connection

> Connection access tokens expire after one hour. Exchange the refresh token for a new pair before then.

Each refresh returns a **new** refresh token and invalidates the old one — replace the stored token every time.



## OpenAPI

````yaml openapi.json POST /api/v2/connect/refresh
openapi: 3.1.0
info:
  title: Agentcard API
  version: 2.0.0
  description: >-
    The Agentcard v2 API — connect your users and verify their identity from
    your own backend. Every call is authenticated with a platform access token
    minted from your `client_id` + `client_secret`.
servers:
  - url: https://api.agentcard.sh
    description: >-
      There is one base URL. Sandbox vs production is decided by the client
      credential you use, never by the host.
security:
  - platformToken: []
tags:
  - name: Authentication
    description: >-
      Exchange your client credentials for a platform access token, and
      introspect what a token acts as.
  - name: Connect
    description: >-
      Connect a user to your platform: send a one-time code, verify it, record
      consent, and keep the connection alive.
  - name: Identity verification
    description: >-
      Verify a connected user's identity: upload their ID, submit any extra
      fields we ask for, then show a short face scan.
  - name: Wallet funding
    description: >-
      Fund a connected user's wallet from your own UI — request a payment link,
      relay the phone verification code, and poll until the funds land.
  - name: Withdrawals
    description: >-
      Move money out of a connected user's wallet — to a saved bank account or a
      crypto address on Base. Transfers are processed manually by the Agentcard
      team, usually within 1-3 business days.
paths:
  /api/v2/connect/refresh:
    post:
      tags:
        - Connect
      summary: Refresh the connection
      description: >-
        Connection access tokens expire after one hour. Exchange the refresh
        token for a new pair before then.


        Each refresh returns a **new** refresh token and invalidates the old one
        — replace the stored token every time.
      operationId: connectRefresh
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - refresh_token
              properties:
                refresh_token:
                  type: string
                  description: >-
                    The refresh token from the most recent `/connect/verify` or
                    `/connect/refresh`.
            example:
              refresh_token: rct_4d5e6f…
      responses:
        '200':
          description: The new token pair.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionRefreshed'
              example:
                object: connection
                access_token: act_9z8y7x…
                refresh_token: rct_6w5v4u…
                token_type: Bearer
                expires_in: 3600
        '400':
          description: >-
            `invalid_request` — missing `refresh_token`.
            `client_credentials_required` — the token wasn't minted from client
            credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: '`invalid_refresh_token` — that refresh token is invalid or expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ConnectionRefreshed:
      type: object
      properties:
        object:
          type: string
          enum:
            - connection
        access_token:
          type: string
          description: The new connection access token.
        refresh_token:
          type: string
          description: >-
            The new refresh token. The old one is now invalid — replace the
            stored token every time.
        token_type:
          type: string
          enum:
            - Bearer
        expires_in:
          type: integer
          description: Seconds until the access token expires (3600 = one hour).
    Error:
      type: object
      description: Every v2 error uses the same envelope.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable string (snake_case). Branch on this.
            message:
              type: string
              description: A human-readable explanation, safe to log.
            docs:
              type: string
              description: A link back to the reference.
            field_errors:
              type: object
              additionalProperties:
                type: string
              description: Only on `invalid_fields` — names each field to fix.
            warnings:
              type: array
              items:
                type: string
              description: >-
                Only on document upload errors — actionable feedback safe to
                show the user.
  securitySchemes:
    platformToken:
      type: http
      scheme: bearer
      description: >-
        A platform access token. Get one on the **Create an access token**
        endpoint by exchanging your `client_id` + `client_secret`, then send it
        as `Authorization: Bearer <token>`. Tokens live one hour.

````