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

# Create Agent Session

> Start a conversation session with an agent and receive a join token for the
session transport (currently LiveKit WebRTC).



## OpenAPI

````yaml post /v1/agent/sessions
openapi: 3.1.0
info:
  title: FishAudio OpenAPI
  version: '1'
servers:
  - description: Fish Audio API
    url: https://api.fish.audio
security: []
tags: []
paths:
  /v1/agent/sessions:
    post:
      tags:
        - Agent Sessions
      summary: Create Agent Session
      description: >-
        Start a conversation session with an agent and receive a join token for
        the

        session transport (currently LiveKit WebRTC). Authenticate with an API
        key to

        start sessions with any agent in your team; without credentials only
        agents

        published as public are reachable, and the request `Origin` must match
        the

        agent's allowed origins.


        `language` (and `overrides.language`) accepts `en`, `ja`, `zh`, `ko`,
        `es`,

        `fr`, `de`; anything else is 422. Omit it to use the agent's configured

        behavior (including automatic language detection when enabled).
      parameters:
        - in: header
          name: origin
          description: ''
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            default: null
            title: Origin
          deprecated: false
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentSessionCreatePayload'
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                description: >-
                  Wire twin of @fishaudio/agent-protocol `SessionToken`
                  (session.ts); keep in sync.
                properties:
                  session_id:
                    title: Session Id
                    type: string
                  expires_at:
                    title: Expires At
                    type: string
                  max_duration_seconds:
                    title: Max Duration Seconds
                    type: integer
                  transport:
                    const: livekit
                    title: Transport
                    type: string
                  livekit_url:
                    title: Livekit Url
                    type: string
                  token:
                    title: Token
                    type: string
                required:
                  - session_id
                  - expires_at
                  - max_duration_seconds
                  - transport
                  - livekit_url
                  - token
                type: object
        '400':
          description: Bad request syntax or unsupported method
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '401':
          description: No permission -- see authorization schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '402':
          description: No payment -- see charging schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '403':
          description: Request forbidden -- authorization will not help
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '404':
          description: Nothing matches the given URI
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '409':
          description: Request conflict
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '429':
          description: >-
            The user has sent too many requests in a given amount of time ("rate
            limiting")
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '502':
          description: Invalid responses from another server/proxy
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
        '503':
          description: The server cannot process the request due to a high load
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                required:
                  - status
                  - message
                type: object
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: bash
          label: Create Session
          source: |-
            curl --request POST \
              --url https://api.fish.audio/v1/agent/sessions \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "agent_id": "<agent-id>"
              }'
components:
  schemas:
    AgentSessionCreatePayload:
      additionalProperties: false
      properties:
        agent_id:
          title: Agent Id
          type: string
        name:
          anyOf:
            - maxLength: 128
              type: string
            - type: 'null'
          default: null
          title: Name
        timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          title: Timezone
        client_timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          title: Client Timezone
        world_context:
          default: true
          title: World Context
          type: boolean
        overrides:
          anyOf:
            - $ref: '#/components/schemas/AgentSessionOverridesPayload'
            - type: 'null'
          default: null
        dynamic_variables:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: integer
                  - type: number
                  - type: boolean
              maxProperties: 50
              type: object
            - type: 'null'
          default: null
          title: Dynamic Variables
        end_user_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          title: End User Id
        metadata:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/JsonValue'
              type: object
            - type: 'null'
          default: null
          title: Metadata
        tool_events:
          default: true
          title: Tool Events
          type: boolean
        record_audio:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Record Audio
      required:
        - agent_id
      title: AgentSessionCreatePayload
      type: object
    AgentSessionOverridesPayload:
      additionalProperties: false
      description: >-
        Wire twin of @fishaudio/agent-protocol `SessionOverrides` (session.ts).


        Every field must be allow-listed in Agent.overrides_allowed;
        unauthorized

        fields fail session creation loudly rather than being silently dropped.

        Keyless (public) sessions are additionally capped to
        PUBLIC_OVERRIDE_FIELDS

        (service.py) regardless of the allowlist.
      properties:
        first_message:
          anyOf:
            - maxLength: 10000
              type: string
            - type: 'null'
          default: null
          title: First Message
        first_message_prompt:
          anyOf:
            - maxLength: 10000
              type: string
            - type: 'null'
          default: null
          title: First Message Prompt
        system_prompt:
          anyOf:
            - maxLength: 8000
              type: string
            - type: 'null'
          default: null
          title: System Prompt
        voice_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          title: Voice Id
        language:
          anyOf:
            - enum:
                - en
                - ja
                - zh
                - ko
                - es
                - fr
                - de
              type: string
            - type: 'null'
          default: null
          title: Language
      title: AgentSessionOverridesPayload
      type: object
    JsonValue: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````