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

# Register a web call

> Register a browser voice call and receive a LiveKit token for it. The token joins the LiveKit room for that call and nothing else. Call this from your backend and return only the token and `call_id` to the browser, never the organization API key. The call runs only when workspace balance, caregiver readiness, and the concurrency limit allow it; a refused call creates no record.



## OpenAPI

````yaml /openapi/backend.json post /api/calls/web/register
openapi: 3.0.3
info:
  title: Drive Health operational API
  version: 1.0.0
  description: >-
    Server-to-server API for organizations integrating with Drive Health. It
    starts chat and voice conversations and reads the calls, chats, transcripts,
    and recordings those conversations produce. Authenticate every request with
    an organization API key.
servers:
  - url: https://backend.drivehealth.ai
    description: Production. Use the API origin supplied for your environment.
security:
  - organizationBearer: []
  - organizationApiKey: []
tags:
  - name: Chat
    description: >-
      Start a chat with a caregiver, exchange messages, and end the session.
      These routes also answer on the compatibility mount `/v1/chat/...`.
  - name: Voice
    description: Start phone calls from an owned number and register browser voice calls.
  - name: Results
    description: >-
      Read the calls, chat sessions, transcripts, and recordings your
      organization owns.
paths:
  /api/calls/web/register:
    post:
      tags:
        - Voice
      summary: Register a web call
      description: >-
        Register a browser voice call and receive a LiveKit token for it. The
        token joins the LiveKit room for that call and nothing else. Call this
        from your backend and return only the token and `call_id` to the
        browser, never the organization API key. The call runs only when
        workspace balance, caregiver readiness, and the concurrency limit allow
        it; a refused call creates no record.
      operationId: registerWebCall
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebCallRequest'
            example:
              assistant_id: 1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d
              variables: []
      responses:
        '201':
          description: The web call was registered.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebCallResponse'
              example:
                err: false
                msg: Success
                results:
                  call_id: 3c2b1a09-8f7e-4d6c-9b8a-7d6c5b4a3f2e
                  token: eyJEXAMPLE.LIVEKIT.TOKEN
        '400':
          description: A call precondition failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                err: true
                msg: Maximum concurrency limit reached.
        '403':
          $ref: '#/components/responses/Refused'
        '412':
          description: The caregiver was not found in your organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                err: true
                msg: AI Assistant not found.
components:
  schemas:
    WebCallRequest:
      type: object
      required:
        - assistant_id
      properties:
        assistant_id:
          type: string
          format: uuid
          description: ID of the caregiver to talk to. It must belong to your organization.
        variables:
          type: array
          description: Values the caregiver can use during the call.
          items:
            $ref: '#/components/schemas/CallVariable'
          default: []
    WebCallResponse:
      type: object
      required:
        - err
        - msg
        - results
      properties:
        err:
          type: boolean
          example: false
        msg:
          type: string
          example: Success
        results:
          type: object
          required:
            - call_id
            - token
          properties:
            call_id:
              type: string
              format: uuid
              description: ID of the new call.
            token:
              type: string
              description: >-
                Short-lived LiveKit token that joins this call's room and
                nothing else.
    ErrorEnvelope:
      type: object
      required:
        - err
        - msg
      properties:
        err:
          type: boolean
          example: true
        msg:
          type: string
          description: What went wrong.
    CallVariable:
      type: object
      required:
        - var_name
        - var_value
      properties:
        var_name:
          type: string
          example: patient_name
        var_value:
          type: string
          example: Alex
    Refusal:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Why the request was refused.
  responses:
    Refused:
      description: >-
        Refused before the endpoint ran, with `detail` instead of the standard
        envelope: the key is missing, invalid, or revoked; more than one
        credential was presented; or a selector names a different organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
          examples:
            invalidKey:
              summary: Invalid or revoked key
              value:
                detail: Unauthorized
            noCredential:
              summary: No credential
              value:
                detail: Authentication credentials were not provided.
            conflictingCredentials:
              summary: More than one credential
              value:
                detail: >-
                  More than one credential was presented. Send an organization
                  key or a session token, not both.
            foreignSelector:
              summary: Selector names another organization
              value:
                detail: >-
                  This key belongs to a different organization than the request
                  selected.
  securitySchemes:
    organizationBearer:
      type: http
      scheme: bearer
      description: >-
        An organization API key starting with `dh_`, sent as `Authorization:
        Bearer dh_your_api_key`.
    organizationApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Alternative to the Authorization header. Send one credential per
        request.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.