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

# Refresh a CLI access token.

> Trades a refresh token for a new access token and refresh token without another browser round trip, returning the same session payload as the initial exchange. Pass organization_id to move the refreshed session to another organization the signed-in user belongs to. Store the returned refresh token: the presented one is consumed.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/auth/cli/refresh
openapi: 3.1.0
info:
  description: >-
    Deterministic biological evidence primitives. Every response is the same
    envelope: ok, data, warnings, provenance.
  title: Rafflesia API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.rafflesia.ai
security:
  - bearerAuth: []
paths:
  /v1/auth/cli/refresh:
    post:
      tags:
        - Auth
      summary: Refresh a CLI access token.
      description: >-
        Trades a refresh token for a new access token and refresh token without
        another browser round trip, returning the same session payload as the
        initial exchange. Pass organization_id to move the refreshed session to
        another organization the signed-in user belongs to. Store the returned
        refresh token: the presented one is consumed.
      operationId: auth.cli.refresh
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CLIRefreshRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthEnvelopeCLITokenData'
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
components:
  schemas:
    CLIRefreshRequest:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/CLIRefreshRequest.json
          format: uri
          readOnly: true
          type: string
        organization_id:
          type: string
        refresh_token:
          type: string
      required:
        - refresh_token
      type: object
    AuthEnvelopeCLITokenData:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/AuthEnvelopeCLITokenData.json
          format: uri
          readOnly: true
          type: string
        data:
          $ref: '#/components/schemas/CLITokenData'
          description: Operation result data.
        error:
          $ref: '#/components/schemas/AuthError'
          description: Structured error information.
        ok:
          description: Whether the operation succeeded.
          type: boolean
      required:
        - ok
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    CLITokenData:
      additionalProperties: false
      properties:
        access_token:
          type: string
        entitlements:
          items:
            type: string
          type:
            - array
            - 'null'
        expires_at:
          type: string
        organization_id:
          type: string
        permissions:
          items:
            type: string
          type:
            - array
            - 'null'
        refresh_token:
          type: string
        role:
          type: string
        session_id:
          type: string
        token_type:
          type: string
        user:
          $ref: '#/components/schemas/AuthUser'
      required:
        - access_token
        - refresh_token
        - token_type
      type: object
    AuthError:
      additionalProperties: false
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
      required:
        - code
        - message
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    AuthUser:
      additionalProperties: false
      properties:
        email:
          type: string
        email_verified:
          type: boolean
        first_name:
          type: string
        id:
          type: string
        last_name:
          type: string
        name:
          type: string
      required:
        - id
        - email
        - email_verified
      type: object
  securitySchemes:
    bearerAuth:
      description: 'A Rafflesia API key, sent as `Authorization: Bearer <key>`.'
      scheme: bearer
      type: http

````