> ## 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 a company operation type

> Creates a CompanyOperationTypes row for the API-key company. Use type=budget and name Centros de resultados (company seed default) when the company has no budget type yet. Optional operation_form_config is validated with parseOperationFormConfig (kind up_down / exchange / other) and persisted. Omit it for today's null/default. Optional default_completed (boolean, default true) sets whether create forms mark this type completed for approvers. Does not invent new type enum values. company_id is taken from the API key.



## OpenAPI

````yaml /docs/openapi.json post /api/operation-types
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/operation-types:
    post:
      tags:
        - Operation Types
      summary: Create a company operation type
      description: >-
        Creates a CompanyOperationTypes row for the API-key company. Use
        type=budget and name Centros de resultados (company seed default) when
        the company has no budget type yet. Optional operation_form_config is
        validated with parseOperationFormConfig (kind up_down / exchange /
        other) and persisted. Omit it for today's null/default. Optional
        default_completed (boolean, default true) sets whether create forms mark
        this type completed for approvers. Does not invent new type enum values.
        company_id is taken from the API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - type
              properties:
                name:
                  type: string
                  maxLength: 100
                  description: Display name, e.g. Centros de resultados
                type:
                  type: string
                  enum:
                    - up
                    - down
                    - exchange
                    - other
                    - budget
                    - interest
                  description: >-
                    Existing operation_type enum. budget is required for POST
                    /api/operations budget creates.
                operation_form_config:
                  $ref: '#/components/schemas/OperationFormConfig'
                default_completed:
                  type: boolean
                  description: >-
                    Default create-op completed checkbox for this type. Omit for
                    true.
      responses:
        '201':
          description: Operation type created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationType'
        '400':
          description: >-
            Bad request — missing name/type, type not in the existing enum, or
            invalid operation_form_config
        '401':
          description: Unauthorized - Missing or invalid API key
        '500':
          description: Server error
      security:
        - apiKey: []
components:
  schemas:
    OperationFormConfig:
      type: object
      nullable: true
      description: >-
        Company operation-type form config (dashboard operation_form_config).
        Validated with parseOperationFormConfig. kind is up_down (type=up or
        down), exchange, or other.
      properties:
        kind:
          type: string
          enum:
            - up_down
            - exchange
            - other
        version:
          type: integer
        fixedConfig:
          type: object
          additionalProperties: true
        fieldModes:
          type: object
          additionalProperties: true
    OperationType:
      type: object
      properties:
        id:
          type: integer
          description: Operation type ID
        name:
          type: string
          description: Operation type name
        type:
          type: string
          enum:
            - up
            - down
            - exchange
            - other
            - budget
            - interest
          description: Operation category
        company_id:
          type: integer
          description: Company ID
        operation_form_config:
          $ref: '#/components/schemas/OperationFormConfig'
        default_completed:
          type: boolean
          description: >-
            When true, create-operation forms default the completed checkbox on
            for approvers for this type. False starts them pending. Users
            without approve permission always create pending. Defaults to true.
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
  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.