> ## Documentation Index
> Fetch the complete documentation index at: https://hanabiaiinc-him188-rename-multi-turn-simulation.mintlify.site/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`, `pt`, `it`, `nl`; anything else is 422. Omit it to use the
        agent's configured

        speaking language.
      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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                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
          description: >-
            IANA timezone (like `Asia/Tokyo`) for the agent's sense of local
            date and time in this session. Overrides the agent's configured
            timezone, which defaults to UTC. Invalid names are rejected with
            422.
          title: Timezone
        client_timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          description: >-
            The end user's device timezone as an IANA name (like `Asia/Tokyo`),
            used as a fallback hint: it applies only when neither `timezone` nor
            the agent's configured timezone is set, and invalid values are
            ignored rather than rejected. The Web SDK fills it automatically
            from the browser for public agents. When your backend creates the
            session, forward the value from your client.
          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
        llm_extra_body:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/JsonValue'
              type: object
            - type: 'null'
          default: null
          title: Llm Extra Body
        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.
      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: 500000
              type: string
            - type: 'null'
          default: null
          description: >-
            Limited to 32000 tokens (o200k_base), same budget as the configured
            prompt it replaces.
          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
                - pt
                - it
                - nl
                - ar
                - hi
                - id
                - tr
                - ru
                - bg
                - sr
                - hr
                - cs
                - sk
                - pl
                - uk
                - ro
                - hu
                - el
                - sv
                - da
                - 'no'
                - fi
                - et
                - lv
                - lt
                - ca
                - he
                - fa
                - ur
                - kk
                - ka
                - hy
                - bn
                - ta
                - te
                - kn
                - mr
                - gu
                - pa
                - ne
                - th
                - vi
                - ms
                - tl
                - af
              type: string
            - type: 'null'
          default: null
          title: Language
      title: AgentSessionOverridesPayload
      type: object
    JsonValue: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````