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

# Approve a pending operation

> Approves an operation by setting all its transactions to 'completed' status. Only works if all transactions in the operation are currently 'pending'.



## OpenAPI

````yaml /openapi/openapi.json post /api/operations/{id}/approve
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://finsync.ar
    description: API server
security:
  - apiKey: []
tags:
  - name: Clients
    description: Operations related to clients and their accounts
  - name: Accounts
    description: Operations related to account balances
  - 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: Superadmin
    description: Cross-tenant operations (JWT + email allowlist)
  - name: External client
    description: >-
      Exports for external (portal-linked) clients. Authenticate with
      `x-api-key` (company-owned client ID) or `Authorization: Bearer` (Supabase
      access token with an ExternalClient invite).
paths:
  /api/operations/{id}/approve:
    post:
      tags:
        - Operations
      summary: Approve a pending operation
      description: >-
        Approves an operation by setting all its transactions to 'completed'
        status. Only works if all transactions in the operation are currently
        'pending'.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: Operation ID to approve
      responses:
        '200':
          description: Operation approved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  operation_id:
                    type: integer
                    description: ID of the approved operation
                  message:
                    type: string
                    description: Success message
                  approved_transactions:
                    type: integer
                    description: Number of transactions that were approved
              example:
                operation_id: 123
                message: Operation approved successfully
                approved_transactions: 2
        '400':
          description: >-
            Bad request - Cannot approve operation with non-pending transactions
            or operation has no transactions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              examples:
                nonPending:
                  value:
                    error: Cannot approve operation with non-pending transactions
                noTransactions:
                  value:
                    error: Operation has no transactions to approve
        '401':
          description: Unauthorized - Missing or invalid API key
        '404':
          description: Operation not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Operation not found
        '500':
          description: Server error
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````