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

# Update Agent Evaluation Test

> Update an agent evaluation test to replace its saved name, folder, type, and configuration without starting a run.

Changes state - verify before retry

Update an agent evaluation test to replace its saved name, folder, type, and configuration without starting a run.

## Update Agent Evaluation Test

Get the agent and test IDs from [List Agent Evaluation Tests](https://dialnexa.com/docs/api-reference/v1/eval-tests/list.md). Preserve any configuration you want to keep.

## Minimal request

Send all three required fields: `name`, `type`, and `config`. This operation is not a partial merge of `config`. Omit `folder`, or send null or an empty string, to clear the folder.

```json theme={null}
{
  "name": "Answers a pricing question",
  "type": "simulation",
  "config": {
    "scenario": "Ask what the product costs.",
    "criteria": [
      "Uses the pricing in the agent prompt."
    ],
    "mock_strategy": "all",
    "mock_fallback": "error"
  }
}
```

For a simulation, `scenario` describes the caller’s task and `criteria` lists the expected behavior. For `next_reply`, provide `history` ending in a caller turn and criteria for the next reply. For `tool_call`, save the conversation history and expected tool configuration. The `config` object is saved as supplied, so review its contents before running.

## Verify the result

A `200` response contains the updated test in `data`. List tests again and compare the saved definition before starting another evaluation run.

## Errors and recovery

`400` indicates an invalid definition; `404` means the agent or test was not found in this workspace. Repeating the same replacement does not create another test, but it can overwrite a newer edit. Read the current definition before retrying.

Missing, expired, or invalid API credentials return `401`. See [API authentication](https://dialnexa.com/docs/api-reference/api-fundamentals.md#authenticate-dialnexa-api-requests).

## Related endpoints

* [List Agent Evaluation Tests](https://dialnexa.com/docs/api-reference/v1/eval-tests/list.md)
* [Create Agent Evaluation Test](https://dialnexa.com/docs/api-reference/v1/eval-tests/create.md)
* [Start Agent Evaluation Run](https://dialnexa.com/docs/api-reference/v1/eval-runs/create.md)
* [Get Agent Evaluation Run](https://dialnexa.com/docs/api-reference/v1/eval-runs/get.md)
* [Get Agent Evaluation Conversation](https://dialnexa.com/docs/api-reference/v1/eval-runs/conversation.md)


## OpenAPI

````yaml PATCH /v1/agents/{id}/tests/{testId}
openapi: 3.0.0
info:
  title: DialNexa API
  description: Public `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/agents/{id}/tests/{testId}:
    patch:
      tags:
        - Agent Evaluations
      summary: Update Agent Evaluation Test
      description: >-
        Replaces the saved name, folder, type and configuration of a test.
        Supply all required fields; omitting folder clears it. Does not start a
        run.
      operationId: updateAgentEvalTest
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Agent ID from List Agents.
        - name: testId
          in: path
          required: true
          schema:
            type: string
          description: Saved test ID from List Agent Evaluation Tests.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveAgentEvalTest'
            examples:
              request:
                value:
                  name: Answers a pricing question
                  type: simulation
                  config:
                    scenario: Ask what the product costs.
                    criteria:
                      - Uses the pricing in the agent prompt.
                    mock_strategy: all
                    mock_fallback: error
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - data
                  - timestamp
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  error:
                    type: boolean
                    enum:
                      - false
                  statusCode:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Success
                  data:
                    $ref: '#/components/schemas/AgentEvalTest'
                  timestamp:
                    type: string
                    format: date-time
        '400':
          description: >-
            Invalid test definition or run selection. For runs, check test
            ownership, enabled tests, target version and secondary-model
            availability.
        '401':
          description: Missing, expired or invalid API key.
        '404':
          description: Agent, test, run or conversation was not found in this workspace.
      security:
        - bearer: []
components:
  schemas:
    SaveAgentEvalTest:
      type: object
      properties:
        name:
          type: string
          maxLength: 200
          description: Test name. Surrounding whitespace is removed.
        folder:
          type: string
          maxLength: 100
          nullable: true
          description: >-
            Optional folder. Omit, send null or an empty string to use no
            folder.
        type:
          type: string
          enum:
            - next_reply
            - tool_call
            - simulation
        config:
          type: object
          additionalProperties: true
          description: >-
            Test definition for the selected type. Use a scenario and criteria
            for a simulation, or history and criteria for a reply check. Saved
            as supplied; saving does not run the test.
      required:
        - name
        - type
        - config
    AgentEvalTest:
      type: object
      properties:
        id:
          type: string
        agent_id:
          type: string
        name:
          type: string
        folder:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - next_reply
            - tool_call
            - simulation
        config:
          type: object
          additionalProperties: true
        template_id:
          type: string
          nullable: true
        enabled:
          type: boolean
        last_result:
          type: object
          properties:
            run_id:
              type: string
            passed:
              type: integer
            total:
              type: integer
            finished_at:
              type: string
              format: date-time
              nullable: true
            version_number:
              type: integer
              nullable: true
            target:
              type: string
              nullable: true
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - agent_id
        - name
        - type
        - config
        - enabled
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

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