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

# WebRTC セッションを作成

> Creates a WebRTC session on your trusted server and returns credentials for the browser to join. Authenticate this request with an API key; access tokens, including returned session tokens, cannot create sessions.



## OpenAPI

````yaml latest.yml POST /v1/agents/webrtc/{agent_id}/sessions
openapi: 3.0.1
info:
  title: Cartesia API
  version: 0.0.1
servers:
  - url: https://api.cartesia.ai
    description: Production
security: []
paths:
  /v1/agents/webrtc/{agent_id}/sessions:
    post:
      tags:
        - Agents
      summary: Create a WebRTC session
      description: >-
        Creates a WebRTC session on your trusted server and returns credentials
        for the browser to join. Authenticate this request with an API key;
        access tokens, including returned session tokens, cannot create
        sessions.
      operationId: createAgentWebrtcSession
      parameters:
        - name: agent_id
          in: path
          description: Unique identifier for the agent.
          required: true
          schema:
            type: string
            minLength: 1
        - $ref: '#/components/parameters/CartesiaVersionHeader'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentWebSessionRequest'
      responses:
        '200':
          description: The pre-created call and its browser WebRTC credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentWebrtcSessionResponse'
        '400':
          description: Invalid session configuration or missing required dynamic variables.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
        '404':
          description: Agent not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
        '429':
          description: Agent concurrency limit reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
      security:
        - APIKeyAuth: []
components:
  parameters:
    CartesiaVersionHeader:
      name: Cartesia-Version
      in: header
      description: API version header.
      required: true
      schema:
        type: string
        format: date
        example: '2026-08-14'
        default: '2026-08-14'
        enum:
          - '2026-08-14'
  schemas:
    CreateAgentWebSessionRequest:
      type: object
      properties:
        dynamic_variables:
          type: object
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
          description: >-
            Trusted values that Cartesia stores on the call and supplies to the
            agent.
        config_overrides:
          $ref: '#/components/schemas/AgentSessionConfig'
    CreateAgentWebrtcSessionResponse:
      type: object
      required:
        - call_id
        - url
        - token
        - room
        - expires_at
      properties:
        call_id:
          type: string
          description: ID of the pre-created call.
        url:
          type: string
          format: uri
          description: LiveKit server URL the browser connects to.
        token:
          type: string
          description: >-
            Short-lived LiveKit participant token for the browser connection. Do
            not log it.
        room:
          type: string
          description: LiveKit room the browser joins.
        expires_at:
          type: string
          format: date-time
          description: >-
            Connection deadline. Create a new session if the browser does not
            join before this time.
    PublicErrorResponse:
      type: object
      properties:
        doc_url:
          description: URL to relevant documentation for the error
          type: string
          nullable: true
        error_code:
          description: Machine-readable error code
          type: string
          nullable: true
        message:
          description: Detailed human-readable error message
          type: string
        request_id:
          description: >-
            Unique identifier for this request. Include this when contacting
            support.
          type: string
        title:
          description: Short human-readable error summary, like "File too large"
          type: string
      required:
        - request_id
        - message
        - title
      title: PublicErrorResponse
    AgentSessionConfig:
      type: object
      additionalProperties: false
      description: >-
        Per-call overrides using the same field structure as agent
        configuration. Omitted fields use the agent's published configuration.
      properties:
        instructions:
          type: string
          minLength: 1
          maxLength: 200000
          description: Instructions that define the agent's behavior for this call.
        initial_message:
          nullable: true
          type: string
          maxLength: 1000
          description: >-
            Message spoken when the call begins. Set to `null` to wait for the
            caller to speak first.
        language:
          type: object
          additionalProperties: false
          properties:
            primary:
              allOf:
                - $ref: '#/components/schemas/ManagedAgentPrimaryLanguageV1'
              nullable: true
              description: >-
                Primary language used for this call. Omit to inherit the
                published language or set to `null` to use English (`en`).
        audio:
          type: object
          additionalProperties: false
          properties:
            output:
              type: object
              additionalProperties: false
              properties:
                voice_id:
                  type: string
                  minLength: 1
                  description: ID of the voice used for agent speech during this call.
                speed:
                  nullable: true
                  type: number
                  minimum: 0.6
                  maximum: 1.5
                  description: >-
                    Speech speed multiplier from `0.6` to `1.5`. Set to `null`
                    to use the default speed.
                emotion:
                  allOf:
                    - $ref: '#/components/schemas/Emotion'
                  nullable: true
                  description: >-
                    Text-to-speech emotion. Set to `null` to let the model infer
                    the emotion from the transcript.
    ManagedAgentPrimaryLanguageV1:
      description: >-
        The language the agent starts each call in: a language, such as `en`, or
        a locale, such as `en-US`. See [supported languages and
        locales](/build-with-cartesia/capability-guides/advanced-capabilities#which-locales-are-supported).
      allOf:
        - $ref: '#/components/schemas/LanguageOrLocale'
      title: ManagedAgentPrimaryLanguageV1
    Emotion:
      title: Emotion
      type: string
      description: >-
        The primary emotions are `neutral`, `calm`, `angry`, `content`, `sad`,
        `scared`. For more options, see [Volume, Speed, and
        Emotion](/build-with-cartesia/capability-guides/volume-speed-emotion#emotion-controls-beta).
      enum:
        - neutral
        - happy
        - excited
        - enthusiastic
        - elated
        - euphoric
        - triumphant
        - amazed
        - surprised
        - flirtatious
        - curious
        - content
        - peaceful
        - serene
        - calm
        - grateful
        - affectionate
        - trust
        - sympathetic
        - anticipation
        - mysterious
        - angry
        - mad
        - outraged
        - frustrated
        - agitated
        - threatened
        - disgusted
        - contempt
        - envious
        - sarcastic
        - ironic
        - sad
        - dejected
        - melancholic
        - disappointed
        - hurt
        - guilty
        - bored
        - tired
        - rejected
        - nostalgic
        - wistful
        - apologetic
        - hesitant
        - insecure
        - confused
        - resigned
        - anxious
        - panicked
        - alarmed
        - scared
        - proud
        - confident
        - distant
        - skeptical
        - contemplative
        - determined
    LanguageOrLocale:
      type: string
      enum:
        - en
        - fr
        - de
        - es
        - pt
        - zh
        - ja
        - hi
        - it
        - ko
        - nl
        - pl
        - ru
        - sv
        - tr
        - tl
        - bg
        - ro
        - ar
        - cs
        - el
        - fi
        - hr
        - ms
        - sk
        - da
        - ta
        - uk
        - hu
        - 'no'
        - vi
        - bn
        - th
        - he
        - ka
        - id
        - te
        - gu
        - kn
        - ml
        - mr
        - pa
        - or
        - ur
        - bg-BG
        - bn-IN
        - cs-CZ
        - da-DK
        - de-DE
        - el-GR
        - en-AU
        - en-CA
        - en-GB
        - en-IE
        - en-IN
        - en-NZ
        - en-SG
        - en-US
        - en-ZA
        - es-ES
        - es-MX
        - es-US
        - fi-FI
        - fr-CA
        - fr-FR
        - gu-IN
        - he-IL
        - hi-IN
        - hr-HR
        - hu-HU
        - id-ID
        - it-IT
        - ja-JP
        - ka-GE
        - kn-IN
        - ko-KR
        - ml-IN
        - mr-IN
        - ms-MY
        - nl-BE
        - nl-NL
        - no-NO
        - or-IN
        - pa-IN
        - pl-PL
        - pt-BR
        - pt-PT
        - ro-RO
        - ru-RU
        - sk-SK
        - sv-SE
        - ta-IN
        - te-IN
        - th-TH
        - tl-PH
        - tr-TR
        - uk-UA
        - ur-IN
        - vi-VN
        - zh-CN
  securitySchemes:
    APIKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Cartesia API key (`sk_car_...`). Get one at
        [play.cartesia.ai/keys](https://play.cartesia.ai/keys).
      x-default: $CARTESIA_API_KEY

````

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