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

# Create a web session token

> Mint a LiveKit token for a browser or mobile client to talk to a stored assistant. It is a standard LiveKit token — connect to `wsUrl` with any LiveKit client SDK or UI component library and the assistant joins the room on its own. The token is good for the assistant's `config.session.ttl`, 600 seconds by default — that caps how long the client has to connect, not how long the conversation can run, so mint one token per conversation. The session record is written when the token is minted, so an unused token still leaves a session behind.



## OpenAPI

````yaml /voice-agents/api-reference/openapi.yaml post /realtime-assistants/{realtimeAssistantId}/session
openapi: 3.1.0
info:
  title: UpliftAI Voice Agents API
  version: '1.0'
  description: >-
    Build voice assistants, start conversations on the web or the phone, run
    calling campaigns, and receive outcomes by webhook. All endpoints take a
    bearer API key unless noted otherwise.
servers:
  - url: https://api.upliftai.org/v1
security:
  - apiKey: []
tags:
  - name: Assistants
  - name: Authoring an assistant
  - name: Starting a conversation
  - name: Sessions & call records
  - name: Campaigns
  - name: Campaign outcomes
  - name: Contacts
  - name: Google Sheet sources
  - name: Integrations & delivery health
paths:
  /realtime-assistants/{realtimeAssistantId}/session:
    post:
      tags:
        - Starting a conversation
      summary: Create a web session token
      description: >-
        Mint a LiveKit token for a browser or mobile client to talk to a stored
        assistant. It is a standard LiveKit token — connect to `wsUrl` with any
        LiveKit client SDK or UI component library and the assistant joins the
        room on its own. The token is good for the assistant's
        `config.session.ttl`, 600 seconds by default — that caps how long the
        client has to connect, not how long the conversation can run, so mint
        one token per conversation. The session record is written when the token
        is minted, so an unused token still leaves a session behind.
      operationId: createAssistantSession
      parameters:
        - name: realtimeAssistantId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          example: 452dda41-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionRequest'
            example:
              participantName: عائشہ صدیقی
              roomName: shifa-clinic
      responses:
        '200':
          description: The join token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionToken'
              example:
                token: >-
                  eyJhbGciOiJIUzI1NiJ9.eyJ2aWRlbyI6eyJyb29tSm9pbiI6dHJ1ZSwicm9vbSI6…
                wsUrl: wss://upliftai-prod-yd34to8b.livekit.cloud
                roomName: shifa-clinic-f2c14cfc-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        '400':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message:
                  - participantName should not be empty
                  - participantName must be a string
                error: Bad Request
                statusCode: 400
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: The organization is out of credits. No session is created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Insufficient credits to start a realtime session
                error: Payment Required
                statusCode: 402
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/VersionNotReady'
components:
  schemas:
    CreateSessionRequest:
      type: object
      properties:
        participantName:
          type: string
          minLength: 1
          description: >-
            The LiveKit participant identity the client joins under. Stored on
            the session record as `participantIdentity`.
        roomName:
          type: string
          description: >-
            Cosmetic prefix for the generated room name, truncated to its first
            15 characters. Overrides the assistant's
            `config.session.roomPrefix`; with neither set the prefix is `web`.
        assistantVersion:
          $ref: '#/components/schemas/AssistantVersionSelector'
        variables:
          type: object
          additionalProperties: true
          propertyNames:
            maxLength: 64
          description: >-
            Facts about the person on this session. They reach the model as a
            [caller record](/voice-agents/personalization/variables) and come
            back verbatim on every session read. Same limits as on a
            [call](/api-reference/starting-a-conversation/dispatch-a-call-from-this-assistant).
            **The rendered record rides in the returned `token`, so the browser
            can read it.** Keep secrets out.
        additionalInstructions:
          type: string
          maxLength: 2000
          description: >-
            Appended to the assistant's instructions for this session only. **It
            rides in the returned `token`, so the browser can read it.** Keep
            secrets out.
      required:
        - participantName
    SessionToken:
      type: object
      properties:
        token:
          type: string
          description: >-
            LiveKit access token. Hand it to a LiveKit client SDK along with
            `wsUrl`.
        wsUrl:
          type: string
          format: uri
          description: LiveKit WebSocket URL the client connects to.
        roomName:
          type: string
          description: The room this token opens. Server-generated — treat it as opaque.
    Error:
      type: object
      properties:
        message:
          description: >-
            One message per failed field for validation errors, a single string
            otherwise.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        error:
          type: string
        statusCode:
          type: integer
    AssistantVersionSelector:
      oneOf:
        - type: string
          enum:
            - prod
            - draft
        - type: integer
          minimum: 1
      default: prod
      description: >-
        Which version of the assistant runs. `prod` is the published version, or
        the draft before the first publish. `draft` tries unpublished edits on a
        real conversation. A number runs that exact published version, and one
        never published is a 404. Send a number as a JSON number, not a string.
      example: draft
  responses:
    Unauthorized:
      description: A bearer key was sent but is not recognized.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: invalid authorization
            error: Unauthorized
            statusCode: 401
    Forbidden:
      description: No API key sent, or the key lacks permission for this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Forbidden resource
            error: Forbidden
            statusCode: 403
    NotFound:
      description: No such resource in the API key's project.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: 'Realtime assistant not found: 00000000-0000-4000-8000-000000000000'
            error: Not Found
            statusCode: 404
    VersionNotReady:
      description: >-
        The published version hasn't reached this region yet, usually right
        after a publish. No session or call was started. Retry in a few seconds.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: >-
              Published version 14 of assistant
              0f4a91d3-xxxx-xxxx-xxxx-xxxxxxxxxxxx is not readable yet
            statusCode: 503
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Project API key (`sk_api_…`).

````