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

# Start a browser WebRTC session

> Creates a browser voice session and returns a room URL plus a one-time access token your browser uses to connect to the agent in real time.

The session is fully tracked on the platform — when the session ends, the same `session.completed` partner webhook fires (transcript, recording_url, extraction). The webhook payload's `call` field is omitted for these sessions because there is no associated phone call. See [Web Voice Testing](/web-voice-testing) for end-to-end browser integration code.

**Auth + limits:** Bearer API key (`rg_live_*`). Bound by the API key's concurrency limit. Rate-limited to 10 starts/minute per key.



## OpenAPI

````yaml /openapi.json post /sessions/webrtc
openapi: 3.1.0
info:
  title: Vocobase Partner API
  version: '2.0'
  description: >-
    API for managing voice AI agents, documents, and calls on the Vocobase
    platform.
servers:
  - url: https://api.vocobase.com/api/v2
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Config
    description: >-
      Read and update partner configuration, webhook settings, and telephony
      credentials.
  - name: Agents
    description: Create, read, update, and delete voice AI agents.
  - name: Voices
    description: >-
      List voice tiers, available voices, and stream preview audio for agent
      configuration.
  - name: Documents
    description: Upload, manage, and delete knowledge base documents.
  - name: Agent Documents
    description: Link and unlink documents to agents for knowledge base integration.
  - name: Calls
    description: Initiate outbound calls and view call history.
  - name: Phone Numbers
    description: >-
      Import DIDs, assign agents for inbound routing, and re-sync carrier
      Application bindings.
  - name: Inbound Routing Policies
    description: >-
      Define pre-answer routing decisions for inbound calls before AI sessions
      are created.
  - name: Telephony Connections
    description: Create, list, rename, and disconnect named V2 telephony connections.
  - name: VoiceLink Management
    description: Manage VoiceLink reseller clients, DID mapping, and readiness sync.
  - name: Projects
    description: Organize agents into projects. Every agent belongs to exactly one project.
  - name: Dictionaries
    description: Speech-recognition dictionary CRUD and agent attachment.
  - name: Sessions
    description: Browser-initiated WebRTC voice sessions for in-app voice agents.
paths:
  /sessions/webrtc:
    post:
      tags:
        - Sessions
      summary: Start a browser WebRTC session
      description: >-
        Creates a browser voice session and returns a room URL plus a one-time
        access token your browser uses to connect to the agent in real time.


        The session is fully tracked on the platform — when the session ends,
        the same `session.completed` partner webhook fires (transcript,
        recording_url, extraction). The webhook payload's `call` field is
        omitted for these sessions because there is no associated phone call.
        See [Web Voice Testing](/web-voice-testing) for end-to-end browser
        integration code.


        **Auth + limits:** Bearer API key (`rg_live_*`). Bound by the API key's
        concurrency limit. Rate-limited to 10 starts/minute per key.
      operationId: startWebrtcSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agent_id
              properties:
                agent_id:
                  type: string
                  format: uuid
                  description: ID of the agent to use for this session.
                variables:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Pre-call variable values. Keys must match variable names
                    declared on the agent (`Agent.variables`). Substituted into
                    the agent's prompt and greeting via `{{name}}` placeholders.
                    Echoed in the `session.completed` webhook for partner-side
                    audit. Missing variables render as empty strings.
                  example:
                    callee_name: Sajal
      responses:
        '201':
          description: >-
            Session started successfully. Pass `daily_room_url` and
            `daily_token` to your WebRTC client.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      session_id:
                        type: string
                        format: uuid
                      agent_id:
                        type: string
                        format: uuid
                      daily_room_url:
                        type: string
                        format: uri
                        description: >-
                          WebRTC room URL. Pass to `client.connect({ url, token
                          })`.
                      daily_token:
                        type: string
                        description: One-time WebRTC access token for the room.
              example:
                success: true
                data:
                  session_id: s1234567-abcd-1234-abcd-123456789012
                  agent_id: a1234567-abcd-1234-abcd-123456789012
                  daily_room_url: https://voice-session.example.com/abc123
                  daily_token: eyJhbGciOi...
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          description: Concurrency limit reached for this API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: CONCURRENCY_LIMIT_EXCEEDED
                  message: >-
                    Concurrency limit reached. Maximum simultaneous sessions
                    exceeded.
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          description: Voice session temporarily unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BOT_SERVER_UNAVAILABLE
                  message: Voice session temporarily unavailable. Please try again.
components:
  responses:
    ValidationError:
      description: Validation error in request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: VALIDATION_ERROR
              message: agent_name is required and must be max 50 characters
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or missing API key
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: NOT_FOUND
              message: Resource not found
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in format: `rg_live_xxxx`. Pass as a Bearer token in the
        Authorization header.

````