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

# Update instructions and settings on several agents

> Runs once per agent and returns one result per agent; a failure on one agent does not stop the others. Omit agentIds to target every agent the key can access.



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/bulk/agents
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/bulk/agents:
    patch:
      tags:
        - Bulk
      summary: Update instructions and settings on several agents
      description: >-
        Runs once per agent and returns one result per agent; a failure on one
        agent does not stop the others. Omit agentIds to target every agent the
        key can access.
      operationId: PublicApiBulkController_updateAgents
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateAgentsDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkAgentsResponse'
        '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'
      security:
        - api-key: []
components:
  schemas:
    BulkUpdateAgentsDto:
      type: object
      properties:
        agentIds:
          maxItems: 100
          description: >-
            Agents to apply the operation to. Omit to use every agent the API
            key can access.
          type: array
          items:
            type: string
        name:
          type: string
          maxLength: 100
          example: Example SLO
        systemPrompt:
          type: string
          maxLength: 10000
          description: The instructions (system prompt) the agent follows.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          example: 0.4
        language:
          type: string
          description: Language code the agent answers in, e.g. "sl" or "en".
          maxLength: 20
        modelId:
          type: string
          description: >-
            A model `id` from GET /v1/agents/{agentId}/models. Must be available
            on the plan.
        autoRetrainEnabled:
          type: boolean
          description: Re-crawl link sources on a schedule. Scale plan only.
        isPublic:
          type: boolean
          description: >-
            Whether the widget can be embedded on any site. When false, only
            `allowedDomains` can embed it.
        allowedDomains:
          maxItems: 100
          example:
            - example.com
            - '*.example.com'
          description: Sites allowed to embed the widget.
          type: array
          items:
            type: string
        ipLimit:
          type: number
          minimum: 1
          description: Messages per visitor IP per timeframe.
        ipLimitTimeframe:
          type: number
          minimum: 1
          description: IP limit timeframe in seconds.
        ipLimitMessage:
          type: string
          maxLength: 500
        askUserToProvideEmailAddress:
          type: boolean
          description: Ask visitors for their email address.
        preventChatWithoutEmail:
          type: boolean
          description: Require an email before chatting.
        emailDiscountIncentive:
          type: boolean
          description: Offer a discount in exchange for an email.
        discountCode:
          type: string
          nullable: true
          maxLength: 100
        discountPercentage:
          type: number
          nullable: true
          minimum: 0
          maximum: 100
        automaticDiscountEnabled:
          type: boolean
    BulkAgentsResponse:
      type: object
      properties:
        succeeded:
          type: number
        failed:
          type: number
        results:
          type: array
          items:
            $ref: '#/components/schemas/BulkAgentsAgentResult'
      required:
        - succeeded
        - failed
        - results
    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
    BulkAgentsAgentResult:
      type: object
      properties:
        agentId:
          type: string
        ok:
          type: boolean
          description: False when this agent failed.
        status:
          type: number
          example: 200
          description: The HTTP status this agent would have had on its own.
        data:
          allOf:
            - $ref: '#/components/schemas/PublicAgentDto'
          description: Present when ok is true.
        error:
          description: Present when ok is false.
          allOf:
            - $ref: '#/components/schemas/BulkErrorDto'
      required:
        - agentId
        - ok
        - status
    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
    PublicAgentDto:
      type: object
      properties:
        id:
          type: string
          example: clx1agent
        name:
          type: string
          example: Example SLO
        systemPrompt:
          type: string
          description: The instructions (system prompt).
        temperature:
          type: number
          example: 0.4
        language:
          type: string
          example: sl
          nullable: true
        model:
          type: string
          example: gpt-5.5-mini
          description: Model value; see modelDetails.
        modelDetails:
          $ref: '#/components/schemas/AgentModelDetailsDto'
        lastTrainedAt:
          type: string
          nullable: true
          format: date-time
        autoRetrainEnabled:
          type: boolean
        isPublic:
          type: boolean
          description: Embeddable on any site when true.
        allowedDomains:
          type: array
          items:
            type: string
        ipLimit:
          type: number
        ipLimitTimeframe:
          type: number
          description: Seconds.
        ipLimitMessage:
          type: string
        emailCapture:
          $ref: '#/components/schemas/EmailCaptureDto'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - systemPrompt
        - temperature
        - language
        - model
        - modelDetails
        - lastTrainedAt
        - autoRetrainEnabled
        - isPublic
        - allowedDomains
        - ipLimit
        - ipLimitTimeframe
        - ipLimitMessage
        - emailCapture
        - createdAt
        - updatedAt
    BulkErrorDto:
      type: object
      properties:
        message:
          type: string
          example: Agent not found
      required:
        - message
    AgentModelDetailsDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        value:
          type: string
          example: gpt-5.5-mini
        creditMultiplier:
          type: number
          description: Credits each reply costs with this model.
          example: 1
      required:
        - id
        - name
        - value
        - creditMultiplier
    EmailCaptureDto:
      type: object
      properties:
        askUserToProvideEmailAddress:
          type: boolean
        preventChatWithoutEmail:
          type: boolean
        emailDiscountIncentive:
          type: boolean
        discountCode:
          type: string
          nullable: true
        discountPercentage:
          type: number
          nullable: true
        automaticDiscountEnabled:
          type: boolean
      required:
        - askUserToProvideEmailAddress
        - preventChatWithoutEmail
        - emailDiscountIncentive
        - discountCode
        - discountPercentage
        - automaticDiscountEnabled
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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