> ## Documentation Index
> Fetch the complete documentation index at: https://hanabiaiinc-fish-772-enterprise-versions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Agent

> Create an agent, optionally with its full initial configuration inline —
one call provisions a ready-to-publish agent.



## OpenAPI

````yaml post /v1/agent/agents
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/agents:
    post:
      tags:
        - Agents
      summary: Create Agent
      description: >-
        Create an agent, optionally with its full initial configuration inline —

        one call provisions a ready-to-publish agent. The agent starts as a
        draft:

        publish it before creating sessions with it.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicAgentCreatePayload'
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  agent_id:
                    title: Agent Id
                    type: string
                  workspace_id:
                    title: Workspace Id
                    type: string
                  name:
                    title: Name
                    type: string
                  description:
                    default: ''
                    title: Description
                    type: string
                  status:
                    enum:
                      - active
                      - archived
                    title: Status
                    type: string
                  publication_state:
                    description: >-
                      `live` once at least one version is published; `draft`
                      agents cannot take sessions yet.
                    enum:
                      - live
                      - draft
                    title: Publication State
                    type: string
                  public_enabled:
                    default: false
                    title: Public Enabled
                    type: boolean
                  allowed_origins:
                    items:
                      type: string
                    title: Allowed Origins
                    type: array
                  overrides_allowed:
                    items:
                      enum:
                        - first_message
                        - system_prompt
                        - voice_id
                        - language
                      type: string
                    title: Overrides Allowed
                    type: array
                  created_at:
                    format: date-time
                    title: Created At
                    type: string
                  updated_at:
                    format: date-time
                    title: Updated At
                    type: string
                required:
                  - agent_id
                  - workspace_id
                  - name
                  - status
                  - publication_state
                  - created_at
                  - updated_at
                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
        '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
        '422':
          description: ''
          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 Agent
          source: |-
            curl --request POST \
              --url https://api.fish.audio/v1/agent/agents \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "name": "Receptionist",
                "description": "Handles inbound calls.",
                "config": {
                  "prompt": {
                    "system_prompt": "You are the receptionist for Fish Dental."
                  },
                  "voice": {
                    "voice_id": "<voice-model-id>",
                    "speaking_language": "en"
                  }
                }
              }'
components:
  schemas:
    PublicAgentCreatePayload:
      additionalProperties: false
      properties:
        name:
          maxLength: 120
          minLength: 1
          title: Name
          type: string
        description:
          default: ''
          maxLength: 2000
          title: Description
          type: string
        config:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentConfigPatchPayload'
            - type: 'null'
          default: null
          description: >-
            Optional initial draft configuration, applied atop the platform
            defaults; one call provisions a fully configured agent.
      required:
        - name
      title: PublicAgentCreatePayload
      type: object
    PublicAgentConfigPatchPayload:
      additionalProperties: false
      properties:
        prompt:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentPromptPatch'
            - type: 'null'
          default: null
        voice:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentVoicePatch'
            - type: 'null'
          default: null
        conversation:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentConversationPatch'
            - type: 'null'
          default: null
        tools:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentToolsPatch'
            - type: 'null'
          default: null
        webhooks:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentWebhooksPatch'
            - type: 'null'
          default: null
        knowledge_base:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentKnowledgeBasePatch'
            - type: 'null'
          default: null
        analysis:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentAnalysisPatch'
            - type: 'null'
          default: null
      title: PublicAgentConfigPatchPayload
      type: object
    PublicAgentPromptPatch:
      additionalProperties: false
      properties:
        system_prompt:
          anyOf:
            - maxLength: 4000
              type: string
            - type: 'null'
          default: null
          title: System Prompt
        first_message_mode:
          anyOf:
            - enum:
                - 'off'
                - fixed
                - prompt
              type: string
            - type: 'null'
          default: null
          title: First Message Mode
        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
      title: PublicAgentPromptPatch
      type: object
    PublicAgentVoicePatch:
      additionalProperties: false
      properties:
        voice_id:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          title: Voice Id
        speaking_language:
          anyOf:
            - enum:
                - en
                - ja
                - zh
                - ko
                - es
                - fr
                - de
              type: string
            - type: 'null'
          default: null
          title: Speaking Language
      title: PublicAgentVoicePatch
      type: object
    PublicAgentConversationPatch:
      additionalProperties: false
      properties:
        max_duration_seconds:
          anyOf:
            - maximum: 3600
              minimum: 60
              type: integer
            - type: 'null'
          default: null
          title: Max Duration Seconds
        eagerness:
          anyOf:
            - enum:
                - relaxed
                - balanced
                - eager
              type: string
            - type: 'null'
          default: null
          title: Eagerness
        interruptible:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Interruptible
        interruption_sensitivity:
          anyOf:
            - enum:
                - low
                - balanced
                - high
              type: string
            - type: 'null'
          default: null
          title: Interruption Sensitivity
        reengage_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Reengage Enabled
        record_audio:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Record Audio
        timezone:
          anyOf:
            - maxLength: 64
              type: string
            - type: 'null'
          default: null
          title: Timezone
        transfer_destinations:
          anyOf:
            - items:
                $ref: '#/components/schemas/AgentTransferDestinationPatch'
              type: array
            - type: 'null'
          default: null
          title: Transfer Destinations
      title: PublicAgentConversationPatch
      type: object
    PublicAgentToolsPatch:
      additionalProperties: false
      properties:
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Enabled
        tool_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            Replaces the attached tool set wholesale. Every id must be an
            existing tool in the agent's workspace, else 422.
          title: Tool Ids
        system_tools:
          anyOf:
            - $ref: '#/components/schemas/PublicSystemToolsPatch'
            - type: 'null'
          default: null
      title: PublicAgentToolsPatch
      type: object
    PublicAgentWebhooksPatch:
      additionalProperties: false
      properties:
        post_call:
          anyOf:
            - items:
                $ref: '#/components/schemas/PublicPostCallWebhookPayload'
              maxItems: 5
              type: array
            - type: 'null'
          default: null
          description: >-
            Up to 5 endpoints, each receiving every post-call event. Replaces
            the configured list wholesale; a single object is still accepted and
            is stored as a one-element list, and null (or an empty list) clears
            every endpoint. URLs must be unique.
          title: Post Call
      title: PublicAgentWebhooksPatch
      type: object
    PublicAgentKnowledgeBasePatch:
      additionalProperties: false
      properties:
        enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Enabled
        knowledge_source_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          description: >-
            Replaces the attached knowledge sources wholesale. Every id must be
            an existing knowledge source visible to the agent, else 422.
          title: Knowledge Source Ids
      title: PublicAgentKnowledgeBasePatch
      type: object
    PublicAgentAnalysisPatch:
      additionalProperties: false
      properties:
        summary:
          anyOf:
            - $ref: '#/components/schemas/PublicAgentAnalysisSummaryPatch'
            - type: 'null'
          default: null
        data_fields:
          anyOf:
            - items:
                $ref: '#/components/schemas/PublicAgentAnalysisDataField'
              maxItems: 20
              type: array
            - type: 'null'
          default: null
          title: Data Fields
        criteria:
          anyOf:
            - items:
                $ref: '#/components/schemas/PublicAgentAnalysisCriterion'
              maxItems: 10
              type: array
            - type: 'null'
          default: null
          title: Criteria
      title: PublicAgentAnalysisPatch
      type: object
    AgentTransferDestinationPatch:
      additionalProperties: false
      properties:
        type:
          const: phone
          default: phone
          title: Type
          type: string
        label:
          default: ''
          title: Label
          type: string
        phone_number:
          title: Phone Number
          type: string
        mode:
          default: cold
          enum:
            - cold
            - warm
          title: Mode
          type: string
        warm_connect:
          default: confirm
          enum:
            - confirm
            - direct
          title: Warm Connect
          type: string
      required:
        - phone_number
      title: AgentTransferDestinationPatch
      type: object
    PublicSystemToolsPatch:
      additionalProperties: false
      properties:
        hang_up_call:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Hang Up Call
      title: PublicSystemToolsPatch
      type: object
    PublicPostCallWebhookPayload:
      additionalProperties: false
      properties:
        url:
          maxLength: 4000
          minLength: 1
          title: Url
          type: string
        secret:
          anyOf:
            - maxLength: 256
              type: string
            - type: 'null'
          default: null
          description: >-
            Optional HMAC-SHA256 signing secret (X-Fish-Webhook-Signature).
            Write-only: reads report `has_secret` instead of the value.
          title: Secret
      required:
        - url
      title: PublicPostCallWebhookPayload
      type: object
    PublicAgentAnalysisSummaryPatch:
      additionalProperties: false
      properties:
        enabled:
          default: true
          title: Enabled
          type: boolean
        prompt:
          anyOf:
            - maxLength: 1000
              type: string
            - type: 'null'
          default: null
          title: Prompt
        language:
          default: en
          enum:
            - en
            - zh
            - ja
            - ko
            - es
            - fr
            - de
            - pt
            - ru
            - ar
          title: Language
          type: string
      title: PublicAgentAnalysisSummaryPatch
      type: object
    PublicAgentAnalysisDataField:
      additionalProperties: false
      properties:
        name:
          pattern: ^[a-z][a-z0-9_]{0,63}$
          title: Name
          type: string
        type:
          default: text
          enum:
            - boolean
            - text
            - number
            - enum
          title: Type
          type: string
        description:
          default: ''
          maxLength: 500
          title: Description
          type: string
        enum_options:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          title: Enum Options
      required:
        - name
      title: PublicAgentAnalysisDataField
      type: object
    PublicAgentAnalysisCriterion:
      additionalProperties: false
      properties:
        name:
          pattern: ^[a-z][a-z0-9_]{0,63}$
          title: Name
          type: string
        description:
          default: ''
          maxLength: 500
          title: Description
          type: string
      required:
        - name
      title: PublicAgentAnalysisCriterion
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````