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

# Update a WhatsApp tool

> Renames, enables/disables, or updates `fixed_config` / `parameter_schema` on an existing company tool. Same validation as dashboard PATCH `/api/kapso/tools/:id`. At least one field is required. Cross-company ids return 404.



## OpenAPI

````yaml /docs/openapi.json patch /api/whatsapp/tools/{id}
openapi: 3.0.0
info:
  title: FinSync API Documentation
  version: 1.0.0
  description: API documentation for FinSync application
  contact:
    name: FinSync Support
    email: support@finsync.com
servers:
  - url: https://api.finsync.ar
    description: Direct Fly API (preferred for API keys and webhooks)
  - url: https://finsync.ar
    description: Same-origin via finsync.ar (Vercel rewrite)
security:
  - apiKey: []
tags:
  - name: Clients
    description: Operations related to clients and their accounts
  - name: Tags
    description: >-
      Company-scoped client labels (Configuración > Etiquetas). Distinct from
      the special Centro de resultados / Centro de costos tag used for budget
      clients.
  - name: Accounts
    description: Operations related to account balances
  - name: Cost Centers
    description: Company centros de resultados (cost_center_id) and their budgets
  - name: Operations
    description: Operations for creating and managing financial operations
  - name: Operation Types
    description: Company operation types management
  - name: Transaction Types
    description: Company transaction types management
  - name: WhatsApp Tools
    description: >-
      Company-scoped WhatsApp bot operation tools (Configuración > WhatsApp >
      Tools). Same WhatsAppOperationTool rows as the dashboard. Authenticate
      with x-api-key.
  - name: External client
    description: >-
      Exports for external (portal-linked) clients. Authenticate with
      `x-api-key` (company-owned client ID) or `Authorization: Bearer` (Auth.js
      session for an ExternalAccessGrant).
  - name: Mesas
    description: >-
      Company FX trading desks (mesas). Same records and paths as the dashboard
      Mesas module. Integrators authenticate with x-api-key; the dashboard uses
      an employee session. Superadmin must set mesas_enabled first; there is no
      public PATCH for that flag. created_by / opened_by / closed_by are null
      for API-key callers.
  - name: Home metrics
    description: >-
      Named dashboard home metrics (list + values). API keys receive the
      Métricas-group cards (day P&L, commissions, cost centers) without the
      metrics-password cookie. Employee sessions need the matching view
      permission; they still skip the UI password gate on this surface.
paths:
  /api/whatsapp/tools/{id}:
    patch:
      tags:
        - WhatsApp Tools
      summary: Update a WhatsApp tool
      description: >-
        Renames, enables/disables, or updates `fixed_config` /
        `parameter_schema` on an existing company tool. Same validation as
        dashboard PATCH `/api/kapso/tools/:id`. At least one field is required.
        Cross-company ids return 404.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: WhatsApp tool ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 100
                slug:
                  type: string
                description:
                  type: string
                  nullable: true
                enabled:
                  type: boolean
                fixed_config:
                  $ref: '#/components/schemas/WhatsAppToolFixedConfig'
                parameter_schema:
                  $ref: '#/components/schemas/WhatsAppToolParameterSchema'
      responses:
        '200':
          description: Updated tool
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppOperationTool'
        '400':
          description: Invalid id, empty body, or invalid config
        '401':
          description: Unauthorized - Missing or invalid API key
        '404':
          description: WhatsApp tool not found
        '409':
          description: A WhatsApp tool with this slug already exists
        '500':
          description: Server error
      security:
        - apiKey: []
components:
  schemas:
    WhatsAppToolFixedConfig:
      type: object
      description: >-
        Same discriminated `fixed_config` stored on WhatsAppOperationTool and
        sent by Configuración > WhatsApp > Tools. Validated with
        whatsAppToolFixedConfigSchema. `operationTypeId` must be a
        CompanyOperationTypes id of this company and must match `toolKind`
        (up/down → up_down, other → other, exchange → exchange, budget →
        budget). Budget config uses
        costCenter/paymentSourceMode/internalAccount/payerClient/amount/description;
        it does not require up_down mode/source/destination. Direction defaults
        to expense. paymentSourceMode defaults to internal (caja).
        Expense+external credits a type=1 CC (payerClientId) and does not debit
        caja. If internalAccountId is omitted on internal, confirm uses the cost
        center default caja.
      required:
        - operationTypeId
        - toolKind
      properties:
        toolKind:
          type: string
          enum:
            - up_down
            - other
            - exchange
            - budget
        operationTypeId:
          type: integer
          description: >-
            Company operation type ID (dashboard field; not a top-level
            operation_type_id)
      additionalProperties: true
    WhatsAppToolParameterSchema:
      type: object
      description: >-
        Dynamic fields the bot asks for (`parameter_schema`). Same shape as the
        dashboard form: `{ parameters: [...] }`. Omit or send `{ parameters: []
        }` when every field is fixed.
      properties:
        parameters:
          type: array
          items:
            type: object
            additionalProperties: true
    WhatsAppOperationTool:
      type: object
      description: >-
        WhatsAppOperationTool row (deleted_at IS NULL). List includes disabled
        tools.
      properties:
        id:
          type: integer
        company_id:
          type: integer
        name:
          type: string
          maxLength: 100
        slug:
          type: string
        description:
          type: string
          nullable: true
        enabled:
          type: boolean
        company_operation_type_id:
          type: integer
          description: Copied from fixed_config.operationTypeId
        mode:
          type: string
          enum:
            - standard
            - internal_transfer
            - third_party
          description: >-
            Legacy UP/DOWN column. OTHER, EXCHANGE, and BUDGET store `standard`
            here; real settings live in fixed_config.
        fixed_config:
          $ref: '#/components/schemas/WhatsAppToolFixedConfig'
        parameter_schema:
          $ref: '#/components/schemas/WhatsAppToolParameterSchema'
        created_by:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````

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