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

# Get one operation

> Read-only operation detail from Postgres (same company and scoped-client rules as the list). Includes created_by, cancelled_by, and channel. Returns 404 when the id is missing or belongs to another tenant.



## OpenAPI

````yaml /docs/openapi.json get /api/operations/{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: Audit
    description: >-
      Read-only company audit trail. Requires audit.view for employee / personal
      API keys. Company x-api-key sees the full company. Tenant scope is
      audit_logs.company_id (FS-03: never attributed by actor).
  - 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/operations/{id}:
    get:
      tags:
        - Operations
      summary: Get one operation
      description: >-
        Read-only operation detail from Postgres (same company and scoped-client
        rules as the list). Includes created_by, cancelled_by, and channel.
        Returns 404 when the id is missing or belongs to another tenant.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Operation with transactions and audit actors
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      operation_id:
                        type: integer
                      company_id:
                        type: integer
                      operation_description:
                        type: string
                        nullable: true
                      operation_type_name:
                        type: string
                        nullable: true
                      operation_type:
                        type: string
                        nullable: true
                      operation_created_at:
                        type: string
                      total_transactions:
                        type: integer
                      total_credito_amount:
                        type: number
                      total_debito_amount:
                        type: number
                      trx:
                        type: array
                        items:
                          type: object
                  - $ref: '#/components/schemas/PublicOperationAuditFields'
        '400':
          description: Invalid operation ID
        '401':
          description: Unauthorized
        '404':
          description: Operation not found
        '500':
          description: Server error
      security:
        - apiKey: []
components:
  schemas:
    PublicOperationAuditFields:
      type: object
      properties:
        created_by:
          $ref: '#/components/schemas/PublicAuditActor'
        cancelled_by:
          $ref: '#/components/schemas/PublicAuditActor'
        channel:
          type: string
          nullable: true
          enum:
            - dashboard
            - whatsapp
            - api
            - twin
            - system
        channel_detail:
          $ref: '#/components/schemas/PublicAuditChannelDetail'
    PublicAuditActor:
      type: object
      description: >-
        Resolved actor for an audit event or operation. Email is included
        because audit_logs.changed_by stores only the employee email; without it
        integrators cannot tell two people with the same display name apart. It
        is Employee.email, never an AuthUser secret, password hash, or session
        token. id is null when the email does not match a current employee of
        this company (deleted employee, missing GUC, company API key write).
      properties:
        id:
          type: integer
          nullable: true
        name:
          type: string
          nullable: true
        email:
          type: string
          nullable: true
    PublicAuditChannelDetail:
      type: object
      description: >-
        Present only when channel is whatsapp or twin and a
        WhatsAppOperationDraft exists for the operation. Not stored on
        audit_logs.
      properties:
        requested_by:
          type: object
          properties:
            contact_id:
              type: integer
            phone:
              type: string
              nullable: true
            employee:
              $ref: '#/components/schemas/PublicEmployeeActor'
            client:
              type: object
              nullable: true
              properties:
                id:
                  type: integer
                name:
                  type: string
                  nullable: true
    PublicEmployeeActor:
      type: object
      description: >-
        Resolved company employee. Used next to existing integer actor ids
        (opened_by, closed_by, created_by). Name only; email is omitted here
        because those fields are already employee ids.
      properties:
        id:
          type: integer
        name:
          type: string
          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.