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

# Check the instructions

> A model reviews the agent's instructions (or a draft in `systemPrompt`, for another model in `modelId`) against its knowledge, integrations, skills and the last 30 days' results. It returns findings with a severity and an exact edit each, plus `suggestedPrompt` with every edit applied. `suggestedPrompt` is a suggestion for a person to review, never something to save automatically: findings with `requiresHumanReview: true` add links, contact details, discounts or offers and must be read by the owner first. Nothing is saved: test the suggestion with `POST test-runs` and save it with `PATCH /v1/agents/{agentId}`. The same instructions and model are answered from a 24-hour cache (`cached: true`); at most 20 uncached checks per agent and 100 per team per day.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/agents/{agentId}/prompt-check
openapi: 3.0.0
info:
  title: Totebot Public API
  description: >-
    Manage your agents (settings, instructions, widget, skills, actions, MCP
    connections, integrations), their knowledge, test questions, the help desk,
    customers and your team from code, read conversations and analytics, and
    analyse which knowledge each answer used.


    Authenticate with a Bearer token: a team API key (`tb_live_…`, created by a
    team owner in Team settings → API keys) or a legacy per-agent key.

    New keys can only read. Write access is opt-in per area (`agents:write`,
    `plugins:write`, `knowledge:write`, `conversations:write`, `helpdesk:write`,
    `team:write`, `members:write`, `chat:write`, `customers:delete`,
    `quality:write`, `experiments:write`, `sales:write`). Provider cost in USD
    needs the opt-in `billing:read` scope. A key may also be limited to some
    agents.

    Routes that act on one agent take it from the `agentId` path parameter or,
    on the older `/v1/<resource>` routes, from the `X-Agent-Id` header.

    Write routes accept an `Idempotency-Key` header. Over the rate limit you get
    429 with `Retry-After`. Errors share one shape: `{ status: "error", error: {
    code, message, details } }`.

    Not available through the API, on purpose: billing and plan changes,
    deleting the team, creating or changing API keys, and OAuth connect flows.


    This spec is public at https://api.totebot.ai/v1/openapi.json (and .yaml).
  version: '2.0'
  contact: {}
servers:
  - url: https://api.totebot.ai
security: []
tags: []
paths:
  /v1/agents/{agentId}/prompt-check:
    post:
      tags:
        - Setup assistant
      summary: Check the instructions
      description: >-
        A model reviews the agent's instructions (or a draft in `systemPrompt`,
        for another model in `modelId`) against its knowledge, integrations,
        skills and the last 30 days' results. It returns findings with a
        severity and an exact edit each, plus `suggestedPrompt` with every edit
        applied. `suggestedPrompt` is a suggestion for a person to review, never
        something to save automatically: findings with `requiresHumanReview:
        true` add links, contact details, discounts or offers and must be read
        by the owner first. Nothing is saved: test the suggestion with `POST
        test-runs` and save it with `PATCH /v1/agents/{agentId}`. The same
        instructions and model are answered from a 24-hour cache (`cached:
        true`); at most 20 uncached checks per agent and 100 per team per day.
      operationId: PublicApiSetupController_checkPrompt
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Any unique string (e.g. a UUID). Retrying with the same key within
            24 hours replays the first response instead of repeating the change.
          required: false
          schema:
            type: string
        - name: agentId
          required: true
          in: path
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromptCheckRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromptCheckResponseDto'
        '400':
          description: Invalid request, or rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '401':
          description: Missing, invalid, revoked or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '403':
          description: >-
            The plan lacks the feature, or the key lacks a scope
            (`error.details.missingScopes`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '404':
          description: Not found, or not an agent this key can access.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '409':
          description: >-
            The same Idempotency-Key is still in progress, or the resource
            conflicts (e.g. the link already exists, or the source is being
            trained).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '422':
          description: Idempotency-Key reused with a different request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '429':
          description: The daily limit of prompt checks for this agent or team is reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '503':
          description: The check could not finish. Retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
      security:
        - api-key: []
components:
  schemas:
    PromptCheckRequestDto:
      type: object
      properties:
        systemPrompt:
          type: string
          maxLength: 10000
          description: >-
            Check these instructions instead of the saved ones (a draft).
            Nothing is saved.
        modelId:
          type: string
          description: >-
            Check the instructions for this model id (from GET
            /v1/agents/{agentId}/models) instead of the saved model.
        refresh:
          type: boolean
          description: >-
            Run the check again even when the same instructions were checked in
            the last 24 hours. Counts toward the daily limit.
    PromptCheckResponseDto:
      type: object
      properties:
        promptHash:
          type: string
          description: Hash of the checked instructions and model; the cache key.
        checkedAt:
          type: string
        cached:
          type: boolean
          description: True when the result is a replay of a check from the last 24 hours.
        checkedBy:
          $ref: '#/components/schemas/CheckedByDto'
        target:
          $ref: '#/components/schemas/PromptCheckTargetDto'
        summary:
          type: string
        findings:
          type: array
          items:
            $ref: '#/components/schemas/PromptFindingDto'
        suggestedPrompt:
          type: string
          description: >-
            The instructions with every applicable edit applied. A suggestion
            for a person to review before saving, never something to save
            automatically.
        prompt:
          $ref: '#/components/schemas/PromptSizeDto'
      required:
        - promptHash
        - checkedAt
        - cached
        - checkedBy
        - target
        - summary
        - findings
        - suggestedPrompt
        - prompt
    ApiErrorDto:
      type: object
      properties:
        status:
          type: string
          example: error
        error:
          $ref: '#/components/schemas/ApiErrorBodyDto'
        path:
          type: string
          example: /v1/agents/clx123
        timestamp:
          type: string
          example: '2026-11-24T10:00:00.000Z'
      required:
        - status
        - error
        - path
        - timestamp
    CheckedByDto:
      type: object
      properties:
        model:
          type: string
          example: GPT-6.2 Sol
      required:
        - model
    PromptCheckTargetDto:
      type: object
      properties:
        modelId:
          type: string
        modelName:
          type: string
        draft:
          type: boolean
          description: True when a draft prompt or another model was checked.
      required:
        - modelId
        - modelName
        - draft
    PromptFindingDto:
      type: object
      properties:
        id:
          type: string
          example: f1
        severity:
          type: string
          enum:
            - high
            - medium
            - low
        category:
          type: string
          enum:
            - conflict
            - belongs_in_knowledge
            - missing_basics
            - language_tone
            - length_cost
            - outcomes
          description: >-
            conflict: contradicting or self-defeating instructions.
            belongs_in_knowledge: facts to move to knowledge. missing_basics:
            shipping, payments, returns, contact or handover not covered.
            language_tone, length_cost, outcomes: changes the measured results
            call for.
        title:
          type: string
        explanation:
          type: string
        evidence:
          type: string
          nullable: true
        edit:
          nullable: true
          description: The suggested change. Null when the fix is not in the instructions.
          allOf:
            - $ref: '#/components/schemas/PromptEditDto'
        requiresHumanReview:
          type: boolean
          description: >-
            True when the edit adds a link, contact details, a discount or an
            offer. Show it to the owner and never apply it automatically.
        knowledgeSuggestion:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/KnowledgeSuggestionDto'
      required:
        - id
        - severity
        - category
        - title
        - explanation
        - evidence
        - edit
        - requiresHumanReview
        - knowledgeSuggestion
    PromptSizeDto:
      type: object
      properties:
        characters:
          type: number
        estimatedTokens:
          type: number
      required:
        - characters
        - estimatedTokens
    ApiErrorBodyDto:
      type: object
      properties:
        code:
          type: string
          example: NotFoundException
        message:
          type: string
          example: Agent not found
        details:
          type: object
          description: >-
            Extra fields, e.g. `missingScopes` on 403 or `secondsRemaining` on a
            training cooldown.
          additionalProperties: true
      required:
        - code
        - message
    PromptEditDto:
      type: object
      properties:
        find:
          type: string
          description: >-
            Exact text in the instructions to replace. Empty: add `replace` at
            the end.
        replace:
          type: string
          description: 'New text. Empty: delete `find`.'
      required:
        - find
        - replace
    KnowledgeSuggestionDto:
      type: object
      properties:
        id:
          type: string
        status:
          allOf:
            - $ref: '#/components/schemas/KnowledgeSuggestionStatus'
        normalizedQuestion:
          type: string
          description: The question customers ask that knowledge does not answer well.
        category:
          type: string
        suggestedAction:
          type: string
        reasoning:
          type: string
        frequency:
          type: number
          description: How often it came up.
        impactScore:
          type: number
        sampleQuestions:
          type: array
          items:
            type: string
        conversationIds:
          type: array
          items:
            type: string
        resolvedBySourceId:
          type: string
          nullable: true
          description: Knowledge source created when resolved.
        resolvedAt:
          type: string
          nullable: true
          format: date-time
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - status
        - normalizedQuestion
        - category
        - suggestedAction
        - reasoning
        - frequency
        - impactScore
        - sampleQuestions
        - conversationIds
        - resolvedBySourceId
        - resolvedAt
        - createdAt
    KnowledgeSuggestionStatus:
      type: string
      enum:
        - PENDING
        - DISMISSED
        - RESOLVED
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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