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

# Create a voice agent

> Create a voice agent with its prompt. Optionally set prompt, voice and
knowledge-base values in the same request; they are validated exactly as in the settings
endpoints and the whole request fails if any value is rejected. Add tools afterwards with
`POST /api/v2/tools` using the returned `id` as `agent_id`.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/voice_agents
openapi: 3.1.0
info:
  title: Customer API
  version: 1.0.0-beta
  description: >
    **Beta.** This API is in beta. Contracts can still change while we complete
    it, including

    breaking changes; we announce changes in the release notes and keep them as
    rare as we can.

    Pin your integration to the field names and status codes documented here and
    treat unknown

    fields as optional.


    REST API to create and configure voice agents, add tools, test them with
    evals, read

    conversations, and place AI outbound calls.


    **Authentication.** Voice agents, settings, tools, evals and conversations
    use an API token

    created on the **Keys** page of your dashboard. Each operation lists the
    scope it needs under

    `x-required-scopes`; `<resource>:*` grants every action of a resource.
    Outbound calls use a

    separate outbound API token from the **Outbound Calls** page. Send either
    token as

    `Authorization: Bearer <token>`.


    **Responses.** A single resource is returned as a flat JSON object; a
    collection is wrapped in a plural

    key (`voice_agents`, `tools`, `evals`, `conversations`) next to its paging
    fields. Deleting returns

    `204 No Content`. Everything is addressed by the voice agent's `id`; prompts
    and numbers are internal.


    **Errors.** Authentication failures return `{ "error", "message" }`. Request
    quotas return

    `429` with a `Retry-After` header and `{ "error", "message", "details" }`,
    where `error` is a

    stable machine-readable code. Every API call must finish within 30 seconds;
    longer requests return `503` with

    `mf-core:api-request-timeout`. Validation errors list the problems per
    field; the exact shape is

    shown on each operation.
servers:
  - url: https://app.miyon.ai
security: []
tags:
  - name: Voice Agents
    description: >-
      Create and manage voice agents. Configure them through the voice, prompt
      and knowledge-base settings endpoints.
  - name: Voice Agent Settings
    description: >-
      Read and change a voice agent's voice, prompt and knowledge-base settings.
      A voice agent has one prompt (its instructions, greeting and conversation
      settings). Read the schema of a settings group, then update one
      `key`/`value` pair per request.
  - name: Tools
    description: >-
      Create, configure, enable and execute agent tools. Tools are enabled per
      voice agent with `agent_id`. These endpoints accept scoped API tokens
      only; every error uses the `{ "error", "message", "details" }` envelope
      with a stable `mf-core:tool-*` code.
  - name: Outbound Calls
    description: >-
      Place AI calls and review their outcome. Authenticate with the outbound
      API token from the **Outbound Calls** page.
  - name: Conversations
    description: >-
      List and inspect the conversations of your account, including transcripts
      when your retention settings allow.
  - name: Evals
    description: >-
      Evals are automated test conversations that check how a voice agent
      responds. A scenario contains cases; each case contains the caller's turns
      and what the agent must say or do. Run a scenario to get pass/fail
      results.
paths:
  /api/v1/voice_agents:
    post:
      tags:
        - Voice Agents
      summary: Create a voice agent
      description: >
        Create a voice agent with its prompt. Optionally set prompt, voice and

        knowledge-base values in the same request; they are validated exactly as
        in the settings

        endpoints and the whole request fails if any value is rejected. Add
        tools afterwards with

        `POST /api/v2/tools` using the returned `id` as `agent_id`.
      operationId: createVoiceAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoiceAgentCreateRequest'
            example:
              name: Booking agent
              description: Takes appointment calls
              prompt:
                user_prompt: You help callers book appointments.
                initial_response: Hello, how can I help you?
              voice_config:
                voice_config.response_time_ms: 1200
      responses:
        '201':
          description: The created voice agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoiceAgent'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: >
            Nothing was created. `{ errors: { name: ["is required"] } }`, `{
            errors: { tools: [...] } }`,

            `{ errors: { prompt | voice_config | knowledge_base: ["unsupported
            keys: ..."] } }`,

            `{ errors: { base: [...] } }` from agent creation, or the concern
            envelope with `errors`

            when a nested value was rejected.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/FieldErrors'
                    title: Field errors
                  - $ref: '#/components/schemas/ConcernResponse'
                    title: Settings response with errors
              example:
                errors:
                  name:
                    - is required
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
      security:
        - scopedJwt: []
components:
  schemas:
    VoiceAgentCreateRequest:
      type: object
      description: >
        Flat JSON object. Unknown top-level keys are ignored. The nested
        sections are validated exactly as

        in the settings endpoints; if any value is rejected, nothing is created
        (HTTP 422). A `tools` key

        is rejected: create and enable tools with the Tools endpoints after the
        agent exists.
      properties:
        name:
          type: string
          minLength: 1
          description: Display name of the agent.
        description:
          type: string
          description: Free-text description shown in the dashboard.
        prompt:
          type: object
          description: >-
            Prompt settings. Keys may also be given in dotted form
            (`prompts.user_prompt`). Unknown keys return 422.
          properties:
            user_prompt:
              type: string
              description: The agent's instructions.
            initial_response:
              type: string
              maxLength: 1000
              description: The greeting.
            mute_user_while_assistant_speaks:
              type: boolean
            transcription_locale:
              type: string
              description: >-
                A supported locale code from the prompt schema, or `multi` for
                automatic language detection.
        voice_config:
          type: object
          description: >-
            Dotted voice settings keys as listed by `GET
            /api/v1/voice_agents/{id}/concerns/voice_config/schema`, for example
            `voice_config.response_time_ms`. Unknown keys return 422.
          propertyNames:
            pattern: ^voice_config\.
          additionalProperties: true
        knowledge_base:
          type: object
          properties:
            selected_datasource_ids:
              type: array
              items:
                type: integer
              description: >-
                IDs of the knowledge sources the agent may use. Replaces the
                current selection.
          description: Knowledge sources to attach to the agent's prompt.
      required:
        - name
    VoiceAgent:
      type: object
      properties:
        id:
          type: integer
          description: ID of the voice agent.
        name:
          type:
            - string
            - 'null'
          description: Display name of the agent.
        description:
          type: string
          description: Empty string when no description is set.
        created_at:
          type: string
          format: date-time
          description: When the agent was created.
        updated_at:
          type: string
          format: date-time
          description: When the agent or its prompt was last changed.
        concerns:
          type: object
          description: URLs of this agent's settings endpoints.
          properties:
            voice_config:
              $ref: '#/components/schemas/ConcernLinks'
            prompts:
              $ref: '#/components/schemas/ConcernLinks'
            knowledge_base:
              $ref: '#/components/schemas/ConcernLinks'
          required:
            - voice_config
            - prompts
            - knowledge_base
      required:
        - id
        - name
        - description
        - created_at
        - updated_at
        - concerns
    FieldErrors:
      type: object
      description: Field-keyed error envelope. `base` holds errors not tied to one field.
      properties:
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Problems per field; `base` for problems not tied to one field.
      required:
        - errors
      additionalProperties: false
    ConcernResponse:
      type: object
      description: >-
        Response format for reading and updating a settings group. On 409 and
        422 the same format is returned with `errors` filled and
        `values`/`revision` reflecting the unchanged current state.
      properties:
        concern:
          type: string
          enum:
            - voice_config
            - prompts
            - knowledge_base
          description: The settings group this response belongs to.
        shape:
          type: string
          const: blocks
          description: Layout hint for clients that render the settings; always `blocks`.
        schema_version:
          type: string
          examples:
            - voice-config.v1
            - prompts.v4
            - knowledge_base.v2
          description: Version of the settings schema, for example `voice-config.v1`.
        save_mode:
          type: 'null'
          description: Reserved; always null.
        revision:
          type: string
          description: >-
            Current revision. Send it as `If-Match` on voice settings writes to
            avoid overwriting concurrent changes.
        values:
          type: object
          additionalProperties: true
          description: Dotted field key to current value.
        schema:
          type: 'null'
          description: Reserved; always null. Read the schema from the schema endpoint.
        schema_revision:
          type: 'null'
          description: Reserved; always null.
        effects:
          type: array
          items:
            $ref: '#/components/schemas/ConcernEffect'
          description: Related settings that changed as a consequence of this update.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Problems per field key. Empty on success.
        draft:
          type: 'null'
          description: Reserved; always null.
        affected_concerns:
          type: array
          items:
            type: object
            properties:
              concern:
                type: string
              revision:
                type: string
            required:
              - concern
              - revision
          description: Settings groups whose revision changed.
        system_prompt:
          type: string
          description: >-
            Voice settings updates only. Present when the update regenerated the
            agent's instructions.
      required:
        - concern
        - shape
        - schema_version
        - revision
        - values
        - effects
        - errors
        - affected_concerns
    ConcernLinks:
      type: object
      properties:
        read_url:
          type: string
          description: GET the current values.
        schema_url:
          type: string
          description: GET the fields and accepted values.
        change_url:
          type: string
          description: PATCH one `key`/`value` pair.
      required:
        - read_url
        - schema_url
        - change_url
      description: Read, schema and update URLs of one settings group.
    AuthError:
      type: object
      description: >-
        Returned when the API token is missing, invalid, expired or lacks the
        required scope.
      properties:
        error:
          type: string
          description: Short error category.
          examples:
            - Authentication failed
            - Forbidden
        message:
          type: string
          description: Human-readable explanation. Absent on some 403 responses.
          examples:
            - 'Missing required scope: voice_agents:write'
      required:
        - error
    ConcernEffect:
      type: object
      description: A dependent value that changed as a side effect of the write.
      properties:
        key:
          type: string
          description: Dotted key of the setting that changed.
        old_value:
          description: Value before the update.
        value:
          description: Value after the update.
        reason:
          type:
            - string
            - 'null'
          description: Why the setting changed, when the server can say.
      required:
        - key
    ApiError:
      type: object
      description: >-
        Error format with a stable machine-readable `error` code, a
        human-readable `message` and request-specific `details`.
      properties:
        error:
          type: string
          description: >-
            Stable machine-readable error code, for example
            `mf-core:rate-limit-exceeded`.
        message:
          type: string
          description: Human-readable explanation.
        details:
          type: object
          additionalProperties: true
          description: >-
            Request-specific data, for example the offending parameter or the
            quota policy.
      required:
        - error
        - message
        - details
  responses:
    Unauthorized:
      description: Missing, expired or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Authentication failed
            message: Missing bearer token
    Forbidden:
      description: >-
        The token does not carry the scope this operation requires (see
        `x-required-scopes`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Forbidden
            message: 'Missing required scope: voice_agents:write'
    RateLimited:
      description: >-
        Too many requests. Wait the number of seconds given in `Retry-After`
        before retrying.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error: mf-core:rate-limit-exceeded
            message: Rate limit exceeded
            details:
              policy: api_write
              retry_after: 3
    ServiceUnavailable:
      description: >-
        The request was not completed. Either it exceeded the 30-second request
        time limit that applies to every API call (narrow the request and
        retry), or rate limiting is temporarily unavailable. Retry shortly.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            timeout:
              value:
                error: mf-core:api-request-timeout
                message: The API request exceeded the 30-second time limit
                details: {}
            limiter:
              value:
                error: mf-core:rate-limiter-unavailable
                message: API rate limiting is temporarily unavailable
                details:
                  policy: api_write
  securitySchemes:
    scopedJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Scoped API token. Required scopes are listed on each operation in
        x-required-scopes.

````

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