> ## 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.

# Review An Agent Prompt

> Run DialNexa agent prompt review checks before publishing a Single Prompt Agent or Conversational Flow Agent version.

Changes state - verify before retry
Review an agent prompt before publishing. The operation can check instructions, variables, speech quality, contradictions, hallucination risks, language, model fallback, post-call capture, and call-handling settings without editing or publishing the agent version.

## When To Use Agent Prompt Review

* Check a draft prompt before creating an immutable version.
* Review only the check groups relevant to your release gate.
* Generate a `fix_prefill` instruction that can be sent to an editing assistant.
* Recheck after changing the prompt or the names of its default variables. A stored report is reused when only other settings changed (see below).

## Before You Call It

* Use an `agent_` ID from [List Agents](https://dialnexa.com/docs/api-reference/v1/agents/list.md).
* Use a version number returned by [Get Agent Details](https://dialnexa.com/docs/api-reference/v1/agents/get.md).
* Keep `prompt_text` at `100,000` characters or fewer. Omit it to review the stored version prompt.
* An empty or whitespace-only `prompt_text` also falls back to the stored prompt.

## Choose Prompt Review Checks

Omit `checks` to run every available group. Send a smaller list when you need a faster focused review.

| Check | What it evaluates |
| - | - |
| `structure` | Prompt length, missing sections, and instruction alignment. |
| `variables` | Undefined or unused dynamic variables. |
| `speech` | Wording and punctuation that may sound poor when spoken, prompt rules that conflict with the configured languages, and a welcome message written in a script the agent's languages do not use. |
| `unknowable` | Claims or questions the prompt does not provide enough information to answer. |
| `conflicts` | Instructions that cannot both be followed. |
| `language` | Accepted, but no check runs under it today: language findings are reported under `speech`. |
| `models` | Primary and fallback model configuration. |
| `capture` | Knowledge base and post-call field grounding. |
| `call_handling` | Silence timeout and maximum call duration values short enough to cut calls off. |

The `unknowable`, `conflicts`, `structure`, and `speech` groups use a model-based check. Leave all four out to avoid model calls.

## Response Fields

| Field | Meaning |
| - | - |
| `review_fingerprint` | Stable fingerprint of the reviewed prompt and the version's default variable names. |
| `findings` | Warning and informational findings. Each item includes a stable `fingerprint`, `kind`, `family`, message, optional evidence, and acknowledgement state. |
| `new_warning_count` | Warnings that have not already been accepted or dismissed. |
| `reviewed_at` | ISO 8601 time when the report was produced. |
| `degraded` | `true` when model-based checks could not run and only the available deterministic checks completed. |
| `cached` | `true` when a previous complete report was reused. |
| `fix_prefill` | An editing instruction built from up to three unacknowledged warnings, or `null` when there are none. |

## Side Effects And Retry Safety

This operation does not edit or publish the agent version. It can run billable model work, may take several seconds, and can store a complete report for reuse. Complete, non-degraded reports are cached by the prompt, the version's default variable names, and the requested checks. Other settings such as languages, models, knowledge bases, post-call fields, and timeouts are not part of that key, so after changing only those settings the stored report is returned with `cached: true`; change the `checks` list to force a fresh review. Degraded reports are not cached so a later request can retry the full review.

It is safe to retry after a timeout, but first allow enough time for the original review to finish. An identical completed request can return the cached report.

## Verify The Result

Check `degraded` before treating the review as complete. Review every item where `acknowledged` is `false`, then either revise the prompt or record a decision with [Acknowledge A Prompt Review Finding](https://dialnexa.com/docs/api-reference/v1/agents/acknowledge-prompt-review-finding.md). Publishing remains a separate user action.

## Operation-Specific Errors

| Status | Meaning | What to do |
| - | - | - |
| `400 Bad Request` | The prompt is too long, or a check name is invalid. | Correct the request and retry. |
| `500 Internal Server Error` | `versionNumber` is not a number. | Send the version number as digits, for example `0`. |
| `401 Unauthorized` | The API key is missing or invalid. | Send a valid workspace API key. |
| `404 Not Found` | The agent version was not found in the authenticated workspace. | Confirm the agent ID, version number, and workspace. |

## Related Lifecycle Operations

* [Get Agent Details](https://dialnexa.com/docs/api-reference/v1/agents/get.md) to find version numbers and the stored prompt.
* [Update Agent](https://dialnexa.com/docs/api-reference/v1/agents/update.md) to revise a draft before publishing.
* [Acknowledge A Prompt Review Finding](https://dialnexa.com/docs/api-reference/v1/agents/acknowledge-prompt-review-finding.md) to accept or dismiss one reviewed finding.


## OpenAPI

````yaml POST /v1/agent-versions/{agentId}/version/{versionNumber}/prompt-review
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/agent-versions/{agentId}/version/{versionNumber}/prompt-review:
    post:
      tags:
        - Agents
      summary: Review An Agent Prompt
      description: >-
        Reviews one agent version prompt and configuration without editing or
        publishing the agent.
      operationId: reviewAgentPrompt
      parameters:
        - name: agentId
          required: true
          in: path
          schema:
            type: string
          description: Signed agent ID.
        - name: versionNumber
          required: true
          in: path
          schema:
            type: number
          description: Agent version number to review.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptReviewRequest'
            examples:
              focusedReview:
                summary: Review speech, contradictions, and hallucination risks
                value:
                  checks:
                    - speech
                    - conflicts
                    - unknowable
      responses:
        '201':
          description: Prompt review completed.
          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: 201
                  message:
                    type: string
                    example: Success
                  data:
                    type: object
                    required:
                      - review_fingerprint
                      - findings
                      - new_warning_count
                      - reviewed_at
                      - degraded
                      - cached
                      - fix_prefill
                    properties:
                      review_fingerprint:
                        type: string
                        description: >-
                          SHA-256 of the reviewed prompt and the version's
                          default variable names.
                      findings:
                        type: array
                        items:
                          type: object
                          required:
                            - severity
                            - family
                            - kind
                            - message
                            - fingerprint
                            - acknowledged
                          properties:
                            severity:
                              type: string
                              enum:
                                - warning
                                - info
                            family:
                              type: string
                              enum:
                                - prompt
                                - config
                            kind:
                              type: string
                              enum:
                                - contradiction
                                - hallucination_risk
                                - undefined_variable
                                - unused_variable
                                - thin_prompt
                                - missing_section
                                - tts_dashes
                                - instruction_misaligned
                                - instruction_inert
                                - speech_unfriendly
                                - flow_break
                                - flow_note
                                - branch_gap
                                - fallback_without_model
                                - fallback_same_as_primary
                                - welcome_script_mismatch
                                - unused_knowledge_base
                                - postcall_field_ungrounded
                                - timeout_extreme
                                - language_not_configured
                                - language_lock_conflict
                                - language_switch_unconfigured
                                - number_format_conflict
                                - language_script_unconfigured
                                - language_conflict
                            message:
                              type: string
                            evidence:
                              type: string
                              nullable: true
                            fingerprint:
                              type: string
                              pattern: ^[0-9a-f]{40}$
                            acknowledged:
                              type: boolean
                      new_warning_count:
                        type: integer
                        minimum: 0
                      reviewed_at:
                        type: string
                        format: date-time
                      degraded:
                        type: boolean
                      cached:
                        type: boolean
                        description: >-
                          True when a stored report was reused. The cache key
                          covers the prompt, the default variable names, the
                          checks and the review engine, not other version
                          settings, so after changing only settings a stored
                          report can be returned.
                      fix_prefill:
                        type: string
                        nullable: true
                        description: >-
                          An editing instruction built from up to three
                          unacknowledged warnings, starting "Fix these prompt
                          review findings:". Null when there are none.
                  timestamp:
                    type: string
                    format: date-time
              examples:
                success:
                  summary: Review with one warning
                  value:
                    success: true
                    error: false
                    statusCode: 201
                    message: Success
                    data:
                      review_fingerprint: >-
                        12a8f88ad6f0f521347705e2af1417f1fc8396f2e2913fcb056082ee1c51723f
                      findings:
                        - severity: warning
                          family: prompt
                          kind: contradiction
                          message: >-
                            The prompt conflicts with the platform's call-time
                            rules: Never end the call until the customer agrees
                            to book a demo.
                          evidence: >-
                            Never end the call until the customer agrees to book
                            a demo.
                          fingerprint: 318c8c636a975f8879bdf2db85a2a0df1d6aa738
                          acknowledged: false
                      new_warning_count: 1
                      reviewed_at: '2026-08-31T03:15:00.000Z'
                      degraded: false
                      cached: false
                      fix_prefill: >-
                        Fix these prompt review findings:

                        1) Resolve this contradiction between rules: Never end
                        the call until the customer agrees to book a demo.
                    timestamp: '2026-09-07T06:00:00.000Z'
        '400':
          description: >-
            Invalid request body: prompt_text is not a string or exceeds 100000
            characters, or checks is not an array of known check groups.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Agent version not found in the authenticated workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    PromptReviewRequest:
      type: object
      properties:
        checks:
          type: array
          description: >-
            Check groups to run. Omit for all. unknowable, conflicts, structure
            and speech call a model; leave all four out to avoid model work.
          items:
            type: string
            enum:
              - structure
              - variables
              - speech
              - unknowable
              - conflicts
              - language
              - models
              - capture
              - call_handling
        prompt_text:
          type: string
          description: >-
            Prompt text to review instead of the stored prompt, up to 100,000
            characters. Empty or whitespace falls back to the stored prompt. The
            version must still exist in your workspace.
          maxLength: 100000
    ErrorResponse:
      type: object
      description: Error body on endpoints without response filtering.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

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