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

# Create or update optimizer for an agent



## OpenAPI

````yaml https://api.comm.com/docs/api.json post /v1/voice/agents/{agent}/optimizer
openapi: 3.1.0
info:
  title: Commvoice API
  version: '1'
servers:
  - url: https://api.comm.com/api
    description: Live
security:
  - http: []
paths:
  /v1/voice/agents/{agent}/optimizer:
    post:
      tags:
        - AgentOptimizers
      summary: Create or update optimizer for an agent
      operationId: voice.agents.optimizer.store
      parameters:
        - name: agent
          in: path
          required: true
          description: The agent ID
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                optimizer_id:
                  type:
                    - string
                    - 'null'
                  format: uuid
                name:
                  type: string
                  maxLength: 255
                system_prompt:
                  type: string
                  maxLength: 2000
                answered_calls_per_test:
                  type: integer
                  minimum: 1
                  maximum: 500
                test_volume_percent:
                  type: integer
                  minimum: 0
                  maximum: 100
                is_enabled:
                  type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Optimizer linked successfully
                  optimizer:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      agent_id:
                        type: string
                      system_prompt:
                        type: string
                      answered_calls_per_test:
                        type: string
                      test_volume_percent:
                        type: string
                      is_enabled:
                        type: string
                      current_test_id:
                        type: string
                      is_active:
                        type: boolean
                    required:
                      - id
                      - name
                      - agent_id
                      - system_prompt
                      - answered_calls_per_test
                      - test_volume_percent
                      - is_enabled
                      - current_test_id
                      - is_active
                required:
                  - message
                  - optimizer
        '201':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Optimizer created successfully
                  optimizer:
                    type: object
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      agent_id:
                        type: string
                      system_prompt:
                        type: string
                      answered_calls_per_test:
                        type: string
                      test_volume_percent:
                        type: string
                      is_enabled:
                        type: string
                      current_test_id:
                        type: string
                      is_active:
                        type: boolean
                    required:
                      - id
                      - name
                      - agent_id
                      - system_prompt
                      - answered_calls_per_test
                      - test_volume_percent
                      - is_enabled
                      - current_test_id
                      - is_active
                required:
                  - message
                  - optimizer
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Unauthorized
                required:
                  - message
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      scheme: bearer
      bearerFormat: JWT

````