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

# Create Client Token

> Create an ephemeral API token for client sessions.



## OpenAPI

````yaml /openapi.json post /v1/client/tokens
openapi: 3.1.0
info:
  title: Decart API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/client/tokens:
    post:
      summary: Create Client Token
      description: Create an ephemeral API token for client sessions.
      operationId: create_client_token_v1_client_tokens_post
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            description: API key for authentication
            title: X-Api-Key
          description: API key for authentication
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/ClientTokenRequest'
                - type: 'null'
              title: Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientTokenResponse'
        '401':
          description: No or invalid API key provided
        '403':
          description: Cannot create client token from a client token
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ClientTokenRequest:
      properties:
        expiresIn:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expiresin
          description: Seconds until the token expires (default 60)
        allowedModels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowedmodels
          description: Restrict which models this token can access (max 20)
        allowedOrigins:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowedorigins
          description: Restrict which web origins this token can be used from (max 20)
        constraints:
          anyOf:
            - $ref: '#/components/schemas/TokenConstraints'
            - type: 'null'
          description: Operational limits for the token
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      title: ClientTokenRequest
    ClientTokenResponse:
      properties:
        apiKey:
          type: string
          title: Apikey
        expiresAt:
          type: string
          title: Expiresat
        permissions:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Permissions
        constraints:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Constraints
      type: object
      required:
        - apiKey
        - expiresAt
      title: ClientTokenResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TokenConstraints:
      properties:
        realtime:
          anyOf:
            - $ref: '#/components/schemas/RealtimeConstraints'
            - type: 'null'
      type: object
      title: TokenConstraints
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    RealtimeConstraints:
      properties:
        maxSessionDuration:
          anyOf:
            - type: integer
            - type: 'null'
          title: Maxsessionduration
      type: object
      title: RealtimeConstraints

````