{
  "openapi": "3.0.0",
  "paths": {
    "/v1/audit": {
      "get": {
        "operationId": "AuditController_list",
        "parameters": [
          {
            "name": "action",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "audit"
        ]
      }
    },
    "/v1/audit/export.csv": {
      "get": {
        "operationId": "AuditController_exportCsv",
        "parameters": [
          {
            "name": "action",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "audit"
        ]
      }
    },
    "/v1/health": {
      "get": {
        "description": "Siempre 200 mientras el proceso corra. Úsalo como `livenessProbe` o desde un monitor externo (BetterStack/UptimeRobot) para saber si el contenedor está vivo.",
        "operationId": "HealthController_liveness",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Servicio vivo",
            "content": {
              "application/json": {
                "schema": {
                  "example": {
                    "status": "ok",
                    "service": "fe-api",
                    "env": "production",
                    "timestamp": "2026-04-21T18:32:01.000Z"
                  }
                }
              }
            }
          }
        },
        "summary": "Liveness probe",
        "tags": [
          "health"
        ]
      }
    },
    "/v1/health/ready": {
      "get": {
        "description": "Verifica Postgres + Redis (queue + cache) con timeout de 500 ms. 200 si todo responde, 503 si alguna dependencia está caída.",
        "operationId": "HealthController_readiness",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Todas las dependencias respondieron (o ninguna respondió → 503)",
            "content": {
              "application/json": {
                "schema": {
                  "example": {
                    "status": "ok",
                    "checks": {
                      "postgres": {
                        "ok": true,
                        "latencyMs": 3
                      },
                      "redisQueue": {
                        "ok": true,
                        "latencyMs": 1
                      },
                      "redisCache": {
                        "ok": true,
                        "latencyMs": 1
                      }
                    },
                    "timestamp": "2026-04-21T18:32:01.000Z"
                  }
                }
              }
            }
          }
        },
        "summary": "Readiness probe",
        "tags": [
          "health"
        ]
      }
    },
    "/v1/health/deep": {
      "get": {
        "description": "Readiness + MinIO storage reachability. Diseñado para monitores de uptime externos con cadencia de 60-120 s. Devuelve 503 si cualquier dependencia crítica está caída.",
        "operationId": "HealthController_deep",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Todas las dependencias críticas respondieron",
            "content": {
              "application/json": {
                "schema": {
                  "example": {
                    "status": "ok",
                    "checks": {
                      "postgres": {
                        "ok": true,
                        "latencyMs": 3
                      },
                      "redisQueue": {
                        "ok": true,
                        "latencyMs": 1
                      },
                      "redisCache": {
                        "ok": true,
                        "latencyMs": 1
                      },
                      "storage": {
                        "ok": true,
                        "latencyMs": 12
                      }
                    },
                    "timestamp": "2026-04-21T18:32:01.000Z"
                  }
                }
              }
            }
          }
        },
        "summary": "Deep health probe",
        "tags": [
          "health"
        ]
      }
    },
    "/v1/auth/whoami": {
      "get": {
        "operationId": "WhoAmIController_whoami",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "auth"
        ]
      }
    },
    "/v1/organizations": {
      "post": {
        "operationId": "IdentityController_createOrganization",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "IdentityController_me",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      },
      "put": {
        "operationId": "IdentityController_updateMe",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/organizations/{id}/invitations": {
      "post": {
        "operationId": "IdentityController_createInvitation",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      },
      "get": {
        "operationId": "IdentityController_listInvitations",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/organizations/{id}/invitations/{inviteId}": {
      "delete": {
        "operationId": "IdentityController_revokeInvitation",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inviteId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/organizations/{id}/members": {
      "get": {
        "operationId": "IdentityController_listMembers",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/organizations/{id}/members/{membershipId}/scopes": {
      "get": {
        "operationId": "IdentityController_getMemberScopes",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "membershipId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      },
      "put": {
        "operationId": "IdentityController_setMemberScopes",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "membershipId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/invitations/{token}/accept": {
      "post": {
        "operationId": "IdentityController_acceptInvitation",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "Identity"
        ]
      }
    },
    "/v1/mh-lookup/{cedula}": {
      "get": {
        "operationId": "MhLookupController_lookup",
        "parameters": [
          {
            "name": "cedula",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/public/referral/{code}": {
      "get": {
        "operationId": "PublicReferralController_resolve",
        "parameters": [
          {
            "name": "code",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "PublicReferral"
        ]
      }
    },
    "/v1/waitlist": {
      "post": {
        "operationId": "WaitlistController_join",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/integration-requests": {
      "post": {
        "operationId": "IntegrationRequestsController_create",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Submit a Wave-2 integration request (public, unauthenticated)",
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/migrations/alegra/preview": {
      "post": {
        "operationId": "AlegraController_preview",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Parse an Alegra CSV export without writing to the DB",
        "tags": [
          "migrations"
        ]
      }
    },
    "/v1/companies/{companyId}/migrations/alegra/products/commit": {
      "post": {
        "operationId": "AlegraController_commitProducts",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Commit parsed Alegra products as SKUs on the target company",
        "tags": [
          "migrations"
        ]
      }
    },
    "/v1/companies/{companyId}/skus": {
      "get": {
        "operationId": "InventoryController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "inventory"
        ]
      },
      "post": {
        "operationId": "InventoryController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inventory"
        ]
      }
    },
    "/v1/companies/{companyId}/skus/{skuId}/adjust": {
      "post": {
        "operationId": "InventoryController_adjust",
        "parameters": [
          {
            "name": "skuId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inventory"
        ]
      }
    },
    "/v1/bulk-issue/preview": {
      "post": {
        "operationId": "BulkIssueController_preview",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Preview a sheet-style bulk issue CSV without writing",
        "tags": [
          "bulk-issue"
        ]
      }
    },
    "/v1/bulk-issue/commit": {
      "post": {
        "operationId": "BulkIssueController_commit",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Emit each parsed draft via the documents queue (retries/quota shared)",
        "tags": [
          "bulk-issue"
        ]
      }
    },
    "/v1/companies/{companyId}/documents": {
      "post": {
        "description": "Crea y pone en cola para envío a Hacienda un nuevo comprobante (FE/TE/NC/ND/FEC). Devuelve `{ documentId, clave }` inmediatamente; el estado evoluciona asíncronamente — consulta `GET /companies/:companyId/documents/:id` para el estado final. Consumo contra el plan API: **1 emit** por request exitoso.",
        "operationId": "DocumentsController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "description": "ID de la empresa emisora (cédula jurídica o física). Debes tener acceso vía membresía.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Emitir un comprobante electrónico",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/companies/{companyId}/documents/bulk": {
      "post": {
        "description": "Sube hasta 4 MB de CSV/XLSX (field `file`) y encola N documentos. El response lista filas válidas + errores de validación para que puedas corregir y re-enviar.",
        "operationId": "DocumentsController_bulkCreate",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "description": "ID de la empresa emisora (cédula jurídica o física). Debes tener acceso vía membresía.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Emisión en lote vía CSV o XLSX",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/predictions": {
      "get": {
        "operationId": "DocumentDetailController_getPredictions",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/resend": {
      "post": {
        "operationId": "DocumentDetailController_resend",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/batch-get": {
      "post": {
        "description": "POST body `{ ids: string[] }` con hasta 100 ids. Devuelve `{ docs, missing }` donde `missing` incluye ids no encontrados o fuera de tenant. Consumo API: 1 read por request.",
        "operationId": "DocumentDetailController_batchGet",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Bulk-fetch comprobantes por lista de ids",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/bulk/redispatch": {
      "post": {
        "operationId": "DocumentDetailController_bulkRedispatch",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/void": {
      "post": {
        "operationId": "DocumentDetailController_voidDocument",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/clone": {
      "post": {
        "operationId": "DocumentDetailController_cloneDocument",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents": {
      "get": {
        "description": "Listado paginado (max 50 por página) con filtros opcionales `type` (FE/TE/NC/ND/FEC), `status`, `q` (búsqueda por clave/receptor/nombre), `companyId`. Consumo API: **1 read** por request.",
        "operationId": "DocumentDetailController_list",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Listar comprobantes",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/trends": {
      "get": {
        "operationId": "DocumentDetailController_trends",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/export.csv": {
      "get": {
        "operationId": "DocumentDetailController_exportCsv",
        "parameters": [
          {
            "name": "type",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}": {
      "get": {
        "description": "Devuelve el documento completo con estado de aceptación de Hacienda, respuestas MH, claves y totales.",
        "operationId": "DocumentDetailController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Obtener un comprobante por ID",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/rejection-analysis": {
      "get": {
        "description": "Para documentos rechazados, parsea el DetalleMensaje y clasifica la causa. Retorna applicable=false cuando el documento está aceptado o en otro estado.",
        "operationId": "DocumentDetailController_rejectionAnalysis",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Análisis del rechazo de Hacienda",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/xml": {
      "get": {
        "description": "Devuelve el XML v4.4 firmado (CAdES-EPES). `Content-Disposition: attachment` con nombre `<claveNumerica>.xml`.",
        "operationId": "DocumentDetailController_xml",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Descargar XML firmado del comprobante",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/download-urls": {
      "get": {
        "description": "Devuelve URLs pre-firmadas con TTL corto (10 min). El browser hace GET directo al storage; el API queda fuera del hot path de descargas.",
        "operationId": "DocumentDetailController_downloadUrls",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Pre-signed URLs para descargar XML + PDF directo de MinIO",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/documents/{id}/pdf": {
      "get": {
        "description": "PDF renderizado (A4). Se sirve desde cache MinIO si existe; si no, renderiza on-demand + cachea + stream.",
        "operationId": "DocumentDetailController_pdfEndpoint",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Descargar representación gráfica PDF",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/companies": {
      "get": {
        "operationId": "CompaniesController_list",
        "parameters": [
          {
            "name": "include",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      },
      "post": {
        "operationId": "CompaniesController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/companies/{companyId}": {
      "patch": {
        "operationId": "CompaniesController_update",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/companies/{companyId}/branding": {
      "patch": {
        "operationId": "CompaniesController_updateBranding",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/companies/{companyId}/branding/logo": {
      "post": {
        "operationId": "CompaniesController_uploadLogo",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      },
      "delete": {
        "operationId": "CompaniesController_deleteLogo",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "identity"
        ]
      }
    },
    "/v1/companies/{companyId}/branches": {
      "get": {
        "operationId": "BranchesController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "List branches + per-branch consecutives",
        "tags": [
          "companies"
        ]
      },
      "post": {
        "operationId": "BranchesController_add",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Add a new branch; eagerly seeds consecutives for all standard doc types",
        "tags": [
          "companies"
        ]
      }
    },
    "/v1/companies/{companyId}/consecutives/allocate": {
      "post": {
        "operationId": "ConsecutivesWizardController_allocate",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Allocate a consecutive range for a (branch, terminal, docType) so other POSes cannot collide",
        "tags": [
          "companies"
        ]
      }
    },
    "/v1/companies/{companyId}/consecutives/overview": {
      "get": {
        "operationId": "ConsecutivesWizardController_overview",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Matrix of (branch x terminal x docType) with current-next values",
        "tags": [
          "companies"
        ]
      }
    },
    "/v1/v1/documents/duplicate-check": {
      "get": {
        "description": "Retorna `matches: []` cuando no hay duplicados. Los DRAFT no cuentan. Cambios de moneda no matchean — el match exige misma moneda exacta.",
        "operationId": "DocumentsDuplicateController_duplicateCheck",
        "parameters": [
          {
            "name": "receptorId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "total",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Revisar si hay CE emitidos en las últimas 24h al mismo receptor por el mismo monto",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/companies/{companyId}/certificate": {
      "post": {
        "operationId": "CertificatesController_upload",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "certificates"
        ]
      },
      "get": {
        "operationId": "CertificatesController_status",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "certificates"
        ]
      }
    },
    "/v1/certificates/expiring": {
      "get": {
        "operationId": "CertificatesExpiringController_expiring",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "certificates"
        ]
      }
    },
    "/v1/admin/dispatch/failed": {
      "get": {
        "operationId": "DispatchAdminController_listFailed",
        "parameters": [
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/dispatch/failed/{jobId}/retry": {
      "post": {
        "operationId": "DispatchAdminController_retry",
        "parameters": [
          {
            "name": "jobId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/documents/{id}/status/stream": {
      "get": {
        "description": "Server-Sent Events stream. Emits one JSON object per status transition (`DRAFT` → `DISPATCHED` → `ACCEPTED`/`REJECTED`). Heartbeat every 25s as an SSE comment line. Max connection duration 5 min; server then sends `{\"type\":\"reconnect\"}` and closes — clients should reconnect with exponential backoff. 429 returned when the user has 5 open streams already.",
        "operationId": "DispatchStreamController_stream",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "description": "Document id (cuid)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Live dispatch-status stream (SSE)",
        "tags": [
          "documents"
        ]
      }
    },
    "/v1/firm/sign-off/config": {
      "get": {
        "operationId": "SignOffConfigController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "sign-off"
        ]
      },
      "put": {
        "operationId": "SignOffConfigController_put",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "sign-off"
        ]
      }
    },
    "/v1/sign-offs": {
      "get": {
        "operationId": "SignOffController_listPending",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "sign-off"
        ]
      }
    },
    "/v1/sign-offs/{id}/approve": {
      "post": {
        "operationId": "SignOffController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "sign-off"
        ]
      }
    },
    "/v1/sign-offs/{id}/reject": {
      "post": {
        "operationId": "SignOffController_reject",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "sign-off"
        ]
      }
    },
    "/v1/catalogs/cabys": {
      "get": {
        "operationId": "CatalogsController_cabys",
        "parameters": [
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/{companyId}/cabys/favorites": {
      "get": {
        "operationId": "CatalogsController_listFavorites",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/{companyId}/cabys/suggestions": {
      "get": {
        "operationId": "CatalogsController_cabysSuggestions",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/cabys/curated": {
      "get": {
        "operationId": "CatalogsController_cabysCurated",
        "parameters": [
          {
            "name": "activityCode",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/{companyId}/cabys/{code}/star": {
      "post": {
        "operationId": "CatalogsController_star",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/{companyId}/cabys/{code}/unstar": {
      "post": {
        "operationId": "CatalogsController_unstar",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/locations": {
      "get": {
        "operationId": "CatalogsController_locations",
        "parameters": [
          {
            "name": "provincia",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/units": {
      "get": {
        "operationId": "CatalogsController_units",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/payment-methods": {
      "get": {
        "operationId": "CatalogsController_paymentMethods",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/sale-conditions": {
      "get": {
        "operationId": "CatalogsController_saleConditions",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/catalogs/activities": {
      "get": {
        "operationId": "CatalogsController_activities",
        "parameters": [
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "catalogs"
        ]
      }
    },
    "/v1/admin/integrations/xero/retry/{documentId}": {
      "post": {
        "operationId": "IntegrationsAdminController_retryXero",
        "parameters": [
          {
            "name": "documentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/integrations/qbo/retry/{documentId}": {
      "post": {
        "operationId": "IntegrationsAdminController_retryQbo",
        "parameters": [
          {
            "name": "documentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/integrations/xero/resync-org/{orgId}": {
      "post": {
        "operationId": "IntegrationsAdminController_resyncXeroOrg",
        "parameters": [
          {
            "name": "orgId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dryRun",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/integrations/connections": {
      "get": {
        "operationId": "IntegrationsAdminController_listConnections",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "activeOnly",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/integrations/recent-pushes": {
      "get": {
        "operationId": "IntegrationsAdminController_listRecentPushes",
        "parameters": [
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provider",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/firm/overdue-interest": {
      "get": {
        "operationId": "OverdueInterestController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "overdue-interest"
        ]
      },
      "put": {
        "operationId": "OverdueInterestController_put",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "overdue-interest"
        ]
      }
    },
    "/v1/compliance-calendar": {
      "get": {
        "description": "Devuelve tres listas alineadas al calendario fiscal CR (D-104, D-150, D-151, D-101, IVA Retenido, Pago Anual). `upcoming` dentro de 60 días, `overdue` sin evento de generación reciente, `completed` con evento `d10X.generated` en la ventana del ciclo. Todas las fechas en UTC ISO-8601.",
        "operationId": "ComplianceCalendarController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Próximos vencimientos tributarios + atrasos + completados",
        "tags": [
          "compliance-calendar"
        ]
      }
    },
    "/v1/firm/monthly-close/config": {
      "get": {
        "operationId": "MonthlyCloseController_getConfig",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "monthly-close"
        ]
      },
      "put": {
        "operationId": "MonthlyCloseController_putConfig",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "monthly-close"
        ]
      }
    },
    "/v1/firm/monthly-close/run": {
      "post": {
        "operationId": "MonthlyCloseController_run",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "monthly-close"
        ]
      }
    },
    "/v1/firm/monthly-close/runs": {
      "get": {
        "operationId": "MonthlyCloseController_listRuns",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "monthly-close"
        ]
      }
    },
    "/v1/reporting/d150": {
      "get": {
        "operationId": "ReportingController_getD150",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/d101": {
      "get": {
        "operationId": "ReportingController_getD101",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/d151": {
      "get": {
        "operationId": "ReportingController_getD151",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "threshold",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/d104": {
      "get": {
        "operationId": "ReportingController_getD104",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/mh-inspection": {
      "get": {
        "operationId": "ReportingController_mhInspection",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/d104/overrides": {
      "post": {
        "operationId": "ReportingController_saveOverrides",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/tribu-cr": {
      "get": {
        "operationId": "ReportingController_getTribuCr",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d104/simulate": {
      "post": {
        "operationId": "ReportingController_simulateD104",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d104/forecast": {
      "get": {
        "operationId": "ReportingController_forecastD104",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prepay",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/d104.pdf": {
      "get": {
        "operationId": "ReportingController_getD104Pdf",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d150": {
      "get": {
        "operationId": "D150Controller_getD150",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "activity",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d150.pdf": {
      "get": {
        "operationId": "D150Controller_getD150Pdf",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "activity",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d101": {
      "get": {
        "operationId": "D101Controller_getD101",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d101.pdf": {
      "get": {
        "operationId": "D101Controller_getD101Pdf",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d151": {
      "get": {
        "operationId": "D151Controller_getD151",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "thresholdCrc",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "thresholdUsd",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/reporting/companies/{companyId}/d151.pdf": {
      "get": {
        "operationId": "D151Controller_getD151Pdf",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "thresholdCrc",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "thresholdUsd",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "reporting"
        ]
      }
    },
    "/v1/firm/credit-dunning": {
      "get": {
        "operationId": "CreditDunningController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "credit-dunning"
        ]
      },
      "put": {
        "operationId": "CreditDunningController_put",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "credit-dunning"
        ]
      }
    },
    "/v1/admin/tenant-cost-ledger": {
      "get": {
        "operationId": "TenantCostsController_list",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/firm/revenue-share": {
      "get": {
        "operationId": "FirmRevenueShareController_list",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/admin/revenue-share/compute": {
      "post": {
        "operationId": "AdminRevenueShareController_compute",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/revenue-share/{id}/status": {
      "post": {
        "operationId": "AdminRevenueShareController_markStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/firm/accounting-sync/{provider}/oauth/start": {
      "post": {
        "operationId": "AccountingSyncController_start",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "accounting-sync"
        ]
      }
    },
    "/v1/firm/accounting-sync/{provider}/oauth/callback": {
      "get": {
        "operationId": "AccountingSyncController_callback",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "accounting-sync"
        ]
      }
    },
    "/v1/firm/accounting-sync/{provider}/accounts": {
      "get": {
        "operationId": "AccountingSyncController_listAccounts",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "accounting-sync"
        ]
      }
    },
    "/v1/firm/accounting-sync/{provider}/coa-map": {
      "post": {
        "operationId": "AccountingSyncController_upsertCoa",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "accounting-sync"
        ]
      },
      "get": {
        "operationId": "AccountingSyncController_listCoa",
        "parameters": [
          {
            "name": "provider",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "accounting-sync"
        ]
      }
    },
    "/v1/companies/{companyId}/receiver-messages": {
      "post": {
        "operationId": "ReceiverMessagesController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "receiver-messages"
        ]
      },
      "get": {
        "operationId": "ReceiverMessagesController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "receiver-messages"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices": {
      "post": {
        "operationId": "RecurringInvoicesController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      },
      "get": {
        "operationId": "RecurringInvoicesController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}": {
      "patch": {
        "operationId": "RecurringInvoicesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      },
      "delete": {
        "operationId": "RecurringInvoicesController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}/pause": {
      "post": {
        "operationId": "RecurringInvoicesController_pause",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}/resume": {
      "post": {
        "operationId": "RecurringInvoicesController_resume",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}/skip-next": {
      "post": {
        "operationId": "RecurringInvoicesController_skipNext",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}/archive": {
      "post": {
        "operationId": "RecurringInvoicesController_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/recurring-invoices/{id}/unarchive": {
      "post": {
        "operationId": "RecurringInvoicesController_unarchive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "recurring-invoices"
        ]
      }
    },
    "/v1/companies/{companyId}/payment-links": {
      "post": {
        "operationId": "PaymentLinksController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "payment-links"
        ]
      },
      "get": {
        "operationId": "PaymentLinksController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "payment-links"
        ]
      }
    },
    "/v1/companies/{companyId}/payment-links/{id}": {
      "delete": {
        "operationId": "PaymentLinksController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "payment-links"
        ]
      }
    },
    "/v1/public/payment-links/by-token/{token}": {
      "get": {
        "operationId": "PublicPaymentLinksController_byToken",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "payment-links"
        ]
      }
    },
    "/v1/billing/plans": {
      "get": {
        "description": "Catálogo público de planes Facturitica (Starter / Profesional / Contador / Enterprise). Úsalo para renderizar la página /pricing.",
        "operationId": "BillingController_listPlans",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Listar planes SaaS disponibles",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/subscription": {
      "get": {
        "description": "Devuelve la suscripción SaaS activa de la organización + consumo del período corriente (emisiones, usuarios, storage).",
        "operationId": "BillingController_getSubscription",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Estado de la suscripción actual",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/invoices": {
      "get": {
        "description": "Retorna el historial de facturas emitidas por Stripe con link al PDF. Ordenadas por fecha desc.",
        "operationId": "BillingController_getInvoices",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Listar facturas Stripe de la organización",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "description": "Devuelve `{ url }` con el link de Stripe Checkout. `interval` acepta `monthly`, `semi_annual`, `annual`, o `annual_promo` (descuento de lanzamiento).",
        "operationId": "BillingController_checkout",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Crear sesión de checkout para un plan SaaS",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/portal": {
      "post": {
        "description": "Genera una sesión one-time del Stripe Customer Portal (actualizar tarjeta, ver facturas, cancelar). Devuelve `{ url }`.",
        "operationId": "BillingController_portal",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Abrir el Customer Portal de Stripe",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/usage/trends": {
      "get": {
        "description": "Devuelve 6 buckets mensuales (antiguo → reciente) con totales de emisiones (aceptadas / rechazadas / total) para el sparkline del dashboard. Meses sin actividad se rellenan con ceros.",
        "operationId": "BillingController_getUsageTrends",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Tendencia de emisiones últimos 6 meses",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/api-plans": {
      "get": {
        "description": "Catálogo de planes para uso vía API key (Free / Starter / Growth / Business / Enterprise). Incluye cupos mensuales, rate-limit y costo por overage.",
        "operationId": "BillingController_listApiPlans",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Listar planes de API disponibles",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/api-usage": {
      "get": {
        "description": "Combina el plan API efectivo + contadores del mes + `remaining` calculado, para renderizar el medidor de uso sin múltiples requests. Esta respuesta refleja los mismos valores que `X-RateLimit-*` en cada request.",
        "operationId": "BillingController_getApiUsage",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Consumo de API del período corriente",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/api-checkout": {
      "post": {
        "description": "Similar a `/billing/checkout` pero para planes API (fee mensual + overage medido). Devuelve `{ url }` con el link de Stripe Checkout.",
        "operationId": "BillingController_apiCheckout",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Crear sesión de checkout para un plan de API",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "WebhooksController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      },
      "post": {
        "operationId": "WebhooksController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "operationId": "WebhooksController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "WebhooksController_deliveries",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "eventType",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v1/webhooks/deliveries/{deliveryId}/retry": {
      "post": {
        "operationId": "WebhooksController_retryDelivery",
        "parameters": [
          {
            "name": "deliveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v1/webhooks/{webhookId}/deliveries/{deliveryId}/replay": {
      "post": {
        "operationId": "WebhooksController_replayDelivery",
        "parameters": [
          {
            "name": "webhookId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deliveryId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "webhooks"
        ]
      }
    },
    "/v1/push/register": {
      "post": {
        "operationId": "PushController_register",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "push"
        ]
      }
    },
    "/v1/push/unregister": {
      "post": {
        "operationId": "PushController_unregister",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "push"
        ]
      }
    },
    "/v1/admin/impersonate/{userId}": {
      "post": {
        "operationId": "AdminController_impersonate",
        "parameters": [
          {
            "name": "userId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/orgs/{id}": {
      "get": {
        "operationId": "AdminController_getOrg",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/orgs/{id}/plan": {
      "post": {
        "operationId": "AdminController_overridePlan",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/rev-share/payout": {
      "get": {
        "operationId": "AdminController_revSharePayout",
        "parameters": [
          {
            "name": "month",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/rev-share/payout.csv": {
      "get": {
        "operationId": "AdminController_revSharePayoutCsv",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/audit-events": {
      "get": {
        "operationId": "AuditAdminController_list",
        "parameters": [
          {
            "name": "cursor",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "organizationId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "eventType",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/audit-events/event-types": {
      "get": {
        "operationId": "AuditAdminController_eventTypes",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/audit-events/summary": {
      "get": {
        "operationId": "AuditAdminController_summary",
        "parameters": [
          {
            "name": "days",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/users": {
      "get": {
        "operationId": "UsersAdminController_list",
        "parameters": [
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orgId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/announcements": {
      "get": {
        "operationId": "AnnouncementsAdminController_list",
        "parameters": [
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeInactive",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      },
      "post": {
        "operationId": "AnnouncementsAdminController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/announcements/{id}": {
      "patch": {
        "operationId": "AnnouncementsAdminController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      },
      "delete": {
        "operationId": "AnnouncementsAdminController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/public/announcement": {
      "get": {
        "operationId": "AnnouncementsPublicController_publicBanner",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "announcements"
        ]
      }
    },
    "/v1/announcement": {
      "get": {
        "operationId": "AnnouncementsPublicController_authenticatedBanner",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "announcements"
        ]
      }
    },
    "/v1/firm/clients": {
      "get": {
        "operationId": "FirmController_listMyClients",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/referral": {
      "get": {
        "operationId": "FirmController_referralSummary",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/tribu-cr": {
      "get": {
        "operationId": "FirmController_exportTribuCrBatch",
        "parameters": [
          {
            "name": "period",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/churn-risks": {
      "get": {
        "operationId": "FirmController_listChurnRisks",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/import/preview": {
      "post": {
        "operationId": "FirmImportController_preview",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/import/apply": {
      "post": {
        "operationId": "FirmImportController_apply",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "firm"
        ]
      }
    },
    "/v1/firm/brand": {
      "get": {
        "operationId": "FirmBrandController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-brand"
        ]
      },
      "put": {
        "operationId": "FirmBrandController_put",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-brand"
        ]
      }
    },
    "/v1/firm/groups": {
      "get": {
        "operationId": "FirmGroupsController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      },
      "post": {
        "operationId": "FirmGroupsController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      }
    },
    "/v1/firm/groups/{id}": {
      "patch": {
        "operationId": "FirmGroupsController_rename",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      },
      "delete": {
        "operationId": "FirmGroupsController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      }
    },
    "/v1/firm/groups/{id}/members": {
      "post": {
        "operationId": "FirmGroupsController_addMember",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      }
    },
    "/v1/firm/groups/{id}/members/{memberId}": {
      "delete": {
        "operationId": "FirmGroupsController_removeMember",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memberId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "firm-groups"
        ]
      }
    },
    "/v1/api-keys": {
      "post": {
        "operationId": "ApiKeysController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "api-keys"
        ]
      },
      "get": {
        "operationId": "ApiKeysController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "api-keys"
        ]
      }
    },
    "/v1/api-keys/{id}": {
      "delete": {
        "operationId": "ApiKeysController_revoke",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "api-keys"
        ]
      }
    },
    "/v1/me/data-export": {
      "get": {
        "operationId": "PrivacyController_exportMyData",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "privacy"
        ]
      }
    },
    "/v1/me/deletion-request": {
      "post": {
        "operationId": "PrivacyController_requestDeletion",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "privacy"
        ]
      }
    },
    "/v1/me/deletion-requests": {
      "get": {
        "operationId": "PrivacyController_listMyDeletionRequests",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "privacy"
        ]
      }
    },
    "/v1/admin/deletion-requests": {
      "get": {
        "operationId": "PrivacyAdminController_listPending",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "privacy-admin"
        ]
      }
    },
    "/v1/admin/deletion-requests/{id}/deny": {
      "post": {
        "operationId": "PrivacyAdminController_deny",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "privacy-admin"
        ]
      }
    },
    "/v1/admin/deletion-requests/{id}/approve": {
      "post": {
        "operationId": "PrivacyAdminController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "privacy-admin"
        ]
      }
    },
    "/v1/me/export": {
      "post": {
        "operationId": "AccountLifecycleController_requestExport",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/me/export/status": {
      "get": {
        "operationId": "AccountLifecycleController_getExportStatus",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/me/close-account/request-token": {
      "post": {
        "operationId": "AccountLifecycleController_requestCloseToken",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/me/close-account": {
      "post": {
        "operationId": "AccountLifecycleController_scheduleClose",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/me/close-account/cancel": {
      "post": {
        "operationId": "AccountLifecycleController_cancelClose",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/me/close-account/status": {
      "get": {
        "operationId": "AccountLifecycleController_getCloseStatus",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "account-lifecycle"
        ]
      }
    },
    "/v1/organizations/{id}/branding": {
      "patch": {
        "operationId": "OrganizationBrandingController_patch",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "organizations-branding"
        ]
      }
    },
    "/v1/organizations/{id}/preferences": {
      "get": {
        "operationId": "OrganizationPreferencesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "organizations-preferences"
        ]
      },
      "patch": {
        "operationId": "OrganizationPreferencesController_patch",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "organizations-preferences"
        ]
      }
    },
    "/v1/public/brand/{slug}": {
      "get": {
        "operationId": "PublicBrandController_byslug",
        "parameters": [
          {
            "name": "slug",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "public"
        ]
      }
    },
    "/v1/portal/request-access": {
      "post": {
        "operationId": "PortalController_requestAccess",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "portal"
        ]
      }
    },
    "/v1/portal/{token}/receipts": {
      "get": {
        "operationId": "PortalController_receipts",
        "parameters": [
          {
            "name": "token",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "portal"
        ]
      }
    },
    "/v1/saved-filters": {
      "get": {
        "operationId": "SavedFiltersController_list",
        "parameters": [
          {
            "name": "resource",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "saved-filters"
        ]
      },
      "post": {
        "operationId": "SavedFiltersController_upsert",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "saved-filters"
        ]
      }
    },
    "/v1/saved-filters/{id}": {
      "delete": {
        "operationId": "SavedFiltersController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "saved-filters"
        ]
      }
    },
    "/v1/reports": {
      "post": {
        "operationId": "ReportsController_submit",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "reports"
        ]
      }
    },
    "/v1/admin/reports": {
      "get": {
        "operationId": "AdminReportsController_list",
        "parameters": [
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "severity",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "area",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/reports/{id}": {
      "get": {
        "operationId": "AdminReportsController_getById",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      },
      "delete": {
        "operationId": "AdminReportsController_delete",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/reports/{id}/status": {
      "patch": {
        "operationId": "AdminReportsController_updateStatus",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents/upload-xml": {
      "post": {
        "operationId": "InboundDocumentsController_uploadXml",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents": {
      "post": {
        "operationId": "InboundDocumentsController_createManual",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      },
      "get": {
        "operationId": "InboundDocumentsController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents/{id}": {
      "get": {
        "operationId": "InboundDocumentsController_detail",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents/{id}/accept": {
      "post": {
        "operationId": "InboundDocumentsController_accept",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents/{id}/partial": {
      "post": {
        "operationId": "InboundDocumentsController_partial",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/companies/{companyId}/inbound-documents/{id}/reject": {
      "post": {
        "operationId": "InboundDocumentsController_reject",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound-documents"
        ]
      }
    },
    "/v1/inbound/email": {
      "post": {
        "operationId": "InboundEmailWebhookController_receive",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "inbound"
        ]
      }
    },
    "/v1/companies/{companyId}/bank-reconciliation/match": {
      "post": {
        "operationId": "BankReconciliationController_match",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "bank-reconciliation"
        ]
      }
    },
    "/v1/companies/{companyId}/bank-reconciliation/match-json": {
      "post": {
        "operationId": "BankReconciliationController_matchJson",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "bank-reconciliation"
        ]
      }
    },
    "/v1/companies/{companyId}/bank-reconciliation/match-sinpe": {
      "post": {
        "operationId": "BankReconciliationController_matchSinpe",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "bank-reconciliation"
        ]
      }
    },
    "/v1/companies/{companyId}/whatsapp/send/{documentId}": {
      "post": {
        "operationId": "WhatsAppController_send",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "whatsapp"
        ]
      }
    },
    "/v1/consents": {
      "post": {
        "operationId": "ConsentsController_record",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "consents"
        ]
      }
    },
    "/v1/consents/mine": {
      "get": {
        "operationId": "ConsentsController_mine",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "consents"
        ]
      }
    },
    "/v1/companies/{companyId}/clients": {
      "get": {
        "operationId": "ClientsController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "List receiver contacts for a company",
        "tags": [
          "clients"
        ]
      },
      "post": {
        "operationId": "ClientsController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Upsert a receiver contact (idempotent by identificationNumber)",
        "tags": [
          "clients"
        ]
      }
    },
    "/v1/companies/{companyId}/clients/{id}/credit-status": {
      "get": {
        "operationId": "ClientsController_creditStatus",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prospective",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Open-credit balance + configured limit for a specific receptor (CRC)",
        "tags": [
          "clients"
        ]
      }
    },
    "/v1/onboarding/progress": {
      "get": {
        "operationId": "OnboardingController_progress",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "S21 — 48h onboarding progress (steps + countdown + guarantee state)",
        "tags": [
          "onboarding"
        ]
      }
    },
    "/v1/companies/{companyId}/invoice-templates": {
      "post": {
        "operationId": "InvoiceTemplatesController_create",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "summary": "Create a saved invoice template",
        "tags": [
          "invoice-templates"
        ]
      },
      "get": {
        "operationId": "InvoiceTemplatesController_list",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      }
    },
    "/v1/companies/{companyId}/invoice-templates/{id}": {
      "get": {
        "operationId": "InvoiceTemplatesController_get",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      },
      "patch": {
        "operationId": "InvoiceTemplatesController_update",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      },
      "delete": {
        "operationId": "InvoiceTemplatesController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      }
    },
    "/v1/companies/{companyId}/invoice-templates/{id}/touch": {
      "post": {
        "operationId": "InvoiceTemplatesController_touch",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          }
        },
        "summary": "Record a use of this template (increments usage + recency)",
        "tags": [
          "invoice-templates"
        ]
      }
    },
    "/v1/companies/{companyId}/invoice-templates/{id}/archive": {
      "post": {
        "operationId": "InvoiceTemplatesController_archive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      }
    },
    "/v1/companies/{companyId}/invoice-templates/{id}/unarchive": {
      "post": {
        "operationId": "InvoiceTemplatesController_unarchive",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "invoice-templates"
        ]
      }
    },
    "/v1/metrics": {
      "get": {
        "operationId": "MetricsController_scrape",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "health"
        ]
      }
    },
    "/v1/integrations/xero/authorize": {
      "post": {
        "operationId": "IntegrationsXeroController_authorize",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/xero/callback": {
      "get": {
        "operationId": "IntegrationsXeroController_callback",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/xero/disconnect": {
      "post": {
        "operationId": "IntegrationsXeroController_disconnect",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/xero/status": {
      "get": {
        "operationId": "IntegrationsXeroController_status",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/xero/accounts": {
      "get": {
        "operationId": "IntegrationsXeroController_listAccounts",
        "parameters": [
          {
            "name": "refresh",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/xero/mappings": {
      "get": {
        "operationId": "IntegrationsXeroController_listMappings",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      },
      "post": {
        "operationId": "IntegrationsXeroController_upsertMappings",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-xero"
        ]
      }
    },
    "/v1/integrations/qbo/authorize": {
      "post": {
        "operationId": "IntegrationsQboController_authorize",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/integrations/qbo/callback": {
      "get": {
        "operationId": "IntegrationsQboController_callback",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/integrations/qbo/disconnect": {
      "post": {
        "operationId": "IntegrationsQboController_disconnect",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/integrations/qbo/status": {
      "get": {
        "operationId": "IntegrationsQboController_status",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/integrations/qbo/accounts": {
      "get": {
        "operationId": "IntegrationsQboController_listAccounts",
        "parameters": [
          {
            "name": "refresh",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/integrations/qbo/mappings": {
      "get": {
        "operationId": "IntegrationsQboController_listMappings",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      },
      "post": {
        "operationId": "IntegrationsQboController_upsertMappings",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "integrations-qbo"
        ]
      }
    },
    "/v1/companies/{companyId}/compliance-audit": {
      "get": {
        "description": "Devuelve un zip streaming con manifest.json, XML firmados + PDF regenerados para cada CE del rango, y (opcional) el log de eventos. Usa `?includeEvents=1` para incluir `events/events-*.csv`. El rango máximo es 400 días — ventanas mayores deben dividirse.",
        "operationId": "ComplianceAuditController_download",
        "parameters": [
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "description": "ID de la empresa emisora. Debes tener acceso vía membresía. La descarga cubre únicamente los comprobantes de esta empresa dentro del rango solicitado.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Descargar zip de auditoría (DGT-R-48-2016, retención 5 años)",
        "tags": [
          "compliance-audit"
        ]
      }
    },
    "/v1/v1/drafts/autosave": {
      "get": {
        "description": "Devuelve el slot autosave para el usuario + organización actuales, o null si no hay nada guardado.",
        "operationId": "DraftAutosaveController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          }
        ],
        "summary": "Obtener el autosave actual del formulario de emisión",
        "tags": [
          "drafts"
        ]
      },
      "put": {
        "description": "Upsert del payload (shape CreateDocumentInput). Payloads de más de 512 KB son rechazados con 413.",
        "operationId": "DraftAutosaveController_put",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          }
        ],
        "summary": "Guardar/actualizar el autosave del formulario de emisión",
        "tags": [
          "drafts"
        ]
      },
      "delete": {
        "description": "Idempotente — no falla si el slot no existe. Se llama después de emitir con éxito.",
        "operationId": "DraftAutosaveController_remove",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          }
        ],
        "summary": "Borrar el autosave del formulario de emisión",
        "tags": [
          "drafts"
        ]
      }
    },
    "/v1/firm/stripe-connect/onboard": {
      "post": {
        "operationId": "StripeConnectController_onboard",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "stripe-connect"
        ]
      }
    },
    "/v1/firm/stripe-connect": {
      "get": {
        "operationId": "StripeConnectController_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "stripe-connect"
        ]
      }
    },
    "/v1/firm/stripe-connect/auto-emit": {
      "put": {
        "operationId": "StripeConnectController_setAutoEmit",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "stripe-connect"
        ]
      }
    },
    "/v1/admin/feature-flags": {
      "get": {
        "operationId": "FeatureFlagsAdminController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/feature-flags/{key}": {
      "get": {
        "operationId": "FeatureFlagsAdminController_getOne",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      },
      "put": {
        "operationId": "FeatureFlagsAdminController_upsert",
        "parameters": [
          {
            "name": "key",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/feature-flags": {
      "get": {
        "operationId": "FeatureFlagsTenantController_listForTenant",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "feature-flags"
        ]
      }
    },
    "/v1/exports/full-archive": {
      "get": {
        "description": "Streaming zip con todos los comprobantes (XML firmados + PDF regenerados), inbound supplier CE, customers.csv, companies.csv, audit-events.csv, templates.json, recurring.json, webhooks.json (secretos redactados) y README.md. Solo OWNER puede invocarlo; registra `org.full_archive_exported` en el audit log.",
        "operationId": "FullArchiveController_download",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Descargar archivo zip completo de la organización (S67)",
        "tags": [
          "exports"
        ]
      }
    },
    "/v1/export-templates": {
      "get": {
        "operationId": "ExportTemplatesController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "List export templates for the org",
        "tags": [
          "export-templates"
        ]
      },
      "post": {
        "operationId": "ExportTemplatesController_create",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Create an export template",
        "tags": [
          "export-templates"
        ]
      }
    },
    "/v1/export-templates/{id}": {
      "delete": {
        "operationId": "ExportTemplatesController_remove",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Delete an export template",
        "tags": [
          "export-templates"
        ]
      }
    },
    "/v1/export-templates/{id}/run": {
      "post": {
        "description": "Body is `{ filters?: { status?, type?, companyId?, dateFrom?, dateTo? } }`. Runtime filters are merged on top of the stored template filters — runtime wins per-field. Response Content-Type + filename are derived from the template format (csv|json).",
        "operationId": "ExportTemplatesController_run",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "better-auth.session_token": []
          },
          {
            "api-key": []
          }
        ],
        "summary": "Render the template and stream the export file",
        "tags": [
          "export-templates"
        ]
      }
    },
    "/v1/partners/apply": {
      "post": {
        "operationId": "PublicPartnersController_apply",
        "parameters": [],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "partners"
        ]
      }
    },
    "/v1/partners": {
      "get": {
        "operationId": "PublicPartnersController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "partners"
        ]
      }
    },
    "/v1/admin/partners": {
      "get": {
        "operationId": "AdminPartnersController_list",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/partners/approve/{id}": {
      "post": {
        "operationId": "AdminPartnersController_approve",
        "parameters": [
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/realtime/ticket": {
      "get": {
        "description": "Devuelve `{ ticket, expiresInSeconds }`. Pasa `ticket` como query-string `?ticket=…` al abrir el WebSocket contra `wss://api.facturitica.com/v1/realtime/ws` (o como primer mensaje `{\"type\":\"auth\",\"ticket\":\"...\"}`).",
        "operationId": "RealtimeController_ticket",
        "parameters": [],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "security": [
          {
            "api-key": []
          }
        ],
        "summary": "Mint WebSocket handshake ticket (TTL 30s)",
        "tags": [
          "realtime"
        ]
      }
    },
    "/v1/public/uptime": {
      "get": {
        "description": "Returns N calendar-day uptime aggregates (default 30, max 90) for the /status page strip. Days with no rollup row are zero-filled as { uptimePct: null, hadIncident: false }.",
        "operationId": "PublicUptimeController_history",
        "parameters": [
          {
            "name": "days",
            "required": false,
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "target",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "overall",
                "postgres",
                "redis",
                "storage",
                "api"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        },
        "summary": "Uptime history (public)",
        "tags": [
          "public"
        ]
      }
    }
  },
  "info": {
    "title": "Facturitica API",
    "description": "API pública de facturación electrónica Costa Rica (v4.4).\n\n## Autenticación\n- **Cookie-session (better-auth)** — la UI web/mobile usa `better-auth.session_token` y manda `x-organization-id` por request.\n- **API key (bearer)** — servidores externos mandan `Authorization: Bearer fek_...`. Las claves se crean en /app/settings/api-keys.\n\n## Límites\nCada respuesta incluye los headers `X-RateLimit-Limit` y `X-RateLimit-Remaining`. Ver [/pricing/api](https://facturitica.com/pricing/api) para los cupos por plan. Sobrepasar el cupo devuelve `429` con `Retry-After`.\n\n## Errores\nTodos los errores devuelven JSON con `{ error, message }`. Códigos comunes: `400 ValidationError`, `401 Unauthorized`, `403 Forbidden`, `409 DuplicateKey`, `429 RateLimited`, `503 ServiceUnavailable`.\n\n## WebSocket — Real-time push (S92)\nRuta: `wss://api.facturitica.com/v1/realtime/ws`\n\n1. Llamá `GET /v1/realtime/ticket` (auth normal) para obtener `{ ticket, expiresInSeconds }` (TTL 30s).\n2. Abrí la conexión pasando `?ticket=<ticket>` como query-string, o enviá `{\"type\":\"auth\",\"ticket\":\"...\"}` como primer mensaje.\n3. El server envía `{ event: \"hello\", organizationId, heartbeatIntervalSeconds }` al autenticar.\n4. Cada cambio de estado final de un comprobante emite `{ event: \"document.status\", documentId, status, clave }`.\n5. Heartbeat: el server hace `ping` cada 30s; si el cliente no responde con `pong` dentro de 60s, la conexión se cierra (1006).\n6. Tickets desconocidos / expirados → cierre con código `4401`. Primer mensaje tardío → `4408`.",
    "version": "d48da7c",
    "contact": {
      "name": "Soporte Facturitica",
      "url": "https://facturitica.com/support",
      "email": "soporte@facturitica.com"
    },
    "license": {
      "name": "Términos de uso",
      "url": "https://facturitica.com/legal/terms"
    }
  },
  "tags": [
    {
      "name": "identity",
      "description": "Autenticación, sesión, membresía"
    },
    {
      "name": "auth",
      "description": "Sesión + whoami para integraciones externas (Zapier, etc.)"
    },
    {
      "name": "firm",
      "description": "Panel del contador: multi-cliente, bulk import, TRIBU-CR, referidos"
    },
    {
      "name": "documents",
      "description": "Emisión de FE/TE/NC/ND/FEC y consultas de estado"
    },
    {
      "name": "companies",
      "description": "Datos de empresa, branding, sucursales, links de pago"
    },
    {
      "name": "bulk-issue",
      "description": "Emisión masiva desde hoja de cálculo (CSV/XLSX)"
    },
    {
      "name": "clients",
      "description": "Directorio de receptores (contactos) por empresa — idempotente por identificación"
    },
    {
      "name": "invoice-templates",
      "description": "Biblioteca de plantillas de facturas reutilizables"
    },
    {
      "name": "payment-links",
      "description": "Links de pago Stripe con emisión automática + dunning"
    },
    {
      "name": "recurring-invoices",
      "description": "Facturas recurrentes (semanal / quincenal / mensual)"
    },
    {
      "name": "onboarding",
      "description": "Progreso de la garantía 48h (pasos + cronómetro)"
    },
    {
      "name": "catalogs",
      "description": "CAByS, actividades, monedas, unidades de medida"
    },
    {
      "name": "billing",
      "description": "Suscripciones SaaS + API usage + facturación"
    },
    {
      "name": "reporting",
      "description": "Dashboards, exportes y analítica"
    },
    {
      "name": "receiver-messages",
      "description": "Confirmación/rechazo de comprobantes recibidos"
    },
    {
      "name": "receipt-ocr",
      "description": "OCR de recibos físicos (AI-gated)"
    },
    {
      "name": "integration-requests",
      "description": "Señales públicas de demanda para integraciones"
    },
    {
      "name": "realtime",
      "description": "WebSocket push de cambios de estado (S92)"
    },
    {
      "name": "public",
      "description": "Endpoints sin autenticación (brand, referral lookup, payment-links)"
    },
    {
      "name": "health",
      "description": "Healthchecks y readiness probes"
    }
  ],
  "servers": [
    {
      "url": "https://api.facturitica.com",
      "description": "Producción"
    },
    {
      "url": "http://localhost:3001",
      "description": "Desarrollo local"
    }
  ],
  "components": {
    "securitySchemes": {
      "api-key": {
        "scheme": "bearer",
        "bearerFormat": "fek_...",
        "type": "http",
        "description": "Token de API. Formato `fek_<id>_<secret>`. Crea claves en /app/settings/api-keys."
      },
      "cookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token",
        "description": "Cookie de sesión emitida por better-auth (UI web/mobile)."
      }
    },
    "schemas": {}
  }
}