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

# Create or update a mesa override

> action is include, exclude, or null (clear; requires operation_id or override_id). Fabricated trades need side, local_amount, fx, and trade_date together. created_by is null for API-key writes.



## OpenAPI

````yaml /docs/openapi.json post /api/mesas/{id}/overrides
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/mesas/{id}/overrides:
    post:
      tags:
        - Mesas
      summary: Create or update a mesa override
      description: >-
        action is include, exclude, or null (clear; requires operation_id or
        override_id). Fabricated trades need side, local_amount, fx, and
        trade_date together. created_by is null for API-key writes.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: Mesa ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
              properties:
                action:
                  type: string
                  nullable: true
                  enum:
                    - include
                    - exclude
                    - null
                  example: include
                operation_id:
                  type: integer
                  nullable: true
                  example: 88
                override_id:
                  type: integer
                  nullable: true
                fx_override:
                  type: number
                  nullable: true
                side:
                  type: string
                  enum:
                    - buy
                    - sell
                  nullable: true
                local_amount:
                  type: number
                  nullable: true
                fx:
                  type: number
                  nullable: true
                trade_date:
                  type: string
                  format: date-time
                  nullable: true
                note:
                  type: string
                  nullable: true
                  example: keep this FX
            example:
              action: include
              operation_id: 88
              note: keep this FX
      responses:
        '200':
          description: 'Saved override, or { deleted: true } when action is null'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MesaOperationOverride'
              example:
                id: 9
                mesa_id: 1
                operation_id: 88
                action: include
                fx_override: null
                side: null
                local_amount: null
                fx: null
                trade_date: null
                note: keep this FX
                created_by: null
                created_at: '2026-03-02T00:00:00.000Z'
                updated_at: '2026-03-02T00:00:00.000Z'
        '400':
          description: Invalid body or operation outside the period
        '401':
          description: Unauthorized - Missing or invalid API key
        '403':
          description: >-
            Mesas module not enabled for this company (superadmin must set
            mesas_enabled). No public PATCH for that flag.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MesasDisabledError'
              example:
                error: Mesas module not enabled for this company
                code: MESAS_DISABLED
        '404':
          description: Mesa, operation, or override not found
        '409':
          description: No open period or unique-constraint conflict
        '500':
          description: Server error
      security:
        - apiKey: []
components:
  schemas:
    MesaOperationOverride:
      type: object
      description: >-
        Include/exclude or fabricate a trade. created_by is null for API-key
        writes.
      properties:
        id:
          type: integer
          example: 9
        mesa_id:
          type: integer
          example: 1
        operation_id:
          type: integer
          nullable: true
          example: 88
        action:
          type: string
          enum:
            - include
            - exclude
        fx_override:
          type: number
          nullable: true
        side:
          type: string
          enum:
            - buy
            - sell
          nullable: true
        local_amount:
          type: number
          nullable: true
        fx:
          type: number
          nullable: true
        trade_date:
          type: string
          format: date-time
          nullable: true
        note:
          type: string
          nullable: true
        created_by:
          type: integer
          nullable: true
          example: null
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      example:
        id: 9
        mesa_id: 1
        operation_id: 88
        action: include
        fx_override: null
        side: null
        local_amount: null
        fx: null
        trade_date: null
        note: keep this FX
        created_by: null
        created_at: '2026-03-02T00:00:00.000Z'
        updated_at: '2026-03-02T00:00:00.000Z'
    MesasDisabledError:
      type: object
      properties:
        error:
          type: string
          example: Mesas module not enabled for this company
        code:
          type: string
          example: MESAS_DISABLED
  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.