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

# Update a custom AI tool

> Requires `tools:write`. Omit `auth.value` to preserve an existing secret.



## OpenAPI

````yaml /openapi.json patch /tools/{toolId}
openapi: 3.0.3
info:
  title: Visito M2M API
  version: 1.0.0
  description: >-
    Tenant-scoped server-to-server API for channels, conversations, commerce,
    custom AI tools, and WhatsApp templates. Send operations are asynchronous
    and return queued acknowledgements. Expansion adds conversation controls,
    knowledge, sales opportunities, delivery status, reporting, and signed
    webhooks.
servers:
  - url: https://platform-api.visitoai.com/m2m/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Channels
  - name: Conversations
  - name: Commerce
  - name: Custom tools
  - name: WhatsApp templates
  - name: Properties
  - name: Knowledge
  - name: Sales CRM
  - name: Delivery
  - name: Reporting
  - name: Webhooks
paths:
  /tools/{toolId}:
    patch:
      tags:
        - Custom tools
      summary: Update a custom AI tool
      description: >-
        Requires `tools:write`. Omit `auth.value` to preserve an existing
        secret.
      operationId: updateTool
      parameters:
        - $ref: '#/components/parameters/ToolId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolPatchRequest'
      responses:
        '200':
          description: Tool updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolResponse'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    ToolId:
      name: toolId
      in: path
      required: true
      schema:
        type: string
  schemas:
    ToolPatchRequest:
      type: object
      minProperties: 1
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^[a-zA-Z_][a-zA-Z0-9_]{0,63}$
        description:
          type: string
          minLength: 1
          maxLength: 2000
        parameters:
          type: object
          additionalProperties: true
        endpoint:
          type: object
          properties:
            url:
              type: string
              format: uri
            method:
              type: string
              enum:
                - GET
                - POST
            timeoutMs:
              type: integer
              minimum: 500
              maximum: 30000
          additionalProperties: false
        auth:
          $ref: '#/components/schemas/ToolAuthInput'
        active:
          type: boolean
        readOnly:
          type: boolean
        allowInPlayground:
          type: boolean
        propertyIds:
          type: array
          items:
            type: string
      additionalProperties: false
    ToolResponse:
      type: object
      required:
        - tool
      properties:
        tool:
          $ref: '#/components/schemas/Tool'
    ToolAuthInput:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - none
            - bearer
            - api_key
        headerName:
          type: string
        value:
          type: string
          writeOnly: true
      additionalProperties: false
    Tool:
      type: object
      required:
        - toolId
        - tenantId
        - name
        - description
        - parameters
        - endpoint
        - auth
        - active
        - readOnly
        - allowInPlayground
        - propertyIds
        - createdAt
        - updatedAt
      properties:
        toolId:
          type: string
        tenantId:
          type: string
        name:
          type: string
        description:
          type: string
        parameters:
          type: object
          additionalProperties: true
        endpoint:
          $ref: '#/components/schemas/ToolEndpoint'
        auth:
          type: object
          required:
            - type
            - configured
          properties:
            type:
              type: string
              enum:
                - none
                - bearer
                - api_key
            headerName:
              type: string
            secretLastFour:
              type: string
            configured:
              type: boolean
        active:
          type: boolean
        readOnly:
          type: boolean
        allowInPlayground:
          type: boolean
        propertyIds:
          type: array
          items:
            type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: M2M_AUTH_INSUFFICIENT_SCOPE
            message:
              type: string
            details:
              type: object
              additionalProperties: true
      example:
        error:
          code: M2M_AUTH_INSUFFICIENT_SCOPE
          message: M2M credential does not have required scope.
          details:
            requiredScopes:
              - conversations:write
            missingScopes:
              - conversations:write
    ToolEndpoint:
      type: object
      required:
        - url
        - method
      properties:
        url:
          type: string
          format: uri
        method:
          type: string
          enum:
            - GET
            - POST
        timeoutMs:
          type: integer
          minimum: 500
          maximum: 30000
      additionalProperties: false
  responses:
    Error:
      description: Structured error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Visito M2M API key
      description: Server-side tenant-scoped credential created from Build > API Keys.

````