{"openapi":"3.0.0","paths":{"/v1/api-usage/access":{"get":{"description":"Not gated: tells whether the organization has API usage monitoring, the range limits for this caller and whether the caller sees the whole organization or only its own API key's requests.","operationId":"ApiUsageController_access","parameters":[],"responses":{"200":{"description":"Availability and limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUsageAccessResponseDto"}}}},"401":{"description":"UNAUTHORIZED — missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Whether API usage monitoring is available","tags":["Integraciones - Uso de la API"]}},"/v1/api-usage/metrics":{"get":{"description":"Totals, a contiguous time series (hour or Argentina-day buckets), top routes by volume and by p95 latency. Percentiles over more than one hour are a count-weighted approximation. Organization-wide: read from the hourly rollup (≤ 5 min behind), range at most 31 days, default the last 30. With an API key: computed live from that key's requests, range at most 7 days (and within the last 60), default the last 7. With an API key you see only the requests made with that key; a dashboard session sees the whole organization.","operationId":"ApiUsageController_getMetrics","parameters":[{"name":"from","required":false,"in":"query","description":"Range start (ISO 8601), inclusive. Default: `to` − 30 days.","schema":{"example":"2026-09-01T00:00:00.000Z","type":"string"}},{"name":"to","required":false,"in":"query","description":"Range end (ISO 8601), exclusive. Default: now. At most 31 days after `from`.","schema":{"example":"2026-09-26T00:00:00.000Z","type":"string"}},{"name":"granularity","required":false,"in":"query","description":"Bucket size. Default: `hour` for ranges up to 2 days, else `day` (Argentina calendar days).","schema":{"type":"string","enum":["hour","day"]}}],"responses":{"200":{"description":"Metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUsageMetricsResponseDto"}}}},"400":{"description":"API_USAGE_INVALID_RANGE, API_USAGE_RANGE_TOO_LONG, API_USAGE_OUTSIDE_HOT_WINDOW (API key, range older than 60 days).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"401":{"description":"UNAUTHORIZED — missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"The organization does not have API usage monitoring enabled (answered as an unknown route).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"429":{"description":"More than 60 requests per minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"API usage metrics for a range","tags":["Integraciones - Uso de la API"]}},"/v1/api-usage/requests":{"get":{"description":"Newest first, cursor-paginated. Filters: status class, route template, method, minimum duration, idempotency key and `provider_id` (the request body's providerId, paired with its `_NC` credit note). Limited to the last 60 days, at most 31 per query. With an API key you see only the requests made with that key; a dashboard session sees the whole organization.","operationId":"ApiUsageController_listRequests","parameters":[{"name":"from","required":false,"in":"query","description":"Range start (ISO 8601), inclusive. Default: `to` − 30 days.","schema":{"example":"2026-09-01T00:00:00.000Z","type":"string"}},{"name":"to","required":false,"in":"query","description":"Range end (ISO 8601), exclusive. Default: now. At most 31 days after `from`.","schema":{"example":"2026-09-26T00:00:00.000Z","type":"string"}},{"name":"status_class","required":false,"in":"query","description":"`4xx` is 400–498; `499` is client aborts; `error` is any status ≥ 400.","schema":{"type":"string","enum":["2xx","4xx","5xx","499","error"]}},{"name":"route","required":false,"in":"query","description":"Exact route template.","schema":{"example":"/v1/sales/sales-receipts","type":"string"}},{"name":"method","required":false,"in":"query","schema":{"example":"POST","type":"string"}},{"name":"min_duration_ms","required":false,"in":"query","description":"Only requests at least this slow (ms).","schema":{"type":"number"}},{"name":"idempotency_key","required":false,"in":"query","description":"Exact Idempotency-Key the request carried.","schema":{"type":"string"}},{"name":"provider_id","required":false,"in":"query","description":"The `providerId` sent in the request body (trimmed, exact). Also matches its credit note: `X` finds `X` and `X_NC`, and `X_NC` finds both as well.","schema":{"maxLength":100,"example":"PY-1234567","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque cursor from a previous page's `nextCursor`.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Page size (default 50, max 100).","schema":{"type":"number"}}],"responses":{"200":{"description":"A page of requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUsageRequestListResponseDto"}}}},"400":{"description":"API_USAGE_INVALID_RANGE, API_USAGE_RANGE_TOO_LONG, API_USAGE_OUTSIDE_HOT_WINDOW, API_USAGE_INVALID_CURSOR, or a query parameter failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"401":{"description":"UNAUTHORIZED — missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"The organization does not have API usage monitoring enabled (answered as an unknown route).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"429":{"description":"More than 60 requests per minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Recent API requests (metadata only)","tags":["Integraciones - Uso de la API"]}},"/v1/api-usage/requests/{id}":{"get":{"description":"The stored evidence of what was sent and what we answered (credentials redacted). A request of another organization — or, with an API key, of another key — answers 404. With an API key you see only the requests made with that key; a dashboard session sees the whole organization.","operationId":"ApiUsageController_getRequest","parameters":[{"name":"id","required":true,"in":"path","description":"Request id, from the list.","schema":{"type":"number"}}],"responses":{"200":{"description":"The request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUsageRequestDetailDto"}}}},"401":{"description":"UNAUTHORIZED — missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"API_USAGE_REQUEST_NOT_FOUND. The organization does not have API usage monitoring enabled (answered as an unknown route).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"410":{"description":"API_USAGE_REQUEST_ARCHIVED — the request is older than the hot retention window and was archived. Reading archived requests is not available yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"429":{"description":"More than 60 requests per minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"One API request, with its request and response bodies","tags":["Integraciones - Uso de la API"]}},"/v1/exports/download":{"get":{"description":"Get a signed URL (valid for 48 hours) to download a file the API generated for you — for example, a CSV export or a bulk PDF job. Pass the `key` you received from the export endpoint and download the file from the `url` you get back. You can only download files that belong to your own organization. If the link expires, just call this endpoint again with the same key to get a fresh URL.","operationId":"ExportsController_getDownloadUrl","parameters":[{"name":"key","required":true,"in":"query","description":"The export key returned by whichever endpoint generated the file.","schema":{"type":"string"}}],"responses":{"200":{"description":"`{ url }` — fetch this within 48 hours to download the file"},"400":{"description":"Validation failed. Codes: MISSING_EXPORT_KEY, INVALID_EXPORT_KEY, STORAGE_NOT_CONFIGURED, EXPORT_FILE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a download URL for an exported file","tags":["Common - Exportaciones"]}},"/v1/exports/sales/range":{"post":{"description":"Kick off a sales export covering a date range (both dates inclusive) and upload it to the organization's shared Google Drive folder. The range is split into weekly files (up to 7 days each), so a whole month arrives as several CSVs — this keeps each background job fast and reliable. The jobs run in the background; the response returns one entry per weekly file with its `runId` and the `fileName` that will appear in Drive once it finishes (a few minutes each). Files are named per-range so they never overwrite the per-day exports. This endpoint is currently enabled for a single organization.","operationId":"ExportsController_createRangeExport","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRangeExportDto"}}}},"responses":{"201":{"description":"`{ exports: [{ runId, jobId, fileName, dateFrom, dateTo }], count }` — one entry per weekly file; each CSV will appear in your Google Drive folder under its `fileName` when it completes."},"400":{"description":"Validation failed. Code: INVALID_DATE_RANGE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Your organization can't use this export. Code: RANGE_EXPORT_NOT_ALLOWED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Generate a multi-day sales export to Google Drive","tags":["Common - Exportaciones"]}},"/v1/tax-categories":{"get":{"description":"Returns the fiscal condiciones the org can choose from — Argentina's regime-filtered set, or the single 'No aplica' row for countries without their own.","operationId":"TaxCategoriesController_findAllActive","parameters":[],"responses":{"200":{"description":"List of active tax categories","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TaxCategoryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List active tax categories for the current organization","tags":["Common - Categorías Fiscales"]}},"/v1/tax-categories/{id}":{"get":{"description":"Returns a single tax category by id; 404s if it does not exist.","operationId":"TaxCategoriesController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Tax category id","schema":{"type":"number"}}],"responses":{"200":{"description":"Tax category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxCategoryResponseDto"}}}},"404":{"description":"TAX_CATEGORY_NOT_FOUND — tax category does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get tax category by id","tags":["Common - Categorías Fiscales"]}},"/v1/tax-categories/{id}/exportacion":{"get":{"description":"Returns whether the given tax category id corresponds to an exportación condición.","operationId":"TaxCategoriesController_isExportacion","parameters":[{"name":"id","required":true,"in":"path","description":"Tax category id","schema":{"type":"number"}}],"responses":{"200":{"description":"Object with exportacion boolean","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxCategoryExportacionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Check if tax category is exportación","tags":["Common - Categorías Fiscales"]}},"/v1/tax-categories/{id}/monotributo":{"get":{"description":"Returns whether the given tax category id corresponds to a monotributo condición.","operationId":"TaxCategoriesController_isMonotributo","parameters":[{"name":"id","required":true,"in":"path","description":"Tax category id","schema":{"type":"number"}}],"responses":{"200":{"description":"Object with monotributo boolean","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxCategoryMonotributoResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Check if tax category is monotributo","tags":["Common - Categorías Fiscales"]}},"/v1/currencies":{"get":{"description":"Returns the configured favorite currencies ordered by id.","operationId":"CurrenciesController_findAll","parameters":[],"responses":{"200":{"description":"List of favorite currencies","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CurrencyResponseDto"}}}}}},"summary":"List favorite currencies","tags":["Common - Monedas"]}},"/v1/currencies/default":{"get":{"description":"Returns the configured default currency; 404s if none is configured.","operationId":"CurrenciesController_getDefault","parameters":[],"responses":{"200":{"description":"Default currency","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrencyResponseDto"}}}},"404":{"description":"DEFAULT_CURRENCY_NOT_FOUND — no default currency configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get default currency","tags":["Common - Monedas"]}},"/v1/currencies/default-id":{"get":{"description":"Returns the configured default currency id.","operationId":"CurrenciesController_getDefaultId","parameters":[],"responses":{"200":{"description":"Object with default currency id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DefaultCurrencyIdResponseDto"}}}}},"summary":"Get default currency id","tags":["Common - Monedas"]}},"/v1/currencies/favorites":{"get":{"description":"Returns the list of configured favorite currency ids.","operationId":"CurrenciesController_getFavoriteIds","parameters":[],"responses":{"200":{"description":"Object with list of favorite currency ids","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FavoriteCurrencyIdsResponseDto"}}}}},"summary":"Get favorite currency ids","tags":["Common - Monedas"]}},"/v1/currencies/{id}":{"get":{"description":"Returns a single currency by id; 404s if it does not exist.","operationId":"CurrenciesController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Currency id","schema":{"type":"number"}}],"responses":{"200":{"description":"Currency","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrencyResponseDto"}}}},"404":{"description":"CURRENCY_NOT_FOUND — currency does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get currency by id","tags":["Common - Monedas"]}},"/v1/certificates":{"get":{"description":"Get every certificate associated with your organization, including ones that are still being set up. Use `GET /certificates/active` when you only need the one currently in use for invoicing.","operationId":"CertificatesController_findAll","parameters":[],"responses":{"200":{"description":"List of certificates","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CertificateResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List certificates","tags":["Common - Certificados"]},"post":{"description":"Begin the certificate setup flow. POST with a `name` and the API will generate a CSR for you. Next, download the CSR via `GET /certificates/:id/csr`, upload it to AFIP, and post the `.crt` AFIP gives back via `POST /certificates/:id/upload-crt`.","operationId":"CertificatesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCertificateDto"}}}},"responses":{"201":{"description":"Certificate created — download the CSR next","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponseDto"}}}},"400":{"description":"ORGANIZATION_WITHOUT_TAX_ID — the organization has no tax ID (CUIT), so there is nothing to put in the CSR. ELECTRONIC_EMISSION_NOT_AVAILABLE — AFIP certificates only exist for countries with electronic emission (Argentina); Spain is self-managed. FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ORGANIZATION_NOT_FOUND — caller's organization no longer exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Start a new certificate","tags":["Common - Certificados"]}},"/v1/certificates/active":{"get":{"description":"Get the certificate currently used to authorize receipts with AFIP. A 404 means you don't have a valid certificate set up — receipts will still be created but will stay in `PENDIENTE_AFIP` until you complete the certificate flow (`POST /certificates` → upload CSR to AFIP → `POST /certificates/:id/upload-crt`).","operationId":"CertificatesController_findActive","parameters":[],"responses":{"200":{"description":"Active certificate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponseDto"}}}},"404":{"description":"No active certificate"}},"security":[{"apiKey":[]}],"summary":"Get the active certificate","tags":["Common - Certificados"]}},"/v1/certificates/expiration-status":{"get":{"description":"Use this to drive an expiration banner or renewal reminder in your UI. For each certificate you get back days remaining, whether it's expired, and whether it's ready to use. Plan renewals ahead of time — AFIP issuance can take a few days.","operationId":"CertificatesController_getExpirationStatus","parameters":[],"responses":{"200":{"description":"Per-certificate expiration info","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CertificateExpirationStatusDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Check expiration for every certificate","tags":["Common - Certificados"]}},"/v1/certificates/{id}/csr":{"get":{"description":"Download the CSR file for this certificate so you can upload it to AFIP's certificate portal. Once AFIP gives you back a `.crt`, finish setup by posting it via `POST /certificates/:id/upload-crt`.","operationId":"CertificatesController_getCsr","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"CSR file download"},"404":{"description":"Certificate or CSR file not found"}},"security":[{"apiKey":[]}],"summary":"Download CSR","tags":["Common - Certificados"]}},"/v1/certificates/{id}/crt":{"get":{"description":"Download the AFIP-signed `.crt` for this certificate — useful for backups or to inspect when the certificate expires.","operationId":"CertificatesController_getCrt","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"CRT file download"},"404":{"description":"Certificate or CRT file not found"}},"security":[{"apiKey":[]}],"summary":"Download CRT","tags":["Common - Certificados"]}},"/v1/certificates/{id}":{"get":{"description":"Get a certificate's name, status, and expiration date. To download the CSR or CRT file, use the `/csr` and `/crt` sub-paths.","operationId":"CertificatesController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Certificate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get certificate by id","tags":["Common - Certificados"]},"patch":{"description":"Rename a certificate or toggle `isActive` to switch which certificate is used for invoicing. Only one should be active at a time.","operationId":"CertificatesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCertificateDto"}}}},"responses":{"200":{"description":"Updated certificate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponseDto"}}}},"404":{"description":"CERTIFICATE_NOT_FOUND — certificate does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update certificate","tags":["Common - Certificados"]},"delete":{"description":"Remove a certificate you no longer need (e.g. an expired one you've already replaced). If you delete the active certificate before uploading a replacement, receipts can still be created but will stay in `PENDIENTE_AFIP` — they won't be authorized by AFIP until a new certificate is active.","operationId":"CertificatesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CERTIFICATE_NOT_FOUND — certificate does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete certificate","tags":["Common - Certificados"]}},"/v1/certificates/{id}/validate-connection":{"post":{"description":"Run a quick check against AFIP to confirm the certificate works before you rely on it for real receipts. Both domestic invoicing (WSFE) and export invoicing (WSFEX) are checked, but only the services your organization needs count towards `success`: WSFE is always required, WSFEX only when you have an active export receipt book. Each service reports whether it authenticated, whether it is `required`, and if it failed, the error message AFIP returned. Run this right after uploading a CRT.","operationId":"CertificatesController_validateConnection","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"`{ success, environment, services: { wsfe, wsfex } }`. `success` is `true` when every `required` service passes; a non-required service (WSFEX without an export receipt book) may fail without affecting it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateValidateConnectionResponseDto"}}}},"400":{"description":"Validation failed. Codes: CRT_OR_P12_MISSING. ELECTRONIC_EMISSION_NOT_AVAILABLE — AFIP certificates only exist for countries with electronic emission (Argentina); Spain is self-managed. FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CERTIFICATE_NOT_FOUND — certificate does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Validate certificate against AFIP","tags":["Common - Certificados"]}},"/v1/certificates/{id}/upload-crt":{"post":{"description":"Finish setting up the certificate by uploading the `.crt` AFIP gave you when you submitted the CSR (PEM or DER). The file must be the one issued for this certificate's CSR — a `.crt` issued for another key is rejected with `CRT_DOES_NOT_MATCH_CSR` and nothing is stored. After this call, the certificate is ready to use — run `POST /certificates/:id/validate-connection` to double-check.","operationId":"CertificatesController_uploadCrt","parameters":[{"name":"id","required":true,"in":"path","description":"Certificate id","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["crt"],"properties":{"crt":{"type":"string","format":"binary","description":"The `.crt` file you downloaded from AFIP."}}}}}},"responses":{"200":{"description":"Certificate is now ready to use","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateResponseDto"}}}},"400":{"description":"Validation failed. Codes: NO_FILE_PROVIDED, PRIVATE_KEY_NOT_IN_STORAGE. CRT_INVALID — the file is not an X.509 certificate (PEM or DER). CRT_DOES_NOT_MATCH_CSR — the `.crt` was issued for another key (e.g. a previous CSR); download from ARCA the certificate issued for this certificate's CSR. Nothing is stored when the upload is rejected. ELECTRONIC_EMISSION_NOT_AVAILABLE — AFIP certificates only exist for countries with electronic emission (Argentina); Spain is self-managed. FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CERTIFICATE_NOT_FOUND — certificate does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Upload AFIP-signed CRT","tags":["Common - Certificados"]}},"/v1/locations":{"get":{"description":"Get the list of locations to populate the location dropdown when creating a customer, branch, or receipt. Returns Argentine locations by default; pass `country_code=ES` for the Spanish provinces. Pass `onlyExport=true` when the user is issuing an export invoice and needs to pick a foreign destination. Use `nombre` to narrow the list as the user types.","operationId":"LocationsController_findAll","parameters":[{"name":"nombre","required":false,"in":"query","description":"Filter by name (case-insensitive partial match) — pair with the user's search input","schema":{"type":"string"}},{"name":"onlyExport","required":false,"in":"query","description":"Pass `true` to get foreign destinations for export invoicing. Omit (or `false`) for Argentine locations.","schema":{"type":"boolean"}},{"name":"country_code","required":false,"in":"query","description":"ISO 3166-1 alpha-2 of the country whose provinces to list. Default `AR` (the Argentine list, unchanged). `ES` lists the 52 Spanish provinces (50 provincias + Ceuta + Melilla; `afipData` holds the INE code 01–52, `province` the autonomous community). Pass the organization's `countryCode`. `onlyExport` is an Argentine (AFIP export invoice) concept: with any other country it returns an empty list. Not two letters → 400 INVALID_COUNTRY_CODE.","schema":{"type":"string"}}],"responses":{"200":{"description":"List of locations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LocationResponseDto"}}}}},"400":{"description":"INVALID_COUNTRY_CODE — country_code is not an ISO alpha-2 code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"List locations","tags":["Common - Localidades"]}},"/v1/locations/default":{"get":{"description":"Get the location to pre-select on new customer/branch forms. Returns 404 when no default has been configured — fall back to letting the user pick from the full list.","operationId":"LocationsController_findDefault","parameters":[],"responses":{"200":{"description":"Default location","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationResponseDto"}}}},"404":{"description":"DEFAULT_LOCATION_NOT_FOUND — no default location configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get the default location","tags":["Common - Localidades"]}},"/v1/locations/{id}":{"get":{"description":"Get a single location's details — useful when you have an id stored on a customer/branch/receipt and need to display its name.","operationId":"LocationsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Location id","schema":{"type":"number"}}],"responses":{"200":{"description":"Location","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationResponseDto"}}}},"404":{"description":"LOCATION_NOT_FOUND — location does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get location by id","tags":["Common - Localidades"]}},"/v1/combos":{"get":{"description":"Returns an empty list — combos are fetched by id. Use `GET /combos/:id/items` with the id of the list you need (5 for receipt types, 6 for sale conditions, etc.).","operationId":"CombosController_findAll","parameters":[],"responses":{"200":{"description":"Empty list","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ComboResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List combos","tags":["Common - Combos"]}},"/v1/combos/{id}/items":{"get":{"description":"Fetch the items of a combo to populate a dropdown. Show `data` to the user; send the item's `id` when creating a receipt or customer that needs this value. The IVA combo (9) returns every rate by default, because a Monotributista organization still needs them to load supplier invoices, products and reports. A sales form that wants the catalogue the organization can sell with sends `organization_is_monotributista=true`: if the organization is really Monotributista only *Sin IVA* is returned.","operationId":"CombosController_getItems","parameters":[{"name":"id","required":true,"in":"path","description":"Combo id (e.g. 5 = receipt types, 6 = sale conditions)","schema":{"type":"number"}},{"name":"country_code","required":false,"in":"query","description":"Scope the catalogue to this country instead of the caller's organization. For the create-organization form, where the country being chosen is not the country you are currently in — without it the form offers the catalogue of the org you happen to be signed into.","schema":{"type":"string"}},{"name":"organization_is_monotributista","required":false,"in":"query","description":"Send `true` from a SALES form to get the catalogue a Monotributista can sell with (IVA combo: only *Sin IVA*). The server checks the organization's real tax regime, so the value only opts in — a Responsable Inscripto organization still gets every rate. Omit it everywhere else (purchases, products, reports).","schema":{"type":"string"}}],"responses":{"200":{"description":"List of combo items","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ComboItemResponseDto"}}}}},"404":{"description":"COMBO_NOT_FOUND — combo does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get combo items","tags":["Common - Combos"]}},"/v1/combos/{id}":{"get":{"description":"Get the combo's name and description. To list the items the user can pick from, call `GET /combos/:id/items` instead.","operationId":"CombosController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Combo id","schema":{"type":"number"}}],"responses":{"200":{"description":"Combo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComboResponseDto"}}}},"404":{"description":"COMBO_NOT_FOUND — combo does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get combo by id","tags":["Common - Combos"]}},"/v1/exchange-rates":{"get":{"description":"Get the exchange rate to suggest when invoicing or paying in a foreign currency. Pass the target currency (`to`) and use the rate from the response. When there is no rate for the requested day yet (e.g. before the daily 09:00 sync), the latest earlier rate is returned instead — compare the response's `date` with the day you asked for and show it to your user. The response is `null` when no rate is available at all — show your user a manual-entry input or block the operation when that happens. Organizations without an AFIP connection never wait on a live AFIP query.","operationId":"ExchangeRatesController_getRate","parameters":[{"name":"from","required":false,"in":"query","description":"Source currency id. Omit to use your organization's default currency.","schema":{"type":"string"}},{"name":"to","required":true,"in":"query","description":"Target currency id.","schema":{"type":"string"}},{"name":"date","required":false,"in":"query","description":"ISO date — defaults to today in Argentina (America/Buenos_Aires). Use the date the receipt is issued on.","schema":{"type":"string"}}],"responses":{"200":{"description":"Exchange rate (its `date` may be earlier than the requested day), or `null` when none is available","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExchangeRateResponseDto"},{"type":"null"}]}}}},"400":{"description":"Validation failed. Codes: INVALID_FROM_CURRENCY, TO_CURRENCY_REQUIRED, INVALID_TO_CURRENCY, INVALID_DATE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Get exchange rate","tags":["Common - Cotizaciones"]}},"/v1/taxpayer-registries/{taxId}/fce-receiver":{"get":{"description":"Whether a receipt must be a Factura de Crédito Electrónica is decided by Peakly on confirm, from the customer's padrón entry and the receipt total — you send the kind of receipt (`factura`, `nota_credito`, `nota_debito`) and nothing else. This endpoint exists so you can show the answer in your own UI ahead of time; you do not need to call it, and its answer does not change what you send. Pass the receipt's total and the customer's CUIT.","operationId":"TaxpayerRegistriesController_isFceReceiver","parameters":[{"name":"taxId","required":true,"in":"path","description":"Customer's CUIT (companies) or CUIL (individuals) — 11 digits, no dashes","schema":{"type":"string"}},{"name":"total","required":false,"in":"query","description":"The receipt's total in ARS. Omit (or `0`) to check whether the taxpayer can ever receive FCE, ignoring the amount.","schema":{"type":"string"}}],"responses":{"200":{"description":"`{ taxId, total, isFceReceiver }` — use `isFceReceiver` to decide the receipt type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FceReceiverResponseDto"}}}},"404":{"description":"TAXPAYER_REGISTRY_NOT_FOUND — no registry entry for this CUIT/CUIL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Check FCE eligibility for a taxpayer (informational)","tags":["Common - Padrón"]}},"/v1/taxpayer-registries/{taxId}":{"get":{"description":"Look up a taxpayer to pre-fill a new customer form (fiscal name, tax category, address) or to verify an existing customer's details before issuing a receipt.","operationId":"TaxpayerRegistriesController_findOne","parameters":[{"name":"taxId","required":true,"in":"path","description":"CUIT (companies) or CUIL (individuals) — 11 digits, no dashes","schema":{"type":"string"}}],"responses":{"200":{"description":"Taxpayer details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaxpayerRegistryResponseDto"}}}},"404":{"description":"TAXPAYER_REGISTRY_NOT_FOUND — no taxpayer registered for this CUIT/CUIL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Look up taxpayer by CUIT/CUIL","tags":["Common - Padrón"]}},"/v1/product-categories":{"get":{"description":"Returns the active product categories of the current organization ordered by id, optionally filtered by name (case-insensitive partial match on description).","operationId":"ProductCategoriesController_findAll","parameters":[{"name":"name","required":false,"in":"query","description":"Filter by category name (description, partial match)","schema":{"type":"string"}}],"responses":{"200":{"description":"List of product categories","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductCategoryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List product categories for the current organization","tags":["Stock - Categorías"]},"post":{"description":"Creates a product category (description and active flag) for the current organization and returns the created category.","operationId":"ProductCategoriesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProductCategoryDto"}}}},"responses":{"201":{"description":"Created product category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create product category","tags":["Stock - Categorías"]}},"/v1/product-categories/{id}":{"get":{"description":"Returns a single product category of the current organization by its id; responds 404 if it does not exist or belongs to another organization.","operationId":"ProductCategoriesController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Product category id","schema":{"type":"number"}}],"responses":{"200":{"description":"Product category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryResponseDto"}}}},"404":{"description":"PRODUCT_CATEGORY_NOT_FOUND — product category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get product category by id","tags":["Stock - Categorías"]},"patch":{"description":"Updates the product category's description or active flag for the current organization; returns the updated category or 404 if it does not exist or belongs to another organization.","operationId":"ProductCategoriesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProductCategoryDto"}}}},"responses":{"200":{"description":"Updated product category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCategoryResponseDto"}}}},"404":{"description":"PRODUCT_CATEGORY_NOT_FOUND — product category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update product category","tags":["Stock - Categorías"]},"delete":{"description":"Soft-deletes the product category (sets it inactive) for the current organization; returns 204 on success or 404 if it does not exist or belongs to another organization.","operationId":"ProductCategoriesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PRODUCT_CATEGORY_NOT_FOUND — product category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete product category","tags":["Stock - Categorías"]}},"/v1/products/bulk-drafts":{"post":{"description":"Matches 1-2000 rows against the organization's active products (by barcode, description or id) and stores a preview: per row update / create / unchanged / error with before and after values. Only the fields present in a row change. Nothing is written to products until the draft is confirmed.","operationId":"ProductBulkDraftsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProductBulkDraftDto"}}}},"responses":{"201":{"description":"Draft preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkDraftResponseDto"}}}},"400":{"description":"Validation failed (no rows, too many rows, bad matchBy).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"A row writes named price-list prices and the caller lacks price-lists:manage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a product bulk draft","tags":["Stock - Productos"]}},"/v1/products/bulk-drafts/file":{"post":{"description":"Uploads a CSV / XLSX (max 10 MB, 2000 rows) with a \"Código\" (providerId; matched first, then barcode) or \"Código de barras\" column plus any of \"Precio\", \"Costo\" (+ \"Moneda costo\") and one column per named price list (header = list name, net price). The product export (GET /products/export) is a valid template. Only existing products are updated; unknown keys are error rows. Cost changes need costMethod manual (error rows otherwise). Returns the draft preview plus how each column was read; confirm it with POST /products/bulk-drafts/{id}/confirm.","operationId":"ProductBulkDraftsController_createFromFile","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"201":{"description":"Draft preview and the columns read","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkFileDraftResponseDto"}}}},"400":{"description":"PRODUCT_BULK_FILE_INVALID — no file, no Código / barcode column, nothing to update, no rows or too many rows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"A row writes named price-list prices and the caller lacks price-lists:manage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a price-update bulk draft from a file","tags":["Stock - Productos"]}},"/v1/products/bulk-drafts/{id}":{"get":{"description":"Returns the draft with its summary and every row of the plan.","operationId":"ProductBulkDraftsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkDraftResponseDto"}}}},"404":{"description":"PRODUCT_BULK_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a product bulk draft","tags":["Stock - Productos"]},"delete":{"description":"Marks the draft as discarded; no product changes.","operationId":"ProductBulkDraftsController_discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Discarded draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkDraftResponseDto"}}}},"404":{"description":"PRODUCT_BULK_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"PRODUCT_BULK_DRAFT_NOT_DRAFT — the draft was already confirmed or discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Discard a product bulk draft","tags":["Stock - Productos"]}},"/v1/products/bulk-drafts/{id}/confirm":{"post":{"description":"Recomputes the plan against the current products and applies every non-error row (updates and creations) in one transaction. Error rows are skipped and reported in the response.","operationId":"ProductBulkDraftsController_confirm","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Confirmed draft with the applied plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkDraftResponseDto"}}}},"403":{"description":"A row writes named price-list prices and the caller lacks price-lists:manage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_BULK_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"PRODUCT_BULK_DRAFT_NOT_DRAFT — the draft was already confirmed or discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Confirm a product bulk draft","tags":["Stock - Productos"]}},"/v1/products/bulk-update/preview":{"post":{"description":"Computes, without writing anything, the new unitPrice or costPrice of every product matching the filters (category, supplier via purchase lines, search, ids): value × (1 + percent/100), rounded to 2 decimals, whole units or the nearest 10. Products whose current value is null or 0 are skipped. At most 2000 products.","operationId":"ProductBulkUpdateController_preview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkUpdatePreviewDto"}}}},"responses":{"200":{"description":"Products and their old/new values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkUpdatePreviewResponseDto"}}}},"400":{"description":"Validation failed. Codes: BULK_UPDATE_TOO_MANY, COST_METHOD_NOT_MANUAL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview a bulk price/cost update by percentage","tags":["Stock - Productos"]}},"/v1/products/bulk-update/apply":{"post":{"description":"Recomputes the preview inside one transaction and writes it. unitPrice changes go through the same path as PATCH /products/:id (price history and the default price-list row stay in sync). costPrice is only editable when the organization's costMethod is manual. Send the preview's count as expectedCount to refuse the update if the matching products changed meanwhile.","operationId":"ProductBulkUpdateController_apply","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkUpdateApplyDto"}}}},"responses":{"200":{"description":"Number of products written","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBulkUpdateApplyResponseDto"}}}},"400":{"description":"Validation failed. Codes: BULK_UPDATE_TOO_MANY, COST_METHOD_NOT_MANUAL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"BULK_UPDATE_STALE — the filters now match a different number of products than expectedCount.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Apply a bulk price/cost update by percentage","tags":["Stock - Productos"]}},"/v1/products":{"get":{"description":"Returns a page of products. Use cursor from nextCursor for the next page.","operationId":"ProductsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"name","required":false,"in":"query","description":"Filter by product name (description, partial match)","schema":{"type":"string"}},{"name":"provider_id","required":false,"in":"query","description":"Exact match on the external provider identifier","schema":{"type":"string"}},{"name":"match_brand","required":false,"in":"query","description":"When true, `name` also matches the brand and the manufacturer (partial, case-insensitive). Default false.","schema":{"type":"boolean"}},{"name":"warehouse_id","required":false,"in":"query","description":"Organizations with more than one warehouse: also return each product's stock in this warehouse (`warehouseQuantity`). Ignored otherwise.","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated products (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPageResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List products (cursor-paginated)","tags":["Stock - Productos"]},"post":{"description":"Send the `Idempotency-Key` header to make retries safe: a second request with the same key returns the original product with status 200 and an `Idempotent-Replayed: true` response header. The header value is stored as the product's `providerId`, so it must be unique per organization. Sending both the header and a body `providerId` is rejected with IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT.","operationId":"ProductsController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Idempotency key (max 255 chars). On replay, returns the original product with status 200 and `Idempotent-Replayed: true`.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProductDto"}}}},"responses":{"200":{"description":"Idempotent replay — original product returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponseDto"}}}},"201":{"description":"Created product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponseDto"}}}},"400":{"description":"Validation failed. Codes: PROVIDER_ID_DUPLICATE, IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT, IDEMPOTENCY_KEY_TOO_LONG, COST_METHOD_NOT_MANUAL, COST_CURRENCY_NOT_FOUND, COST_CURRENCY_UNSUPPORTED, COST_PRICE_FOREIGN_REQUIRED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create product","tags":["Stock - Productos"]}},"/v1/products/search":{"get":{"description":"Returns organization products grouped as favorites, recents, and fuzzy-matched results for the optional query (trigram similarity on description; partial match on description, barcode, brand and manufacturer), optionally filtered by category and capped by limit (default 20).","operationId":"ProductsController_search","parameters":[{"name":"q","required":false,"in":"query","description":"Search query (fuzzy match on description; partial match on barcode, brand and manufacturer)","schema":{"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Filter by category ID","schema":{"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Max results, clamped to 1-100 (default 20)","schema":{"type":"number"}}],"responses":{"200":{"description":"Search results with favorites, recents, and matches","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductSearchResultsResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Search products with favorites, recents, and fuzzy matching","tags":["Stock - Productos"]}},"/v1/products/{id}/favorite":{"post":{"description":"Toggles the product's favorite flag for the current organization and returns the resulting isFavorite state; responds 404 if the product does not exist or belongs to another organization.","operationId":"ProductsController_toggleFavorite","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Favorite toggled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductFavoriteResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Toggle product as favorite for the organization","tags":["Stock - Productos"]}},"/v1/products/export":{"get":{"description":"Streams matching organization products as a downloadable CSV file, paging by keyset cursor; supports a search filter on description/barcode and, when is_active=false, includes soft-deleted products (current products only by default). Columns (Spanish headers, same as the product import reads back): Código (providerId), Código de barras, Descripción, Categoría, Unidad de medida, IVA, Tipo, Precio, Costo (in Moneda costo), Moneda costo (empty = organization currency), Stock mínimo, Marca, Fabricante, Stock actual (no se importa — informational, ignored by the import). Organizations with combo / kit products also get Componentes (`CÓDIGO x CANTIDAD; …`), and Tipo reads Combo on those rows.","operationId":"ProductsController_exportCsv","parameters":[{"name":"search","required":false,"in":"query","description":"Filter by description or barcode (partial match)","schema":{"type":"string"}},{"name":"is_active","required":false,"in":"query","description":"When false, include soft-deleted products. Default true (only current products).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export products as CSV (cursor-based, streaming)","tags":["Stock - Productos"]}},"/v1/products/{id}":{"get":{"description":"Returns a single product of the current organization by its id, including category, VAT rate, and unit of measure; responds 404 if it does not exist or belongs to another organization.","operationId":"ProductsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get product by id","tags":["Stock - Productos"]},"patch":{"description":"Updates the product for the current organization, enforcing providerId uniqueness; returns the updated product or 404 if it does not exist or belongs to another organization.","operationId":"ProductsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProductDto"}}}},"responses":{"200":{"description":"Updated product","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponseDto"}}}},"400":{"description":"Validation failed. Codes: PROVIDER_ID_DUPLICATE, COST_METHOD_NOT_MANUAL, COST_CURRENCY_NOT_FOUND, COST_CURRENCY_UNSUPPORTED, COST_PRICE_FOREIGN_REQUIRED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update product","tags":["Stock - Productos"]},"delete":{"description":"Soft-deletes the product (sets deleted_at) for the current organization; idempotent, returns 204 on success or 404 if it does not exist or belongs to another organization. A component of a combo cannot be deleted (409).","operationId":"ProductsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"PRODUCT_IN_COMBO — the product is a component of a combo; remove it from the combo first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete product","tags":["Stock - Productos"]}},"/v1/products/{id}/components":{"put":{"description":"Replaces the composition of a combo / kit product: a product made of other products, sold with its own price and code but with no stock of its own. Selling one moves its components' stock (component quantity × units sold); its cost is derived and kept up to date (Σ component cost × quantity, null while a component has no cost). A non-empty list makes the product a combo; an empty list turns it back into a simple product. Rules: up to 50 components of the same organization, not repeated, not the product itself; combos do not nest; a product with stock or with a foreign-currency cost cannot become a combo.","operationId":"ProductsController_setComponents","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetProductComponentsDto"}}}},"responses":{"200":{"description":"The product with its composition","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductResponseDto"}}}},"400":{"description":"Validation failed. Codes: PRODUCT_COMBO_INVALID_COMPONENT, PRODUCT_COMBO_NESTED, PRODUCT_COMBO_HAS_STOCK, PRODUCT_COMBO_FOREIGN_COST.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set a product's combo components","tags":["Stock - Productos"]}},"/v1/products/{productId}/stock-changes":{"post":{"description":"Records a manual stock movement for the product (positive or negative quantity); requires stock tracking enabled for the organization. With more than one warehouse, `warehouseId` picks the warehouse (default: the primary).","operationId":"StockController_addManualAdjustment","parameters":[{"name":"productId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddManualStockChangeDto"}}}},"responses":{"201":{"description":"Created stock movement","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockChangeResponseDto"}}}},"400":{"description":"Validation failed. Codes: STOCK_TRACKING_DISABLED, STOCK_NOT_APPLICABLE_TO_SERVICE, INSUFFICIENT_STOCK, PRODUCT_COMBO_HAS_NO_STOCK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization. WAREHOUSE_NOT_FOUND — `warehouseId` is not an active warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Add a manual stock adjustment","tags":["Stock - Movimientos"]},"get":{"description":"Returns the paginated stock movement history for the product with a total count; requires stock tracking enabled for the organization. For a combo / kit product (no stock of its own) it returns the movements of its components that came from selling it.","operationId":"StockController_getStockHistory","parameters":[{"name":"productId","required":true,"in":"path","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based)","schema":{"default":1,"type":"number"}},{"name":"limit","required":false,"in":"query","description":"Items per page","schema":{"default":20,"type":"number"}},{"name":"type","required":false,"in":"query","description":"Filter by stock change type (SALE, PURCHASE, MANUAL, TRANSFER, DELIVERY_NOTE)","schema":{"type":"string"}},{"name":"warehouse_id","required":false,"in":"query","description":"Only the movements of this warehouse (multi-warehouse organizations; ignored otherwise). The primary warehouse's id returns the movements recorded on it.","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated stock movements with total count","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockHistoryPageResponseDto"}}}},"400":{"description":"STOCK_TRACKING_DISABLED — stock tracking is not enabled for this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get stock movement history for a product","tags":["Stock - Movimientos"]}},"/v1/stock-syncs":{"post":{"description":"Matches up to 5000 rows (key + ABSOLUTE target quantity) against the organization's active products and stores a draft preview. Nothing changes until the draft is confirmed; drafts expire 24 h after creation.","operationId":"StockSyncController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStockSyncDto"}}}},"responses":{"201":{"description":"Draft preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}}},"400":{"description":"Validation failed (more than 5000 rows, bad matchBy).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouseId` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a stock sync draft","tags":["Stock - Sincronización"]},"get":{"description":"Returns the organization's stock sync drafts, newest first, with their summary (items omitted).","operationId":"StockSyncController_list","parameters":[{"name":"status","required":false,"in":"query","description":"Filter by status (expired = pending past its 24 h)","schema":{"type":"string","enum":["pending","applied","discarded","expired"]}},{"name":"limit","required":false,"in":"query","schema":{"maximum":100,"default":20,"type":"number"}}],"responses":{"200":{"description":"Drafts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List stock sync drafts","tags":["Stock - Sincronización"]}},"/v1/stock-syncs/products":{"get":{"description":"Physical count sheet: the organization's active, stock-carrying products (services excluded) with their current stock and category, ordered by description and paginated (page_size up to 500). Filters: search (description, barcode or provider id), category_id and supplier_id (products with any purchase line from that supplier). With more than one warehouse, each product also carries its stock in warehouse_id or, omitted, in the primary warehouse (warehouseQuantity); 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization.","operationId":"StockSyncController_listCountSheet","parameters":[{"name":"search","required":false,"in":"query","description":"Substring of the description, barcode or provider id","schema":{"example":"lavandina","type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category","schema":{"example":3,"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Only products bought from this supplier (any non-deleted purchase line)","schema":{"example":7,"type":"number"}},{"name":"page","required":false,"in":"query","schema":{"minimum":1,"default":1,"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"maximum":500,"default":100,"type":"number"}},{"name":"warehouse_id","required":false,"in":"query","description":"Warehouse whose stock each product carries in `warehouseQuantity`, to count one warehouse; omitted = the primary warehouse. Organizations with more than one warehouse; ignored otherwise.","schema":{"type":"number"}}],"responses":{"200":{"description":"Products with their current stock","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockCountSheetResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List products to count","tags":["Stock - Sincronización"]}},"/v1/stock-syncs/{id}":{"get":{"description":"Returns the draft with its matched items and unmatched rows; a pending draft older than 24 h reads as expired.","operationId":"StockSyncController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}}},"404":{"description":"STOCK_SYNC_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a stock sync draft","tags":["Stock - Sincronización"]},"put":{"description":"Re-matches the given rows (same shape as create) against the products now and replaces the draft preview; the 24 h expiry restarts. Omitted source/matchBy keep their stored value. Only pending, non-expired drafts can be updated. Used to save a physical count in progress.","operationId":"StockSyncController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStockSyncDto"}}}},"responses":{"200":{"description":"Updated draft preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}}},"400":{"description":"Validation failed (more than 5000 rows, bad matchBy).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"STOCK_SYNC_NOT_FOUND; WAREHOUSE_NOT_FOUND — `warehouseId` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"Codes: STOCK_SYNC_NOT_PENDING, STOCK_SYNC_EXPIRED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Replace the rows of a stock sync draft","tags":["Stock - Sincronización"]}},"/v1/stock-syncs/{id}/confirm":{"post":{"description":"Sets each matched product to its target stock in one transaction and records one MANUAL stock movement per product whose stock changes. The delta is computed against the stock at confirm time; products that moved since the draft are reported as drift. With more than one warehouse, the target is the stock of the draft's warehouse (default: the primary) and only that warehouse moves.","operationId":"StockSyncController_confirm","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Applied draft with its result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}}},"404":{"description":"STOCK_SYNC_NOT_FOUND; WAREHOUSE_NOT_FOUND — the draft's warehouse was archived since.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"Codes: STOCK_SYNC_NOT_PENDING, STOCK_SYNC_EXPIRED, STOCK_TRACKING_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Confirm a stock sync draft","tags":["Stock - Sincronización"]}},"/v1/stock-syncs/{id}/discard":{"post":{"description":"Marks a pending draft as discarded; no stock changes.","operationId":"StockSyncController_discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Discarded draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}}},"404":{"description":"STOCK_SYNC_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"Codes: STOCK_SYNC_NOT_PENDING, STOCK_SYNC_EXPIRED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Discard a stock sync draft","tags":["Stock - Sincronización"]}},"/v1/stock/reorder":{"get":{"description":"Stock-tracked products (not services) with a minStock whose quantity is at or below it, ordered by how many units are missing (minStock − quantity). Includes the cost, the last purchase cost and the supplier of the latest purchase. Always on the product's total stock, across every warehouse (no warehouse filter). Empty when the organization does not track stock.","operationId":"StockReportsController_reorder","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on the product description or barcode","schema":{"maxLength":200,"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category (rubro) id","schema":{"example":3,"type":"number"}}],"responses":{"200":{"description":"Products at or below their minimum stock","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockReorderResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List products to restock","tags":["Stock - Movimientos"]}},"/v1/stock/valuation":{"get":{"description":"Stock-tracked products with a non-zero quantity (negative stock included) valued at the organization's effective unit cost per its costMethod (manual: costPrice; last: lastCost; average: avgCost — falling back to costPrice while the calculated cost is empty). Totals add the quantity, the value and the number of products without a cost. With more than one warehouse, warehouse_id values only that warehouse's stock (the unit cost is per product, the same in every warehouse) and echoes it as `warehouse`. Empty when the organization does not track stock.","operationId":"StockReportsController_valuation","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on the product description or barcode","schema":{"maxLength":200,"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category (rubro) id","schema":{"example":3,"type":"number"}},{"name":"warehouse_id","required":false,"in":"query","description":"Report only this warehouse (depósito): quantities are its balance. Organizations with more than one warehouse; ignored otherwise. 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization.","schema":{"example":4,"type":"number"}}],"responses":{"200":{"description":"Valued stock with totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockValuationResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Inventory valuation","tags":["Stock - Movimientos"]}},"/v1/stock/valuation/export":{"get":{"description":"The same report as GET /stock/valuation, as a CSV file (UTF-8 with BOM, comma-separated, dot decimals) with a final totals line.","operationId":"StockReportsController_exportValuation","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on the product description or barcode","schema":{"maxLength":200,"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category (rubro) id","schema":{"example":3,"type":"number"}},{"name":"warehouse_id","required":false,"in":"query","description":"Report only this warehouse (depósito): quantities are its balance. Organizations with more than one warehouse; ignored otherwise. 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization.","schema":{"example":4,"type":"number"}}],"responses":{"200":{"description":"CSV file download"},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export the inventory valuation as CSV","tags":["Stock - Movimientos"]}},"/v1/stock/movements-summary":{"get":{"description":"Per stock-tracked product (services excluded), for a range of Argentina-time days: opening stock, purchases in, purchase returns, sales out, sales returns, net manual adjustments and closing stock — quantities only, from the stock ledger. A movement and its reversal (void, delete, edit) inside the range cancel out. Transfers between warehouses are left out: they never change a product's total. With more than one warehouse, warehouse_id reports only that warehouse: its own movements and balances, plus transfersIn / transfersOut, and echoes it as `warehouse`. Lists products with a movement in the range or a non-zero opening/closing stock, by description, paginated; totals cover every page. Filters: search, category_id, supplier_id (products bought from that supplier), warehouse_id. 400 when the organization does not track stock.","operationId":"StockReportsController_movementsSummary","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on the product description or barcode","schema":{"maxLength":200,"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category (rubro) id","schema":{"example":3,"type":"number"}},{"name":"warehouse_id","required":false,"in":"query","description":"Report only this warehouse (depósito): quantities are its balance. Organizations with more than one warehouse; ignored otherwise. 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization.","schema":{"example":4,"type":"number"}},{"name":"from","required":true,"in":"query","description":"First day of the range (YYYY-MM-DD, Argentina time), inclusive","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":true,"in":"query","description":"Last day of the range (YYYY-MM-DD, Argentina time), inclusive","schema":{"example":"2026-10-31","type":"string"}},{"name":"supplier_id","required":false,"in":"query","description":"Only products bought from this supplier (any line in a non-deleted purchase receipt)","schema":{"example":7,"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based)","schema":{"default":1,"example":1,"type":"number"}},{"name":"page_size","required":false,"in":"query","description":"Products per page","schema":{"maximum":500,"default":100,"example":100,"type":"number"}}],"responses":{"200":{"description":"One page of the summary with totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockMovementsResponseDto"}}}},"400":{"description":"Codes: STOCK_TRACKING_DISABLED (the organization does not track stock), STOCK_INVALID_DATE_RANGE (from after to), or a validation error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Stock movements summary","tags":["Stock - Movimientos"]}},"/v1/stock/movements-summary/export":{"get":{"description":"The same report as GET /stock/movements-summary, every product in one CSV file (UTF-8 with BOM, comma-separated, dot decimals) with a final totals line. Filtered to one warehouse, it adds the transfers in / out columns.","operationId":"StockReportsController_exportMovements","parameters":[{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on the product description or barcode","schema":{"maxLength":200,"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category (rubro) id","schema":{"example":3,"type":"number"}},{"name":"warehouse_id","required":false,"in":"query","description":"Report only this warehouse (depósito): quantities are its balance. Organizations with more than one warehouse; ignored otherwise. 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization.","schema":{"example":4,"type":"number"}},{"name":"from","required":true,"in":"query","description":"First day of the range (YYYY-MM-DD, Argentina time), inclusive","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":true,"in":"query","description":"Last day of the range (YYYY-MM-DD, Argentina time), inclusive","schema":{"example":"2026-10-31","type":"string"}},{"name":"supplier_id","required":false,"in":"query","description":"Only products bought from this supplier (any line in a non-deleted purchase receipt)","schema":{"example":7,"type":"number"}}],"responses":{"200":{"description":"CSV file download"},"400":{"description":"Codes: STOCK_TRACKING_DISABLED (the organization does not track stock), STOCK_INVALID_DATE_RANGE (from after to), or a validation error.","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — `warehouse_id` is not a warehouse of this organization (only checked with more than one warehouse).","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export the stock movements summary as CSV","tags":["Stock - Movimientos"]}},"/v1/stock/transfers":{"post":{"description":"Moves quantities of one or more products from one warehouse to another, atomically and immediately. The products' total stock and cost do not change. Requires stock tracking and more than one warehouse. With forceStock on, the source warehouse cannot go below zero; without it the move is recorded even if the source goes negative (same rule as manual adjustments). Duplicated products are summed.","operationId":"StockTransfersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStockTransferDto"}}}},"responses":{"201":{"description":"The transfer, with its lines.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockTransferResponseDto"}}}},"400":{"description":"Codes: STOCK_TRACKING_DISABLED, MULTI_WAREHOUSE_DISABLED, TRANSFER_SAME_WAREHOUSE, STOCK_NOT_APPLICABLE_TO_SERVICE, INSUFFICIENT_STOCK, INVALID_STOCK_TRANSFER. A malformed body (no lines, a quantity ≤ 0, a bad date, an unknown field…) is INVALID_STOCK_TRANSFER with a Spanish message and every problem in details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — a warehouse is unknown, archived or of another organization; PRODUCT_NOT_FOUND — a product is not of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Transfer stock between warehouses","tags":["Stock - Depósitos"]},"get":{"description":"The organization's transfers between warehouses, newest first, without their lines. Filters: a warehouse (as source or destination), a product, a date range. Requires stock tracking.","operationId":"StockTransfersController_list","parameters":[{"name":"warehouse_id","required":false,"in":"query","description":"Transfers out of or into this warehouse.","schema":{"type":"number"}},{"name":"product_id","required":false,"in":"query","description":"Transfers that move this product.","schema":{"type":"number"}},{"name":"from","required":false,"in":"query","description":"From date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"To date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-10-31","type":"string"}},{"name":"page","required":false,"in":"query","schema":{"default":1,"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockTransferListResponseDto"}}}},"400":{"description":"STOCK_TRACKING_DISABLED — stock tracking is off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List stock transfers","tags":["Stock - Depósitos"]}},"/v1/stock/transfers/{id}":{"get":{"description":"A transfer with its lines. Requires stock tracking.","operationId":"StockTransfersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockTransferResponseDto"}}}},"400":{"description":"STOCK_TRACKING_DISABLED — stock tracking is off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"STOCK_TRANSFER_NOT_FOUND — not a transfer of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a stock transfer","tags":["Stock - Depósitos"]}},"/v1/stock/transfers/{id}/void":{"post":{"description":"Puts every quantity of the transfer back where it came from, atomically: the destination gives back and the source receives, the products' total stock and cost do not change, and the transfer becomes `voided` with its `voidedAt`. The ledger keeps the original rows and adds one reversal per row. Requires stock tracking and more than one warehouse, and both warehouses still active. With forceStock on, it is rejected if the destination no longer has the quantities (sold or moved since).","operationId":"StockTransfersController_void","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"The voided transfer, with its lines.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockTransferResponseDto"}}}},"400":{"description":"Codes: STOCK_TRACKING_DISABLED, MULTI_WAREHOUSE_DISABLED, INSUFFICIENT_STOCK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"STOCK_TRANSFER_NOT_FOUND — not a transfer of this organization; WAREHOUSE_NOT_FOUND — one of its warehouses was archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"STOCK_TRANSFER_ALREADY_VOIDED — the transfer was already voided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void a stock transfer","tags":["Stock - Depósitos"]}},"/v1/price-lists/default":{"get":{"description":"Lists every active product's default effective price (default price_list_items row, else products.unit_price). Pass format=csv to stream a CSV download (always the full list). Pass `cursor` and/or `page_size` to page the JSON response instead of materializing the whole catalogue (response becomes `{ data, nextCursor, hasMore }`); omit both to keep the legacy bare-array response.","operationId":"PriceListsController_getDefault","parameters":[{"name":"format","required":false,"in":"query","description":"When 'csv', streams a CSV download (full list, not paginated)","schema":{"enum":["csv"],"type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor (product id). Presence of this or page_size switches to the paginated response shape.","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size, 1-500 (default 50). Presence of this or cursor switches to the paginated response shape.","schema":{"type":"number"}}],"responses":{"200":{"description":"Default price list — bare array by default, or `{ data, nextCursor, hasMore }` when cursor/page_size is passed","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PriceListItemResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Default price list (one row per product with a default price)","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/customers/{id}":{"get":{"description":"Resolves each active product's price via the customer > economic group > default > unit_price cascade. Pass format=csv to stream a CSV download (always the full list). Pass `cursor` and/or `page_size` to page the JSON response instead of materializing the whole catalogue (response becomes `{ data, nextCursor, hasMore }`); omit both to keep the legacy bare-array response.","operationId":"PriceListsController_getForCustomer","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"format","required":false,"in":"query","schema":{"enum":["csv"],"type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor (product id). Presence of this or page_size switches to the paginated response shape.","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size, 1-500 (default 50). Presence of this or cursor switches to the paginated response shape.","schema":{"type":"number"}}],"responses":{"200":{"description":"Effective customer price list — bare array by default, or `{ data, nextCursor, hasMore }` when cursor/page_size is passed","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PriceListItemResponseDto"}}}}},"400":{"description":"CUSTOMER_NOT_FOUND — customer does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Effective price list for a customer (customer > group > default cascade)","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/economic-groups/{id}":{"get":{"description":"Resolves each active product's price via the economic group > default > unit_price cascade. Pass format=csv to stream a CSV download (always the full list). Pass `cursor` and/or `page_size` to page the JSON response instead of materializing the whole catalogue (response becomes `{ data, nextCursor, hasMore }`); omit both to keep the legacy bare-array response.","operationId":"PriceListsController_getForEconomicGroup","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"format","required":false,"in":"query","schema":{"enum":["csv"],"type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor (product id). Presence of this or page_size switches to the paginated response shape.","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size, 1-500 (default 50). Presence of this or cursor switches to the paginated response shape.","schema":{"type":"number"}}],"responses":{"200":{"description":"Effective economic-group price list — bare array by default, or `{ data, nextCursor, hasMore }` when cursor/page_size is passed","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PriceListItemResponseDto"}}}}},"400":{"description":"ECONOMIC_GROUP_NOT_FOUND — economic group does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Effective price list for an economic group (group > default cascade)","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/resolve":{"get":{"description":"Batch version of GET /products/:id/price, for prefilling an invoice. Cascade: customer special price (C) > economic group special price (G) > named price list (L: the customer's, else its group's; `price_list_id` forces one) > default price (D) > products.unit_price (PRODUCT) > null. List prices are net. Returns one row per unique product id, in request order. Ids that do not belong to the organization resolve to `price: null` (no other organization's data is read).","operationId":"PriceListsController_resolvePrices","parameters":[{"name":"product_ids","required":true,"in":"query","description":"Comma-separated product ids (max 200)","schema":{"example":"12,13,14","type":"string"}},{"name":"customer_id","required":false,"in":"query","description":"Resolve against this customer (its special prices, economic group and named price list)","schema":{"type":"number"}},{"name":"price_list_id","required":false,"in":"query","description":"Force this named price list in the L step instead of the customer's","schema":{"type":"number"}}],"responses":{"200":{"description":"Resolved prices","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ResolvedPriceResponseDto"}}}}},"400":{"description":"INVALID_PRODUCT_IDS, INVALID_CUSTOMER_ID or INVALID_PRICE_LIST_ID — malformed query param.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CUSTOMER_NOT_FOUND — customer_id does not exist or belongs to another organization. PRICE_LIST_NOT_FOUND — price_list_id does not exist, was deleted, or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Resolve the effective prices of several products for a customer","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/items":{"put":{"description":"Mirrors v1 promote-on-edit: editing a value that only existed at a broader scope creates a new row at the requested scope. Also appends a product_price_history audit row.","operationId":"PriceListsController_upsertItem","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertPriceListItemDto"}}}},"responses":{"200":{"description":"Upserted price-list item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceListItemResponseDto"}}}},"400":{"description":"Validation failed. Codes: SCOPE_AMBIGUOUS, SCOPE_MISMATCH, SCOPE_INVALID, PRICE_INVALID, PRODUCT_NOT_FOUND, CUSTOMER_NOT_FOUND, ECONOMIC_GROUP_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Upsert a price-list item (default/customer/group) + append price history","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/customers/{id}/items/{productId}":{"delete":{"description":"Deletes the customer-scoped (C) price of the product, so the customer's price falls back to the next step of the cascade (economic group > named price list > default > products.unit_price).","operationId":"PriceListsController_deleteCustomerItem","parameters":[{"name":"id","required":true,"in":"path","description":"Customer id","schema":{"type":"number"}},{"name":"productId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Special price removed"},"404":{"description":"CUSTOMER_NOT_FOUND — customer does not exist or belongs to another org. PRICE_LIST_ITEM_NOT_FOUND — the customer has no special price for this product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Remove a customer's special price for a product","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/economic-groups/{id}/items/{productId}":{"delete":{"description":"Deletes the group-scoped (G) price of the product, so the group's customers fall back to the next step of the cascade (named price list > default > products.unit_price). Customer special prices are untouched.","operationId":"PriceListsController_deleteEconomicGroupItem","parameters":[{"name":"id","required":true,"in":"path","description":"Economic group id","schema":{"type":"number"}},{"name":"productId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Special price removed"},"404":{"description":"ECONOMIC_GROUP_NOT_FOUND — economic group does not exist or belongs to another org. PRICE_LIST_ITEM_NOT_FOUND — the group has no special price for this product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Remove an economic group's special price for a product","tags":["Ventas - Listas de Precios"]}},"/v1/products/{id}/price":{"get":{"description":"Cascade: customer special price (C) > economic group special price (G) > named price list (L: the customer's, else its group's; `price_list_id` forces one) > default price (D) > products.unit_price (PRODUCT) > null. List prices are net.","operationId":"ProductPriceController_resolvePrice","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Resolve against this customer (its special prices, economic group and named price list)","schema":{"type":"number"}},{"name":"price_list_id","required":false,"in":"query","description":"Force this named price list in the L step instead of the customer's","schema":{"type":"number"}}],"responses":{"200":{"description":"Resolved price","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolvedPriceResponseDto"}}}},"400":{"description":"INVALID_CUSTOMER_ID or INVALID_PRICE_LIST_ID — customer_id / price_list_id is present but not a positive integer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — product does not exist or belongs to another organization. CUSTOMER_NOT_FOUND — customer_id does not exist or belongs to another organization. PRICE_LIST_NOT_FOUND — price_list_id does not exist, was deleted, or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Resolve the effective price of a product for a customer","tags":["Ventas - Listas de Precios"]}},"/v1/economic-groups":{"get":{"description":"Returns the organization's economic groups ordered by name.","operationId":"EconomicGroupsController_findAll","parameters":[],"responses":{"200":{"description":"Economic groups","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EconomicGroupResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List economic groups","tags":["Ventas - Grupos Económicos"]},"post":{"description":"Creates an economic group with the given name (and optionally a named price list for its customers) for the current organization.","operationId":"EconomicGroupsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEconomicGroupDto"}}}},"responses":{"201":{"description":"Created economic group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EconomicGroupResponseDto"}}}},"400":{"description":"PRICE_LIST_NOT_FOUND — priceListId does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create economic group","tags":["Ventas - Grupos Económicos"]}},"/v1/economic-groups/{id}":{"get":{"description":"Returns a single economic group; 404s if it does not exist or belongs to another organization.","operationId":"EconomicGroupsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Economic group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EconomicGroupResponseDto"}}}},"404":{"description":"ECONOMIC_GROUP_NOT_FOUND — group does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get economic group by id","tags":["Ventas - Grupos Económicos"]},"put":{"description":"Renames an economic group and optionally sets its named price list (omit priceListId to keep it, null to clear it); 404s if it does not exist or belongs to another organization.","operationId":"EconomicGroupsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEconomicGroupDto"}}}},"responses":{"200":{"description":"Updated economic group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EconomicGroupResponseDto"}}}},"400":{"description":"PRICE_LIST_NOT_FOUND — priceListId does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ECONOMIC_GROUP_NOT_FOUND — group does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update economic group","tags":["Ventas - Grupos Económicos"]},"delete":{"description":"Hard-deletes an economic group; rejected if it still has special prices on active products or active assigned customers. Soft-deleted customers still linked to the group are detached and its special prices on deleted or inactive products are removed in the same transaction.","operationId":"EconomicGroupsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"ECONOMIC_GROUP_IN_USE — group still has special prices on active products or active assigned customers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ECONOMIC_GROUP_NOT_FOUND — group does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete economic group","tags":["Ventas - Grupos Económicos"]}},"/v1/price-lists/lists":{"get":{"description":"The organization's named price lists (not deleted), ordered by name, with their category margins and how many active customers (`customerCount`) and economic groups (`groupCount`) have each list assigned.","operationId":"NamedPriceListsController_findAll","parameters":[],"responses":{"200":{"description":"Named price lists","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NamedPriceListResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List named price lists","tags":["Ventas - Listas de Precios"]},"post":{"description":"With `marginPercent`, every product with a cost is priced net = cost × (1 + margin / 100), rounded; the prices are computed before the response. Without it the list is manual.","operationId":"NamedPriceListsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNamedPriceListDto"}}}},"responses":{"201":{"description":"Created list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListResponseDto"}}}},"409":{"description":"PRICE_LIST_NAME_TAKEN — another list already has this name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a named price list","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/lists/{id}":{"get":{"description":"One list with its category margins and its assigned customer / economic group counts.","operationId":"NamedPriceListsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Named price list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListResponseDto"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a named price list","tags":["Ventas - Listas de Precios"]},"patch":{"description":"Partial update. Changing the margin, rounding or roundOnGross recomputes the list's rule prices before the response (manual prices are kept); `marginPercent: null` turns the list manual.","operationId":"NamedPriceListsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNamedPriceListDto"}}}},"responses":{"200":{"description":"Updated list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListResponseDto"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"PRICE_LIST_NAME_TAKEN — another list already has this name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a named price list","tags":["Ventas - Listas de Precios"]},"delete":{"description":"Soft delete. Customers and economic groups assigned to the list are left without one (their invoices fall back to the default prices).","operationId":"NamedPriceListsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a named price list","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/lists/{id}/category-margins":{"put":{"description":"Replaces the list's per-category margins (a product's own margin beats its category's, which beats the list's) and recomputes the list's rule prices before the response.","operationId":"NamedPriceListsController_setCategoryMargins","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCategoryMarginsDto"}}}},"responses":{"200":{"description":"Updated list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListResponseDto"}}}},"400":{"description":"Validation failed. Codes: CATEGORY_NOT_FOUND, CATEGORY_DUPLICATED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set the category margins of a named price list","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/lists/{id}/items":{"get":{"description":"Every active product with its cost, the margin the rule applies and where it comes from (product, category, list), the net price in the list, the final price with VAT and whether it is rule-derived or manual. `noCost` flags products the rule cannot price. Keyset-paginated by product id.","operationId":"NamedPriceListsController_items","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"Opaque keyset cursor (product id)","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size, 1-500 (default 50)","schema":{"type":"number"}},{"name":"search","required":false,"in":"query","description":"Case-insensitive partial match on description or barcode","schema":{"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category id; `none` = products without a category","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of list items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListItemPageResponseDto"}}}},"400":{"description":"INVALID_CURSOR — cursor is not a non-negative integer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Products of a named price list","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/lists/{id}/export":{"get":{"description":"Streams the same rows as the items endpoint (all pages), honoring `search` and `category_id`. Amounts have 2 decimals with a dot separator; the file is named `lista-precios-<list-name-slug>-<YYYY-MM-DD>.csv`.","operationId":"NamedPriceListsController_export","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"category_id","required":false,"in":"query","description":"Only products of this category id; `none` = products without a category","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"text/csv":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export a named price list as CSV","tags":["Ventas - Listas de Precios"]}},"/v1/price-lists/lists/{id}/items/{productId}":{"put":{"description":"mode=manual fixes the price (net `price`, or `priceWithVat` converted with the product's VAT rate); it beats the rule and is never recomputed. mode=rule hands the product back to the rule, optionally with its own `marginPercent`, and recomputes it before the response.","operationId":"NamedPriceListsController_setItem","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"productId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPriceListItemDto"}}}},"responses":{"200":{"description":"The product as the list shows it","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NamedPriceListItemResponseDto"}}}},"400":{"description":"MANUAL_PRICE_REQUIRED — mode=manual needs exactly one of price / priceWithVat.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRICE_LIST_NOT_FOUND — list does not exist, was deleted, or belongs to another org. PRODUCT_NOT_FOUND — product does not exist or belongs to another org.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set one product of a named price list","tags":["Ventas - Listas de Precios"]}},"/v1/customers":{"get":{"description":"Returns a page of customers. Use cursor from nextCursor for the next page.","operationId":"CustomersController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"search","required":false,"in":"query","description":"Filter by business name, tax ID, or email (partial match)","schema":{"type":"string"}},{"name":"provider_id","required":false,"in":"query","description":"Exact match on the external provider identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated customers (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List customers (cursor-paginated)","tags":["Ventas - Clientes"]},"post":{"description":"Send the `Idempotency-Key` header to make retries safe: a second request with the same key returns the original customer with status 200 and an `Idempotent-Replayed: true` response header. The header value is stored as the customer's `providerId`, so it must be unique per organization. Sending both the header and a body `providerId` is rejected with IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT.","operationId":"CustomersController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Idempotency key (max 255 chars). On replay, returns the original customer with status 200 and `Idempotent-Replayed: true`.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomerDto"}}}},"responses":{"200":{"description":"Idempotent replay — original customer returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}},"201":{"description":"Created customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_CUIT, BUSINESS_NAME_REQUIRED, TAX_CATEGORY_REQUIRED, TAX_CATEGORY_NOT_FOUND, TAX_CATEGORY_NOT_IN_ORG_REGIME, DOCUMENT_TYPE_COMBO_EMPTY, TAX_ID_DUPLICATE, TAX_ID_DUPLICATE_INACTIVE, PROVIDER_ID_DUPLICATE, IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT, IDEMPOTENCY_KEY_TOO_LONG, ORGANIZATION_NOT_FOUND. TAX_ID_DUPLICATE_INACTIVE means the taxId belongs to a deleted customer; its `details` carry `customerId=<id>` so the caller can restore it with PATCH /customers/{id} `{ isActive: true }`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create customer","tags":["Ventas - Clientes"]}},"/v1/customers/lookup-cuit":{"get":{"description":"Validates CUIT and fetches business data from AFIP via system certificate.","operationId":"CustomersController_lookupCuit","parameters":[{"name":"cuit","required":true,"in":"query","description":"CUIT to look up (11 digits, with or without dashes)","schema":{"type":"string"}}],"responses":{"200":{"description":"CUIT lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CuitLookupResponseDto"}}}},"400":{"description":"INVALID_CUIT — malformed or bad check digit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"AFIP_PERSONA_NOT_FOUND — no taxpayer registered in AFIP for this CUIT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"502":{"description":"AFIP_WSCI_ERROR — upstream AFIP (WSCI) failure. See providerMessage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Lookup CUIT for customer auto-fill","tags":["Ventas - Clientes"]}},"/v1/customers/export":{"get":{"description":"Streams all matching customers of the current organization as a downloadable CSV file, paging by keyset cursor; supports search, provider_id, and is_active filters (active only by default).","operationId":"CustomersController_exportCsv","parameters":[{"name":"search","required":false,"in":"query","description":"Filter by business name, tax ID, or email (partial match)","schema":{"type":"string"}},{"name":"is_active","required":false,"in":"query","description":"Include only active customers (default true)","schema":{"type":"boolean"}},{"name":"provider_id","required":false,"in":"query","description":"Exact match on the external provider identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export customers as CSV (cursor-based, streaming)","tags":["Ventas - Clientes"]}},"/v1/customers/{id}/current-account":{"get":{"description":"Movements of one customer (invoices and debit notes as debit; credit notes and collections as credit) with a running balance. `openingBalance` is what the customer owed before `date_from`, and the first row's balance starts from it. Excludes drafts and voided documents. Same data as the `customer_account_statement` MCP tool. Balance is positive when the customer owes money.","operationId":"CustomersController_currentAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Movements from this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Movements up to this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based, default 1)","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}}],"responses":{"200":{"description":"Movements with running balance, opening and final balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerAccountResponseDto"}}}},"404":{"description":"CUSTOMER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Customer current account (Cuenta corriente)","tags":["Ventas - Clientes"]}},"/v1/customers/{id}/current-account/export":{"get":{"description":"Streams every movement in the range (date, type, description, debit, credit, balance) as a CSV file. When `date_from` is given and a balance is carried in, the first row is the opening balance.","operationId":"CustomersController_exportCurrentAccount","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Movements from this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Movements up to this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file download"},"404":{"description":"CUSTOMER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export customer current account as CSV","tags":["Ventas - Clientes"]}},"/v1/customers/{id}":{"get":{"description":"Returns a single customer of the current organization by its id, including tax category, sale condition, location, and document type; responds 404 if it does not exist or belongs to another organization.","operationId":"CustomersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get customer by id","tags":["Ventas - Clientes"]},"patch":{"description":"Updates the customer's master data for the current organization, re-validating CUIT, tax category against the org regime, and taxId/providerId uniqueness; returns the updated customer.","operationId":"CustomersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomerDto"}}}},"responses":{"200":{"description":"Updated customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_CUIT, TAX_CATEGORY_NOT_FOUND, TAX_CATEGORY_NOT_IN_ORG_REGIME, TAX_ID_DUPLICATE, TAX_ID_DUPLICATE_INACTIVE, PROVIDER_ID_DUPLICATE, ORGANIZATION_NOT_FOUND. TAX_ID_DUPLICATE_INACTIVE means the taxId belongs to a deleted customer; its `details` carry `customerId=<id>` so the caller can restore it with PATCH /customers/{id} `{ isActive: true }`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CUSTOMER_NOT_FOUND — customer does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update customer","tags":["Ventas - Clientes"]},"delete":{"description":"Soft-deletes the customer (sets it inactive) for the current organization; returns 204 on success or 404 if it does not exist or belongs to another organization.","operationId":"CustomersController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CUSTOMER_NOT_FOUND — customer does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete customer","tags":["Ventas - Clientes"]}},"/v1/sales/reports/creators":{"get":{"description":"Returns the distinct users (id and full name) that authored at least one sales receipt in the organization, for use as a report filter.","operationId":"SalesReportsController_findCreators","parameters":[],"responses":{"200":{"description":"Array of distinct user creators (id + fullName)","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptCreatorResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List distinct users who created sales receipts for the org","tags":["Ventas - Reportes"]}},"/v1/sales/reports/dashboard-stats":{"get":{"description":"Aggregates sales KPIs, time-series charts grouped by day/week/month and top customers over the date range; summary_only skips per-receipt queries for high-volume orgs.","operationId":"SalesReportsController_getDashboardStats","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"group_by","required":false,"in":"query","schema":{"enum":["day","week","month"],"type":"string"}},{"name":"summary_only","required":false,"in":"query","description":"Skip expensive per-receipt queries for high-volume orgs","schema":{"type":"string"}}],"responses":{"200":{"description":"Dashboard statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardStatsResponseDto"}}}},"400":{"description":"Validation failed. Codes: DATE_RANGE_REQUIRED, INVALID_DATE_FORMAT, INVALID_DATE_RANGE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Dashboard KPIs, charts, and top customers","tags":["Ventas - Reportes"]}},"/v1/sales/reports/vat-sales-book":{"get":{"description":"Cursor-paginated VAT sales book rows for the date range, one row per receipt with discriminated VAT amounts, perceptions and totals. Spanish organizations get the Libro registro de facturas expedidas instead: the page carries `layout: \"ES\"`, a `columns` descriptor ([{ id, label }] in display order, ids = row keys) and EsVatSalesBookRow rows built from the receipt's tax breakdown (bases and cuotas at 21/10/4 %, recargo de equivalencia, exempt / not subject / reverse-charge bases, IRPF); a voided invoice and its rectificativa both appear and cancel out. Argentine pages have no `layout` field.","operationId":"SalesReportsController_getVatSalesBook","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque pagination cursor from a previous page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated VAT book rows (Argentine layout, or `layout: \"ES\"` for Spanish organizations)","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/VatSalesBookPageResponseDto"},{"$ref":"#/components/schemas/EsVatSalesBookPageResponseDto"}]}}}}},"security":[{"apiKey":[]}],"summary":"VAT Sales Book (Libro IVA Ventas)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/vat-sales-book/export":{"get":{"description":"Streams the full VAT sales book for the date range as a CSV download and records a success notification for the user. Spanish organizations get the Libro registro de facturas expedidas columns (Serie/Numero, Tipo, NIF, bases and cuotas 21/10/4 %, recargo, exenta, no sujeta, ISP, IRPF).","operationId":"SalesReportsController_exportVatSalesBook","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export VAT Sales Book as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-product":{"get":{"description":"Cursor-paginated sales aggregated by product and month for the date range, with optional customer_id filter; refused for high-volume orgs.","operationId":"SalesReportsController_getSalesByProduct","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque pagination cursor from a previous page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter to a single customer","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated sales by product rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesByProductPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Sales by Product (aggregated by month)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-product/export":{"get":{"description":"Streams sales aggregated by product and month for the date range as a CSV download, with optional customer_id filter; refused for high-volume orgs.","operationId":"SalesReportsController_exportSalesByProduct","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}},{"name":"customer_id","required":false,"in":"query","description":"Filter to a single customer","schema":{"type":"number"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export Sales by Product as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-product/barcodes":{"get":{"description":"`date_to` is exclusive. Use date_to=2026-07-01 for a full June 2026 report.","operationId":"SalesReportsController_getSalesByProductByBarcodes","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"Exclusive end date","schema":{"example":"2026-01-31","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque pagination cursor from a previous page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter to a single customer","schema":{"type":"number"}},{"name":"barcodes","required":true,"in":"query","description":"Comma-separated product barcodes","schema":{"type":"string"}},{"name":"tax_type_id","required":false,"in":"query","description":"Filter to a single IVA tax type","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated sales by product barcode rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesByProductBarcodePageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Sales by Product filtered by product barcodes","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-product/barcodes/export":{"get":{"description":"`date_to` is exclusive. Use date_to=2026-07-01 for a full June 2026 report.","operationId":"SalesReportsController_exportSalesByProductByBarcodes","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"Exclusive end date","schema":{"example":"2026-01-31","type":"string"}},{"name":"customer_id","required":false,"in":"query","description":"Filter to a single customer","schema":{"type":"number"}},{"name":"barcodes","required":true,"in":"query","description":"Comma-separated product barcodes","schema":{"type":"string"}},{"name":"tax_type_id","required":false,"in":"query","description":"Filter to a single IVA tax type","schema":{"type":"number"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export Sales by Product filtered by product barcodes as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-customer":{"get":{"description":"Cursor-paginated sales accumulated per customer for the date range; refused for high-volume orgs.","operationId":"SalesReportsController_getSalesByCustomer","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque pagination cursor from a previous page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated sales by customer rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesByCustomerPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Sales by Customer (accumulated)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/sales-by-customer/export":{"get":{"description":"Streams sales accumulated per customer for the date range as a CSV download; refused for high-volume orgs.","operationId":"SalesReportsController_exportSalesByCustomer","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export Sales by Customer as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/outstanding-receivables":{"get":{"description":"Cursor-paginated list of receipts with an outstanding balance still pending collection for the organization. The first page (no cursor) also carries `summary`: totals over the whole outstanding set — total pending, overdue vs not yet due, aging buckets by days past due (as of today in Argentina) and the top 10 debtors. Pass `summary_only=true` to get only the summary. In Spanish organizations the rectificativa issued by a void is not listed (its invoice is voided; the pair owes nothing).","operationId":"SalesReportsController_getOutstandingReceivables","parameters":[{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}},{"name":"summary_only","required":false,"in":"query","description":"Return only the summary (data is empty, hasMore false)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Paginated outstanding receivable rows, plus the whole-set summary on the first page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutstandingReceivablePageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Outstanding receivables","tags":["Ventas - Reportes"]}},"/v1/sales/reports/receivables-aging":{"get":{"description":"Accounts-receivable aging over the whole outstanding set, aggregated server-side: pending balance and receipt count per bucket — not yet due, 1–30, 31–60, 61–90 and more than 90 days past the due date (as of today in Argentina) — plus the top 5 overdue debtors, and `upcoming`: the cumulative balance falling due within the next 30 / 60 / 90 days (for cash-flow projections). Issued receipts only; credit notes subtract. `total` equals the dashboard's pending collection figure.","operationId":"SalesReportsController_getReceivablesAging","parameters":[],"responses":{"200":{"description":"Aging buckets, total and top overdue debtors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceivablesAgingResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Receivables aging","tags":["Ventas - Reportes"]}},"/v1/sales/reports/outstanding-receivables/export":{"get":{"description":"Streams all outstanding receivables for the organization as a CSV download.","operationId":"SalesReportsController_exportOutstandingReceivables","parameters":[],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export outstanding receivables as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/iibb":{"get":{"description":"Cursor-paginated Gross Income (IIBB) perceptions aggregated by jurisdiction and month for the date range.","operationId":"SalesReportsController_getIIBB","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque pagination cursor from a previous page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated IIBB rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IIBBPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Gross Income (IIBB) by jurisdiction and month","tags":["Ventas - Reportes"]}},"/v1/sales/reports/iibb/export":{"get":{"description":"Streams the IIBB (Gross Income) perceptions report for the date range as a CSV download.","operationId":"SalesReportsController_exportIIBB","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export IIBB report as CSV","tags":["Ventas - Reportes"]}},"/v1/sales/reports/trends":{"get":{"description":"Returns monthly revenue with MoM/YoY comparisons and a 3-month forecast over the last N months (default 24, clamped 6-36); refused for high-volume orgs.","operationId":"SalesReportsController_getRevenueTrends","parameters":[{"name":"months","required":false,"in":"query","description":"Number of past months to include (default 24)","schema":{"type":"string"}}],"responses":{"200":{"description":"Revenue trend data with forecasting","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevenueTrendsResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Revenue trends with MoM/YoY comparisons and 3-month forecast","tags":["Ventas - Reportes"]}},"/v1/sales/reports/iva-digital/ventas":{"get":{"description":"Streams the AFIP IVA Digital 'Ventas Comprobantes' fixed-width text file for the date range, one line per receipt.","operationId":"SalesReportsController_getIvaDigitalVentas","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}}],"responses":{"200":{"description":"Fixed-width text file"},"400":{"description":"REPORT_NOT_AVAILABLE_FOR_COUNTRY — AFIP/ARCA format, only for organizations that emit electronically through AFIP (Argentina)."}},"security":[{"apiKey":[]}],"summary":"IVA Digital Ventas Comprobantes (fixed-width text)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/iva-digital/ventas-alicuotas":{"get":{"description":"Streams the AFIP IVA Digital 'Ventas Alicuotas' fixed-width text file for the date range, one line per VAT rate on each receipt.","operationId":"SalesReportsController_getIvaDigitalVentasAlicuotas","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-01","type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date (YYYY-MM-DD), inclusive.","schema":{"example":"2026-01-31","type":"string"}}],"responses":{"200":{"description":"Fixed-width text file"},"400":{"description":"REPORT_NOT_AVAILABLE_FOR_COUNTRY — AFIP/ARCA format, only for organizations that emit electronically through AFIP (Argentina)."}},"security":[{"apiKey":[]}],"summary":"IVA Digital Ventas Alicuotas (fixed-width text)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/customer-account/{customerId}":{"get":{"description":"Chronological merge of sales receipts (cargo) and collections (crédito) with running balance. Credit notes are treated as credits. Excludes drafts and voided documents — except in Spanish organizations, where a voided invoice stays as a charge next to the rectificativa that cancels it (the pair nets to zero). Balance is positive when the customer owes money. v1 parity: Mayor de Clientes.","operationId":"SalesReportsController_getCustomerAccount","parameters":[{"name":"customerId","required":true,"in":"path","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number (1-based, default 1)","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","description":"Rows per page (default 50, max 500)","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Filter movements from this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter movements up to this date (YYYY-MM-DD, inclusive)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated customer account movements with running balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerAccountResponseDto"}}}},"404":{"description":"Customer not found in this organization. Code: CUSTOMER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Customer account statement (Cuenta Corriente Cliente)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/monotributo/declaracion-informativa":{"get":{"description":"Provide either `semester` (S1=Ene–Jun / S2=Jul–Dic) + `year` (semestral preset, default) or `date_from` + `date_to` (custom range). Category is the org's CURRENT monotax category (see `caveat`), not necessarily the one in force during the period. `serviciosPublicos` (energía/alquileres/superficie) is not tracked in v2 and is always null.","operationId":"MonotributoReportsController_getDeclaracion","parameters":[{"name":"semester","required":false,"in":"query","schema":{"enum":["S1","S2"],"type":"string"}},{"name":"year","required":false,"in":"query","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Declaración informativa DTO","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonotributoDeclaracionResponseDto"}}}},"400":{"description":"Invalid period. Code: MONOTRIBUTO_INVALID_PERIOD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Monotributo — Declaración Informativa (semestral)","tags":["Ventas - Reportes"]}},"/v1/sales/reports/monotributo/declaracion-informativa/export":{"get":{"description":"Same params as the JSON endpoint. Emits a single flat CSV with a `Seccion` column separating encabezado / ventas / top clientes / compras / top proveedores.","operationId":"MonotributoReportsController_exportDeclaracion","parameters":[{"name":"semester","required":false,"in":"query","schema":{"enum":["S1","S2"],"type":"string"}},{"name":"year","required":false,"in":"query","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file download"},"400":{"description":"Invalid period. Code: MONOTRIBUTO_INVALID_PERIOD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export Monotributo Declaración Informativa as CSV (multi-section)","tags":["Ventas - Reportes"]}},"/v1/purchases/purchase-receipts/applications":{"get":{"description":"Lists NC→invoice applications for the organization, optionally filtered by receipt or credit note.","operationId":"PurchaseReceiptApplicationsController_findAll","parameters":[{"name":"receipt_id","required":false,"in":"query","description":"Filter by applied (discounted) receipt","schema":{"type":"number"}},{"name":"credit_note_id","required":false,"in":"query","description":"Filter by credit note","schema":{"type":"number"}}],"responses":{"200":{"description":"List of applications","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptApplicationResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List credit note applications (imputaciones)","tags":["Compras - Imputaciones"]},"post":{"description":"Increases total_paid on both receipts. The invoice becomes Pagada when fully covered; the credit note becomes Imputado when fully consumed. No journal entry is generated (v1 parity), except between currencies: with the credit note and the invoice in different currencies (one in the organization's currency) `amount` is in the organization's currency, the foreign side moves amount / exchangeRate and the exchange difference is posted to \"Diferencias de cambio\" (PAN-392b).","operationId":"PurchaseReceiptApplicationsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePurchaseReceiptApplicationDto"}}}},"responses":{"201":{"description":"Created application","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptApplicationResponseDto"}}}},"400":{"description":"Validation failed. Codes: APPLICATION_AMOUNT_INVALID, APPLICATION_SAME_RECEIPT, APPLICATION_NOT_CREDIT_NOTE, APPLICATION_CREDIT_NOTE_INSUFFICIENT_BALANCE, APPLICATION_RECEIPT_INSUFFICIENT_BALANCE, RECEIPT_VOIDED, APPLICATION_CURRENCY_PAIR_NOT_SUPPORTED, EXCHANGE_RATE_REQUIRED, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — credit note or invoice does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Apply a credit note against an invoice (imputación NC→Factura)","tags":["Compras - Imputaciones"]}},"/v1/purchases/purchase-receipts/applications/{id}":{"delete":{"description":"Decreases total_paid on both receipts, resets their statuses to Creada and deletes the application.","operationId":"PurchaseReceiptApplicationsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Reverted and deleted"},"404":{"description":"APPLICATION_NOT_FOUND — application does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Revert a credit note application","tags":["Compras - Imputaciones"]}},"/v1/purchases/purchase-receipts/scan":{"post":{"description":"Upload one or more invoice files (PDF or image). Runs OCR to extract supplier, dates, line items and totals, tries to match the supplier by CUIT, stores the files as attachments, and returns a draft plus the attachment ids. The receipt is NOT created — pass the attachment ids to POST / (create) to link them after the user reviews the data.","operationId":"PurchaseReceiptsController_scan","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","items":{"type":"string","format":"binary"}}}}}}},"responses":{"201":{"description":"Extracted invoice draft + stored attachments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseInvoiceScanResponseDto"}}}},"400":{"description":"Validation failed. Codes: OCR_NO_FILE, ATTACHMENT_INVALID_FILE_TYPE, ATTACHMENT_FILE_TOO_LARGE, OCR_NOT_CONFIGURED, OCR_EXTRACTION_FAILED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Scan invoice files (OCR) to prefill a purchase receipt","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts":{"get":{"description":"Returns a page of purchase receipts. Use cursor from nextCursor for the next page.","operationId":"PurchaseReceiptsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"search","required":false,"in":"query","description":"Filter by number or observation","schema":{"type":"string"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status","schema":{"type":"string"}},{"name":"letter","required":false,"in":"query","description":"Filter by letter (A/B/C)","schema":{"type":"string"}},{"name":"type_id","required":false,"in":"query","description":"Filter by type","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Filter by date from (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by date to (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated purchase receipts (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List purchase receipts (cursor-paginated)","tags":["Compras - Comprobantes"]},"post":{"description":"Creates a purchase receipt, recomputing totals/VAT from detail lines, recording stock (in for facturas, out for NC de compra) and the OC journal entry when accounting is enabled; rejects duplicates.","operationId":"PurchaseReceiptsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePurchaseReceiptDto"}}}},"responses":{"201":{"description":"Created purchase receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_PURCHASE_RECEIPT, SUPPLIER_ID_REQUIRED, TYPE_ID_REQUIRED, LETTER_DOES_NOT_DISCRIMINATE_VAT, PURCHASE_RECEIPT_DUPLICATE, CURRENCY_NOT_FOUND, INVALID_EXCHANGE_RATE, DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE, DISCOUNT_REQUIRES_UNIT_PRICE, PRODUCT_COMBO_NOT_PURCHASABLE, RESPONSIBLE_USER_NOT_IN_ORGANIZATION. INVALID_EXCHANGE_RATE: a currency other than the organization's needs a positive `exchangeRate`. DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE: a line sends both `discount` and `discountAmount`. DISCOUNT_REQUIRES_UNIT_PRICE: a discounted line has no `quantity` and `unitPrice`. PRODUCT_COMBO_NOT_PURCHASABLE: a line is a combo product (buy its components).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create purchase receipt (with optional details)","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/export":{"get":{"description":"Streams a cursor-paginated CSV of purchase receipts filtered by supplier, status and date range; defaults to active (non-deleted) receipts unless active_only=false.","operationId":"PurchaseReceiptsController_exportCsv","parameters":[{"name":"supplier_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}},{"name":"active_only","required":false,"in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export purchase receipts as CSV","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/unpaid/{supplierId}":{"get":{"description":"Returns the supplier's non-deleted receipts with a pending balance (total > total_paid) so a payment order can be applied to them.","operationId":"PurchaseReceiptsController_findUnpaidBySupplier","parameters":[{"name":"supplierId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"List of unpaid purchase receipts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Get unpaid receipts for a supplier (for payment orders)","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/{id}":{"get":{"description":"Returns a single non-deleted purchase receipt with its supplier, type, purchase condition and detail lines.","operationId":"PurchaseReceiptsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Purchase receipt with details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get purchase receipt by id (with details)","tags":["Compras - Comprobantes"]},"patch":{"description":"Updates a purchase receipt's fields; rejected if it is voided, paid, or has a payment or credit-note application settled against it (partially paid, or an Imputado credit note), and re-checks for duplicates when supplier/letter/number/type change.","operationId":"PurchaseReceiptsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePurchaseReceiptDto"}}}},"responses":{"200":{"description":"Updated purchase receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: RECEIPT_VOIDED, RECEIPT_PAID, RECEIPT_PARTIALLY_PAID, LETTER_DOES_NOT_DISCRIMINATE_VAT, PURCHASE_RECEIPT_DUPLICATE, CURRENCY_NOT_FOUND, INVALID_EXCHANGE_RATE, INVALID_TYPE_ID. INVALID_EXCHANGE_RATE: a currency other than the organization's needs a positive `exchangeRate`. INVALID_TYPE_ID: `typeId` is not an active purchase comprobante type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update purchase receipt","tags":["Compras - Comprobantes"]},"delete":{"description":"Soft-deletes the receipt (sets deleted_at) and reverses the stock-IN; rejected if it is paid or partially paid.","operationId":"PurchaseReceiptsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"Validation failed. Codes: RECEIPT_PARTIALLY_PAID, RECEIPT_PAID, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete purchase receipt (soft delete)","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/{id}/attachments":{"get":{"description":"Returns the receipt's stored attachments with short-lived signed download URLs; 404s if the receipt is deleted or belongs to another organization.","operationId":"PurchaseReceiptsController_listAttachments","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Attachments with short-lived signed download URLs"},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist, is deleted, or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List a purchase receipt's attachments (with signed URLs)","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/{id}/anular":{"post":{"description":"Marks the receipt Anulada, deletes its auto journal entry and reverses the stock-IN; rejected if it is already voided, paid or partially paid.","operationId":"PurchaseReceiptsController_anular","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided purchase receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: RECEIPT_PARTIALLY_PAID, RECEIPT_ALREADY_VOIDED, RECEIPT_PAID, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before voiding. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) a purchase receipt","tags":["Compras - Comprobantes"]}},"/v1/purchases/purchase-receipts/{id}/details":{"put":{"description":"Replaces every detail line and re-syncs stock (reverses the prior movement, re-records from the new lines); rejected if the receipt is voided, paid, or has a payment or credit-note application settled against it. Line discounts are applied before VAT exactly as on create; header totals are not recalculated here (PATCH the receipt).","operationId":"PurchaseReceiptsController_replaceDetails","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"prices_include_vat","required":false,"in":"query","description":"true when the lines' unitPrice / discountAmount (and total without unitPrice) include VAT; normalized to net, not persisted. Default false.","schema":{"type":"boolean"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptDetailInputDto"}}}}},"responses":{"200":{"description":"Replaced details","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptDetailResponseDto"}}}}},"400":{"description":"Validation failed. Codes: RECEIPT_VOIDED, RECEIPT_PAID, RECEIPT_PARTIALLY_PAID, DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE, DISCOUNT_REQUIRES_UNIT_PRICE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PURCHASE_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Replace all details for a purchase receipt","tags":["Compras - Comprobantes"]}},"/v1/purchases/reports/purchases-by-category":{"get":{"description":"Purchase spend grouped by expense category (rubro) over a date range, netting NC de compra. Uncategorized lines fold into 'Sin rubro'. Optional supplier filter. Excludes voided and deleted receipts.","operationId":"PurchaseReportsController_purchasesByCategory","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"supplier_id","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Spend rows by rubro, highest first","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchasesByCategoryRowResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Compras por Rubro","tags":["Compras - Reportes"]}},"/v1/purchases/reports/vat-book":{"get":{"description":"VAT purchases book for a date range. Credit notes are listed with negative amounts. Excludes voided and deleted receipts.","operationId":"PurchaseReportsController_vatBook","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated VAT book rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VatBookPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Libro IVA Compras","tags":["Compras - Reportes"]}},"/v1/purchases/reports/vat-book/export":{"get":{"description":"Streams the VAT purchases book for a date range as CSV, with credit notes as negative amounts, excluding voided and deleted receipts.","operationId":"PurchaseReportsController_vatBookExport","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"apiKey":[]}],"summary":"Export Libro IVA Compras as CSV","tags":["Compras - Reportes"]}},"/v1/purchases/reports/iva-digital/compras":{"get":{"description":"CITI / IVA Digital Compras REG record — one line per non-voided purchase receipt. Fixed-width AFIP layout (v1 ReporteCitiItem.ToComprasRowString parity). Uses magnitudes (abs).","operationId":"PurchaseReportsController_ivaDigitalCompras","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Fixed-width text file"},"400":{"description":"REPORT_NOT_AVAILABLE_FOR_COUNTRY — AFIP/ARCA format, only for organizations that emit electronically through AFIP (Argentina)."}},"security":[{"apiKey":[]}],"summary":"IVA Digital Compras — Comprobantes (fixed-width text)","tags":["Compras - Reportes"]}},"/v1/purchases/reports/iva-digital/compras-alicuotas":{"get":{"description":"CITI / IVA Digital Compras CBTE record — one line per non-zero IVA bracket (Letra A only). Fixed-width AFIP layout (v1 ReporteCitiItem.ToComprasAlicuotasString parity).","operationId":"PurchaseReportsController_ivaDigitalComprasAlicuotas","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Fixed-width text file"},"400":{"description":"REPORT_NOT_AVAILABLE_FOR_COUNTRY — AFIP/ARCA format, only for organizations that emit electronically through AFIP (Argentina)."}},"security":[{"apiKey":[]}],"summary":"IVA Digital Compras — Alicuotas (fixed-width text)","tags":["Compras - Reportes"]}},"/v1/purchases/reports/supplier-account/{supplierId}":{"get":{"description":"Chronological merge of purchase receipts (debit; credit notes as credit) and non-voided payment orders (credit) with running balance.","operationId":"PurchaseReportsController_supplierAccount","parameters":[{"name":"supplierId","required":true,"in":"path","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated supplier account movements + final balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierAccountPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Cuenta corriente proveedor","tags":["Compras - Reportes"]}},"/v1/purchases/reports/payables-due":{"get":{"description":"Receipts with pending balance (total_paid < total, not voided), ordered by due date with days overdue.","operationId":"PurchaseReportsController_payablesDue","parameters":[{"name":"supplier_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"date_to","required":false,"in":"query","description":"Only receipts due up to this date","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated payables due","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayablesDuePageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Cuentas a pagar por vencimiento","tags":["Compras - Reportes"]}},"/v1/accounting/journal-accounts":{"get":{"description":"Returns the organization's chart of accounts (plan de cuentas).","operationId":"JournalAccountsController_list","parameters":[],"responses":{"200":{"description":"List of journal accounts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/JournalAccountResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List journal accounts (plan de cuentas)","tags":["Accounting - Plan de Cuentas"]},"post":{"description":"Creates a new account in the organization's chart of accounts (plan de cuentas).","operationId":"JournalAccountsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJournalAccountDto"}}}},"responses":{"201":{"description":"Created journal account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalAccountResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a journal account","tags":["Accounting - Plan de Cuentas"]}},"/v1/accounting/journal-accounts/export":{"get":{"description":"Streams the organization's chart of accounts as a downloadable CSV file (Codigo, Nombre, Categoria, Subcategoria, Numero), ordered by category. Opens directly in Excel/Sheets.","operationId":"JournalAccountsController_export","parameters":[],"responses":{"200":{"description":""}},"security":[{"apiKey":[]}],"summary":"Export the chart of accounts (plan de cuentas) as CSV","tags":["Accounting - Plan de Cuentas"]}},"/v1/accounting/journal-accounts/{id}":{"patch":{"description":"Updates an existing account in the chart of accounts.","operationId":"JournalAccountsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateJournalAccountDto"}}}},"responses":{"200":{"description":"Updated journal account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalAccountResponseDto"}}}},"400":{"description":"ACCOUNTING_DISABLED — accounting is not enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"JOURNAL_ACCOUNT_NOT_FOUND — account does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a journal account","tags":["Accounting - Plan de Cuentas"]},"delete":{"description":"Deletes a journal account; fails if the account is already referenced by journal entries (in use).","operationId":"JournalAccountsController_delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Deletion confirmation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalAccountDeletedResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, JOURNAL_ACCOUNT_IN_USE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"JOURNAL_ACCOUNT_NOT_FOUND — account does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a journal account","tags":["Accounting - Plan de Cuentas"]}},"/v1/accounting/fiscal-years":{"get":{"description":"Returns the organization's fiscal years (ejercicios contables) with their open/closed state.","operationId":"FiscalYearsController_list","parameters":[],"responses":{"200":{"description":"List of fiscal years","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FiscalYearResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List fiscal years","tags":["Accounting - Ejercicios"]},"post":{"description":"Creates the fiscal year. If a CLOSED, contiguous predecessor exists (ending the day before this year's start date), its asiento de apertura is materialized automatically in the same transaction (idempotent).","operationId":"FiscalYearsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFiscalYearDto"}}}},"responses":{"201":{"description":"Created fiscal year","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiscalYearResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a fiscal year","tags":["Accounting - Ejercicios"]}},"/v1/accounting/fiscal-years/{id}":{"patch":{"description":"Updates a fiscal year's fields; fails if the fiscal year is already closed.","operationId":"FiscalYearsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFiscalYearDto"}}}},"responses":{"200":{"description":"Updated fiscal year","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiscalYearResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, FISCAL_YEAR_CLOSED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FISCAL_YEAR_NOT_FOUND — fiscal year does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a fiscal year","tags":["Accounting - Ejercicios"]}},"/v1/accounting/fiscal-years/{id}/close":{"post":{"description":"Closes the fiscal year and, by default, generates a refundición de cuentas de resultado (CIERRE journal entry) that zeroes all result accounts (categories 4 & 5) against 'Resultado del Ejercicio' (account code 3.1.001). Pass `generate_closing_entry=false` to close without generating the entry.","operationId":"FiscalYearsController_close","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"generate_closing_entry","required":false,"in":"query","description":"Whether to generate the refundición closing entry (default: true)","schema":{"type":"boolean"}}],"responses":{"201":{"description":"Closed fiscal year + optional closing entry ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseFiscalYearResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, FISCAL_YEAR_ALREADY_CLOSED, RESULTADO_EJERCICIO_ACCOUNT_NOT_FOUND, JOURNAL_ENTRY_NOT_BALANCED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FISCAL_YEAR_NOT_FOUND — fiscal year does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Close a fiscal year","tags":["Accounting - Ejercicios"]}},"/v1/accounting/fiscal-years/{id}/open":{"post":{"description":"Materializes the asiento de apertura for this fiscal year, carrying forward the closing balances of all patrimonial accounts (categories 1/2/3 — Activo/Pasivo/PN) from its contiguous, CLOSED predecessor. Use this on the create-new-then-close-old ordering, where closing the predecessor happened before this year existed. Idempotent: returns the existing apertura id if one already exists.","operationId":"FiscalYearsController_open","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"201":{"description":"Fiscal year + generated (or pre-existing) apertura entry ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenFiscalYearResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, PRIOR_FISCAL_YEAR_NOT_CLOSED, PRIOR_FISCAL_YEAR_NOT_REFUNDIDO, DATE_LOCKED, JOURNAL_ENTRY_NOT_BALANCED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FISCAL_YEAR_NOT_FOUND — fiscal year or its contiguous predecessor does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Generate the asiento de apertura for a fiscal year","tags":["Accounting - Ejercicios"]}},"/v1/accounting/journal-entries":{"get":{"description":"Returns a paginated list of the organization's journal entries (asientos), filterable by module, date range and manual vs auto-generated origin.","operationId":"JournalEntriesController_list","parameters":[{"name":"page","required":false,"in":"query","schema":{"default":1,"type":"number"}},{"name":"limit","required":false,"in":"query","schema":{"default":20,"type":"number"}},{"name":"module","required":false,"in":"query","description":"Filter by module (ventas, compras, tesoreria, manual)","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter from date (ISO string)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter to date (ISO string)","schema":{"type":"string"}},{"name":"is_manual","required":false,"in":"query","description":"Filter manual entries only","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Paginated journal entries (items, total)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List journal entries with pagination","tags":["Accounting - Asientos"]},"post":{"description":"Creates a manual journal entry; line items must balance (total debit == total credit) and the date must fall in an open fiscal year and an unlocked period.","operationId":"JournalEntriesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJournalEntryDto"}}}},"responses":{"201":{"description":"Created journal entry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, JOURNAL_ENTRY_ITEMS_REQUIRED, JOURNAL_ENTRY_NOT_BALANCED, FISCAL_YEAR_CLOSED, DATE_LOCKED, INVALID_JOURNAL_ACCOUNT_IDS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FISCAL_YEAR_NOT_FOUND — fiscal year does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a manual journal entry","tags":["Accounting - Asientos"]}},"/v1/accounting/journal-entries/reports/profit-loss":{"get":{"description":"Computes the profit & loss (estado de resultados) over the given date range, aggregating result-account balances grouped by account.","operationId":"JournalEntriesController_getProfitAndLoss","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Profit and loss report grouped by account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfitAndLossResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get profit and loss report","tags":["Accounting - Asientos"]}},"/v1/accounting/journal-entries/reports/balance-sheet":{"get":{"description":"Computes the balance sheet (estado de situación patrimonial) as of the given date, aggregating account balances grouped by category.","operationId":"JournalEntriesController_getBalanceSheet","parameters":[{"name":"as_of_date","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Balance sheet grouped by account category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceSheetResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get balance sheet report","tags":["Accounting - Asientos"]}},"/v1/accounting/journal-entries/{id}":{"get":{"description":"Returns a single journal entry (asiento) with its debit/credit line items.","operationId":"JournalEntriesController_getById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Journal entry with line items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponseDto"}}}},"400":{"description":"ACCOUNTING_DISABLED — accounting is not enabled for this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"JOURNAL_ENTRY_NOT_FOUND — journal entry does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a journal entry with its items","tags":["Accounting - Asientos"]},"put":{"description":"Edits a manual journal entry (auto-generated entries cannot be edited); items must stay balanced (debit == credit) and fall in an open, unlocked period.","operationId":"JournalEntriesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJournalEntryDto"}}}},"responses":{"200":{"description":"Updated journal entry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, CANNOT_EDIT_AUTO_ENTRY, JOURNAL_ENTRY_ITEMS_REQUIRED, JOURNAL_ENTRY_NOT_BALANCED, FISCAL_YEAR_CLOSED, DATE_LOCKED, INVALID_JOURNAL_ACCOUNT_IDS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"JOURNAL_ENTRY_NOT_FOUND — journal entry does not exist. FISCAL_YEAR_NOT_FOUND — fiscal year does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Edit a manual journal entry","tags":["Accounting - Asientos"]},"delete":{"description":"Deletes a manual journal entry; auto-generated entries cannot be deleted.","operationId":"JournalEntriesController_delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Deletion confirmation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryDeletedResponseDto"}}}},"400":{"description":"Validation failed. Codes: ACCOUNTING_DISABLED, CANNOT_DELETE_AUTO_ENTRY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"JOURNAL_ENTRY_NOT_FOUND — journal entry does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a manual journal entry","tags":["Accounting - Asientos"]}},"/v1/accounting/accounting-locks":{"get":{"description":"Returns the organization's accounting locks — date periods in which posting journal entries is blocked.","operationId":"AccountingLocksController_list","parameters":[],"responses":{"200":{"description":"List of accounting locks","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AccountingLockResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List accounting locks","tags":["Accounting - Bloqueos"]},"post":{"description":"Creates an accounting lock over a start/end date period, optionally tied to a fiscal year, blocking journal entries dated within it.","operationId":"AccountingLocksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountingLockDto"}}}},"responses":{"201":{"description":"Created lock","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountingLockResponseDto"}}}},"400":{"description":"ACCOUNTING_DISABLED — accounting is not enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FISCAL_YEAR_NOT_FOUND — fiscal year does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create an accounting lock","tags":["Accounting - Bloqueos"]}},"/v1/accounting/accounting-locks/{id}":{"patch":{"description":"Updates an accounting lock's date period, name or active state.","operationId":"AccountingLocksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountingLockDto"}}}},"responses":{"200":{"description":"Updated lock","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountingLockResponseDto"}}}},"400":{"description":"ACCOUNTING_DISABLED — accounting is not enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ACCOUNTING_LOCK_NOT_FOUND — lock does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update an accounting lock","tags":["Accounting - Bloqueos"]},"delete":{"description":"Deletes an accounting lock, reopening its date period for posting journal entries.","operationId":"AccountingLocksController_delete","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Deletion confirmation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountingLockDeletedResponseDto"}}}},"400":{"description":"ACCOUNTING_DISABLED — accounting is not enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ACCOUNTING_LOCK_NOT_FOUND — lock does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete an accounting lock","tags":["Accounting - Bloqueos"]}},"/v1/accounting/reports/general-ledger":{"get":{"description":"Returns paginated account movements over the date range with a running balance per account, optionally filtered to a single account.","operationId":"AccountingReportsController_generalLedger","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"account_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated general ledger movements with running balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeneralLedgerPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"General Ledger (Libro Mayor) — account movements with running balance","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/general-ledger/export":{"get":{"description":"Streams the General Ledger (Libro Mayor) for the date range as a downloadable CSV file, optionally filtered to a single account. Ranges with more than 200000 journal lines are refused with REPORT_EXPORT_TOO_LARGE.","operationId":"AccountingReportsController_generalLedgerExport","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"account_id","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"CSV file download"},"400":{"description":"Validation failed. Codes: DATE_RANGE_REQUIRED, REPORT_EXPORT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export General Ledger as CSV","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/daily-book":{"get":{"description":"Returns paginated chronological journal entries over the date range, one row per debit/credit line item.","operationId":"AccountingReportsController_dailyBook","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated chronological journal entries (one row per item)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyBookPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Daily Book (Libro Diario) — chronological journal entries","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/daily-book/export":{"get":{"description":"Streams the Daily Book (Libro Diario) for the date range as a downloadable CSV file. Ranges with more than 200000 journal lines are refused with REPORT_EXPORT_TOO_LARGE.","operationId":"AccountingReportsController_dailyBookExport","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file download"},"400":{"description":"Validation failed. Codes: DATE_RANGE_REQUIRED, REPORT_EXPORT_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export Daily Book as CSV","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/trial-balance":{"get":{"description":"Per imputable account: sum of debe, sum of haber and the resulting saldo (deudor/acreedor) over the period, plus a `totals` row where, by double-entry, total debe = total haber. Accepts `from`/`to` (aliases of `date_from`/`date_to`).","operationId":"AccountingReportsController_trialBalance","parameters":[{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}},{"name":"from","required":false,"in":"query","description":"Alias of date_from","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","description":"Alias of date_to","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated trial balance with per-account totals and a totals row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialBalanceReportResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Trial Balance (Balance de Sumas y Saldos) — account totals","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/balance-comprobacion":{"get":{"description":"Per account: Sumas (debe, haber), Saldos (deudor, acreedor) and the 8-column split of the saldos into Resultado (pérdida/ganancia) vs Patrimonial/Balance (activo/pasivo) driven by the account type (journal_accounts.category: 1=Activo, 2=Pasivo, 3=Patrimonio Neto → Balance; 4=Resultado Positivo, 5=Resultado Negativo → Resultado). Includes column totals. Accepts `from`/`to` (aliases of `date_from`/`date_to`).","operationId":"AccountingReportsController_balanceComprobacion","parameters":[{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}},{"name":"from","required":false,"in":"query","description":"Alias of date_from","schema":{"type":"string"}},{"name":"to","required":false,"in":"query","description":"Alias of date_to","schema":{"type":"string"}}],"responses":{"200":{"description":"8-column trial balance with column totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceComprobacionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Balance de Comprobación (8 columnas)","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/trial-balance/export":{"get":{"description":"Streams the Trial Balance (Sumas y Saldos) for the date range as a downloadable CSV file.","operationId":"AccountingReportsController_trialBalanceExport","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"apiKey":[]}],"summary":"Export Trial Balance as CSV","tags":["Accounting - Reportes"]}},"/v1/accounting/reports/trial-balance/tree":{"get":{"description":"Returns the trial balance as a nested tree grouped by account code prefix. Leaf nodes are accounts with movements; branch nodes carry aggregated subtotals. Zero-balance leaf accounts are excluded. Server-side cap: 2 000 leaf accounts.","operationId":"AccountingReportsController_trialBalanceTree","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Hierarchical trial balance tree (complete, no pagination)","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TrialBalanceTreeNodeDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Hierarchical Trial Balance (Sumas y Saldos — Árbol)","tags":["Accounting - Reportes"]}},"/v1/accounting/cmv":{"get":{"description":"Read-only. CMV = Σ quantity × unit cost (snapshotted on each line when the receipt was issued) over the month's issued Facturas − the same over credit notes that return stock. Voided receipts (and the credit note that voids one), drafts, debit notes, observation lines, free-text lines and services are excluded; lines without a cost snapshot are excluded and reported in `missingCost`. The month is the receipts' calendar date. Also returns the accounts the entry would post to, the month's existing CMV entry and whether the period is locked.","operationId":"CmvController_preview","parameters":[{"name":"month","required":true,"in":"query","description":"YYYY-MM","schema":{"example":"2026-10","type":"string"}}],"responses":{"200":{"description":"Month preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmvPreviewResponseDto"}}}},"400":{"description":"Codes: ACCOUNTING_DISABLED, CMV_INVALID_MONTH.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview the month's cost of goods sold (CMV)","tags":["Accounting - Costo de mercaderías vendidas"]},"post":{"description":"One summary entry per organization and month: Debe cost of goods sold / Haber inventory (sides swapped when returns outweigh sales). Regenerating replaces the month's previous CMV entry in the same transaction; a zero CMV posts nothing. CMV = Σ quantity × unit cost (snapshotted on each line when the receipt was issued) over the month's issued Facturas − the same over credit notes that return stock. Voided receipts (and the credit note that voids one), drafts, debit notes, observation lines, free-text lines and services are excluded; lines without a cost snapshot are excluded and reported in `missingCost`. The month is the receipts' calendar date. Requires stock tracking. Refused when the month overlaps an accounting lock or its fiscal year is closed.","operationId":"CmvController_generate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateCmvDto"}}}},"responses":{"201":{"description":"Generated entry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmvGenerateResponseDto"}}}},"400":{"description":"Codes: ACCOUNTING_DISABLED, CMV_INVALID_MONTH, CMV_STOCK_TRACKING_DISABLED, CMV_PERIOD_LOCKED, CMV_ACCOUNT_NOT_CONFIGURED, DATE_OUTSIDE_FISCAL_YEAR, DATE_LOCKED, JOURNAL_ENTRY_PERIOD_LOCKED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Generate or regenerate the month's CMV journal entry","tags":["Accounting - Costo de mercaderías vendidas"]}},"/v1/accounting/cmv/settings":{"get":{"description":"The configured cost and inventory accounts (null = the chart's default code, also returned).","operationId":"CmvController_getSettings","parameters":[],"responses":{"200":{"description":"CMV accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmvSettingsResponseDto"}}}},"400":{"description":"Codes: ACCOUNTING_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get the CMV entry's accounts","tags":["Accounting - Costo de mercaderías vendidas"]},"patch":{"description":"Pick the cost / inventory accounts from the organization's chart; `null` reverts to the default code.","operationId":"CmvController_updateSettings","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCmvSettingsDto"}}}},"responses":{"200":{"description":"Updated CMV accounts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmvSettingsResponseDto"}}}},"400":{"description":"Codes: ACCOUNTING_DISABLED, INVALID_JOURNAL_ACCOUNT_IDS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set the CMV entry's accounts","tags":["Accounting - Costo de mercaderías vendidas"]}},"/v1/purchases/suppliers":{"get":{"description":"Returns a page of suppliers. Use cursor from nextCursor for the next page.","operationId":"SuppliersController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"search","required":false,"in":"query","description":"Filter by business name, tax ID, or email (partial match)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated suppliers (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List suppliers (cursor-paginated)","tags":["Compras - Proveedores"]},"post":{"description":"Creates a supplier for the current organization. When taxId is a valid CUIT, missing fields (business name, address, city, tax category) are auto-filled from ARCA padrón; rejects duplicate CUITs within the org.","operationId":"SuppliersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSupplierDto"}}}},"responses":{"201":{"description":"Created supplier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_CUIT, BUSINESS_NAME_REQUIRED, TAX_CATEGORY_REQUIRED, TAX_CATEGORY_NOT_FOUND, TAX_CATEGORY_NOT_IN_ORG_REGIME, TAX_ID_DUPLICATE, ORGANIZATION_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create supplier","tags":["Compras - Proveedores"]}},"/v1/purchases/suppliers/lookup-cuit":{"get":{"description":"Validates CUIT and fetches business data from AFIP via system certificate.","operationId":"SuppliersController_lookupCuit","parameters":[{"name":"cuit","required":true,"in":"query","description":"CUIT to look up (11 digits, with or without dashes)","schema":{"type":"string"}}],"responses":{"200":{"description":"CUIT lookup result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CuitLookupResponseDto"}}}},"400":{"description":"INVALID_CUIT — malformed or bad check digit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"AFIP_PERSONA_NOT_FOUND — no taxpayer registered in AFIP for this CUIT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"502":{"description":"AFIP_WSCI_ERROR — upstream AFIP (WSCI) failure. See providerMessage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Lookup CUIT for supplier auto-fill","tags":["Compras - Proveedores"]}},"/v1/purchases/suppliers/export":{"get":{"description":"Streams the organization's suppliers as a CSV download (id, business name, tax ID, address, tax category, purchase condition, bank account) using keyset pagination; honors the search and active_only filters.","operationId":"SuppliersController_exportCsv","parameters":[{"name":"search","required":false,"in":"query","description":"Filter by business name, tax ID, or email (partial match)","schema":{"type":"string"}},{"name":"active_only","required":false,"in":"query","description":"Include only active suppliers (default true)","schema":{"type":"boolean"}}],"responses":{"200":{"description":"CSV file download"}},"security":[{"apiKey":[]}],"summary":"Export suppliers as CSV (cursor-based, streaming)","tags":["Compras - Proveedores"]}},"/v1/purchases/suppliers/{id}":{"get":{"description":"Returns a single supplier of the current organization by id, including tax category, purchase condition, location, and document type. 404 if it does not exist or belongs to another organization.","operationId":"SuppliersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Supplier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get supplier by id","tags":["Compras - Proveedores"]},"patch":{"description":"Updates the supplier's editable fields (business name, taxId, tax category, address, contact, bank account). Re-validates CUIT and org-uniqueness when taxId changes; 404 if not found in this organization.","operationId":"SuppliersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSupplierDto"}}}},"responses":{"200":{"description":"Updated supplier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_CUIT, TAX_CATEGORY_NOT_FOUND, TAX_CATEGORY_NOT_IN_ORG_REGIME, TAX_ID_DUPLICATE, ORGANIZATION_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SUPPLIER_NOT_FOUND — supplier does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update supplier","tags":["Compras - Proveedores"]},"delete":{"description":"Soft-deletes a single supplier of the current organization by id (sets deleted_at) and returns 204. Responds 404 if it does not exist or belongs to another organization.","operationId":"SuppliersController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"SUPPLIER_NOT_FOUND — supplier does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete supplier (soft delete)","tags":["Compras - Proveedores"]}},"/v1/purchases/suppliers/get-or-create":{"post":{"description":"Looks up supplier by CUIT. If not found, auto-creates using AFIP padron data.","operationId":"SuppliersController_getOrCreate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrCreateSupplierDto"}}}},"responses":{"200":{"description":"Existing or newly created supplier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierResponseDto"}}}},"400":{"description":"Validation failed. Codes: TAX_ID_REQUIRED, INVALID_CUIT, ORGANIZATION_NOT_FOUND, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get existing supplier by CUIT or create with AFIP data","tags":["Compras - Proveedores"]}},"/v1/purchases/suppliers/bulk-delete":{"post":{"description":"Soft-deletes the given supplier ids for the current organization (sets deleted_at) and returns how many were deleted; ids not found or belonging to another organization are skipped.","operationId":"SuppliersController_removeBulk","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteSuppliersDto"}}}},"responses":{"200":{"description":"Number of deleted suppliers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteSuppliersResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Bulk delete suppliers (soft delete)","tags":["Compras - Proveedores"]}},"/v1/provider-configs/status":{"get":{"description":"Returns the connection/integration status for each supported provider for the current organization.","operationId":"ProviderConfigsController_getStatus","parameters":[],"responses":{"200":{"description":"Integration status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationStatusResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get integration status per provider","tags":["Integraciones - Configuración"]}},"/v1/provider-configs/oauth":{"get":{"description":"Returns the authenticated browser start URL for connecting the given provider. The browser establishes a short-lived HttpOnly binding before provider authorization; returns 501 for unsupported providers.","operationId":"ProviderConfigsController_getOAuthUrl","parameters":[{"name":"provider","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OAuth URL for redirect","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthUrlResponseDto"}}}},"501":{"description":"OAuth not implemented for this provider"}},"security":[{"apiKey":[]}],"summary":"Get OAuth redirect URL for a provider","tags":["Integraciones - Configuración"]}},"/v1/provider-configs/by-provider/{provider}":{"get":{"description":"Returns the stored provider config for the given provider, or null when none exists for the current organization.","operationId":"ProviderConfigsController_findByProvider","parameters":[{"name":"provider","required":true,"in":"path","schema":{"enum":["SPARKPOST","TIENDANUBE"],"type":"string"}}],"responses":{"200":{"description":"Provider config, or `null` when none exists for the given provider","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProviderConfigResponseDto"},{"type":"null"}]}}}}},"security":[{"apiKey":[]}],"summary":"Get config by provider","tags":["Integraciones - Configuración"]}},"/v1/provider-configs":{"get":{"description":"Returns all provider configs belonging to the current organization.","operationId":"ProviderConfigsController_findAll","parameters":[],"responses":{"200":{"description":"List of provider configs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProviderConfigResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List provider configs for the current organization","tags":["Integraciones - Configuración"]},"post":{"description":"Creates a provider config for the current organization.","operationId":"ProviderConfigsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProviderConfigDto"}}}},"responses":{"201":{"description":"Created provider config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderConfigResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_PROVIDER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create provider config","tags":["Integraciones - Configuración"]}},"/v1/provider-configs/{id}":{"get":{"description":"Returns a single provider config by id, scoped to the current organization; 404 when it does not exist.","operationId":"ProviderConfigsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Provider config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderConfigResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get provider config by id","tags":["Integraciones - Configuración"]},"patch":{"description":"Updates an existing provider config; 404 when it does not exist or belongs to another organization.","operationId":"ProviderConfigsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProviderConfigDto"}}}},"responses":{"200":{"description":"Updated provider config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderConfigResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_PROVIDER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PROVIDER_CONFIG_NOT_FOUND — provider config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update provider config","tags":["Integraciones - Configuración"]},"delete":{"description":"Deletes a provider config; 404 when it does not exist or belongs to another organization.","operationId":"ProviderConfigsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PROVIDER_CONFIG_NOT_FOUND — provider config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete provider config","tags":["Integraciones - Configuración"]}},"/v1/mercado-pago-configs/preferences":{"post":{"description":"Builds a hosted-checkout link for a collectible sales receipt. The receipt UUID is stamped as the preference's external_reference so the settle-only IPN webhook can map the approved payment back to the receipt.","operationId":"MercadoPagoConfigsController_createPreference","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMercadoPagoPreferenceDto"}}}},"responses":{"201":{"description":"Mercado Pago checkout preference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MercadoPagoPreferenceResponseDto"}}}},"400":{"description":"MERCADO_PAGO_NOT_CONNECTED — org has no Mercado Pago access token. MERCADO_PAGO_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another org. MERCADO_PAGO_RECEIPT_NOT_COLLECTIBLE — receipt is not collectible (must be Creada with saldo > 0).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a Mercado Pago checkout preference for a sales receipt","tags":["Integraciones - Mercado Pago"]}},"/v1/mercado-pago-configs/by-organization":{"get":{"description":"Returns the current organization's Mercado Pago config, creating a default one if none exists yet.","operationId":"MercadoPagoConfigsController_getByOrganization","parameters":[],"responses":{"200":{"description":"Mercado Pago config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MercadoPagoConfigResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get or create the Mercado Pago config for the current organization","tags":["Integraciones - Mercado Pago"]}},"/v1/mercado-pago-configs":{"get":{"description":"Returns all Mercado Pago configs belonging to the current organization.","operationId":"MercadoPagoConfigsController_findAll","parameters":[],"responses":{"200":{"description":"List of Mercado Pago configs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MercadoPagoConfigResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List Mercado Pago configs for the current organization","tags":["Integraciones - Mercado Pago"]},"post":{"description":"Creates a Mercado Pago config for the current organization, including the treasury bank account used to settle payments received via the IPN webhook.","operationId":"MercadoPagoConfigsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMercadoPagoConfigDto"}}}},"responses":{"201":{"description":"Created Mercado Pago config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MercadoPagoConfigResponseDto"}}}},"400":{"description":"INVALID_INCLUDE_PAYMENT_BUTTON — invalid includePaymentButton value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create Mercado Pago config","tags":["Integraciones - Mercado Pago"]}},"/v1/mercado-pago-configs/{id}":{"get":{"description":"Returns a single Mercado Pago config by id, scoped to the current organization; 404 when it does not exist.","operationId":"MercadoPagoConfigsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Mercado Pago config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MercadoPagoConfigResponseDto"}}}},"404":{"description":"MERCADO_PAGO_CONFIG_NOT_FOUND — config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get Mercado Pago config by id","tags":["Integraciones - Mercado Pago"]},"patch":{"description":"Updates an existing Mercado Pago config, such as the payment-button toggle or the treasury bank account used to settle payments.","operationId":"MercadoPagoConfigsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMercadoPagoConfigDto"}}}},"responses":{"200":{"description":"Updated Mercado Pago config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MercadoPagoConfigResponseDto"}}}},"400":{"description":"INVALID_INCLUDE_PAYMENT_BUTTON — invalid includePaymentButton value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"MERCADO_PAGO_CONFIG_NOT_FOUND — config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update Mercado Pago config","tags":["Integraciones - Mercado Pago"]},"delete":{"description":"Deletes a Mercado Pago config; 404 when it does not exist or belongs to another organization.","operationId":"MercadoPagoConfigsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"MERCADO_PAGO_CONFIG_NOT_FOUND — config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete Mercado Pago config","tags":["Integraciones - Mercado Pago"]}},"/v1/mercado-pago-configs/{id}/reset-auth":{"patch":{"description":"Clears the stored OAuth tokens for the Mercado Pago config so the organization must reconnect its Mercado Pago account.","operationId":"MercadoPagoConfigsController_resetAuth","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Auth reset"},"404":{"description":"MERCADO_PAGO_CONFIG_NOT_FOUND — config does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Reset auth — clears the stored refresh token so the user must reconnect","tags":["Integraciones - Mercado Pago"]}},"/v1/collections":{"get":{"description":"Returns a page of collections. Use cursor from nextCursor for the next page.","operationId":"CollectionsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter by customer","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status (Cobrada/Anulada)","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by date from (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by date to (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated collections (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List collections (cursor-paginated)","tags":["Ventas - Cobranzas"]},"post":{"description":"Collects sales receipts with one or more valores. Updates receipt total_collected/status, registers treasury movements (cash/bank/checks/retentions) and generates the CZ journal entry when accounting is enabled. A bank account or cash register in a foreign currency goes up by the payment's `foreignAmount` (default amount / exchangeRate); `amount` stays in the organization's currency.","operationId":"CollectionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCollectionDto"}}}},"responses":{"201":{"description":"Created collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionResponseDto"}}}},"400":{"description":"Validation failed. Codes: RECEIPTS_REQUIRED, PAYMENTS_REQUIRED, CUSTOMER_NOT_FOUND, TYPE_NOT_FOUND, RECEIPT_NOT_FOUND, RECEIPT_AMOUNT_INVALID, RECEIPT_AMOUNT_EXCEEDS_PENDING, RECEIPT_CUSTOMER_MISMATCH, RECEIPT_NOT_COLLECTIBLE, RECEIPT_DUPLICATED_IN_COLLECTION, PAYMENTS_TOTAL_MISMATCH, PAYMENT_AMOUNT_INVALID, PAYMENT_METHOD_NOT_FOUND, PAYMENT_TYPE_NOT_SUPPORTED, EXCHANGE_RATE_REQUIRED, PAYMENT_FX_MISMATCH, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create collection (cobranza)","tags":["Ventas - Cobranzas"]}},"/v1/collections/next-reference":{"get":{"description":"Returns MAX(reference_number)+1 for the org (v1 GetProximoNroReferencia).","operationId":"CollectionsController_nextReference","parameters":[],"responses":{"200":{"description":"Next reference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionNextReferenceResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get the next collection reference number","tags":["Ventas - Cobranzas"]}},"/v1/collections/{id}/pdf/download":{"get":{"description":"Public endpoint that verifies a signed token to generate and stream the collection receipt (recibo de cobranza) PDF inline.","operationId":"CollectionsController_downloadReceiptPublic","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"token","required":true,"in":"query","description":"Signed download token","schema":{"type":"string"}},{"name":"expires","required":true,"in":"query","description":"Token expiration (unix seconds)","schema":{"type":"string"}}],"responses":{"200":{"description":"Collection receipt PDF file"},"401":{"description":"Invalid or expired token"},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Download collection receipt (recibo de cobranza) PDF via signed URL (public)","tags":["Ventas - Cobranzas"]}},"/v1/collections/{id}":{"get":{"description":"Returns a single collection with its imputed receipt items and payment entries; 404 if it does not exist in this organization.","operationId":"CollectionsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionResponseDto"}}}},"404":{"description":"COLLECTION_NOT_FOUND — collection does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get collection by id (with receipt items and payment entries)","tags":["Ventas - Cobranzas"]},"delete":{"description":"DELETE is a soft void: the collection is kept with status Anulada and all treasury/receipt effects are reverted (same as POST :id/void).","operationId":"CollectionsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionResponseDto"}}}},"400":{"description":"Same codes as POST :id/void. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"COLLECTION_NOT_FOUND — collection does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) a collection — alias of POST :id/void","tags":["Ventas - Cobranzas"]}},"/v1/collections/{id}/void":{"post":{"description":"Reverts receipt total_collected/status, cash/bank balances and check/retention statuses. The collection is kept with status Anulada.","operationId":"CollectionsController_void","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionResponseDto"}}}},"400":{"description":"Validation failed. Codes: COLLECTION_ALREADY_VOIDED, PAYMENT_CHECK_ALREADY_DEPOSITED, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before voiding. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"COLLECTION_NOT_FOUND — collection does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) a collection","tags":["Ventas - Cobranzas"]}},"/v1/purchases/payment-orders":{"get":{"description":"Returns a page of payment orders. Use cursor from nextCursor for the next page.","operationId":"PaymentOrdersController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status (Creada/Anulada)","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by date from (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by date to (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated payment orders (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrderPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List payment orders (cursor-paginated)","tags":["Compras - Órdenes de Pago"]},"post":{"description":"Pays purchase receipts with one or more payment methods. Updates receipt total_paid/status, registers treasury movements (cash/bank/checks/retentions) and generates the OP journal entry when accounting is enabled. A bank account or cash register in a foreign currency goes down by the payment's `foreignAmount` (default amount / exchangeRate); `amount` stays in the organization's currency.","operationId":"PaymentOrdersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentOrderDto"}}}},"responses":{"201":{"description":"Created payment order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrderResponseDto"}}}},"400":{"description":"Validation failed. Codes: RECEIPTS_REQUIRED, PAYMENTS_REQUIRED, SUPPLIER_NOT_FOUND, TYPE_NOT_FOUND, RECEIPT_NOT_FOUND, RECEIPT_AMOUNT_INVALID, RECEIPT_AMOUNT_EXCEEDS_PENDING, RECEIPT_SUPPLIER_MISMATCH, RECEIPT_NOT_PAYABLE, RECEIPT_IS_CREDIT_NOTE, RECEIPT_DUPLICATED_IN_ORDER, PAYMENTS_TOTAL_MISMATCH, EXCHANGE_RATE_REQUIRED, PAYMENT_FX_MISMATCH, PAYMENT_AMOUNT_INVALID, PAYMENT_METHOD_NOT_FOUND, PAYMENT_TYPE_NOT_SUPPORTED, PAYMENT_OWN_CHECK_INVALID_STATE, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create payment order","tags":["Compras - Órdenes de Pago"]}},"/v1/purchases/payment-orders/{id}":{"get":{"description":"Returns a single payment order with its paid receipt items and payment-method entries; 404s if it does not exist or belongs to another organization.","operationId":"PaymentOrdersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Payment order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrderResponseDto"}}}},"404":{"description":"PAYMENT_ORDER_NOT_FOUND — payment order does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get payment order by id (with receipt items and payment entries)","tags":["Compras - Órdenes de Pago"]}},"/v1/purchases/payment-orders/{id}/anular":{"post":{"description":"Reverts receipt total_paid/status, cash/bank balances and check/retention statuses. The order is kept with status Anulada.","operationId":"PaymentOrdersController_anular","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided payment order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentOrderResponseDto"}}}},"400":{"description":"Validation failed. Codes: PAYMENT_ORDER_ALREADY_VOIDED, PAYMENT_CHECK_ALREADY_DEPOSITED, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before voiding. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PAYMENT_ORDER_NOT_FOUND — payment order does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) a payment order","tags":["Compras - Órdenes de Pago"]}},"/v1/finance/payment-methods":{"get":{"description":"Returns the current organization's active payment methods (name, currency, payment-method type) ordered by id; inactive/soft-deleted ones are excluded.","operationId":"PaymentMethodsController_findAll","parameters":[],"responses":{"200":{"description":"List of payment methods","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethodResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List payment methods (active only)","tags":["Finanzas - Medios de Pago"]},"post":{"description":"Creates a payment method (name, currencyId, paymentMethodTypeId combo item) for the current organization; created active by default.","operationId":"PaymentMethodsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentMethodDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create payment method","tags":["Finanzas - Medios de Pago"]}},"/v1/finance/payment-methods/{id}":{"get":{"description":"Returns a single payment method of the current organization by id, including its currency and payment-method type. Responds 404 if it does not exist or belongs to another organization.","operationId":"PaymentMethodsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Payment method","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodResponseDto"}}}},"404":{"description":"PAYMENT_METHOD_NOT_FOUND — payment method does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get payment method by id","tags":["Finanzas - Medios de Pago"]},"patch":{"description":"Updates a payment method's name, active flag, currency, or type for the current organization. Responds 404 if it does not exist or belongs to another organization.","operationId":"PaymentMethodsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentMethodDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodResponseDto"}}}},"404":{"description":"PAYMENT_METHOD_NOT_FOUND — payment method does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update payment method","tags":["Finanzas - Medios de Pago"]},"delete":{"description":"Soft-deletes a payment method by setting isActive=false for the current organization; returns 204. Responds 404 if it does not exist or belongs to another organization.","operationId":"PaymentMethodsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PAYMENT_METHOD_NOT_FOUND — payment method does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete payment method (soft)","tags":["Finanzas - Medios de Pago"]}},"/v1/finance/payment-methods/entries/all":{"get":{"description":"Returns all payment-method entries (movements) of the current organization with their payment method, ordered by id. Each entry records an income/expense amount, date, and reference.","operationId":"PaymentMethodsController_findAllEntries","parameters":[],"responses":{"200":{"description":"List of payment method entries","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethodEntryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List all payment method entries","tags":["Finanzas - Medios de Pago"]}},"/v1/finance/payment-methods/entries/{entryId}":{"get":{"description":"Returns a single payment-method entry of the current organization by id, including its payment method. Responds 404 if it does not exist or belongs to another organization.","operationId":"PaymentMethodsController_findEntry","parameters":[{"name":"entryId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Payment method entry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodEntryResponseDto"}}}},"404":{"description":"PAYMENT_METHOD_ENTRY_NOT_FOUND — payment method entry does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get payment method entry by id","tags":["Finanzas - Medios de Pago"]},"patch":{"description":"Updates a payment-method entry's fields (description, amount, date, entryType, account, payment method, references) for the current organization. Responds 404 if not found in this organization.","operationId":"PaymentMethodsController_updateEntry","parameters":[{"name":"entryId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentMethodEntryDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodEntryResponseDto"}}}},"400":{"description":"PAYMENT_METHOD_ENTRY_LINKED — the entry belongs to a payment order, expense, collection or card cancellation; change that document instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PAYMENT_METHOD_ENTRY_NOT_FOUND — payment method entry does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update payment method entry","tags":["Finanzas - Medios de Pago"]},"delete":{"description":"Permanently deletes a payment-method entry of the current organization by id (hard delete); returns 204. Responds 404 if it does not exist or belongs to another organization.","operationId":"PaymentMethodsController_removeEntry","parameters":[{"name":"entryId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"PAYMENT_METHOD_ENTRY_LINKED — the entry belongs to a payment order, expense, collection or card cancellation; change that document instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PAYMENT_METHOD_ENTRY_NOT_FOUND — payment method entry does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete payment method entry","tags":["Finanzas - Medios de Pago"]}},"/v1/finance/payment-methods/entries":{"post":{"description":"Creates a payment-method entry (movement) for the current organization: description, amount, date, entryType (income/expense), account, and payment method; optionally linked to an external entity.","operationId":"PaymentMethodsController_createEntry","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentMethodEntryDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodEntryResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create payment method entry","tags":["Finanzas - Medios de Pago"]}},"/v1/finance/banks":{"get":{"description":"Returns the organization's active banks (isActive=true), each with its location.","operationId":"BanksController_findAll","parameters":[],"responses":{"200":{"description":"List of banks","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BankResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List banks (active only)","tags":["Finanzas - Bancos"]},"post":{"description":"Creates a bank (marked active) for the organization.","operationId":"BanksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankResponseDto"}}}},"400":{"description":"BANK_LOCATION_REQUIRED — no locationId (province) for a non-Spanish organization; Spanish banks are stored with locationId null.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create bank","tags":["Finanzas - Bancos"]}},"/v1/finance/banks/{id}":{"get":{"description":"Returns a single bank with its location, scoped to the organization.","operationId":"BanksController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Bank","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankResponseDto"}}}},"404":{"description":"BANK_NOT_FOUND — bank does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get bank by id","tags":["Finanzas - Bancos"]},"patch":{"description":"Updates a bank's name, active flag, or location; scoped to the organization.","operationId":"BanksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBankDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankResponseDto"}}}},"400":{"description":"BANK_LOCATION_REQUIRED — no locationId (province) for a non-Spanish organization; Spanish banks are stored with locationId null.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"BANK_NOT_FOUND — bank does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update bank","tags":["Finanzas - Bancos"]},"delete":{"description":"Soft-deletes the bank by setting isActive=false; scoped to the organization.","operationId":"BanksController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"BANK_NOT_FOUND — bank does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete bank (soft)","tags":["Finanzas - Bancos"]}},"/v1/finance/bank-accounts":{"get":{"description":"Returns the organization's bank accounts with isActive=true (including bank and currency relations), ordered by id.","operationId":"BankAccountsController_findAll","parameters":[],"responses":{"200":{"description":"List of bank accounts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List bank accounts (active only)","tags":["Finanzas - Cuentas Bancarias"]},"post":{"description":"Creates a bank account for the organization with isActive=true.","operationId":"BankAccountsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBankAccountDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankAccountResponseDto"}}}},"400":{"description":"BANK_ACCOUNT_BANK_REQUIRED — no bankId (or < 1); BANK_NOT_FOUND — bankId of another organization; BANK_ACCOUNT_ACCOUNT_REQUIRED — no accountId (or < 1) and no default to apply (Spanish organizations default to their 572 account); JOURNAL_ACCOUNT_NOT_FOUND — accountId of another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create bank account","tags":["Finanzas - Cuentas Bancarias"]}},"/v1/finance/bank-accounts/{id}":{"get":{"description":"Returns a single bank account scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"BankAccountsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Bank account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankAccountResponseDto"}}}},"404":{"description":"BANK_ACCOUNT_NOT_FOUND — bank account does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get bank account by id","tags":["Finanzas - Cuentas Bancarias"]},"patch":{"description":"Patches editable fields of a bank account (number, name, issuesChecks, isActive, bankId, currencyId, accountId, onlinePayment). `balance` is server-owned: it changes only through treasury movements.","operationId":"BankAccountsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBankAccountDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BankAccountResponseDto"}}}},"400":{"description":"BANK_ACCOUNT_BANK_REQUIRED — no bankId (or < 1); BANK_NOT_FOUND — bankId of another organization; BANK_ACCOUNT_ACCOUNT_REQUIRED — no accountId (or < 1) and no default to apply (Spanish organizations default to their 572 account); JOURNAL_ACCOUNT_NOT_FOUND — accountId of another organization; BANK_ACCOUNT_BALANCE_NOT_EDITABLE — balance differs from the current value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"BANK_ACCOUNT_NOT_FOUND — bank account does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update bank account","tags":["Finanzas - Cuentas Bancarias"]},"delete":{"description":"Soft-deletes the bank account by setting isActive=false; the record is retained for historical movements.","operationId":"BankAccountsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"BANK_ACCOUNT_NOT_FOUND — bank account does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete bank account (soft)","tags":["Finanzas - Cuentas Bancarias"]}},"/v1/finance/bank-accounts/histories/all":{"get":{"description":"Returns bank account balance-history entries for the organization, optionally filtered by bank_account_id, ordered by id.","operationId":"BankAccountsController_findHistories","parameters":[{"name":"bank_account_id","required":false,"in":"query","description":"Filter by bank account","schema":{"type":"number"}}],"responses":{"200":{"description":"List of bank account histories","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BankAccountHistoryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List bank account histories","tags":["Finanzas - Cuentas Bancarias"]}},"/v1/finance/cash-registers":{"get":{"description":"Returns the organization's cash registers (cajas) with isActive=true, ordered by id.","operationId":"CashRegistersController_findAll","parameters":[],"responses":{"200":{"description":"List of cash registers","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CashRegisterResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List cash registers (active only)","tags":["Finanzas - Cajas"]},"post":{"description":"Creates a cash register for the organization with isActive=true. `currencyId` makes it a cash register in another currency (null = the organization's); its `funds` are in that currency.","operationId":"CashRegistersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCashRegisterDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashRegisterResponseDto"}}}},"400":{"description":"CASH_REGISTER_ACCOUNT_REQUIRED — no accountId (or < 1) and no default to apply (Spanish organizations default to their 570 account); JOURNAL_ACCOUNT_NOT_FOUND — accountId belongs to another organization or does not exist; CASH_REGISTER_CURRENCY_NOT_FOUND — currencyId does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create cash register","tags":["Finanzas - Cajas"]}},"/v1/finance/cash-registers/{id}":{"get":{"description":"Returns a single cash register scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"CashRegistersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Cash register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashRegisterResponseDto"}}}},"404":{"description":"CASH_REGISTER_NOT_FOUND — cash register does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get cash register by id","tags":["Finanzas - Cajas"]},"patch":{"description":"Patches editable fields of a cash register (name, isActive, accountId, currencyId). `funds` is server-owned: it changes only through treasury movements. `currencyId` can only change while the cash register has no movements and a zero balance (`currencyLocked` false).","operationId":"CashRegistersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCashRegisterDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashRegisterResponseDto"}}}},"400":{"description":"CASH_REGISTER_ACCOUNT_REQUIRED — no accountId (or < 1) and no default to apply (Spanish organizations default to their 570 account); JOURNAL_ACCOUNT_NOT_FOUND — accountId belongs to another organization or does not exist; CASH_REGISTER_CURRENCY_NOT_FOUND — currencyId does not exist; CASH_REGISTER_CURRENCY_LOCKED — currencyId changes on a cash register that already has movements or a balance other than zero; CASH_REGISTER_FUNDS_NOT_EDITABLE — funds differs from the current value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CASH_REGISTER_NOT_FOUND — cash register does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update cash register","tags":["Finanzas - Cajas"]},"delete":{"description":"Soft-deletes the cash register by setting isActive=false; the record is retained for historical movements.","operationId":"CashRegistersController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CASH_REGISTER_NOT_FOUND — cash register does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete cash register (soft)","tags":["Finanzas - Cajas"]}},"/v1/finance/cash-registers/histories/all":{"get":{"description":"Returns cash register balance-history entries for the organization, optionally filtered by cash_register_id, ordered by id.","operationId":"CashRegistersController_findHistories","parameters":[{"name":"cash_register_id","required":false,"in":"query","description":"Filter by cash register","schema":{"type":"number"}}],"responses":{"200":{"description":"List of cash register histories","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CashRegisterHistoryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List cash register histories","tags":["Finanzas - Cajas"]}},"/v1/finance/checks":{"get":{"description":"Cursor-paginated check listing scoped to the organization, with optional filters by issuing bank, third-party customer, status, and check-date range.","operationId":"ChecksController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}},{"name":"bank_id","required":false,"in":"query","description":"Filter by issuing bank","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter by third-party customer","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by check status","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by check date >= (ISO date)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by check date <= (ISO date)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of checks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List checks","tags":["Finanzas - Cheques"]},"post":{"description":"Registers a check (own or third-party) for the organization.","operationId":"ChecksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create check","tags":["Finanzas - Cheques"]}},"/v1/finance/checks/{id}":{"get":{"description":"Returns a single check with its issuing bank and third-party customer, scoped to the organization.","operationId":"ChecksController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResponseDto"}}}},"404":{"description":"CHECK_NOT_FOUND — check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get check by id","tags":["Finanzas - Cheques"]},"patch":{"description":"Updates an existing check's fields (dates, amount, number, status, bank, customer); scoped to the organization.","operationId":"ChecksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCheckDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResponseDto"}}}},"404":{"description":"CHECK_NOT_FOUND — check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update check","tags":["Finanzas - Cheques"]},"delete":{"description":"Hard-deletes a check scoped to the organization.","operationId":"ChecksController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CHECK_NOT_FOUND — check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete check","tags":["Finanzas - Cheques"]}},"/v1/finance/checks/{id}/return":{"post":{"description":"Marks a third-party check as Devuelto; allowed only from Depositado (reverses the bank-account credit) or Entregado (no balance change); rejected if already returned.","operationId":"ChecksController_returnCheck","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReturnCheckDto"}}}},"responses":{"200":{"description":"Check marked as Devuelto; bank credit reversed if was Depositado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResponseDto"}}}},"400":{"description":"CHECK_ALREADY_RETURNED — already returned. CHECK_INVALID_STATE_FOR_RETURN — current state is not Depositado or Entregado. CHECK_DEPOSIT_NOT_FOUND — deposited check has no deposit record to reverse.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"CHECK_NOT_FOUND — check not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Return / bounce a third-party check (Devuelto)","tags":["Finanzas - Cheques"]}},"/v1/finance/own-checks":{"get":{"description":"Returns a cursor-paginated list of own checks (cheques propios) with optional filters by bank account, supplier, status, and check-date range.","operationId":"OwnChecksController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}},{"name":"bank_account_id","required":false,"in":"query","description":"Filter by bank account","schema":{"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by own-check status","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by check date >= (ISO date)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by check date <= (ISO date)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of own checks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnCheckPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List own checks","tags":["Finanzas - Cheques Propios"]},"post":{"description":"Creates an own check in a draft status (Borrador or Emitido), validating that the check number is unique per bank account within the organization.","operationId":"OwnChecksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOwnCheckDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnCheckResponseDto"}}}},"400":{"description":"OWN_CHECK_INVALID_STATUS_TRANSITION — status is not Borrador or Emitido. OWN_CHECK_ALREADY_USED — check number already exists on the bank account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create own check","tags":["Finanzas - Cheques Propios"]}},"/v1/finance/own-checks/{id}":{"get":{"description":"Returns a single own check scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"OwnChecksController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Own check","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnCheckResponseDto"}}}},"404":{"description":"OWN_CHECK_NOT_FOUND — own check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get own check by id","tags":["Finanzas - Cheques Propios"]},"patch":{"description":"Patches editable fields of an own check (date, amount, number, status, paymentDate, supplierId, bankAccountId). The responsible user is never changed. A Borrador or Emitido check may move to Borrador, Emitido or Anulado; Entregado and Pagado come from payment orders and /pay, and a check past draft keeps its status. Once the check is Entregado, Pagado or Anulado, amount and bankAccountId are frozen.","operationId":"OwnChecksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOwnCheckDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnCheckResponseDto"}}}},"400":{"description":"OWN_CHECK_INVALID_STATUS_TRANSITION — status change not allowed (target not Borrador/Emitido/Anulado, or the check is past draft). OWN_CHECK_IMMUTABLE_FIELD — amount or bankAccountId changed on a check past draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OWN_CHECK_NOT_FOUND — own check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update own check","tags":["Finanzas - Cheques Propios"]},"delete":{"description":"Hard-deletes a draft (Borrador or Emitido) own check scoped to the organization; returns 404 if it does not exist or belongs to another org.","operationId":"OwnChecksController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"OWN_CHECK_DELETE_NOT_ALLOWED — the check is Entregado, Pagado or Anulado; only draft checks can be deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OWN_CHECK_NOT_FOUND — own check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete own check","tags":["Finanzas - Cheques Propios"]}},"/v1/finance/own-checks/{id}/pay":{"post":{"description":"Marks the own check as Pagado, stamps the payment date, and debits the linked bank account balance; rejects checks already Pagado or Anulado.","operationId":"OwnChecksController_confirmPayment","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmPaymentDto"}}}},"responses":{"200":{"description":"Own check marked as paid and bank account debited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnCheckResponseDto"}}}},"400":{"description":"OWN_CHECK_ALREADY_PAID — already paid. OWN_CHECK_CANCELLED — already cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OWN_CHECK_NOT_FOUND — own check not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Confirm payment of an own check (Pagado)","tags":["Finanzas - Cheques Propios"]}},"/v1/finance/own-checks/{id}/exchange":{"post":{"description":"Cancels (Anulado) the old check and creates a replacement in Entregado inheriting amount and supplier; posts a canje journal entry when accounting is enabled.","operationId":"OwnChecksController_exchange","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeOwnCheckDto"}}}},"responses":{"201":{"description":"Old check cancelled, new check created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeOwnCheckResponseDto"}}}},"400":{"description":"OWN_CHECK_ALREADY_CANCELLED — old check already cancelled. OWN_CHECK_ALREADY_PAID — old check already paid. OWN_CHECK_ALREADY_USED — new check number already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OWN_CHECK_NOT_FOUND — old check not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Exchange (canje) an own check for a new one","tags":["Finanzas - Cheques Propios"]}},"/v1/finance/checkbooks":{"get":{"description":"Returns all checkbooks for the organization, each with its bank account.","operationId":"CheckbooksController_findAll","parameters":[],"responses":{"200":{"description":"List of checkbooks","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CheckbookResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List checkbooks","tags":["Finanzas - Chequeras"]},"post":{"description":"Creates a checkbook (numbering range from/to, name, bank account) for the organization.","operationId":"CheckbooksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckbookDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckbookResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create checkbook","tags":["Finanzas - Chequeras"]}},"/v1/finance/checkbooks/{id}":{"get":{"description":"Returns a single checkbook with its bank account, scoped to the organization.","operationId":"CheckbooksController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Checkbook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckbookResponseDto"}}}},"404":{"description":"CHECKBOOK_NOT_FOUND — checkbook does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get checkbook by id","tags":["Finanzas - Chequeras"]},"patch":{"description":"Updates a checkbook's numbering range, name, or bank account; scoped to the organization.","operationId":"CheckbooksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCheckbookDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckbookResponseDto"}}}},"404":{"description":"CHECKBOOK_NOT_FOUND — checkbook does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update checkbook","tags":["Finanzas - Chequeras"]},"delete":{"description":"Hard-deletes a checkbook scoped to the organization.","operationId":"CheckbooksController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CHECKBOOK_NOT_FOUND — checkbook does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete checkbook","tags":["Finanzas - Chequeras"]}},"/v1/finance/deposits":{"get":{"description":"Cursor-paginated deposit listing. Filters mirror v1 GetDepositoFilter: bank account and deposit-date range.","operationId":"DepositsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}},{"name":"account_id","required":false,"in":"query","description":"Filter by bank account id","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Deposit date from (inclusive, YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Deposit date to (inclusive, YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of deposits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List deposits","tags":["Finanzas - Depósitos"]},"post":{"description":"Creates a deposit. If checkIds is provided, runs the check-deposit flow: every check must be in Cartera, the total is computed from the checks, checks are marked Depositado, and an accounting entry is generated.","operationId":"DepositsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDepositDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositResponseDto"}}}},"400":{"description":"DEPOSIT_CHECK_INVALID_STATE — a check is not in Cartera (only checks in the wallet can be deposited). DEPOSIT_CHECK_NOT_FOUND — a check does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create deposit","tags":["Finanzas - Depósitos"]}},"/v1/finance/deposits/{id}":{"get":{"description":"Returns a single deposit with its bank account, scoped to the organization.","operationId":"DepositsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Deposit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositResponseDto"}}}},"404":{"description":"DEPOSIT_NOT_FOUND — deposit does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get deposit by id","tags":["Finanzas - Depósitos"]},"patch":{"description":"Updates a deposit's fields; scoped to the organization.","operationId":"DepositsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDepositDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositResponseDto"}}}},"404":{"description":"DEPOSIT_NOT_FOUND — deposit does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update deposit","tags":["Finanzas - Depósitos"]},"delete":{"description":"Deletes a deposit in one transaction: reverts linked checks to Cartera, removes items and the auto journal entry, then reverses the bank credit; blocked if the accounting period is locked, or if any of its checks already left Depositado through this deposit (returned or re-deposited).","operationId":"DepositsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"DEPOSIT_DELETE_NOT_ALLOWED: a check of the deposit was already returned (its credit was reversed) or re-deposited elsewhere. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before deleting. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"DEPOSIT_NOT_FOUND — deposit does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete deposit","tags":["Finanzas - Depósitos"]}},"/v1/finance/deposits/{id}/items":{"get":{"description":"Returns the deposit items (each linking a deposited check) for the given deposit, scoped to the organization.","operationId":"DepositsController_findItems","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"List of deposit items","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DepositItemResponseDto"}}}}},"404":{"description":"DEPOSIT_NOT_FOUND — deposit does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List deposit items","tags":["Finanzas - Depósitos"]}},"/v1/finance/transfers":{"get":{"description":"Cursor-paginated transfer listing for the organization, with optional filters by bank account, customer, supplier, and transfer-date range.","operationId":"TransfersController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}},{"name":"bank_account_id","required":false,"in":"query","description":"Filter by bank account","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter by customer","schema":{"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Filter by transfer date >= (ISO date)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by transfer date <= (ISO date)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated list of transfers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List transfers","tags":["Finanzas - Transferencias"]},"post":{"description":"Creates a bank-account transfer for the organization, validating the referenced bank account, customer, and supplier.","operationId":"TransfersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTransferDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create transfer","tags":["Finanzas - Transferencias"]}},"/v1/finance/transfers/{id}":{"get":{"description":"Returns a single transfer with its bank account, scoped to the organization.","operationId":"TransfersController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Transfer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferResponseDto"}}}},"404":{"description":"TRANSFER_NOT_FOUND — transfer does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get transfer by id","tags":["Finanzas - Transferencias"]},"patch":{"description":"Updates a transfer's fields, validating referenced bank account, customer, and supplier; scoped to the organization.","operationId":"TransfersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTransferDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferResponseDto"}}}},"404":{"description":"TRANSFER_NOT_FOUND — transfer does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update transfer","tags":["Finanzas - Transferencias"]},"delete":{"description":"Hard-deletes a transfer scoped to the organization.","operationId":"TransfersController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"TRANSFER_NOT_FOUND — transfer does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete transfer","tags":["Finanzas - Transferencias"]}},"/v1/finance/fund-movements":{"get":{"description":"Cursor-paginated fund-movement listing for the organization, each with its bank account and movement type.","operationId":"FundMovementsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated list of fund movements","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundMovementPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List fund movements","tags":["Finanzas - Movimientos de Fondos"]},"post":{"description":"Creates a fund movement and applies its balance effect by type: Deposito (cash->bank), Extraccion (bank->cash), Transferencia (bank->bank); posts an accounting entry when accounting is enabled. `amount` is in the organization's currency. A bank account or cash register in a foreign currency moves `foreignAmount` units instead (e.g. buying dollars: a peso bank account goes down by `amount`, a USD cash register up by amount / exchangeRate); the leg is returned as `fx`.","operationId":"FundMovementsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFundMovementDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundMovementResponseDto"}}}},"400":{"description":"UNKNOWN_FUND_MOVEMENT_TYPE — movementTypeId is not Deposito, Extraccion or Transferencia; EXCHANGE_RATE_REQUIRED — an account is in a foreign currency and no exchangeRate was sent nor cached for the movement's date; PAYMENT_FX_MISMATCH — foreignAmount × exchangeRate does not give amount; FUND_MOVEMENT_CURRENCY_PAIR_NOT_SUPPORTED — the accounts are in two different foreign currencies (e.g. USD and EUR).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create fund movement","tags":["Finanzas - Movimientos de Fondos"]}},"/v1/finance/fund-movements/{id}":{"get":{"description":"Returns a single fund movement with its bank account and movement type, scoped to the organization.","operationId":"FundMovementsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Fund movement","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundMovementResponseDto"}}}},"404":{"description":"FUND_MOVEMENT_NOT_FOUND — fund movement does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get fund movement by id","tags":["Finanzas - Movimientos de Fondos"]},"patch":{"description":"Updates a fund movement's fields; scoped to the organization (does not re-apply balance changes).","operationId":"FundMovementsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFundMovementDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundMovementResponseDto"}}}},"404":{"description":"FUND_MOVEMENT_NOT_FOUND — fund movement does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update fund movement","tags":["Finanzas - Movimientos de Fondos"]},"delete":{"description":"Deletes a fund movement and reverses its balance effect (accounts in a foreign currency by the movement's `fx.foreignAmount`); scoped to the organization.","operationId":"FundMovementsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"FUND_MOVEMENT_NOT_FOUND — fund movement does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete fund movement","tags":["Finanzas - Movimientos de Fondos"]}},"/v1/finance/credit-cards":{"get":{"description":"Returns all credit cards for the organization, each with its bank account.","operationId":"CreditCardsController_findAll","parameters":[],"responses":{"200":{"description":"List of credit cards","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CreditCardResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List credit cards","tags":["Finanzas - Tarjetas de Crédito"]},"post":{"description":"Creates a credit card (number, status, bank account, accounting account) for the organization.","operationId":"CreditCardsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCreditCardDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditCardResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create credit card","tags":["Finanzas - Tarjetas de Crédito"]}},"/v1/finance/credit-cards/{id}":{"get":{"description":"Returns a single credit card with its bank account, scoped to the organization.","operationId":"CreditCardsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Credit card","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditCardResponseDto"}}}},"404":{"description":"CREDIT_CARD_NOT_FOUND — credit card does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get credit card by id","tags":["Finanzas - Tarjetas de Crédito"]},"patch":{"description":"Updates a credit card's number, status, bank account, or accounting account; scoped to the organization.","operationId":"CreditCardsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCreditCardDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditCardResponseDto"}}}},"404":{"description":"CREDIT_CARD_NOT_FOUND — credit card does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update credit card","tags":["Finanzas - Tarjetas de Crédito"]},"delete":{"description":"Hard-deletes a credit card scoped to the organization.","operationId":"CreditCardsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CREDIT_CARD_NOT_FOUND — credit card does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete credit card","tags":["Finanzas - Tarjetas de Crédito"]}},"/v1/finance/card-payments":{"get":{"description":"Returns a cursor-paginated list of credit-card payments for the organization, ordered by id.","operationId":"CardPaymentsController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Pagination cursor","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated list of card payments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardPaymentPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List card payments","tags":["Finanzas - Pagos con Tarjeta"]},"post":{"description":"Creates a credit-card payment for the organization after validating that the referenced credit card exists in the same org.","operationId":"CardPaymentsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardPaymentDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardPaymentResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create card payment","tags":["Finanzas - Pagos con Tarjeta"]}},"/v1/finance/card-payments/{id}":{"get":{"description":"Returns a single credit-card payment scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"CardPaymentsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Card payment","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardPaymentResponseDto"}}}},"404":{"description":"CARD_PAYMENT_NOT_FOUND — card payment does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get card payment by id","tags":["Finanzas - Pagos con Tarjeta"]},"patch":{"description":"Patches editable fields of a card payment; re-validates the credit card when creditCardId changes.","operationId":"CardPaymentsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCardPaymentDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardPaymentResponseDto"}}}},"404":{"description":"CARD_PAYMENT_NOT_FOUND — card payment does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update card payment","tags":["Finanzas - Pagos con Tarjeta"]},"delete":{"description":"Hard-deletes the card payment scoped to the organization; returns 404 if it does not exist or belongs to another org.","operationId":"CardPaymentsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"CARD_PAYMENT_NOT_FOUND — card payment does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete card payment","tags":["Finanzas - Pagos con Tarjeta"]}},"/v1/finance/card-payments/{id}/cancellations":{"get":{"description":"Returns the cancellations (cuotas canceladas) recorded against a given card payment, ordered by id.","operationId":"CardPaymentsController_findCancellations","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"List of cancellations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CardCancellationResponseDto"}}}}},"404":{"description":"CARD_PAYMENT_NOT_FOUND — card payment does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List card payment cancellations","tags":["Finanzas - Pagos con Tarjeta"]},"post":{"description":"Records a cancellation (cuota) for a card payment: creates the Egreso payment-method entry, updates parent totals, debits the card's bank account, and posts a journal entry when accounting is enabled.","operationId":"CardPaymentsController_createCancellation","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCardCancellationDto"}}}},"responses":{"201":{"description":"Cancellation created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardCancellationResponseDto"}}}},"404":{"description":"CARD_PAYMENT_NOT_FOUND — card payment not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a cancellation for a card payment","tags":["Finanzas - Pagos con Tarjeta"]}},"/v1/finance/retentions":{"get":{"description":"Returns the organization's retention types (tipos de retención) with isActive=true, ordered by id.","operationId":"RetentionsController_findAll","parameters":[],"responses":{"200":{"description":"List of retentions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RetentionResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List retentions (active only)","tags":["Finanzas - Retenciones"]},"post":{"description":"Creates a retention type; when contra-accounts are omitted it resolves the shared activo/pasivo rubros by code from the org chart of accounts.","operationId":"RetentionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRetentionDto"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create retention","tags":["Finanzas - Retenciones"]}},"/v1/finance/retentions/receipts":{"get":{"description":"Returns all retention receipts (retenciones practicadas) for the organization, ordered by id.","operationId":"RetentionsController_findReceipts","parameters":[],"responses":{"200":{"description":"List of retention receipts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RetentionReceiptResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List retention receipts","tags":["Finanzas - Retenciones"]},"post":{"description":"Mirrors v1 NuevaRetencion. The withheld amount (`total`) is entered manually — there is no AFIP calc engine. The receipt is created in `Borrador` with `retentionNumber` null; it becomes `Recibido` and gets its `paymentOrderId`/`retentionNumber` stamped when consumed as a RETENCION valor in a payment order.","operationId":"RetentionsController_createReceipt","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRetentionReceiptDto"}}}},"responses":{"201":{"description":"Created retention receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: RETENTION_NOT_FOUND, RETENTION_INACTIVE, RETENTION_RECEIPT_SUPPLIER_REQUIRED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a retention receipt (retención practicada al proveedor)","tags":["Finanzas - Retenciones"]}},"/v1/finance/retentions/receipts/{receiptId}/pdf/download":{"get":{"description":"Streams the retention certificate PDF for a receipt, authorized by a signed token+expires pair; rejected while the receipt is still in Borrador (certificate not yet issued).","operationId":"RetentionsController_downloadCertificatePublic","parameters":[{"name":"receiptId","required":true,"in":"path","schema":{"type":"number"}},{"name":"token","required":true,"in":"query","description":"Signed download token","schema":{"type":"string"}},{"name":"expires","required":true,"in":"query","description":"Token expiration (unix seconds)","schema":{"type":"string"}}],"responses":{"200":{"description":"Retention certificate PDF file"},"401":{"description":"Invalid or expired token"},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Download retention certificate PDF via signed URL (public)","tags":["Finanzas - Retenciones"]}},"/v1/finance/retentions/receipts/report":{"get":{"description":"Rows enriched with retention type + supplier/customer identity (razón social + CUIT). Mirrors v1 GetRetencionFilterReporte. When no date bounds are provided, defaults to the last month.","operationId":"RetentionsController_receiptsReport","parameters":[{"name":"retention_id","required":false,"in":"query","description":"Filter by retention type","schema":{"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"customer_id","required":false,"in":"query","description":"Filter by customer","schema":{"type":"number"}},{"name":"date_from","required":false,"in":"query","description":"Date from (inclusive, YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Date to (inclusive, YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Report rows","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RetentionReceiptReportRowDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Retention receipts report","tags":["Finanzas - Retenciones"]}},"/v1/finance/retentions/receipts/{receiptId}":{"get":{"description":"Returns a single retention receipt scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"RetentionsController_findReceipt","parameters":[{"name":"receiptId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Retention receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionReceiptResponseDto"}}}},"404":{"description":"RETENTION_RECEIPT_NOT_FOUND — retention receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get retention receipt by id","tags":["Finanzas - Retenciones"]}},"/v1/finance/retentions/{id}":{"get":{"description":"Returns a single retention type scoped to the organization, or 404 if it does not exist or belongs to another org.","operationId":"RetentionsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Retention","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionResponseDto"}}}},"404":{"description":"RETENTION_NOT_FOUND — retention does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get retention by id","tags":["Finanzas - Retenciones"]},"patch":{"description":"Patches editable fields of a retention type (abbreviation, description, isActive, isValue, accountId, jurisdictionId, depositAccountId).","operationId":"RetentionsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRetentionDto"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionResponseDto"}}}},"404":{"description":"RETENTION_NOT_FOUND — retention does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update retention","tags":["Finanzas - Retenciones"]},"delete":{"description":"Soft-deletes the retention type by setting isActive=false; the record is retained for historical receipts.","operationId":"RetentionsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"RETENTION_NOT_FOUND — retention does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete retention (soft)","tags":["Finanzas - Retenciones"]}},"/v1/finance/reports/treasury-movements":{"get":{"description":"Returns payment-method entries for the given date range with Ingreso/Egreso totals. v1 equivalent: Reportes/Ingresos + Reportes/Egresos.","operationId":"TreasuryMovementsController_getTreasuryMovements","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date inclusive (YYYY-MM-DD or ISO 8601)","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date inclusive (YYYY-MM-DD or ISO 8601)","schema":{"type":"string"}},{"name":"entry_type","required":false,"in":"query","description":"Filter by type: Ingreso | Egreso","schema":{"type":"string"}},{"name":"page","required":false,"in":"query","description":"Page number (default 1)","schema":{"type":"number"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 500)","schema":{"type":"number"}}],"responses":{"200":{"description":"Paginated treasury movements with totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryMovementsResponseDto"}}}},"400":{"description":"Missing or invalid date params / unknown entry_type"}},"security":[{"apiKey":[]}],"summary":"Treasury movements report (Ingresos/Egresos)","tags":["Finanzas - Reportes"]}},"/v1/finance/reports/treasury-movements/export":{"get":{"description":"Streams the treasury movements (Ingresos/Egresos payment-method entries) for the given date range as a CSV file, optionally filtered by entry_type.","operationId":"TreasuryMovementsController_exportTreasuryMovements","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}},{"name":"entry_type","required":false,"in":"query","description":"Ingreso | Egreso","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"apiKey":[]}],"summary":"Export treasury movements as CSV","tags":["Finanzas - Reportes"]}},"/v1/finance/cashflow":{"get":{"description":"Groups treasury movements (payment_method_entries) by account into inflow (Ingreso), outflow (Egreso) and net, with period totals. Not available for high-volume organizations.","operationId":"FinanceCashflowController_getCashflow","parameters":[{"name":"date_from","required":true,"in":"query","description":"Start date inclusive (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","description":"End date inclusive (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Per-account cashflow with totals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashflowResponseDto"}}}},"400":{"description":"Missing/invalid range or high-volume org","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Cashflow report (per-account inflow/outflow/net)","tags":["Finanzas - Reportes"]}},"/v1/integrations/afip-comprobantes/status":{"get":{"description":"Reports whether the AFIP comprobantes reader is live. Currently a skeleton: available=false, pending read-only credentials + the Playwright scraper.","operationId":"AfipComprobantesController_status","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AfipComprobantesStatusResponseDto"}}}}},"summary":"Estado de la integración de comprobantes AFIP","tags":["Integraciones - AFIP Comprobantes"]}},"/v1/integrations/afip-comprobantes/import":{"post":{"description":"Pulls the org's externally-issued comprobantes from AFIP and registers them as already-authorized. Throws 503 until credentials + scraper are configured.","operationId":"AfipComprobantesController_import","parameters":[],"responses":{"503":{"description":"AFIP_COMPROBANTES_NOT_CONFIGURED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"summary":"Importar comprobantes emitidos en AFIP (pendiente)","tags":["Integraciones - AFIP Comprobantes"]}},"/v1/receipt-books":{"get":{"description":"Returns all non-deleted receipt books (talonarios / points of sale) of the current organization, ordered by point of sale.","operationId":"ReceiptBooksController_findAll","parameters":[],"responses":{"200":{"description":"List of receipt books","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List receipt books for the current organization","tags":["Ventas - Talonarios"]},"post":{"description":"Creates a receipt book for the current organization after validating the point-of-sale type against the organization's country and that the point of sale is not already in use; returns the created receipt book. Spanish organizations get a self-managed (AUTOGESTION) book when `type` is omitted.","operationId":"ReceiptBooksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReceiptBookDto"}}}},"responses":{"201":{"description":"Created receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"400":{"description":"INVALID_RECEIPT_BOOK_TYPE — point-of-sale type not allowed for the organization's country, or WS_MOCK in production. INVALID_POINT_OF_SALE — point of sale outside ARCA's range 1–99998. INVALID_RECEIPT_BOOK_PREFIX — Argentina: prefix is not the point of sale with 4 digits (5 from 10000). BRANCH_NOT_FOUND — branch does not exist, is deleted, or belongs to another organization. ELECTRONIC_EMISSION_NOT_AVAILABLE — WS/WS_MOCK outside Argentina. FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"POINT_OF_SALE_DUPLICATE — another active receipt book of the organization already uses this point of sale (checked atomically, so concurrent creates cannot both succeed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create receipt book","tags":["Ventas - Talonarios"]}},"/v1/receipt-books/by-point-of-sale/{pointOfSale}":{"get":{"description":"Returns the receipt book identified by its point-of-sale number within the current organization; responds 404 if none exists.","operationId":"ReceiptBooksController_findByPointOfSale","parameters":[{"name":"pointOfSale","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get receipt book by point of sale","tags":["Ventas - Talonarios"]}},"/v1/receipt-books/import-from-arca":{"post":{"description":"Imports puntos de venta from ARCA (AFIP) via WSFE (domestic) and WSFEX (export), creating any missing receipt books and seeding each new domestic book's last receipt numbers from AFIP. Points of sale ARCA reports as blocked or discharged are not imported (`skippedInactive`); one that already has a receipt book, even a disabled one, is skipped (`skipped`). If only one web service fails, the other one's points of sale are imported and `warnings` explains what could not be read; if both fail it answers 502. Returns the counts and the books.","operationId":"ReceiptBooksController_importFromArca","parameters":[],"responses":{"200":{"description":"Import result with created/skipped counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFromArcaResponseDto"}}}},"400":{"description":"ELECTRONIC_EMISSION_NOT_AVAILABLE — the organization's country has no electronic emission (Spain: self-managed only). FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"502":{"description":"ARCA_POINTS_OF_SALE_UNAVAILABLE — neither WSFE nor WSFEX answered the points of sale; the message carries ARCA's error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Import puntos de venta from ARCA (AFIP)","tags":["Ventas - Talonarios"]}},"/v1/receipt-books/{id}":{"get":{"description":"Returns a single receipt book of the current organization by its id; responds 404 if it does not exist or belongs to another organization.","operationId":"ReceiptBooksController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get receipt book by id","tags":["Ventas - Talonarios"]},"patch":{"description":"Updates the receipt book for the current organization, validating point-of-sale type and uniqueness; returns the updated receipt book or 404 if it does not exist or belongs to another organization.","operationId":"ReceiptBooksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReceiptBookDto"}}}},"responses":{"200":{"description":"Updated receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"400":{"description":"INVALID_RECEIPT_BOOK_TYPE — point-of-sale type not allowed for the organization's country, or WS_MOCK in production. INVALID_POINT_OF_SALE — point of sale outside ARCA's range 1–99998. INVALID_RECEIPT_BOOK_PREFIX — Argentina: prefix is not the point of sale with 4 digits (5 from 10000). BRANCH_NOT_FOUND — branch does not exist, is deleted, or belongs to another organization. ELECTRONIC_EMISSION_NOT_AVAILABLE — WS/WS_MOCK outside Argentina. FISCAL_PROVIDER_NOT_AVAILABLE — the organization's country has no fiscal provider.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"RECEIPT_BOOK_COUNTERS_FORBIDDEN — a numbering counter (`lastInvoiceA` … `lastDebitNoteC`) was changed without the `receipt-books:import` permission. Counters sent with their current value are accepted and left untouched.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"POINT_OF_SALE_DUPLICATE — another active receipt book of the organization already uses this point of sale (checked atomically, so concurrent creates cannot both succeed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update receipt book","tags":["Ventas - Talonarios"]},"delete":{"description":"Soft-deletes the receipt book (sets deleted_at) for the current organization; returns 204 on success or 404 if it does not exist or belongs to another organization.","operationId":"ReceiptBooksController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete receipt book","tags":["Ventas - Talonarios"]}},"/v1/receipt-books/{id}/disable":{"post":{"description":"Marks the receipt book as not used in Peakly (for example a point of sale another system issues with). It stays listed with `isDisabled: true`, but creating, confirming or voiding with a credit note against it answers 400 RECEIPT_BOOK_DISABLED, the Excel import refuses it and \"Importar desde ARCA\" never re-creates it. Idempotent: disabling an already-disabled book only updates the reason. Returns the updated receipt book.","operationId":"ReceiptBooksController_disable","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisableReceiptBookDto"}}}},"responses":{"200":{"description":"Disabled receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Disable receipt book","tags":["Ventas - Talonarios"]}},"/v1/receipt-books/{id}/enable":{"post":{"description":"Enables a receipt book previously disabled with POST /receipt-books/{id}/disable, so sales receipts can be issued against it again. Idempotent: enabling a book that is not disabled is a no-op. Returns the updated receipt book.","operationId":"ReceiptBooksController_enable","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Enabled receipt book","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — receipt book does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Enable receipt book","tags":["Ventas - Talonarios"]}},"/v1/file-imports/upload":{"post":{"description":"Upload an Excel (.xlsx, .xls) or CSV (.csv) file for import processing. Creates a FileImport record and stores the file server-side for asynchronous processing. Besides `receipt-books:import`, each type needs its own permissions: CLIENTES → customers:create; PRODUCTOS → products:create; PROVEEDORES → suppliers:create; COMPROBANTES_COMPRA → purchase-receipts:create + suppliers:create; purchase-receipts → purchase-receipts:create + suppliers:create; COMPROBANTES_VENTA → sales-receipts:create + sales-receipts:confirm + customers:create + products:create; PAYROLL → employees:write. A role restricted to Consumidor Final customers can only import those, and its sales are created and confirmed as the uploader.","operationId":"FileImportsController_upload","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","type"],"properties":{"file":{"type":"string","format":"binary"},"type":{"type":"string","enum":["COMPROBANTES_VENTA","COMPROBANTES_COMPRA","purchase-receipts","CLIENTES","PROVEEDORES","PRODUCTOS","PAYROLL"],"description":"Import type"}}}}}},"responses":{"201":{"description":"File uploaded and import record created"},"400":{"description":"Validation failed. Codes: NO_FILE_PROVIDED, INVALID_IMPORT_TYPE, INVALID_FILE_EXTENSION, FILE_TOO_LARGE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Missing the permissions of the import type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Upload a file for import","tags":["Common - Importaciones"]}},"/v1/file-imports/preview":{"post":{"description":"Parse and fully validate a sales-receipt import file WITHOUT writing anything: no customers/products are created, no drafts are saved, nothing is sent to AFIP. Returns a per-comprobante preview (would-import vs error + reason) so the file can be checked before the real import auto-emits. Only the sales-receipts type is supported. Needs the permissions of a sales import (receipt-books:import + sales-receipts:create + sales-receipts:confirm + customers:create + products:create).","operationId":"FileImportsController_preview","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Validation preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportPreviewResponseDto"}}}},"400":{"description":"Validation failed. Codes: NO_FILE_PROVIDED, INVALID_FILE_EXTENSION, FILE_TOO_LARGE, TOO_MANY_ROWS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Missing the permissions of a sales import.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Dry-run a sales-receipt import (validate only)","tags":["Common - Importaciones"]}},"/v1/file-imports/download":{"get":{"description":"Returns a short-lived signed URL to download an import result file. The key must be the `resultPath` (or `path`) of one of the current organization's file imports; any other key is rejected with `INVALID_DOWNLOAD_KEY`. For a sales receipts import, the result file is first updated with each comprobante's current number, CAE and emission state.","operationId":"FileImportsController_getDownloadUrl","parameters":[{"name":"key","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Signed download URL"},"400":{"description":"INVALID_DOWNLOAD_KEY — key missing, malformed, or not a file of one of this organization's imports.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get signed download URL for an import result file","tags":["Common - Importaciones"]}},"/v1/file-imports/templates/{type}":{"get":{"description":"Download a pre-built Excel template with headers, example rows, and valid value hints. Type must be one of: customers, products, sales-receipts.","operationId":"FileImportsController_downloadTemplate","parameters":[{"name":"type","required":true,"in":"path","schema":{"enum":["customers","products","sales-receipts","purchase-receipts"],"type":"string"}}],"responses":{"200":{"description":"Excel template file"},"400":{"description":"Invalid template type"}},"security":[{"apiKey":[]}],"summary":"Download import template","tags":["Common - Importaciones"]}},"/v1/file-imports":{"get":{"description":"Returns the organization's file import records, optionally filtered by import type.","operationId":"FileImportsController_findAll","parameters":[{"name":"type","required":false,"in":"query","description":"Filter by import type","schema":{"enum":["COMPROBANTES_VENTA","COMPROBANTES_COMPRA","purchase-receipts","CLIENTES","PROVEEDORES","PRODUCTOS","PAYROLL"],"type":"string"}}],"responses":{"200":{"description":"List of file imports"}},"security":[{"apiKey":[]}],"summary":"List file imports for the current organization","tags":["Common - Importaciones"]},"post":{"description":"Creates a file import record for the current organization (metadata only; use the upload endpoint to store a file and start processing).","operationId":"FileImportsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFileImportDto"}}}},"responses":{"201":{"description":"Created file import"},"400":{"description":"Validation failed. Codes: INVALID_IMPORT_TYPE, INVALID_IMPORT_PATH.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create file import","tags":["Common - Importaciones"]}},"/v1/file-imports/{id}":{"get":{"description":"Returns a single file import record (including its processing status and results) by id, scoped to the current organization.","operationId":"FileImportsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"File import"},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get file import by id","tags":["Common - Importaciones"]},"patch":{"description":"Updates a file import record's status, original filename and counts; 404 when it does not exist or belongs to another organization. `type`, `userId`, `path` and `resultPath` cannot change once the import exists (the import job picks its permissions and processor from them) and are rejected as unknown fields.","operationId":"FileImportsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFileImportDto"}}}},"responses":{"200":{"description":"Updated file import"},"400":{"description":"Validation failed (including a `type`, `userId`, `path` or `resultPath` in the body).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"FILE_IMPORT_NOT_FOUND — file import does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update file import","tags":["Common - Importaciones"]},"delete":{"description":"Deletes a file import record; 404 when it does not exist or belongs to another organization.","operationId":"FileImportsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"FILE_IMPORT_NOT_FOUND — file import does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete file import","tags":["Common - Importaciones"]}},"/v1/branches":{"get":{"description":"Get the list of active branches to populate branch pickers and decide which point of sale to use. Deleted branches are not included.","operationId":"BranchesController_findAll","parameters":[],"responses":{"200":{"description":"List of branches","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BranchResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List branches","tags":["Common - Sucursales"]},"post":{"description":"Create a branch for each physical location your business operates from. Once created, you can reference its id on receipts and assign point-of-sale numbers to it. The name must be different from your other branches.","operationId":"BranchesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBranchDto"}}}},"responses":{"201":{"description":"Created branch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchResponseDto"}}}},"409":{"description":"Codes: BRANCH_NAME_REQUIRED, BRANCH_NAME_DUPLICATE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create branch","tags":["Common - Sucursales"]}},"/v1/branches/{id}":{"get":{"description":"Get a branch's details — useful when you've stored an id on a receipt and need to display the branch name and address.","operationId":"BranchesController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Branch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchResponseDto"}}}},"404":{"description":"BRANCH_NOT_FOUND — branch does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get branch by id","tags":["Common - Sucursales"]},"patch":{"description":"Edit the branch — for example to fix the address or update the contact phone. Send only the fields you want to change. If you change `name`, it still has to be different from your other branches.","operationId":"BranchesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBranchDto"}}}},"responses":{"200":{"description":"Updated branch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchResponseDto"}}}},"404":{"description":"BRANCH_NOT_FOUND — branch does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"BRANCH_NAME_DUPLICATE — another branch already uses this name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update branch","tags":["Common - Sucursales"]},"delete":{"description":"Stop a branch from appearing in pickers and reports when you no longer operate from it. Past receipts that reference the branch keep working.","operationId":"BranchesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"BRANCH_NOT_FOUND — branch does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete branch","tags":["Common - Sucursales"]}},"/v1/sales/sales-receipts/next-number":{"get":{"description":"Previews (without consuming) the next sequential number that would be assigned for the given receipt book, customer and receipt type.","operationId":"SalesReceiptsController_getNextNumber","parameters":[{"name":"receipt_book_id","required":true,"in":"query","schema":{"type":"number"}},{"name":"customer_id","required":true,"in":"query","schema":{"type":"number"}},{"name":"receipt_type","required":false,"in":"query","schema":{"enum":["factura","nota_credito","nota_debito"],"type":"string"}}],"responses":{"200":{"description":"Preview of the next receipt number that would be assigned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NextReceiptNumberResponseDto"}}}},"400":{"description":"Validation failed. Codes: MISSING_SALES_LETTER.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview the next receipt number for a receipt book + customer + type","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/export/columns":{"get":{"description":"Returns every available CSV export column as key/header pairs, for building a custom column selection for the export endpoint.","operationId":"SalesReceiptsController_listExportColumns","parameters":[],"responses":{"200":{"description":"Available export column keys and their headers","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ExportColumnResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List all available export columns (key + header)","tags":["Ventas - Comprobantes - Exports"]}},"/v1/sales/sales-receipts/export":{"get":{"description":"Exports filtered sales receipts as CSV; small result sets stream synchronously while large sets or high-volume orgs return 202 and run as a background job.","operationId":"SalesReceiptsController_exportCsv","parameters":[{"name":"date_from","required":false,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","schema":{"type":"string"}},{"name":"search","required":false,"in":"query","schema":{"type":"string"}},{"name":"customer_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"receipt_type","required":false,"in":"query","schema":{"enum":["factura","nota_credito","nota_debito"],"type":"string"}},{"name":"user_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"receipt_book_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"preset","required":false,"in":"query","schema":{"enum":["default","detailed"],"type":"string"}},{"name":"columns","required":false,"in":"query","description":"Comma-separated column keys (overrides preset and saved config)","schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file download"},"202":{"description":"Async export triggered (large result set or high-volume org)","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/AsyncExportAcceptedResponseDto"}}}},"400":{"description":"Invalid request. Codes: EXPORT_FILTER_DATE_INVALID, EXPORT_TOO_LARGE_WITHOUT_USER. The second one is returned to API keys that have no creating user when the export is too large to stream (or cannot be bounded): narrow the filters or use an API key created by a user.","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export sales receipts as CSV","tags":["Ventas - Comprobantes - Exports"]}},"/v1/sales/sales-receipts":{"get":{"description":"Returns a page of sales receipts. Use cursor from nextCursor for the next page. If date_from/date_to are omitted, all dates are included.","operationId":"SalesReceiptsController_findAll","parameters":[{"name":"date_from","required":false,"in":"query","description":"Filter receipts on or after this date (YYYY-MM-DD). Omit to include all dates.","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter receipts on or before this date (YYYY-MM-DD, inclusive). Omit to include all dates.","schema":{"type":"string"}},{"name":"status","required":false,"in":"query","description":"Filter by receipt status","schema":{"type":"string","enum":["Borrador","Pendiente_Afip","Creada","Cobrada","Imputado","Anulado"]}},{"name":"search","required":false,"in":"query","description":"Search by customer name, receipt number, or CAE. Supports prefixes: cae:<value>, cuit:<value>, nro:<value>, id:<value>","schema":{"type":"string"}},{"name":"customer_id","required":false,"in":"query","description":"Filter by customer ID","schema":{"type":"number"}},{"name":"receipt_type","required":false,"in":"query","description":"Filter by receipt type group","schema":{"type":"string","enum":["factura","nota_credito","nota_debito"]}},{"name":"user_id","required":false,"in":"query","description":"Filter by creator user ID","schema":{"type":"number"}},{"name":"receipt_book_id","required":false,"in":"query","description":"Filter by receipt book ID","schema":{"type":"number"}},{"name":"provider_id","required":false,"in":"query","description":"Exact match on the external provider identifier","schema":{"type":"string"}},{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page (from previous response nextCursor)","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 20, max 100)","schema":{"default":20,"type":"number"}}],"responses":{"200":{"description":"Paginated sales receipts (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptPageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List sales receipts (cursor-paginated, optional date filters)","tags":["Ventas - Comprobantes"]},"post":{"description":"**Quickest path — no IDs required.** Send `customerTaxId` (CUIT) and a line `description`; the server matches an existing customer by tax id (or creates one from ARCA padrón data) and matches an existing product by description (or creates it). No need to pre-create customers or products via separate endpoints. See the **Minimal** example below.\n\nIf you already have IDs from previous calls, send `customerId` / `productId` instead — see the **With existing IDs** example.\n\nSend the `Idempotency-Key` header to make retries safe: a second request with the same key returns the original receipt with status 200 and an `Idempotent-Replayed: true` response header. The header value is stored as the receipt's `providerId`, so it must be unique per organization. Sending both the header and a body `providerId` is rejected with IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT.","operationId":"SalesReceiptsController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Idempotency key (max 255 chars). On replay, returns the original receipt with status 200 and `Idempotent-Replayed: true`.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSalesReceiptDto"},"examples":{"minimal":{"summary":"Minimal — match-or-create customer + product","description":"Send `customerTaxId` and a line `description`. The server resolves (or creates) the customer by tax id and the product by description, and defaults `saleConditionId` to Contado. No prior calls needed.","value":{"receiptBookId":1,"customerTaxId":"30712345670","details":[{"quantity":1,"unitPrice":100,"description":"Servicios de consultoría"}]}},"withExistingIds":{"summary":"With existing IDs — when you already have customerId / productId","description":"If you already created the customer and product via their endpoints, send the IDs directly to skip resolution.","value":{"receiptBookId":1,"saleConditionId":1,"customerId":42,"details":[{"quantity":1,"unitPrice":100,"productId":17}]}}}}}},"responses":{"200":{"description":"Idempotent replay — original sales receipt returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"201":{"description":"Created sales receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, SALES_ISSUANCE_NOT_AVAILABLE, FISCAL_PROVIDER_NOT_AVAILABLE, DETAILS_REQUIRED, MISSING_SALES_LETTER, PROVIDER_ID_DUPLICATE, IDEMPOTENCY_KEY_AND_PROVIDER_ID_CONFLICT, IDEMPOTENCY_KEY_TOO_LONG, EXPORT_DATA_INVALID, EXPORT_DATE_INVALID, EXPORT_RECEIPT_KIND_MISMATCH, RECEIPT_BOOK_DISABLED, SELF_SALE_NOT_ALLOWED, UNSUPPORTED_VAT_RATE, VAT_NOT_ALLOWED_FOR_LETTER, NEGATIVE_TOTAL, SERVICE_DATES_REQUIRED, RECEIPT_DATE_BEFORE_LAST, RECEIPT_DATE_IN_FUTURE, CONSUMER_AMOUNT_LIMIT_EXCEEDED, RECEIVER_CLASS_MISMATCH, RECEIVER_VAT_CONDITION_MISSING, RECEIVER_VAT_CONDITION_INVALID_FOR_CLASS, ASSOCIATED_RECEIPT_NOT_FOUND, ASSOCIATED_RECEIPT_CUSTOMER_MISMATCH, ASSOCIATED_RECEIPT_LETTER_MISMATCH, NOTE_TYPE_OPERATION_MISMATCH, CREDIT_NOTE_AMOUNT_EXCEEDS_BALANCE, FCE_ASSOCIATED_RECEIPT_INVALID, FCE_ASSOCIATED_RECEIPT_REQUIRED, CONSIGNMENT_SETTLEMENT_NOT_ENABLED, CONSIGNMENT_SETTLEMENT_INVALID, FIELD_NOT_SUPPORTED_FOR_COUNTRY, ES_RECEIPT_BOOK_NOT_SELF_MANAGED, ES_UNKNOWN_DOCUMENT_TYPE, ES_DOCUMENT_TYPE_OPERATION_MISMATCH, ES_DEBIT_NOTE_NOT_SUPPORTED, ES_RECIPIENT_TAX_ID_REQUIRED, ES_RECTIFIED_INVOICE_REQUIRED, ES_UNRESOLVED_TAX_CODE, ES_INVALID_IRPF_RATE, ES_WITHHOLDING_NOT_ALLOWED, ES_SURCHARGE_NOT_APPLICABLE, ES_UNIT_PRICE_WITH_VAT_NOT_SUPPORTED, ES_CUSTOMER_TAX_ID_NOT_FOUND, ES_INVALID_SERIES, ES_DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE, ES_RECTIFICATION_REASON_NOT_APPLICABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Customer or receipt book not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create sales receipt","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/confirm":{"post":{"description":"Validates required fields, assigns real receipt number, sets status to Pendiente_Afip, and triggers AFIP authorization. Non-WS books (and every Spanish organization, whose points of sale are self-managed) skip AFIP: the receipt is numbered from its serie and becomes Creada in the same transaction — no CAE, no task.","operationId":"SalesReceiptsController_confirm","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Confirmed receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, SALES_ISSUANCE_NOT_AVAILABLE, FISCAL_PROVIDER_NOT_AVAILABLE, INVALID_RECEIPT_STATUS_FOR_CONFIRM, EXPORT_DATA_INVALID, EXPORT_DATE_INVALID, EXPORT_RECEIPT_KIND_MISMATCH, CUSTOMER_REQUIRED, DETAILS_REQUIRED, RECEIPT_BOOK_REQUIRED, SALE_CONDITION_REQUIRED, RECEIPT_DATE_TOO_OLD, RECEIPT_BOOK_NOT_FOUND, RECEIPT_BOOK_DISABLED, SELF_SALE_NOT_ALLOWED, VAT_NOT_ALLOWED_FOR_LETTER, NEGATIVE_TOTAL, SERVICE_DATES_REQUIRED, RECEIPT_DATE_BEFORE_LAST, RECEIPT_DATE_IN_FUTURE, CONSUMER_AMOUNT_LIMIT_EXCEEDED, RECEIVER_CLASS_MISMATCH, RECEIVER_VAT_CONDITION_MISSING, RECEIVER_VAT_CONDITION_INVALID_FOR_CLASS, ASSOCIATED_RECEIPT_NOT_FOUND, ASSOCIATED_RECEIPT_CUSTOMER_MISMATCH, ASSOCIATED_RECEIPT_LETTER_MISMATCH, NOTE_TYPE_OPERATION_MISMATCH, CREDIT_NOTE_AMOUNT_EXCEEDS_BALANCE, FCE_ASSOCIATED_RECEIPT_INVALID, FCE_ASSOCIATED_RECEIPT_REQUIRED, CONSIGNMENT_SETTLEMENT_NOT_ENABLED, CONSIGNMENT_SETTLEMENT_INVALID, FIELD_NOT_SUPPORTED_FOR_COUNTRY, ES_RECEIPT_BOOK_NOT_SELF_MANAGED, ES_UNKNOWN_DOCUMENT_TYPE, ES_DOCUMENT_TYPE_OPERATION_MISMATCH, ES_DEBIT_NOTE_NOT_SUPPORTED, ES_RECIPIENT_TAX_ID_REQUIRED, ES_RECTIFIED_INVOICE_REQUIRED, ES_UNRESOLVED_TAX_CODE, ES_INVALID_IRPF_RATE, ES_WITHHOLDING_NOT_ALLOWED, ES_SURCHARGE_NOT_APPLICABLE, ES_UNIT_PRICE_WITH_VAT_NOT_SUPPORTED, ES_CUSTOMER_TAX_ID_NOT_FOUND, ES_INVALID_SERIES, ES_DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE, ES_RECTIFICATION_REASON_NOT_APPLICABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DRAFT_CONFLICT — the export draft changed while it was being confirmed; reload before confirming.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Confirm a draft receipt (Borrador -> Pendiente_Afip / Creada)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/retry":{"post":{"description":"Clears any previous error and re-triggers AFIP authorization. Only receipts in Pendiente_Afip status can be retried.","operationId":"SalesReceiptsController_retry","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Retry triggered, receipt returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: INVALID_RECEIPT_STATUS_FOR_RETRY, AUTHORIZATION_ALREADY_IN_PROGRESS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Retry AFIP authorization for a pending receipt","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/void":{"post":{"description":"Voids a Creada receipt by creating a compensating credit note (NC). For WS receipts (with CAE) the original is never marked Anulado: once AFIP authorizes the NC, it is imputed against the original, which ends Cobrada and the NC Imputado. Voiding a credit note issues a debit note instead, and once that debit note is authorized the credit note is imputed against it (NC Imputado, ND Cobrada). For pre-impreso: original is marked Anulado immediately. WS receipts always require a credit note (numbers cannot be reused). Spain: the credit note is a factura rectificativa (R4, or R5 for an F2) numbered in the book's rectificativas serie (`<serie>-R`); it is Creada and the original Anulado in the same transaction. `createCreditNote: false` is rejected (WS_VOID_REQUIRES_CREDIT_NOTE) and a rectificativa cannot itself be voided (ES_DEBIT_NOTE_NOT_SUPPORTED — Spain has no debit note).","operationId":"SalesReceiptsController_voidReceipt","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidSalesReceiptDto"}}}},"responses":{"200":{"description":"Voided receipt with optional credit note ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoidSalesReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, RECEIPT_ALREADY_VOIDED, INVALID_RECEIPT_STATUS_FOR_VOID, RECEIPT_BOOK_NOT_FOUND, RECEIPT_BOOK_DISABLED, WS_VOID_REQUIRES_CREDIT_NOTE, RECEIPT_ALREADY_CREDITED, PARTIAL_CREDIT_EXISTS, HAS_COLLECTIONS_CANNOT_VOID, CREDIT_NOTE_HAS_IMPUTATIONS, CREDIT_NOTE_DELIVERY_NOTES_REINVOICED, COMPENSATING_NOTE_REQUIRES_MANUAL_HANDLING, RECEIVER_VAT_CONDITION_MISSING, ES_DEBIT_NOTE_NOT_SUPPORTED, ES_RECEIPT_BOOK_NOT_SELF_MANAGED, FIELD_NOT_SUPPORTED_FOR_COUNTRY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void a confirmed receipt (Anulación)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/imputations":{"post":{"description":"Applies a credit note (Creada) against invoices/debit notes of the same customer, in partial amounts. Each target accumulates `totalCollected` and becomes `Cobrada` when fully covered; the credit note becomes `Imputado` when fully used.","operationId":"SalesReceiptsController_createImputations","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateImputationsDto"}}}},"responses":{"201":{"description":"Created imputations","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateImputationsResponseDto"}}}},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, IMPUTATION_NOT_A_CREDIT_NOTE, IMPUTATION_TARGET_IS_CREDIT_NOTE, IMPUTATION_INVALID_STATUS, IMPUTATION_CUSTOMER_MISMATCH, IMPUTATION_EXCEEDS_CREDIT_NOTE, IMPUTATION_EXCEEDS_TARGET_PENDING.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — credit note or a target receipt does not exist in this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Apply a credit note against one or more receipts (imputación)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/imputations":{"get":{"description":"Returns the imputations where the receipt participates, either as the credit note being applied or as the target invoice/debit note.","operationId":"SalesReceiptsController_listImputations","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Imputations for the receipt","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ImputationResponseDto"}}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List imputations for a receipt","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/imputations/{imputationId}":{"delete":{"description":"Reverses an imputation: both the credit note and the target receipt subtract the imputed amount and return to `Creada` (v1 AnularImputacion parity).","operationId":"SalesReceiptsController_deleteImputation","parameters":[{"name":"imputationId","required":true,"in":"path","description":"Imputation UUID","schema":{"type":"string"}}],"responses":{"204":{"description":"Imputation deleted and reversed"},"400":{"description":"ORGANIZATION_ARCHIVED — organization is archived (read-only).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"IMPUTATION_NOT_FOUND — imputation does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete an imputation (reversal)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/duplicate":{"post":{"description":"Creates a new BORRADOR draft by copying customer, items, conditions from the source receipt. Dates are reset to today. Any status receipt can be duplicated.","operationId":"SalesReceiptsController_duplicate","parameters":[{"name":"id","required":true,"in":"path","description":"Source sales receipt UUID","schema":{"type":"string"}}],"responses":{"201":{"description":"New draft receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"Validation failed when re-creating the draft. Codes: ORGANIZATION_ARCHIVED, DETAILS_REQUIRED, MISSING_SALES_LETTER, PROVIDER_ID_DUPLICATE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — source receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Duplicate a receipt as a new draft (BORRADOR)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/authorize":{"post":{"description":"Request AFIP authorization for a receipt that's in `PENDIENTE_AFIP`. The API normally drives this automatically when you call `POST /sales-receipts/:id/confirm` — call this endpoint directly only when you want to retry authorization on a receipt that previously failed.","operationId":"SalesReceiptsController_authorizeAfip","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Authorization result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthorizeAfipResponseDto"}}}},"400":{"description":"Validation failed (or AFIP error). Codes: INVALID_RECEIPT_STATUS_FOR_AUTHORIZE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Authorize receipt with AFIP (get CAE)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/pdf/download":{"get":{"description":"Public endpoint that verifies a signed token to stream the invoice PDF inline. Argentina: unavailable while the receipt is still a draft or pending AFIP. Other countries (no authorization step): available from creation, drafts included (marked as draft).","operationId":"SalesReceiptsController_downloadPdfPublic","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}},{"name":"token","required":true,"in":"query","description":"Signed download token","schema":{"type":"string"}},{"name":"expires","required":true,"in":"query","description":"Token expiration (unix seconds)","schema":{"type":"string"}}],"responses":{"200":{"description":"Invoice PDF file"},"401":{"description":"Invalid or expired token"},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Download invoice PDF via signed URL (public)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/pdf":{"get":{"description":"Generates and streams the receipt's invoice PDF inline. Argentina: unavailable while the receipt is still a draft or pending AFIP. Other countries (no authorization step): available from creation, drafts included (marked as draft). `pdfAvailable` on the receipt tells which.","operationId":"SalesReceiptsController_downloadPdf","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Invoice PDF file"},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Download invoice as PDF","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/send-email":{"post":{"description":"Triggers a background job to email the invoice to the customer/collection address; the receipt must already be authorized.","operationId":"SalesReceiptsController_sendEmail","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailDto"}}}},"responses":{"200":{"description":"Email send triggered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailResponseDto"}}}},"400":{"description":"Validation failed. Codes: RECEIPT_NOT_AUTHORIZED_FOR_EMAIL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Codes: SALES_RECEIPT_NOT_FOUND, EMAIL_NOT_AVAILABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Send invoice by email (background job)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/resend-email":{"post":{"description":"Public endpoint that verifies a signed token to re-send the invoice email in the background; rate-limited to once every two minutes per receipt.","operationId":"SalesReceiptsController_resendEmailPublic","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}},{"name":"token","required":true,"in":"query","schema":{"type":"string"}},{"name":"expires","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Email resent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendEmailResponseDto"}}}},"401":{"description":"Invalid or expired token"},"404":{"description":"Not found or no email"},"429":{"description":"Rate limited"}},"security":[{"apiKey":[]}],"summary":"Resend invoice email via signed link (public)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}/tracking-events":{"get":{"description":"Returns the recorded email open/tracking events for the receipt, plus whether email tracking is enabled for the organization.","operationId":"SalesReceiptsController_getTrackingEvents","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Tracking events with tracking enabled flag","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackingEventsResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get email tracking events for a receipt","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/bulk-email":{"post":{"description":"Creates a background job that emails the invoices for the given receipt IDs, and returns the job id for progress polling.","operationId":"SalesReceiptsController_bulkEmail","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkEmailDto"}}}},"responses":{"200":{"description":"Bulk email job created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionJobCreatedResponseDto"}}}},"400":{"description":"Invalid receipt IDs"}},"security":[{"apiKey":[]}],"summary":"Send emails for multiple receipts (background job)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/bulk-pdf":{"post":{"description":"Creates a background job that renders the given receipts' PDFs into a downloadable ZIP, and returns the job id for progress polling.","operationId":"SalesReceiptsController_bulkPdf","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkPdfDto"}}}},"responses":{"200":{"description":"Bulk PDF job created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionJobCreatedResponseDto"}}}},"400":{"description":"Invalid receipt IDs"}},"security":[{"apiKey":[]}],"summary":"Generate PDFs for multiple receipts as a ZIP file (background job)","tags":["Ventas - Comprobantes - Exports"]}},"/v1/sales/sales-receipts/bulk-void":{"post":{"description":"Creates a background job that voids the given receipts, issuing compensating credit notes where required, and returns the job id for progress polling.","operationId":"SalesReceiptsController_bulkVoid","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkVoidDto"}}}},"responses":{"200":{"description":"Bulk void job created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionJobCreatedResponseDto"}}}},"400":{"description":"Invalid receipt IDs"}},"security":[{"apiKey":[]}],"summary":"Void multiple receipts as a background job (creates credit notes where required)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/bulk-actions/{jobId}/status":{"get":{"description":"Returns the status and progress counts of a bulk action job (email, PDF or void), including per-receipt statuses and any download URL.","operationId":"SalesReceiptsController_bulkActionStatus","parameters":[{"name":"jobId","required":true,"in":"path","description":"Bulk action job UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Job status and progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionStatusResponseDto"}}}},"404":{"description":"Job not found"}},"security":[{"apiKey":[]}],"summary":"Get bulk action job progress (email, PDF, or void)","tags":["Ventas - Comprobantes"]}},"/v1/sales/sales-receipts/{id}":{"get":{"description":"Returns a single sales receipt by id; 404 if it does not exist in this organization.","operationId":"SalesReceiptsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"Sales receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"404":{"description":"Not found"}},"security":[{"apiKey":[]}],"summary":"Get sales receipt by id","tags":["Ventas - Comprobantes"]},"patch":{"description":"Updates editable fields of a sales receipt such as observation and collection email; 404 if it does not exist in this organization.","operationId":"SalesReceiptsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSalesReceiptDto"}}}},"responses":{"200":{"description":"Updated sales receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, RECEIPT_DATE_TOO_OLD, MISSING_SALES_LETTER, EXPORT_DATE_INVALID, UNSUPPORTED_VAT_RATE, NUMBERED_RECEIPT_SEQUENCE_IMMUTABLE, NOTE_CLASS_CHANGE_REQUIRES_DETAILS, CONSIGNMENT_SETTLEMENT_NOT_ENABLED, CONSIGNMENT_SETTLEMENT_INVALID, FIELD_NOT_SUPPORTED_FOR_COUNTRY, ES_RECEIPT_BOOK_NOT_SELF_MANAGED, ES_UNKNOWN_DOCUMENT_TYPE, ES_DOCUMENT_TYPE_OPERATION_MISMATCH, ES_DEBIT_NOTE_NOT_SUPPORTED, ES_RECIPIENT_TAX_ID_REQUIRED, ES_RECTIFIED_INVOICE_REQUIRED, ES_UNRESOLVED_TAX_CODE, ES_INVALID_IRPF_RATE, ES_WITHHOLDING_NOT_ALLOWED, ES_SURCHARGE_NOT_APPLICABLE, ES_UNIT_PRICE_WITH_VAT_NOT_SUPPORTED, ES_CUSTOMER_TAX_ID_NOT_FOUND, ES_INVALID_SERIES, ES_DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE, ES_RECTIFICATION_REASON_NOT_APPLICABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DRAFT_CONFLICT — the request sent `expectedUpdatedAt` and the draft changed since. Nothing was written; re-read the draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update sales receipt (observation, collectionEmail)","tags":["Ventas - Comprobantes"]},"delete":{"description":"Hard-deletes a receipt and its details/observations. Borrador receipts can be deleted by any user. Pendiente_Afip receipts can only be deleted by root users. Creada receipts from non-WS (pre-impreso) receipt books can be deleted too. A numbered Pendiente_Afip or Creada receipt can only be deleted if it holds the last number issued for its receipt book, letter and type (the number is released); otherwise NOT_LAST_RECEIPT_NUMBER — delete the later ones first or use a credit note. Confirmed WS receipts cannot be deleted — use a credit note instead. Spain: only drafts can be deleted; an issued invoice is voided with a rectificativa (INVALID_RECEIPT_STATUS_FOR_DELETE).","operationId":"SalesReceiptsController_remove","parameters":[{"name":"id","required":true,"in":"path","description":"Sales receipt UUID","schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted"},"400":{"description":"Validation failed. Codes: ORGANIZATION_ARCHIVED, INVALID_RECEIPT_STATUS_FOR_DELETE, NOT_LAST_RECEIPT_NUMBER, INVOICE_HAS_ASSOCIATED_CREDIT_NOTES, HAS_COLLECTIONS_CANNOT_DELETE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"SALES_RECEIPT_NOT_FOUND — receipt does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a draft or stuck receipt","tags":["Ventas - Comprobantes"]}},"/v1/sales/subscriptions":{"post":{"description":"Sets up recurring emission of one or more invoices to a customer. Each invoice carries its own concepts. Once active, the daily scheduler emits and (when the customer has an email) sends them automatically.","operationId":"SubscriptionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubscriptionDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a subscription (recurring auto-invoicing)","tags":["Ventas - Suscripciones"]},"get":{"description":"Lists the organization's subscriptions, optionally filtered by status and customer_id.","operationId":"SubscriptionsController_findAll","parameters":[{"name":"status","required":true,"in":"query","schema":{"type":"string"}},{"name":"customer_id","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List subscriptions","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}":{"get":{"description":"Returns a single subscription with its invoice templates; 404 if it does not exist in this organization.","operationId":"SubscriptionsController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a subscription with its invoice templates","tags":["Ventas - Suscripciones"]},"patch":{"description":"Updates a subscription's configuration and/or its invoice templates.","operationId":"SubscriptionsController_update","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSubscriptionDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a subscription (config and/or invoice templates)","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}/pause":{"post":{"description":"Sets the subscription status to PAUSED so the scheduler stops emitting invoices for it until resumed.","operationId":"SubscriptionsController_pause","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Pause a subscription (stops emission)","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}/resume":{"post":{"description":"Reactivates emission. Any periods missed while paused are skipped — the next run jumps to the next future occurrence.","operationId":"SubscriptionsController_resume","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Resume a paused subscription","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}/cancel":{"post":{"description":"Sets the subscription status to CANCELLED; this is terminal and cannot be resumed.","operationId":"SubscriptionsController_cancel","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Cancel a subscription (terminal)","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}/runs":{"get":{"description":"Returns the run history (emission attempts and their outcomes) for the subscription.","operationId":"SubscriptionsController_listRuns","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionRunResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"Emission history for a subscription","tags":["Ventas - Suscripciones"]}},"/v1/sales/subscriptions/{id}/run-now":{"post":{"description":"Manually emits the subscription's current period (testing / catch-up). Idempotent — a period already emitted is skipped. Only runs for migrated (B2) organizations.","operationId":"SubscriptionsController_runNow","parameters":[{"name":"id","required":true,"in":"path","description":"Subscription UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionRunNowResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Emit this subscription's current period now","tags":["Ventas - Suscripciones"]}},"/v1/support/tickets/eligibility":{"get":{"description":"Checks membership and paid-support eligibility. Trial and unsubscribed organizations can use the help center and assistant, not open or reply to human tickets.","operationId":"SupportController_eligibility","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportEligibilityResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Check paid support eligibility","tags":["Sistema - Soporte"]}},"/v1/support/tickets":{"get":{"description":"Returns up to 25 tickets with state filtering, keyset cursor and per-member public-message unread status. Never lists another organization's tickets.","operationId":"SupportController_list","parameters":[{"name":"cursor","required":false,"in":"query","description":"Cursor opaco retornado por la página anterior.","schema":{"type":"string"}},{"name":"state","required":false,"in":"query","schema":{"type":"string","enum":["new","on_peakly","on_customer","on_hold","closed"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List the current organization's support tickets","tags":["Sistema - Soporte"]},"post":{"description":"Paid subscriptions only, excluding trials. Accepts a 10–20000 character message, priority and stable retry key; optional attachments are at most five JPEG/PNG/GIF/WebP/PDF files of 5 MB each, validated by magic bytes. Ten tickets per organization per hour. Acknowledgement and email/Slack notifications are enqueued atomically; network delivery never blocks ticket creation.","operationId":"SupportController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSupportTicketDto"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CreateSupportTicketDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketCreatedResponseDto"}}}},"403":{"description":"SUPPORT_PAID_SUBSCRIPTION_REQUIRED"},"409":{"description":"Retry key already used for different content"},"429":{"description":"SUPPORT_RATE_LIMIT"}},"security":[{"apiKey":[]}],"summary":"Open a support ticket","tags":["Sistema - Soporte"]}},"/v1/support/tickets/{number}":{"get":{"description":"Returns at most 100 public non-draft customer/staff/system messages. Internal notes and agent drafts are never returned. Cross-organization identifiers return 404. Only messages returned to this member advance the read marker.","operationId":"SupportController_detail","parameters":[{"name":"number","required":true,"in":"path","schema":{"type":"string"}},{"name":"after_message_id","required":false,"in":"query","description":"ID decimal del último mensaje recibido, sin redondeo numérico.","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketDetailResponseDto"}}}},"404":{"description":"Ticket not found in this organization"}},"security":[{"apiKey":[]}],"summary":"Read a support ticket's public conversation","tags":["Sistema - Soporte"]}},"/v1/support/tickets/{number}/messages":{"post":{"description":"Paid members append a public message and optional validated attachments. Moves the ticket to on_peakly, reopening a closed ticket. Stable member-scoped retry keys prevent duplicate messages and Slack notices; foreign ticket numbers return 404.","operationId":"SupportController_reply","parameters":[{"name":"number","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplySupportTicketDto"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ReplySupportTicketDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketCreatedResponseDto"}}}},"403":{"description":"SUPPORT_PAID_SUBSCRIPTION_REQUIRED"},"404":{"description":"Ticket not found in this organization"}},"security":[{"apiKey":[]}],"summary":"Reply to a support ticket","tags":["Sistema - Soporte"]}},"/v1/support/tickets/{number}/close":{"post":{"description":"Any active member of the same organization can close its ticket idempotently. A later paid customer reply reopens it. Foreign ticket numbers return 404.","operationId":"SupportController_close","parameters":[{"name":"number","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketClosedResponseDto"}}}},"404":{"description":"Ticket not found in this organization"}},"security":[{"apiKey":[]}],"summary":"Mark a support ticket as resolved","tags":["Sistema - Soporte"]}},"/v1/support/tickets/{number}/messages/{messageId}/attachments/{index}":{"get":{"description":"Resolves the attachment from a public non-draft message of a ticket in the authenticated member's organization, never from a caller-supplied object path. Streams it through the authenticated API without exposing storage-provider URLs or tokens. Internal/draft/foreign attachments return 404.","operationId":"SupportController_download","parameters":[{"name":"number","required":true,"in":"path","schema":{"type":"string"}},{"name":"messageId","required":true,"in":"path","schema":{"type":"string"}},{"name":"index","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"Attachment not found in this organization's public ticket messages"}},"security":[{"apiKey":[]}],"summary":"Download a private support attachment","tags":["Sistema - Soporte"]}},"/v1/purchases/purchase-categories":{"get":{"description":"Returns the organization's non-deleted purchase categories (description + linked journal account) ordered by id; optional case-insensitive partial match on description via the search query.","operationId":"PurchaseCategoriesController_findAll","parameters":[{"name":"search","required":false,"in":"query","description":"Filter by description (partial match)","schema":{"type":"string"}}],"responses":{"200":{"description":"List of purchase categories","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseCategoryResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List purchase categories for the current organization","tags":["Compras - Categorías"]},"post":{"description":"Creates a purchase category (description + linked journal account id) for the current organization; used to classify purchase-receipt lines and expense-group rubro leaves.","operationId":"PurchaseCategoriesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePurchaseCategoryDto"}}}},"responses":{"201":{"description":"Created purchase category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseCategoryResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create purchase category","tags":["Compras - Categorías"]}},"/v1/purchases/purchase-categories/{id}":{"get":{"description":"Returns a single non-deleted purchase category of the current organization by id. Responds 404 if it does not exist or belongs to another organization.","operationId":"PurchaseCategoriesController_findOne","parameters":[{"name":"id","required":true,"in":"path","description":"Purchase category id","schema":{"type":"number"}}],"responses":{"200":{"description":"Purchase category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseCategoryResponseDto"}}}},"404":{"description":"PURCHASE_CATEGORY_NOT_FOUND — purchase category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get purchase category by id","tags":["Compras - Categorías"]},"patch":{"description":"Updates a purchase category's description and/or linked journal account for the current organization. Responds 404 if it does not exist or belongs to another organization.","operationId":"PurchaseCategoriesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePurchaseCategoryDto"}}}},"responses":{"200":{"description":"Updated purchase category","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseCategoryResponseDto"}}}},"404":{"description":"PURCHASE_CATEGORY_NOT_FOUND — purchase category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update purchase category","tags":["Compras - Categorías"]},"delete":{"description":"Soft-deletes a purchase category of the current organization by id (sets deleted_at) and returns 204. Responds 404 if it does not exist or belongs to another organization.","operationId":"PurchaseCategoriesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"PURCHASE_CATEGORY_NOT_FOUND — purchase category does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete purchase category (soft delete)","tags":["Compras - Categorías"]}},"/v1/management/income-groups":{"get":{"description":"Returns all income-group nodes of the current organization as a flat list (id, name, parentId, productId); the client composes the tree via parentId. A node with a productId is a product leaf.","operationId":"IncomeGroupsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IncomeGroupResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List income-tree nodes (flat; compose the tree via parentId)","tags":["Reportes - Grupos"]},"post":{"description":"Creates an income-group node for the current organization; pass productId to make it a product leaf. Parent must be an in-org group node (not a leaf), else INVALID_PARENT/INVALID_TREE.","operationId":"IncomeGroupsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIncomeGroupDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncomeGroupResponseDto"}}}},"400":{"description":"INVALID_PARENT / INVALID_TREE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create an income-tree node (group or product leaf)","tags":["Reportes - Grupos"]}},"/v1/management/income-groups/{id}":{"patch":{"description":"Updates an income node's name, parent, or product-leaf reference; reparenting forbids leaf parents, self-parent, and cycles, and a node with children cannot become a leaf. 404 if not found in this org.","operationId":"IncomeGroupsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateIncomeGroupDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncomeGroupResponseDto"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update an income-tree node","tags":["Reportes - Grupos"]},"delete":{"description":"Soft-deletes an income node of the current organization by id; rejects deletion with INVALID_TREE when the node still has children. Returns 204; 404 if not found in this organization.","operationId":"IncomeGroupsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete an income-tree node (soft; must have no children)","tags":["Reportes - Grupos"]}},"/v1/management/expense-groups":{"get":{"description":"Returns all expense-group nodes of the current organization as a flat list (id, name, parentId, purchaseCategoryId); the client composes the tree via parentId. A node with a purchaseCategoryId is a rubro leaf.","operationId":"ExpenseGroupsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseGroupResponseDto"}}}}}},"security":[{"apiKey":[]}],"summary":"List expense-tree nodes (flat; compose the tree via parentId)","tags":["Reportes - Grupos"]},"post":{"description":"Creates an expense-group node for the current organization; pass purchaseCategoryId to make it a rubro leaf. Parent must be an in-org group node (not a leaf), else INVALID_PARENT/INVALID_TREE.","operationId":"ExpenseGroupsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExpenseGroupDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseGroupResponseDto"}}}},"400":{"description":"INVALID_PARENT / INVALID_TREE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create an expense-tree node (group or rubro leaf)","tags":["Reportes - Grupos"]}},"/v1/management/expense-groups/{id}":{"patch":{"description":"Updates an expense node's name, parent, or purchase-category leaf reference; reparenting forbids leaf parents, self-parent, and cycles, and a node with children cannot become a leaf. 404 if not found in this org.","operationId":"ExpenseGroupsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateExpenseGroupDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseGroupResponseDto"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update an expense-tree node","tags":["Reportes - Grupos"]},"delete":{"description":"Soft-deletes an expense node of the current organization by id; rejects deletion with INVALID_TREE when the node still has children. Returns 204; 404 if not found in this organization.","operationId":"ExpenseGroupsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete an expense-tree node (soft; must have no children)","tags":["Reportes - Grupos"]}},"/v1/management/reports/income-expense":{"get":{"description":"Both user-defined trees with a per-node net amount (leaf = its sales/purchases in the range, NC netted; group = Σ children), plus income/expense totals and the result. Refused for high-volume orgs (REPORT_UNAVAILABLE_HIGH_VOLUME).","operationId":"ManagementReportsController_incomeExpense","parameters":[{"name":"date_from","required":true,"in":"query","schema":{"type":"string"}},{"name":"date_to","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncomeExpenseReportDto"}}}},"400":{"description":"INVALID_DATE_RANGE or REPORT_UNAVAILABLE_HIGH_VOLUME","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Grupos de Ingresos/Egresos — management P&L over a date range","tags":["Reportes - Grupos"]}},"/v1/purchases/expenses":{"get":{"description":"Returns a page of other expenses. Use cursor from nextCursor for the next page.","operationId":"ExpensesController_findAll[0]","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status (Creada/Anulada/Pagada)","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by date from (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by date to (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated other expenses (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpensePageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List other expenses (cursor-paginated)","tags":["Compras - Otros Egresos"]},"post":{"description":"Records a purchase expense split by category items and paid with one or more payment methods. Registers treasury movements and generates the OE journal entry when accounting is enabled. A bank account or cash register in a foreign currency goes down by the payment's `foreignAmount` (default amount / exchangeRate); `amount` stays in the organization's currency.","operationId":"ExpensesController_create[0]","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExpenseDto"}}}},"responses":{"201":{"description":"Created other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"400":{"description":"Validation failed. Codes: ITEMS_REQUIRED, PAYMENTS_REQUIRED, SUPPLIER_NOT_FOUND, ITEM_TOTAL_INVALID, PURCHASE_CATEGORY_NOT_FOUND, PAYMENTS_TOTAL_MISMATCH, PAYMENT_AMOUNT_INVALID, PAYMENT_METHOD_NOT_FOUND, PAYMENT_TYPE_NOT_SUPPORTED, EXCHANGE_RATE_REQUIRED, PAYMENT_FX_MISMATCH, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create other expense","tags":["Compras - Otros Egresos"]}},"/v1/purchases/other-expenses":{"get":{"description":"Returns a page of other expenses. Use cursor from nextCursor for the next page.","operationId":"ExpensesController_findAll[1]","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor for next page","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100)","schema":{"example":50,"type":"number"}},{"name":"supplier_id","required":false,"in":"query","description":"Filter by supplier","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status (Creada/Anulada/Pagada)","schema":{"type":"string"}},{"name":"date_from","required":false,"in":"query","description":"Filter by date from (YYYY-MM-DD)","schema":{"type":"string"}},{"name":"date_to","required":false,"in":"query","description":"Filter by date to (YYYY-MM-DD)","schema":{"type":"string"}}],"responses":{"200":{"description":"Paginated other expenses (data, nextCursor, hasMore)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpensePageResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List other expenses (cursor-paginated)","tags":["Compras - Otros Egresos"]},"post":{"description":"Records a purchase expense split by category items and paid with one or more payment methods. Registers treasury movements and generates the OE journal entry when accounting is enabled. A bank account or cash register in a foreign currency goes down by the payment's `foreignAmount` (default amount / exchangeRate); `amount` stays in the organization's currency.","operationId":"ExpensesController_create[1]","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExpenseDto"}}}},"responses":{"201":{"description":"Created other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"400":{"description":"Validation failed. Codes: ITEMS_REQUIRED, PAYMENTS_REQUIRED, SUPPLIER_NOT_FOUND, ITEM_TOTAL_INVALID, PURCHASE_CATEGORY_NOT_FOUND, PAYMENTS_TOTAL_MISMATCH, PAYMENT_AMOUNT_INVALID, PAYMENT_METHOD_NOT_FOUND, PAYMENT_TYPE_NOT_SUPPORTED, EXCHANGE_RATE_REQUIRED, PAYMENT_FX_MISMATCH, RESPONSIBLE_USER_NOT_IN_ORGANIZATION.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create other expense","tags":["Compras - Otros Egresos"]}},"/v1/purchases/expenses/{id}":{"get":{"description":"Returns a single other expense with its category items and payment-method entries; 404s if it does not exist or belongs to another organization.","operationId":"ExpensesController_findOne[0]","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"404":{"description":"OTHER_EXPENSE_NOT_FOUND — other expense does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get other expense by id (with items and payment entries)","tags":["Compras - Otros Egresos"]}},"/v1/purchases/other-expenses/{id}":{"get":{"description":"Returns a single other expense with its category items and payment-method entries; 404s if it does not exist or belongs to another organization.","operationId":"ExpensesController_findOne[1]","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"404":{"description":"OTHER_EXPENSE_NOT_FOUND — other expense does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get other expense by id (with items and payment entries)","tags":["Compras - Otros Egresos"]}},"/v1/purchases/expenses/{id}/anular":{"post":{"description":"Reverts cash/bank balances and check/retention statuses. The expense is kept with status Anulada.","operationId":"ExpensesController_anular[0]","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"400":{"description":"Validation failed. Codes: OTHER_EXPENSE_ALREADY_VOIDED, PAYMENT_CHECK_ALREADY_DEPOSITED, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before voiding. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OTHER_EXPENSE_NOT_FOUND — other expense does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) an other expense","tags":["Compras - Otros Egresos"]}},"/v1/purchases/other-expenses/{id}/anular":{"post":{"description":"Reverts cash/bank balances and check/retention statuses. The expense is kept with status Anulada.","operationId":"ExpensesController_anular[1]","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Voided other expense","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseResponseDto"}}}},"400":{"description":"Validation failed. Codes: OTHER_EXPENSE_ALREADY_VOIDED, PAYMENT_CHECK_ALREADY_DEPOSITED, JOURNAL_ENTRY_PERIOD_LOCKED, FISCAL_YEAR_CLOSED. JOURNAL_ENTRY_PERIOD_LOCKED: the journal entry date falls inside a locked accounting period — unlock the period before voiding. FISCAL_YEAR_CLOSED: the journal entry belongs to a closed fiscal year — record the correction in the open year instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"OTHER_EXPENSE_NOT_FOUND — other expense does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void (anular) an other expense","tags":["Compras - Otros Egresos"]}},"/v1/warehouses":{"get":{"description":"The organization's warehouses (depósitos), primary first then by name. Empty until the first warehouse is added (all stock is then in the single implicit one); after that it lists the primary warehouse too, even when only one is active. Archived warehouses only with include_archived=true.","operationId":"WarehousesController_list","parameters":[{"name":"include_archived","required":false,"in":"query","description":"Include archived warehouses.","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WarehouseListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List warehouses","tags":["Stock - Depósitos"]},"post":{"description":"Creates a warehouse. The first time, it also creates the primary warehouse (named primaryName, default \"Depósito principal\"), which keeps all the current stock, and turns multi-warehouse on for the organization — everything in one transaction. Requires stock tracking.","operationId":"WarehousesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWarehouseDto"}}}},"responses":{"201":{"description":"The new warehouse.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WarehouseResponseDto"}}}},"400":{"description":"WAREHOUSES_REQUIRE_STOCK_TRACKING — stock tracking is off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"WAREHOUSE_NAME_TAKEN — another active warehouse has that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Add a warehouse","tags":["Stock - Depósitos"]}},"/v1/warehouses/receipt-books":{"get":{"description":"The points of sale (receipt books) that sell from a warehouse other than the primary, with that warehouse. Any point of sale not listed sells from the primary. Empty for an organization with a single warehouse.","operationId":"WarehousesController_listReceiptBooks","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookWarehouseListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List the points of sale's warehouses","tags":["Stock - Depósitos"]}},"/v1/warehouses/{id}":{"patch":{"description":"Renames an active warehouse, the primary included.","operationId":"WarehousesController_rename","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWarehouseDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WarehouseResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — not an active warehouse of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"WAREHOUSE_NAME_TAKEN — another active warehouse has that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Rename a warehouse","tags":["Stock - Depósitos"]}},"/v1/warehouses/{id}/archive":{"post":{"description":"Archives an extra warehouse whose balances are all zero. The primary cannot be archived. Archiving the last extra warehouse turns multi-warehouse off: the organization is back to a single warehouse.","operationId":"WarehousesController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WarehouseResponseDto"}}}},"400":{"description":"WAREHOUSE_PRIMARY_FIXED — the primary is fixed; WAREHOUSE_NOT_EMPTY — it still holds stock.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — not an active warehouse of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive a warehouse","tags":["Stock - Depósitos"]}},"/v1/stock/products/{productId}/balances":{"get":{"description":"The product's total stock and, for an organization with more than one warehouse, its stock in each active warehouse (the primary's is the total minus the others). Requires stock tracking.","operationId":"ProductBalancesController_balances","parameters":[{"name":"productId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBalancesResponseDto"}}}},"400":{"description":"STOCK_TRACKING_DISABLED — stock tracking is off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"PRODUCT_NOT_FOUND — not a product of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Stock of a product per warehouse","tags":["Stock - Depósitos"]}},"/v1/receipt-books/{receiptBookId}/warehouse":{"put":{"description":"Sets the warehouse a point of sale (receipt book) sells from: its invoices and drafts confirmed on it take the stock out of that warehouse, and its credit notes return it to the warehouse their invoice left from (or this one). null or the primary's id go back to the primary. Only matters for an organization with more than one warehouse; archiving a warehouse sends its points of sale back to the primary.","operationId":"ReceiptBookWarehouseController_set","parameters":[{"name":"receiptBookId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetReceiptBookWarehouseDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptBookWarehouseResponseDto"}}}},"404":{"description":"RECEIPT_BOOK_NOT_FOUND — not a point of sale of this organization; WAREHOUSE_NOT_FOUND — not an active warehouse of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set the warehouse of a point of sale","tags":["Stock - Depósitos"]}},"/v1/sales/delivery-note-books":{"get":{"description":"The organization's delivery-note (remito) numbering series. Active ones by default; `include_archived=true` adds the archived ones (their numbering is kept).","operationId":"DeliveryNoteBooksController_list","parameters":[{"name":"include_archived","required":false,"in":"query","description":"Include archived books (default false).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteBookListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List delivery-note books","tags":["Ventas - Remitos"]},"post":{"description":"Creates a delivery-note (remito) numbering series: internal numbering, no AFIP. With a CAI the notes print as letter R; without one, as X. Requires stock tracking. The organization issues delivery notes (`/users/me/config` `deliveryNotes`) while it has an active book.","operationId":"DeliveryNoteBooksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDeliveryNoteBookDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteBookResponseDto"}}}},"400":{"description":"Codes: DELIVERY_NOTES_REQUIRE_STOCK_TRACKING, INVALID_DELIVERY_NOTE_BOOK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"WAREHOUSE_NOT_FOUND — not an active warehouse of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DELIVERY_NOTE_BOOK_PV_TAKEN — another active book uses that point of sale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a delivery-note book","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-note-books/{id}":{"patch":{"description":"Renames the book, changes its default warehouse or CAI, archives it (`archived: true`) or reactivates it (`archived: false`, needs stock tracking). Archiving keeps the numbering: reactivating continues where it left off.","operationId":"DeliveryNoteBooksController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDeliveryNoteBookDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteBookResponseDto"}}}},"400":{"description":"Codes: DELIVERY_NOTES_REQUIRE_STOCK_TRACKING, INVALID_DELIVERY_NOTE_BOOK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"DELIVERY_NOTE_BOOK_NOT_FOUND — not a book of this organization; WAREHOUSE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DELIVERY_NOTE_BOOK_PV_TAKEN — reactivating: another active book uses its point of sale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a delivery-note book","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-notes":{"post":{"description":"Issues a delivery note (remito) with the book's next number and moves the stock right away: `delivery` takes the goods out, `customer_return` puts them back (kardex type DELIVERY_NOTE). Combos move their components. With more than one warehouse the stock moves in `warehouseId`, else the book's warehouse, else the primary. With forceStock on, a delivery cannot leave the warehouse below zero. Requires stock tracking.","operationId":"DeliveryNotesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDeliveryNoteDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteResponseDto"}}}},"400":{"description":"Codes: DELIVERY_NOTES_REQUIRE_STOCK_TRACKING, INVALID_DELIVERY_NOTE, STOCK_NOT_APPLICABLE_TO_SERVICE, INSUFFICIENT_STOCK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Codes: DELIVERY_NOTE_BOOK_NOT_FOUND, CUSTOMER_NOT_FOUND, PRODUCT_NOT_FOUND, WAREHOUSE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Issue a delivery note","tags":["Ventas - Remitos"]},"get":{"description":"The organization's delivery notes, newest first, without their lines. `state`: pending (deliveries not invoiced yet), invoiced, voided. `sales_receipt_id`: the notes that receipt invoiced.","operationId":"DeliveryNotesController_list","parameters":[{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["delivery","customer_return"]}},{"name":"state","required":false,"in":"query","description":"pending = delivery not invoiced yet; invoiced = linked to a receipt that is not voided nor fully cancelled by credit notes that return no goods; voided.","schema":{"type":"string","enum":["pending","invoiced","voided"]}},{"name":"customer_id","required":false,"in":"query","schema":{"type":"number"}},{"name":"sales_receipt_id","required":false,"in":"query","description":"Notes invoiced by this sales receipt (voided or not).","schema":{"format":"uuid","type":"string"}},{"name":"from","required":false,"in":"query","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","schema":{"example":"2026-10-31","type":"string"}},{"name":"page","required":false,"in":"query","schema":{"default":1,"type":"number"}},{"name":"page_size","required":false,"in":"query","schema":{"maximum":200,"default":50,"type":"number"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List delivery notes","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-notes/invoice":{"post":{"description":"Creates the invoice of one or more delivery notes of the same customer, exactly like POST /sales/sales-receipts (same body under `receipt`, same validations, numbering and authorization), except that it does not move again the stock the notes already moved: only what the invoice has beyond them leaves stock. The notes become invoiced; voiding the invoice, or cancelling it in full with authorized credit notes that return no goods, makes them pending again. Always a confirmed Factura (no draft); Argentina only.","operationId":"DeliveryNotesController_invoice","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceDeliveryNotesDto"}}}},"responses":{"201":{"description":"The created invoice.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}}}},"400":{"description":"DELIVERY_NOTES_NOT_INVOICEABLE — different customers, not deliveries, voided or already invoiced, a draft or non-invoice receipt; plus every code of POST /sales/sales-receipts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"DELIVERY_NOTE_NOT_FOUND — a note is not of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Invoice delivery notes","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-notes/{id}":{"get":{"description":"A delivery note with its lines and the receipts that invoiced it.","operationId":"DeliveryNotesController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteResponseDto"}}}},"404":{"description":"DELIVERY_NOTE_NOT_FOUND — not a delivery note of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a delivery note","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-notes/{id}/void":{"post":{"description":"Reverts the note's stock movements and marks it voided. A note invoiced by a receipt that is not voided cannot be voided: void the invoice first.","operationId":"DeliveryNotesController_void","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryNoteResponseDto"}}}},"404":{"description":"DELIVERY_NOTE_NOT_FOUND — not a delivery note of this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DELIVERY_NOTE_INVOICED — invoiced by a live receipt; DELIVERY_NOTE_ALREADY_VOIDED — already voided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Void a delivery note","tags":["Ventas - Remitos"]}},"/v1/sales/delivery-notes/{id}/pdf":{"get":{"description":"The remito PDF: letter R (with the book's CAI and its due date) or X, the legend \"Documento no válido como factura\", customer, delivery address, carrier, lines and a reception signature box. A voided note prints as ANULADO.","operationId":"DeliveryNotesController_pdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Delivery note PDF file"},"404":{"description":"DELIVERY_NOTE_NOT_FOUND — not a delivery note of this organization.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Download a delivery note as PDF","tags":["Ventas - Remitos"]}},"/v1/afip/caea-contingency":{"get":{"description":"Whether the organization issues with CAEA when ARCA's WSFE does not answer (off by default), whether it can turn it on (it needs a domestic WS receipt book), the CAEA covering today and the next fortnight's if already granted, and how many rendiciones are still to inform (and how many ARCA rejected).","operationId":"CaeaContingencyController_get","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaeaContingencyStatusDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get the CAEA contingency status","tags":["Common - Contingencia CAEA"]},"put":{"description":"On: Peakly requests the CAEA of the current fortnight right away (and every fortnight after), issues with it while WSFE is down and informs ARCA of what it issued, or that nothing was issued. Off: future fortnights are no longer requested; CAEA already granted or used keep being informed until ARCA's deadline. Returns the resulting status.","operationId":"CaeaContingencyController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCaeaContingencyDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaeaContingencyStatusDto"}}}},"409":{"description":"CAEA_NOT_AVAILABLE — enabling without a domestic electronic (WS) receipt book.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Turn the CAEA contingency on or off","tags":["Common - Contingencia CAEA"]}},"/v1/imports":{"post":{"description":"Reads the whole tab on the server, maps each row with `source.mapping` and plans it: create / existing / duplicate / error with reason codes. Up to 2000 data rows. Customers dedupe by normalized tax id (existing ones are not updated); sales need an existing customer and an explicit VAT rate (never defaulted) and are created as Borrador on confirm; purchases create missing suppliers. Nothing is written until the draft is confirmed. Amounts accept 1.234,56 and 1234.56; dates dd/mm/yyyy and ISO. Permissions depend on the draft's kind: customers → customers:read / customers:create; sales → sales-receipts:read / sales-receipts:create (+ receipt-books:import with salesMode issued); purchases → purchase-receipts:read / purchase-receipts:create + suppliers:create.","operationId":"ImportDraftsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateImportDraftDto"}}}},"responses":{"201":{"description":"Draft preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDraftResponseDto"}}}},"400":{"description":"Validation failed. Codes: IMPORT_UNKNOWN_FIELD, IMPORT_MAPPING_INCOMPLETE, IMPORT_RECEIPT_BOOK_REQUIRED, IMPORT_RECEIPT_BOOK_NOT_FOUND, IMPORT_RECEIPT_BOOK_NOT_SELF_MANAGED, IMPORT_PURCHASE_CONDITION_NOT_FOUND, IMPORT_SHEET_INVALID, IMPORT_EMPTY_SHEET, IMPORT_TOO_MANY_ROWS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Missing the create permission of the kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create an import draft from a Google Sheet tab","tags":["Common - Importaciones"]},"get":{"description":"Newest first, without rows. Only the kinds the caller may read are listed. Permissions depend on the draft's kind: customers → customers:read / customers:create; sales → sales-receipts:read / sales-receipts:create (+ receipt-books:import with salesMode issued); purchases → purchase-receipts:read / purchase-receipts:create + suppliers:create.","operationId":"ImportDraftsController_list","parameters":[{"name":"status","required":false,"in":"query","schema":{"type":"string","enum":["draft","confirmed","discarded"]}},{"name":"kind","required":false,"in":"query","schema":{"type":"string","enum":["customers","sales","purchases"]}},{"name":"page","required":false,"in":"query","schema":{"default":1,"example":1,"type":"number"}},{"name":"limit","required":false,"in":"query","schema":{"maximum":100,"default":20,"example":20,"type":"number"}}],"responses":{"200":{"description":"Page of drafts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDraftListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List import drafts","tags":["Common - Importaciones"]}},"/v1/imports/{id}":{"get":{"description":"Returns the draft with its summary and every planned row. Permissions depend on the draft's kind: customers → customers:read / customers:create; sales → sales-receipts:read / sales-receipts:create (+ receipt-books:import with salesMode issued); purchases → purchase-receipts:read / purchase-receipts:create + suppliers:create.","operationId":"ImportDraftsController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDraftResponseDto"}}}},"403":{"description":"Missing the read permission of the kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"IMPORT_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get an import draft","tags":["Common - Importaciones"]}},"/v1/imports/{id}/confirm":{"post":{"description":"Recomputes the plan against current data and writes every `create` row through the normal services in one transaction (customers; sales as Borrador, never issued — or, with salesMode issued, registered as already issued with their own number and CAE, no ARCA / VERI*FACTU; purchases and their missing suppliers). Rows a service rejects are skipped and reported in `result.skipped`. Permissions depend on the draft's kind: customers → customers:read / customers:create; sales → sales-receipts:read / sales-receipts:create (+ receipt-books:import with salesMode issued); purchases → purchase-receipts:read / purchase-receipts:create + suppliers:create.","operationId":"ImportDraftsController_confirm","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Confirmed draft with its result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDraftResponseDto"}}}},"400":{"description":"IMPORT_USER_REQUIRED: sales need an acting user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Missing the create permission of the kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"IMPORT_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"IMPORT_DRAFT_NOT_DRAFT — already confirmed or discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Confirm an import draft","tags":["Common - Importaciones"]}},"/v1/imports/{id}/discard":{"post":{"description":"Marks the draft as discarded; nothing is written. Permissions depend on the draft's kind: customers → customers:read / customers:create; sales → sales-receipts:read / sales-receipts:create (+ receipt-books:import with salesMode issued); purchases → purchase-receipts:read / purchase-receipts:create + suppliers:create.","operationId":"ImportDraftsController_discard","parameters":[{"name":"id","required":true,"in":"path","schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"description":"Discarded draft","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportDraftResponseDto"}}}},"403":{"description":"Missing the create permission of the kind.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"IMPORT_DRAFT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"IMPORT_DRAFT_NOT_DRAFT — already confirmed or discarded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Discard an import draft","tags":["Common - Importaciones"]}},"/v1/bulk-actions":{"get":{"description":"Returns a cursor-paginated, keyset-ordered page of bulk-action jobs (email/PDF/void/CSV export) filtered by status, type and scope (mine/org), plus the active-job count.","operationId":"BulkActionsController_list","parameters":[{"name":"status","required":false,"in":"query","schema":{"enum":["active","terminal","all"],"type":"string"}},{"name":"type","required":false,"in":"query","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","schema":{"type":"number"}},{"name":"cursor","required":false,"in":"query","schema":{"type":"string"}},{"name":"scope","required":false,"in":"query","schema":{"enum":["mine","org"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List bulk-action jobs (cross-domain) for the Procesos screen","tags":["Procesos"]}},"/v1/bulk-actions/{jobId}/status":{"get":{"description":"Returns the current status and progress of a bulk-action job by UUID; 404s if it does not exist in the organization.","operationId":"BulkActionsController_status","parameters":[{"name":"jobId","required":true,"in":"path","description":"Bulk action job UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionDto"}}}},"404":{"description":"Job not found"}},"security":[{"apiKey":[]}],"summary":"Get a single bulk-action job's status","tags":["Procesos"]}},"/v1/bulk-actions/{jobId}/cancel":{"post":{"description":"Flags a queued/running job as cancelled so the worker stops between batches (never mid-batch); 409s if the job already terminated.","operationId":"BulkActionsController_cancel","parameters":[{"name":"jobId","required":true,"in":"path","description":"Bulk action job UUID","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkActionDto"}}}},"404":{"description":"Job not found"},"409":{"description":"Job already terminated"}},"security":[{"apiKey":[]}],"summary":"Best-effort cancel a queued/running bulk-action job","tags":["Procesos"]}},"/v1/reports/datasets":{"get":{"description":"The datasets the caller can read (sales receipts, attendance work days) with their fields, filter operators, measures, the longest date range allowed for the organization and a default spec.","operationId":"CustomReportsController_datasets","parameters":[],"responses":{"200":{"description":"Datasets the caller can read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List report datasets","tags":["Reportes - Personalizados"]}},"/v1/reports/lookups/{lookup}":{"get":{"description":"Options for entity filters: customers (name or CUIT), branches, receipt books (point of sale), employees, users (organization members), currencies and provinces. `q` searches; `ids` returns the labels of those ids instead. At most `limit` (default 20) options.","operationId":"CustomReportsController_lookup","parameters":[{"name":"lookup","required":true,"in":"path","schema":{"enum":["customers","branches","receipt_books","employees","leave_types","users","currencies","provinces"],"type":"string"}},{"name":"q","required":false,"in":"query","description":"Search text (name, CUIT, document or point of sale number).","schema":{"type":"string"}},{"name":"ids","required":false,"in":"query","description":"Comma-separated ids: returns their labels instead of searching.","schema":{"example":"1,2","type":"string"}},{"name":"limit","required":false,"in":"query","schema":{"minimum":1,"maximum":50,"default":20,"type":"number"}}],"responses":{"200":{"description":"Matching options.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupListResponseDto"}}}},"400":{"description":"Unknown lookup, or `ids`/`limit` malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"REPORT_DATASET_FORBIDDEN — the caller's role cannot read the dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Search values for an entity field","tags":["Reportes - Personalizados"]}},"/v1/reports/query":{"post":{"description":"Runs a report spec: grouped rows (at most `limit`, default 1000, max 10000; `meta.truncated` says whether more exist) and the totals over every matching row. Sales amounts follow the receipt field contract: credit notes subtract, and `currency: ars` (default) converts foreign-currency receipts with their own exchange rate. Without a status filter only issued receipts count. High-volume organizations read the daily rollup when the spec allows it (`meta.source = rollup`).","operationId":"CustomReportsController_query","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportSpecDto"}}}},"responses":{"200":{"description":"Report result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportResultDto"}}}},"400":{"description":"REPORT_INVALID_SPEC — the spec is malformed or names a field, measure or operator the dataset does not have; `details` lists every problem. REPORT_DATE_RANGE_REQUIRED — no `between` filter on the dataset's date field. REPORT_DATE_RANGE_TOO_LARGE — the range is longer than the dataset allows for the organization (the message says the maximum).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"REPORT_DATASET_FORBIDDEN — the caller's role cannot read the dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"REPORT_TIMEOUT — the query ran past 30 seconds; narrow the date range or add filters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Run a report","tags":["Reportes - Personalizados"]}},"/v1/reports/export":{"post":{"description":"Runs a spec and returns it as CSV (UTF-8 with BOM) or XLSX: a header row with the column labels, one row per group (every group, the spec's `limit` does not apply) and a final Total row. At most 50000 rows.","operationId":"CustomReportsController_export","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportReportDto"}}}},"responses":{"200":{"description":"The file, as an attachment."},"400":{"description":"REPORT_INVALID_SPEC — the spec is malformed or names a field, measure or operator the dataset does not have; `details` lists every problem. REPORT_DATE_RANGE_REQUIRED — no `between` filter on the dataset's date field. REPORT_DATE_RANGE_TOO_LARGE — the range is longer than the dataset allows for the organization (the message says the maximum). REPORT_EXPORT_TOO_LARGE — more than 50000 rows.","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"REPORT_DATASET_FORBIDDEN — the caller's role cannot read the dataset.","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"REPORT_TIMEOUT — the query ran past 30 seconds; narrow the date range or add filters.","content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export a report","tags":["Reportes - Personalizados"]}},"/v1/reports/templates":{"get":{"description":"Ready-made specs (sales by month, by customer, by branch and month; hours by employee and month; flagged work days by site) for the datasets the caller can read.","operationId":"CustomReportsController_templates","parameters":[],"responses":{"200":{"description":"Templates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportTemplateListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List report templates","tags":["Reportes - Personalizados"]}},"/v1/reports/views":{"get":{"description":"The caller's views plus those shared with the organization, for the datasets the caller can read. Pinned first, then by name.","operationId":"CustomReportsController_listViews","parameters":[],"responses":{"200":{"description":"Saved views.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportViewListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List saved report views","tags":["Reportes - Personalizados"]},"post":{"description":"Saves a spec under a name, private or shared with the organization. The spec is validated like a query.","operationId":"CustomReportsController_createView","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReportViewDto"}}}},"responses":{"201":{"description":"The saved view.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportViewResponseDto"}}}},"400":{"description":"REPORT_INVALID_SPEC — the spec is malformed or names a field, measure or operator the dataset does not have; `details` lists every problem. REPORT_DATE_RANGE_REQUIRED — no `between` filter on the dataset's date field. REPORT_DATE_RANGE_TOO_LARGE — the range is longer than the dataset allows for the organization (the message says the maximum).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"REPORT_DATASET_FORBIDDEN — the caller's role cannot read the dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Save a report view","tags":["Reportes - Personalizados"]}},"/v1/reports/views/{id}":{"patch":{"description":"Name, spec, visibility or pinned. Owner only.","operationId":"CustomReportsController_updateView","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReportViewDto"}}}},"responses":{"200":{"description":"The updated view.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportViewResponseDto"}}}},"400":{"description":"REPORT_INVALID_SPEC — the spec is malformed or names a field, measure or operator the dataset does not have; `details` lists every problem. REPORT_DATE_RANGE_REQUIRED — no `between` filter on the dataset's date field. REPORT_DATE_RANGE_TOO_LARGE — the range is longer than the dataset allows for the organization (the message says the maximum).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"REPORT_VIEW_FORBIDDEN — only the owner can change it. REPORT_DATASET_FORBIDDEN — the caller's role cannot read the dataset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"REPORT_VIEW_NOT_FOUND — no such view in the organization, or another user's private view.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a saved report view","tags":["Reportes - Personalizados"]},"delete":{"description":"Owner only.","operationId":"CustomReportsController_deleteView","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Deleted."},"403":{"description":"REPORT_VIEW_FORBIDDEN — only the owner can delete it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"REPORT_VIEW_NOT_FOUND — no such view in the organization, or another user's private view.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a saved report view","tags":["Reportes - Personalizados"]}},"/v1/employees":{"get":{"description":"Returns a page of the organization's employees ordered by last name, first name. Active employees only unless `status` says otherwise. Pass `nextCursor` as `cursor` to get the next page.","operationId":"EmployeesController_findAll","parameters":[{"name":"cursor","required":false,"in":"query","description":"Opaque cursor from a previous page's nextCursor.","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100).","schema":{"example":50,"type":"number"}},{"name":"status","required":false,"in":"query","description":"Filter by status. Default `active`.","schema":{"type":"string","enum":["active","inactive","all"]}},{"name":"branch_id","required":false,"in":"query","description":"Only employees of this branch.","schema":{"type":"number"}},{"name":"supervisor_id","required":false,"in":"query","description":"Only direct reports of this employee.","schema":{"type":"number"}},{"name":"q","required":false,"in":"query","description":"Case-insensitive partial match on first/last name (either order), document number, email or employee number.","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of employees (data, nextCursor, hasMore).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeePageResponseDto"}}}},"400":{"description":"EMPLOYEE_INVALID_CURSOR — cursor was not issued by this endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List employees (cursor-paginated)","tags":["Personal - Empleados"]},"post":{"description":"Creates an active employee. Name, document and email are always required; other fields follow the organization's field settings (GET /employee-field-settings). Fields configured as hidden are ignored.","operationId":"EmployeesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEmployeeDto"}}}},"responses":{"201":{"description":"Created employee.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponseDto"}}}},"400":{"description":"Validation failed. Codes: EMPLOYEE_REQUIRED_FIELD_MISSING, EMPLOYEE_INVALID_DOCUMENT, EMPLOYEE_INVALID_CUIL, EMPLOYEE_INVALID_EMAIL, EMPLOYEE_INVALID_DATE, EMPLOYEE_FIELD_TOO_LONG, EMPLOYEE_INVALID_CUSTOM_FIELD, EMPLOYEE_INVALID_BRANCH, EMPLOYEE_INVALID_SUPERVISOR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"`supervisorId` set or changed without the `attendance:approve` permission, or the email of an employee who supervises others changed without it (`EMPLOYEE_SUPERVISOR_IDENTITY_FORBIDDEN`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"Codes: EMPLOYEE_DUPLICATE_DOCUMENT, EMPLOYEE_DUPLICATE_EMAIL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create employee","tags":["Personal - Empleados"]}},"/v1/employees/import/template":{"get":{"description":"Excel template with one column per field the organization shows (system fields plus required and optional fields, custom fields included), and an instructions sheet.","operationId":"EmployeesController_importTemplate","parameters":[],"responses":{"200":{"description":"Excel file (.xlsx)."}},"security":[{"apiKey":[]}],"summary":"Download the employee import template","tags":["Personal - Empleados"]}},"/v1/employees/import":{"post":{"description":"Creates or updates employees from an .xlsx/.xls/.csv file (upsert by document number), validating each row with the same rules as the API. Runs synchronously (up to 1000 rows) and returns the outcome of every row. With `dry_run=true` it only validates and writes nothing.","operationId":"EmployeesController_import","parameters":[{"name":"dry_run","required":false,"in":"query","description":"Validate only (default false).","schema":{"type":"boolean"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Per-row results.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeImportResultDto"}}}},"400":{"description":"Codes: EMPLOYEE_IMPORT_INVALID_FILE, EMPLOYEE_IMPORT_TOO_MANY_ROWS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Import employees from a spreadsheet","tags":["Personal - Empleados"]}},"/v1/employees/{id}":{"get":{"description":"Returns one employee of the organization, active or not.","operationId":"EmployeesController_findOne","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Employee.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get employee by id","tags":["Personal - Empleados"]},"patch":{"description":"Send only the fields to change; null clears an optional field. `customFields` is merged into the stored values. The resulting record must satisfy the organization's current field settings. Status is changed with deactivate/reactivate.","operationId":"EmployeesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEmployeeDto"}}}},"responses":{"200":{"description":"Updated employee.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponseDto"}}}},"400":{"description":"Validation failed. Codes: EMPLOYEE_REQUIRED_FIELD_MISSING, EMPLOYEE_INVALID_DOCUMENT, EMPLOYEE_INVALID_CUIL, EMPLOYEE_INVALID_EMAIL, EMPLOYEE_INVALID_DATE, EMPLOYEE_FIELD_TOO_LONG, EMPLOYEE_INVALID_CUSTOM_FIELD, EMPLOYEE_INVALID_BRANCH, EMPLOYEE_INVALID_SUPERVISOR.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"`remoteMode` changed without the `attendance:manage` permission, or `supervisorId` set or changed without the `attendance:approve` permission, or the email of an employee who supervises others changed without it (`EMPLOYEE_SUPERVISOR_IDENTITY_FORBIDDEN`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"Codes: EMPLOYEE_DUPLICATE_DOCUMENT, EMPLOYEE_DUPLICATE_EMAIL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update employee","tags":["Personal - Empleados"]}},"/v1/employees/{id}/deactivate":{"post":{"description":"Sets status `inactive` and the termination date (default: today in Argentina). Employees are never deleted. Calling it again only updates the termination date.","operationId":"EmployeesController_deactivate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeactivateEmployeeDto"}}}},"responses":{"200":{"description":"Deactivated employee.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponseDto"}}}},"400":{"description":"EMPLOYEE_INVALID_DATE — termination date before the hire date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Deactivate employee (offboarding)","tags":["Personal - Empleados"]}},"/v1/employees/{id}/reactivate":{"post":{"description":"Sets status `active` and clears the termination date. No-op for an active employee.","operationId":"EmployeesController_reactivate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Reactivated employee.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Reactivate employee","tags":["Personal - Empleados"]}},"/v1/employee-field-settings":{"get":{"description":"Which employee fields the organization requires, shows as optional or hides, plus its custom fields. Organizations that never configured anything get the defaults. Use it to build the employee form and the import columns.","operationId":"EmployeeFieldSettingsController_get","parameters":[],"responses":{"200":{"description":"Effective field settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeFieldSettingsResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get employee field settings","tags":["Personal - Campos del legajo"]},"put":{"description":"Send the full list of configurable fields (base fields and custom fields). System fields (name, document, email) cannot be sent. Making a field required applies to the next create or update of each employee; existing records are not re-validated.","operationId":"EmployeeFieldSettingsController_replace","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEmployeeFieldSettingsDto"}}}},"responses":{"200":{"description":"Effective field settings after the change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeFieldSettingsResponseDto"}}}},"400":{"description":"Codes: EMPLOYEE_INVALID_FIELD_SETTINGS, EMPLOYEE_FIELD_NOT_CONFIGURABLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Replace employee field settings","tags":["Personal - Campos del legajo"]}},"/v1/employees/{id}/invite":{"post":{"description":"Issues a one-time invitation for an active employee whose record is not yet linked to an account, and emails it to the employee's address. The link expires in 7 days; issuing a new invitation revokes the previous pending one. The employee accepts it logged in with the same email. The response includes the acceptance link so it can also be shared by other means. Inviting an employee who supervises others also requires the attendance:approve permission (an API key needs a creator who holds it).","operationId":"EmployeeInvitationsController_invite","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteEmployeeDto"}}}},"responses":{"201":{"description":"Invitation issued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeInvitationCreatedDto"}}}},"403":{"description":"EMPLOYEE_SUPERVISOR_IDENTITY_FORBIDDEN — the employee supervises others and the caller (for an API key, its creator) lacks the `attendance:approve` permission.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"EMPLOYEE_NOT_ACTIVE — the employee is inactive; EMPLOYEE_ALREADY_LINKED — the record is already linked to an account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Invite an employee to link their Peakly account","tags":["Personal - Empleados"]}},"/v1/employees/{id}/invitation":{"get":{"description":"Status of the most recent invitation (`pending`, `expired`, `accepted` or `revoked`), or `invitation: null` if none was ever sent. The code is never returned again.","operationId":"EmployeeInvitationsController_latest","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Latest invitation or null.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeInvitationLatestDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get the employee's latest invitation","tags":["Personal - Empleados"]}},"/v1/employees/{id}/devices":{"get":{"description":"Passkeys the employee registered to clock in, newest first, with their status. Key material is never returned.","operationId":"EmployeeDevicesController_list","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Devices.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeDeviceListResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization; DEVICE_NOT_FOUND — the device is not one of this employee's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List an employee's devices","tags":["Personal - Empleados"]}},"/v1/employees/{id}/devices/{deviceId}/approve":{"post":{"description":"Makes a `pending_approval` device the employee's active one and revokes the previously active device, atomically. No-op on the already active device.","operationId":"EmployeeDevicesController_approve","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"deviceId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Approved (now active) device.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeDeviceResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization; DEVICE_NOT_FOUND — the device is not one of this employee's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"DEVICE_NOT_PENDING — the device was revoked; EMPLOYEE_NOT_ACTIVE — the employee is inactive.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Approve a device","tags":["Personal - Empleados"]}},"/v1/employees/{id}/devices/{deviceId}/revoke":{"post":{"description":"The device can no longer be used to clock in. Idempotent. Offboarding an employee revokes all their devices automatically.","operationId":"EmployeeDevicesController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"deviceId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Revoked device.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeDeviceResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization; DEVICE_NOT_FOUND — the device is not one of this employee's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Revoke a device","tags":["Personal - Empleados"]}},"/v1/attendance/sites":{"get":{"description":"Every branch of the organization with its check-in settings — location and geofence radius, allowed IPs, photo mode and retention — or the defaults when none were saved (`configured: false`), plus a count of its kiosks by status.","operationId":"AttendanceSitesController_list","parameters":[],"responses":{"200":{"description":"Sites, by branch name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSiteListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List check-in sites","tags":["Personal - Asistencia"]}},"/v1/attendance/sites/{branchId}":{"put":{"description":"Creates or updates the settings of a branch. Fields left out keep their value. Latitude and longitude go together (both null removes the geofence: check-ins are then flagged `NO_SITE_LOCATION`, informative only). `allowedIps` accepts IPv4/IPv6 addresses or CIDRs; a non-empty list flags check-ins from other IPs (`IP_NOT_ALLOWED`) — it never blocks them. `pinFallbackEnabled` lets the branch's kiosks accept document number + PIN checks for employees without a phone; every such check is flagged for review (`PIN_FALLBACK`) and asks for an evidence photo. `geoCheckinEnabled` lets employees check in from the Peakly app with their phone's location against the geofence, without the kiosk QR (passkey still required; the site needs coordinates); `geoPolicy` decides what happens out of the radius: `reject` refuses the check-in, `observe` records it flagged for review.","operationId":"AttendanceSitesController_update","parameters":[{"name":"branchId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAttendanceSiteDto"}}}},"responses":{"200":{"description":"The site after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSiteResponseDto"}}}},"400":{"description":"ATTENDANCE_SITE_INVALID_LOCATION — only one coordinate sent, out of range, or app location check-in enabled on a site without coordinates; ATTENDANCE_SITE_INVALID_IP — an entry is not an IP or CIDR (listed in `details`); BAD_REQUEST — radius (20–5000), retention (1–730) or photo mode out of range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the branch does not exist, was deleted or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a site's check-in settings","tags":["Personal - Asistencia"]}},"/v1/attendance/kiosks":{"get":{"description":"Every kiosk of the organization with its branch, status and last heartbeat. `online` is true for an active kiosk heard from in the last 10 minutes.","operationId":"AttendanceKiosksController_list","parameters":[],"responses":{"200":{"description":"Kiosks, by branch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KioskListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List kiosks","tags":["Personal - Asistencia"]},"post":{"description":"Registers a kiosk for a branch and returns its one-time pairing code (8 characters, valid 10 minutes). Open `/kiosco` on the tablet and type the code there. The code is returned only in this response.","operationId":"AttendanceKiosksController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKioskDto"}}}},"responses":{"201":{"description":"The pending kiosk and its pairing code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KioskPairingResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the branch does not exist, was deleted or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a kiosk","tags":["Personal - Asistencia"]}},"/v1/attendance/kiosks/{id}/pairing-code":{"post":{"description":"New one-time code for a pending or active kiosk — a code that expired, or a replacement tablet. The paired tablet keeps working until the new code is used; pairing then rotates the kiosk's device token and QR secret, so the old tablet stops working.","operationId":"AttendanceKiosksController_pairingCode","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The kiosk and its new pairing code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KioskPairingResponseDto"}}}},"404":{"description":"KIOSK_NOT_FOUND — the kiosk does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"KIOSK_REVOKED — revoked kiosks cannot be paired again; create a new one.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Issue a new pairing code","tags":["Personal - Asistencia"]}},"/v1/attendance/kiosks/{id}/revoke":{"post":{"description":"Unpairs the kiosk for good (lost or stolen tablet): its device token stops working at once and every QR it can still draw stops verifying. Idempotent.","operationId":"AttendanceKiosksController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The revoked kiosk.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KioskResponseDto"}}}},"404":{"description":"KIOSK_NOT_FOUND — the kiosk does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Revoke a kiosk","tags":["Personal - Asistencia"]}},"/v1/attendance/days":{"get":{"description":"One row per active employee for a Buenos Aires date: their work day (first entry, exit, worked minutes, segments, status) and last event, plus KPIs — present, working now, not checked in, flagged. A work day belongs to the date of its first entry, so a night shift shows on the day it started.","operationId":"AttendanceBoardController_days","parameters":[{"name":"date","required":false,"in":"query","description":"YYYY-MM-DD (Buenos Aires). Default: today.","schema":{"example":"2026-09-26","type":"string"}},{"name":"branch_id","required":false,"in":"query","description":"Only employees of this branch.","schema":{"type":"number"}},{"name":"status","required":false,"in":"query","description":"Only rows whose work day has this status; `not_checked_in` = no events that day, no approved leave and a shift (or no schedule at all); `no_shift` = no events and no shift that day (day off, holiday, or no slot on that weekday); `on_leave` = an approved leave covers the date (F2.4).","schema":{"type":"string","enum":["ok","open","incomplete","flagged","absent","not_checked_in","no_shift","on_leave"]}}],"responses":{"200":{"description":"Board of the date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceDaysResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — `date` is not YYYY-MM-DD.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Daily attendance board","tags":["Personal - Asistencia"]}},"/v1/attendance/employees/{id}/timeline":{"get":{"description":"Work days and events of one employee between two Buenos Aires dates (inclusive, at most 62 days), each event with its risk flags, latest review and whether it has a photo.","operationId":"AttendanceBoardController_timeline","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"from","required":true,"in":"query","description":"YYYY-MM-DD, inclusive.","schema":{"example":"2026-09-01","type":"string"}},{"name":"to","required":true,"in":"query","description":"YYYY-MM-DD, inclusive. At most 62 days after `from`.","schema":{"example":"2026-09-30","type":"string"}}],"responses":{"200":{"description":"Timeline of the range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceTimelineResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — `from`/`to` malformed, reversed, or more than 62 days apart.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Employee attendance timeline","tags":["Personal - Asistencia"]}},"/v1/attendance/events/{id}":{"get":{"description":"One check-in with its location, distance to the site, IP, risk flags, every review (newest first) and, when the site takes photos, a signed URL of the evidence photo valid for 5 minutes.","operationId":"AttendanceBoardController_event","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The event.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceEventDetailResponseDto"}}}},"404":{"description":"ATTENDANCE_EVENT_NOT_FOUND — the event does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get an attendance event","tags":["Personal - Asistencia"]}},"/v1/attendance/events/{id}/review":{"post":{"description":"Records a decision on an event: `ok` accepts it (a flagged event stops flagging its day), `invalid` removes it from the worked hours. The latest review wins; events are never edited. Returns the recomputed work day.","operationId":"AttendanceBoardController_review","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewAttendanceEventDto"}}}},"responses":{"201":{"description":"The review and the recomputed work day.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewAttendanceEventResponseDto"}}}},"404":{"description":"ATTENDANCE_EVENT_NOT_FOUND — the event does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Review an attendance event","tags":["Personal - Asistencia"]}},"/v1/attendance/corrections":{"get":{"description":"Corrections of missing entries/exits requested by employees or loaded by admins, newest first, cursor-paginated. Filter by status (e.g. `pending` for the inbox) and employee.","operationId":"AttendanceCorrectionsController_list","parameters":[{"name":"status","required":false,"in":"query","description":"Only corrections in this status.","schema":{"type":"string","enum":["pending","approved","rejected","cancelled"]}},{"name":"employee_id","required":false,"in":"query","description":"Only corrections of this employee.","schema":{"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"Opaque cursor: the `nextCursor` of the previous page.","schema":{"type":"string"}},{"name":"page_size","required":false,"in":"query","description":"Page size (default 50, max 100).","schema":{"example":50,"type":"number"}}],"responses":{"200":{"description":"A page of corrections.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrectionPageResponseDto"}}}},"400":{"description":"INVALID_CURSOR — `cursor` is not a value returned as `nextCursor`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List attendance corrections","tags":["Personal - Asistencia"]},"post":{"description":"Adds a missing entry or exit for an employee as an already-approved correction signed by the caller: a new event is recorded (events are never edited) and the work day recomputed. The time must be in the past, at most 31 days old, and fall on `date` or — for a night-shift exit — the next day (Buenos Aires).","operationId":"AttendanceCorrectionsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdminCorrectionDto"}}}},"responses":{"201":{"description":"The approved correction and the recomputed work day.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrectionDecisionResponseDto"}}}},"400":{"description":"ATTENDANCE_CORRECTION_IN_FUTURE / ATTENDANCE_CORRECTION_TOO_OLD (more than 31 days) / ATTENDANCE_CORRECTION_DATE_MISMATCH (`at` is neither on `date` nor the next day) / ATTENDANCE_INVALID_DATE_RANGE (`date` malformed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_CORRECTION_DUPLICATE — the employee has a pending correction for that same time: approve it instead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Load a correction directly","tags":["Personal - Asistencia"]}},"/v1/attendance/corrections/{id}/approve":{"post":{"description":"Approves a pending correction: a new event with the proposed time is recorded (source `correction`) and the work day recomputed, in one transaction. Returns the correction and the work day that now holds the event.","operationId":"AttendanceCorrectionsController_approve","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewCorrectionDto"}}}},"responses":{"200":{"description":"The approved correction and the recomputed work day.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrectionDecisionResponseDto"}}}},"404":{"description":"ATTENDANCE_CORRECTION_NOT_FOUND — the correction does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_CORRECTION_NOT_PENDING — it was already approved, rejected or cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Approve an attendance correction","tags":["Personal - Asistencia"]}},"/v1/attendance/corrections/{id}/reject":{"post":{"description":"Rejects a pending correction, optionally with a note the employee sees. No event is recorded.","operationId":"AttendanceCorrectionsController_reject","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewCorrectionDto"}}}},"responses":{"200":{"description":"The rejected correction (`workDay` is null).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorrectionDecisionResponseDto"}}}},"404":{"description":"ATTENDANCE_CORRECTION_NOT_FOUND — the correction does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_CORRECTION_NOT_PENDING — it was already approved, rejected or cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Reject an attendance correction","tags":["Personal - Asistencia"]}},"/v1/attendance/employees/{id}/timesheet.pdf":{"get":{"description":"The planilla horaria of one employee for a month, as required by art. 52 of the Ley de Contrato de Trabajo: employer and employee data, one row per day with entries, exits, worked hours and observations (including approved corrections), the monthly total and signature lines. Times in Buenos Aires.","operationId":"AttendanceTimesheetController_timesheet","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"month","required":true,"in":"query","description":"Month (YYYY-MM), not after the current one.","schema":{"example":"2026-09","type":"string"}}],"responses":{"200":{"description":"The timesheet PDF."},"400":{"description":"ATTENDANCE_INVALID_MONTH — `month` is not YYYY-MM or is a future month.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Employee monthly timesheet (PDF)","tags":["Personal - Asistencia"]}},"/v1/attendance/settings":{"get":{"description":"Organization-wide attendance settings: whether employees who checked in today and have no check-out get an email reminder, and at what hour (Buenos Aires), whether national días no laborables count as holidays, whether planned unpaid breaks are deducted (`unpaidBreakMode`), and after how many hours pending approvals are reminded to their approver (`pendingReminderHours`). Defaults when never saved: enabled, 22 h, días no laborables not observed, breaks not deducted (`none`), no reminder (null).","operationId":"AttendanceSettingsController_get","parameters":[],"responses":{"200":{"description":"Current settings (or the defaults).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSettingsResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get attendance settings","tags":["Personal - Asistencia"]},"put":{"description":"Updates the organization's attendance settings. Fields left out keep their value. The missed check-out reminder hour is a Buenos Aires hour from 17 to 23; the reminder runs hourly in that window and emails each organization at its hour. `observeNonWorkingDays` makes the national `no_laborable` and `puente` days holidays for the organization. `unpaidBreakMode: scheduled` deducts from each closed day the slots' planned unpaid break that was not punched (applies to days recomputed afterwards). `pendingReminderHours` (1–336, null = off): every day at 09:00 each approver gets one email with the leaves, corrections and overtime pending for longer.","operationId":"AttendanceSettingsController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAttendanceSettingsDto"}}}},"responses":{"200":{"description":"Settings after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSettingsResponseDto"}}}},"400":{"description":"ATTENDANCE_SETTINGS_INVALID — a field has the wrong type, the hour is outside 17–23, `unpaidBreakMode` is not none / scheduled or `pendingReminderHours` is not null / 1–336 (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update attendance settings","tags":["Personal - Asistencia"]}},"/v1/attendance/schedules":{"get":{"description":"Weekly schedule templates with their slots (weekday 1 = Monday … 7 = Sunday, HH:MM Buenos Aires; a slot whose end is not after its start crosses midnight), tolerance and how many employees follow each one today or later. Archived ones only with `include_archived=true`.","operationId":"AttendanceSchedulesController_list","parameters":[{"name":"include_archived","required":false,"in":"query","description":"Also return archived schedules (default false).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Schedules, by name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkScheduleListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List work schedules","tags":["Personal - Asistencia"]},"post":{"description":"Creates a weekly template. Several slots per day are allowed; they may not overlap (a slot crossing midnight runs into the next day). Tolerance defaults to 15 minutes: that long after a slot's start without an entry raises a no-show alert.","operationId":"AttendanceSchedulesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkScheduleDto"}}}},"responses":{"201":{"description":"The new schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}}}},"400":{"description":"ATTENDANCE_SCHEDULE_INVALID — a slot has a bad weekday or time, or two slots overlap (listed in `details`); BAD_REQUEST — name or tolerance (0–240) out of range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a work schedule","tags":["Personal - Asistencia"]}},"/v1/attendance/schedules/{id}":{"get":{"description":"One schedule with its slots.","operationId":"AttendanceSchedulesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}}}},"404":{"description":"ATTENDANCE_SCHEDULE_NOT_FOUND — the schedule does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a work schedule","tags":["Personal - Asistencia"]},"patch":{"description":"Fields left out keep their value; `slots`, when sent, replaces every slot. Changes apply from now on to everyone who follows the schedule (alerts already raised stay as they were).","operationId":"AttendanceSchedulesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkScheduleDto"}}}},"responses":{"200":{"description":"The schedule after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}}}},"400":{"description":"ATTENDANCE_SCHEDULE_INVALID — a slot has a bad weekday or time, or two slots overlap (listed in `details`); BAD_REQUEST — name or tolerance (0–240) out of range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_SCHEDULE_NOT_FOUND — the schedule does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_SCHEDULE_ARCHIVED — archived schedules cannot be edited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a work schedule","tags":["Personal - Asistencia"]},"delete":{"description":"Archives the schedule (never deleted: past assignments keep pointing to it). Refused while someone follows it today or from a later date. Archiving an archived schedule returns it unchanged.","operationId":"AttendanceSchedulesController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The archived schedule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}}}},"404":{"description":"ATTENDANCE_SCHEDULE_NOT_FOUND — the schedule does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_SCHEDULE_IN_USE — reassign its employees first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive a work schedule","tags":["Personal - Asistencia"]}},"/v1/employees/{id}/schedule":{"get":{"description":"The assignment in force today (Buenos Aires) with its schedule, and every assignment newest first, future ones included.","operationId":"EmployeeScheduleController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Current assignment and history.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeScheduleResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get an employee's schedule","tags":["Personal - Asistencia"]},"put":{"description":"The employee follows `scheduleId` from `validFrom`; the previous assignment closes the day before. History is never overwritten: `validFrom` must be after the start of the latest assignment. `scheduleId: null` only ends the current assignment. Re-sending the assignment already open is a no-op.","operationId":"EmployeeScheduleController_assign","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignEmployeeScheduleDto"}}}},"responses":{"200":{"description":"Current assignment and history after the change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeScheduleResponseDto"}}}},"400":{"description":"ATTENDANCE_SCHEDULE_INVALID — `validFrom` is not a real date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — the employee does not exist or belongs to another organization. ATTENDANCE_SCHEDULE_NOT_FOUND — the schedule does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_SCHEDULE_ASSIGNMENT_CONFLICT — `validFrom` is not after the latest assignment's start; ATTENDANCE_SCHEDULE_ARCHIVED — the schedule is archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Assign a schedule to an employee","tags":["Personal - Asistencia"]}},"/v1/attendance/alerts":{"get":{"description":"No-show alerts: an employee had a slot in their schedule, its tolerance passed and there was no entry since 2 h before its start. Raised every 5 minutes, around the clock, and emailed to the employee's supervisor, or to the organization's admins. An alert resolves when the employee checks in. Default: today's open alerts.","operationId":"AttendanceAlertsController_list","parameters":[{"name":"from","required":false,"in":"query","description":"First slot date (YYYY-MM-DD, Buenos Aires). Default: today.","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last slot date, inclusive (at most 62 days after `from`). Default: `from`.","schema":{"example":"2026-10-01","type":"string"}},{"name":"status","required":false,"in":"query","description":"`open`: nobody checked in yet; `resolved`: the employee checked in later.","schema":{"default":"open","type":"string","enum":["open","resolved","all"]}}],"responses":{"200":{"description":"Alerts of the range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceAlertListResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — `from`/`to` malformed, reversed, or more than 62 days apart.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List attendance alerts","tags":["Personal - Asistencia"]}},"/v1/attendance/pay-bands/site-rates":{"get":{"description":"Sites' own hourly rates for live pay bands. A minute worked at a site with its own rate for the minute's band is valued at that rate in the hours report; the band that covers the minute does not change. Filter one site with `site_id`.","operationId":"AttendancePayBandSiteRatesController_list","parameters":[{"name":"site_id","required":false,"in":"query","description":"Only the rates of this site (branch).","schema":{"example":3,"type":"number"}}],"responses":{"200":{"description":"Rates.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandSiteRateListResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the site is not a branch of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List per-site pay band rates","tags":["Personal - Asistencia"]}},"/v1/attendance/pay-bands/site-rates/{siteId}/{payBandId}":{"put":{"description":"Creates or replaces the site's own hourly rate for the band. The hours report uses it from the next query, for every month.","operationId":"AttendancePayBandSiteRatesController_save","parameters":[{"name":"siteId","required":true,"in":"path","description":"The site (branch).","schema":{"type":"number"}},{"name":"payBandId","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavePayBandSiteRateDto"}}}},"responses":{"200":{"description":"The site's rate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandSiteRateResponseDto"}}}},"400":{"description":"BAD_REQUEST — rate below 0 or with more than 2 decimals.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the site is not a branch of the organization. ATTENDANCE_PAY_BAND_NOT_FOUND — the band does not exist or belongs to another organization. An archived band also answers 404.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Set a site's rate for a pay band","tags":["Personal - Asistencia"]},"delete":{"description":"The band's base rate applies again at that site. Removing a rate that does not exist is a no-op.","operationId":"AttendancePayBandSiteRatesController_remove","parameters":[{"name":"siteId","required":true,"in":"path","description":"The site (branch).","schema":{"type":"number"}},{"name":"payBandId","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Removed."},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the site is not a branch of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Remove a site's rate for a pay band","tags":["Personal - Asistencia"]}},"/v1/attendance/pay-bands":{"get":{"description":"Hour bands with their reference hourly rate, highest priority first. A worked minute belongs to the live band of highest priority whose weekdays include the minute's Buenos Aires weekday and whose window includes its time (a window whose end is not after its start wraps midnight); otherwise to \"Sin franja\". Archived ones only with `include_archived=true`.","operationId":"AttendancePayBandsController_list","parameters":[{"name":"include_archived","required":false,"in":"query","description":"Also return archived bands (default false).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Bands.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List pay bands","tags":["Personal - Asistencia"]},"post":{"description":"Every live band of the organization shares one currency.","operationId":"AttendancePayBandsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePayBandDto"}}}},"responses":{"201":{"description":"The new band.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandResponseDto"}}}},"400":{"description":"ATTENDANCE_PAY_BAND_INVALID — bad time or currency (listed in `details`); BAD_REQUEST — name, weekdays (1–7), rate (≥ 0, 2 decimals) or priority (0–1000) out of range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a pay band","tags":["Personal - Asistencia"]}},"/v1/attendance/pay-bands/template":{"post":{"description":"Creates Feriado (every day, 00:00–24:00, priority 40, holiday-only: it counts only on the employee's holidays), Fin de semana (Sat–Sun, 00:00–24:00, priority 30), Nocturna (Mon–Fri, 20:00–08:00, priority 20) and Diurna (Mon–Fri, 08:00–20:00, priority 10), with rate 0 until the admin sets it. Only when the organization has no live band.","operationId":"AttendancePayBandsController_template","parameters":[],"responses":{"201":{"description":"The organization's bands after loading.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandListResponseDto"}}}},"409":{"description":"ATTENDANCE_PAY_BANDS_NOT_EMPTY — there are bands already.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Load the suggested pay bands","tags":["Personal - Asistencia"]}},"/v1/attendance/pay-bands/{id}":{"patch":{"description":"Fields left out keep their value. The hours report always uses the current bands.","operationId":"AttendancePayBandsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePayBandDto"}}}},"responses":{"200":{"description":"The band after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandResponseDto"}}}},"400":{"description":"ATTENDANCE_PAY_BAND_INVALID — bad time or currency (listed in `details`); BAD_REQUEST — name, weekdays (1–7), rate (≥ 0, 2 decimals) or priority (0–1000) out of range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_PAY_BAND_NOT_FOUND — the band does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a pay band","tags":["Personal - Asistencia"]},"delete":{"description":"The band stops counting; its minutes go to the next band or to \"Sin franja\". Archiving twice is a no-op.","operationId":"AttendancePayBandsController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The archived band.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayBandResponseDto"}}}},"404":{"description":"ATTENDANCE_PAY_BAND_NOT_FOUND — the band does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive a pay band","tags":["Personal - Asistencia"]}},"/v1/attendance/band-hours":{"get":{"description":"For a month (Buenos Aires): per employee, the minutes worked in each live band and their reference amount (minutes / 60 × hourly rate). The rate is the site's own rate for the band when the minutes were worked at a site that has one (the site of a segment is the branch of its entry event, else of its exit, else the employee's branch; `siteRate` marks those cells), else the band's base rate. Built from the work days' closed segments, minute by minute in Buenos Aires time, so a shift crossing midnight splits by each minute's weekday. Open days count nothing; incomplete days count their closed segments. A reference value, not a payslip.","operationId":"AttendanceBandHoursController_report","parameters":[{"name":"month","required":false,"in":"query","description":"YYYY-MM (Buenos Aires). Default: the current month.","schema":{"example":"2026-10","type":"string"}},{"name":"siteId","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}},{"name":"employeeId","required":false,"in":"query","description":"Only this employee.","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Report of the month.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BandHoursResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_MONTH — `month` is not YYYY-MM or is after the current month.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — `siteId` is not a branch of the organization; EMPLOYEE_NOT_FOUND — `employeeId` is not one of its employees.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Hours by pay band","tags":["Personal - Asistencia"]}},"/v1/attendance/band-hours/export":{"get":{"description":"The same report as a file. XLSX: sheet \"Resumen\" (per employee and band: hours in decimal and h:mm, amount; totals) and sheet \"Detalle\" (employee, date, site, band, minutes, hourly rate, whether it is the site's own rate, amount). CSV (UTF-8 with BOM): the summary only.","operationId":"AttendanceBandHoursController_export","parameters":[{"name":"month","required":false,"in":"query","description":"YYYY-MM (Buenos Aires). Default: the current month.","schema":{"example":"2026-10","type":"string"}},{"name":"siteId","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}},{"name":"employeeId","required":false,"in":"query","description":"Only this employee.","schema":{"example":12,"type":"number"}},{"name":"format","required":false,"in":"query","schema":{"default":"xlsx","type":"string","enum":["xlsx","csv"]}}],"responses":{"200":{"description":"The file, as an attachment."},"400":{"description":"ATTENDANCE_INVALID_MONTH — `month` is not YYYY-MM or is after the current month.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — `siteId` is not a branch of the organization; EMPLOYEE_NOT_FOUND — `employeeId` is not one of its employees.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export hours by pay band","tags":["Personal - Asistencia"]}},"/v1/attendance/holidays":{"get":{"description":"National holidays of the year (official calendar, including provincial ones with the organization's sites in that province) merged with the organization's own holidays. A holiday is not an expected work day: no-show alerts skip it and pay bands marked `holidayOnly` apply on it. `no_laborable` and `puente` days count only when the organization turned on `observeNonWorkingDays` in the attendance settings.","operationId":"AttendanceHolidaysController_list","parameters":[{"name":"year","required":false,"in":"query","description":"Calendar year. Default: the current year (Buenos Aires).","schema":{"minimum":2000,"maximum":2100,"example":2026,"type":"number"}}],"responses":{"200":{"description":"Holidays of the year, by date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HolidayListResponseDto"}}}},"400":{"description":"BAD_REQUEST — `year` is not an integer from 2000 to 2100.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List holidays","tags":["Personal - Asistencia"]}},"/v1/attendance/organization-holidays":{"post":{"description":"Adds a day off of the organization (a provincial holiday, the union's day…), for every site or only the listed ones. One per date.","operationId":"OrganizationHolidaysController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationHolidayDto"}}}},"responses":{"201":{"description":"The new holiday.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HolidayResponseDto"}}}},"400":{"description":"ATTENDANCE_HOLIDAY_INVALID — bad date or name, empty site list, or a site of another organization (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_HOLIDAY_DUPLICATE — there is already one on that date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Add an organization holiday","tags":["Personal - Asistencia"]}},"/v1/attendance/organization-holidays/{id}":{"delete":{"description":"Deletes one of the organization's own holidays. National holidays cannot be deleted.","operationId":"OrganizationHolidaysController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The deleted holiday.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HolidayResponseDto"}}}},"404":{"description":"ATTENDANCE_HOLIDAY_NOT_FOUND — it does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete an organization holiday","tags":["Personal - Asistencia"]}},"/v1/attendance/schedule-overrides":{"get":{"description":"Day-off and one-off shift changes between two dates (default: today and the next 30 days; at most 62 days), optionally for one employee.","operationId":"ScheduleOverridesController_list","parameters":[{"name":"from","required":false,"in":"query","description":"First date (YYYY-MM-DD). Default: today (Buenos Aires).","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last date, inclusive, at most 62 days after `from`. Default: `from` + 30 days.","schema":{"example":"2026-10-31","type":"string"}},{"name":"employee_id","required":false,"in":"query","description":"Only this employee.","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Overrides by date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleOverrideListResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — bad or too long range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List schedule overrides","tags":["Personal - Asistencia"]},"post":{"description":"Changes an employee's plan for one date: `day_off` (no shift) or `shift` (one shift instead of the schedule's slots; it also applies on a holiday). It rules the expected time of that day, its absence and its no-show alert. One per employee and date; up to 62 days back and a year ahead. Bulk changes = one POST per employee.","operationId":"ScheduleOverridesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateScheduleOverrideDto"}}}},"responses":{"201":{"description":"The new override.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleOverrideResponseDto"}}}},"400":{"description":"ATTENDANCE_SCHEDULE_OVERRIDE_INVALID — bad date, out of range, or bad times (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_SCHEDULE_OVERRIDE_DUPLICATE — the employee already has one that date.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Add a schedule override","tags":["Personal - Asistencia"]}},"/v1/attendance/schedule-overrides/{id}":{"delete":{"description":"The day goes back to the schedule (or the holiday) it had.","operationId":"ScheduleOverridesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The deleted override.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleOverrideResponseDto"}}}},"404":{"description":"ATTENDANCE_SCHEDULE_OVERRIDE_NOT_FOUND — the override does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a schedule override","tags":["Personal - Asistencia"]}},"/v1/intranet/announcements":{"get":{"description":"Drafts, published and archived announcements of the organization, newest first (at most 200), with read receipts for the published ones.","operationId":"IntranetAnnouncementsController_list","parameters":[{"name":"status","required":false,"in":"query","description":"Only this status. Default: every status.","schema":{"type":"string","enum":["draft","published","archived"]}}],"responses":{"200":{"description":"Announcements.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementListResponseDto"}}}},"400":{"description":"BAD_REQUEST — `status` is not draft, published or archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List announcements","tags":["Personal - Intranet"]},"post":{"description":"Creates a draft. Employees see nothing until it is published. The body is Markdown; clients render it sanitized (no raw HTML). The audience is everyone or a list of sites (branch ids).","operationId":"IntranetAnnouncementsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAnnouncementDto"}}}},"responses":{"201":{"description":"The new draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"400":{"description":"INTRANET_ANNOUNCEMENT_INVALID — empty or too long title or body, or a site of another organization (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create an announcement","tags":["Personal - Intranet"]}},"/v1/intranet/announcements/{id}":{"get":{"description":"One announcement with its read receipts summary (null for drafts).","operationId":"IntranetAnnouncementsController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The announcement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND — it does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get an announcement","tags":["Personal - Intranet"]},"patch":{"description":"Changes the fields sent. Only drafts: a published announcement is archived and a new one written, so nobody confirms a text that changed after they read it.","operationId":"IntranetAnnouncementsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAnnouncementDto"}}}},"responses":{"200":{"description":"The edited draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"400":{"description":"INTRANET_ANNOUNCEMENT_INVALID — see create.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"INTRANET_ANNOUNCEMENT_NOT_DRAFT — it was already published or archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Edit a draft announcement","tags":["Personal - Intranet"]},"delete":{"description":"Deletes a draft. Published announcements are archived instead.","operationId":"IntranetAnnouncementsController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The deleted draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"INTRANET_ANNOUNCEMENT_NOT_DRAFT — it was published.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Delete a draft announcement","tags":["Personal - Intranet"]}},"/v1/intranet/announcements/{id}/publish":{"post":{"description":"Makes a draft visible in the intranet of every active employee in its audience. With `notifyByEmail`, the audience is emailed within minutes, in batches (employees with an email only).","operationId":"IntranetAnnouncementsController_publish","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"201":{"description":"The published announcement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"INTRANET_ANNOUNCEMENT_NOT_DRAFT — it was already published or archived.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Publish an announcement","tags":["Personal - Intranet"]}},"/v1/intranet/announcements/{id}/archive":{"post":{"description":"Hides it from the intranet (pending emails stop). Reads and confirmations are kept. Archiving twice is a no-op.","operationId":"IntranetAnnouncementsController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"201":{"description":"The archived announcement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive an announcement","tags":["Personal - Intranet"]}},"/v1/intranet/announcements/{id}/stats":{"get":{"description":"How many active employees of the audience opened and confirmed it, and who is missing (not confirmed when a confirmation is asked, else not opened; at most 500). Drafts answer zeros.","operationId":"IntranetAnnouncementsController_stats","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Read receipts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntranetStatsResponseDto"}}}},"404":{"description":"INTRANET_ANNOUNCEMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Announcement read receipts","tags":["Personal - Intranet"]}},"/v1/intranet/documents":{"get":{"description":"Documents of the organization (active first, then by title; at most 200) with the confirmations of their current version.","operationId":"IntranetDocumentsController_list","parameters":[],"responses":{"200":{"description":"Documents.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List documents","tags":["Personal - Intranet"]},"post":{"description":"Uploads a document (version 1) for everyone or some sites. Multipart: `file` plus `title`, optional `description`, `requiresAck` (\"true\"/\"false\") and `audience` (JSON). Files are private: they are downloaded through short signed URLs.","operationId":"IntranetDocumentsController_create","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","title"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG, DOCX or XLSX, up to 10 MB. The type is read from the file's bytes."},"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":2000},"requiresAck":{"type":"string","enum":["true","false"]},"audience":{"type":"string","example":"{\"all\":false,\"branchIds\":[3]}"}}}}}},"responses":{"201":{"description":"The new document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponseDto"}}}},"400":{"description":"INTRANET_DOCUMENT_INVALID — bad title, description or audience (a site of another organization included). INTRANET_DOCUMENT_FILE_INVALID — no file, empty, or not a PDF, PNG, JPEG, DOCX or XLSX.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"413":{"description":"PAYLOAD_TOO_LARGE — the file is over 10 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"INTRANET_STORAGE_NOT_CONFIGURED — document storage is not available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Upload a document","tags":["Personal - Intranet"]}},"/v1/intranet/documents/{id}":{"get":{"description":"One document with every version, newest first.","operationId":"IntranetDocumentsController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND — it does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a document","tags":["Personal - Intranet"]},"patch":{"description":"Changes title, description, audience or whether a confirmation is asked. The file stays: upload a new version to change it.","operationId":"IntranetDocumentsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocumentDto"}}}},"responses":{"200":{"description":"The edited document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponseDto"}}}},"400":{"description":"INTRANET_DOCUMENT_INVALID — see upload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Edit a document","tags":["Personal - Intranet"]}},"/v1/intranet/documents/{id}/versions":{"post":{"description":"Replaces the document's file: the version goes up by one and every confirmation starts over (employees confirm the new version). Older versions stay downloadable here.","operationId":"IntranetDocumentsController_addVersion","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, PNG, JPEG, DOCX or XLSX, up to 10 MB. The type is read from the file's bytes."}}}}}},"responses":{"201":{"description":"The document at its new version.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponseDto"}}}},"400":{"description":"INTRANET_DOCUMENT_FILE_INVALID — no file, empty, or not a PDF, PNG, JPEG, DOCX or XLSX.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"INTRANET_DOCUMENT_ARCHIVED — the document is archived. INTRANET_DOCUMENT_VERSION_CHANGED — another version was uploaded at the same time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"413":{"description":"PAYLOAD_TOO_LARGE — the file is over 10 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"INTRANET_STORAGE_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Upload a new version","tags":["Personal - Intranet"]}},"/v1/intranet/documents/{id}/archive":{"post":{"description":"Hides it from the intranet. Versions and confirmations are kept. Archiving twice is a no-op.","operationId":"IntranetDocumentsController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"201":{"description":"The archived document.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive a document","tags":["Personal - Intranet"]}},"/v1/intranet/documents/{id}/download":{"get":{"description":"A signed URL (valid 5 minutes) for the current version or the one in `version`.","operationId":"IntranetDocumentsController_download","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"version","required":false,"in":"query","description":"Version to download. Default: the current one.","schema":{"example":1,"type":"number"}}],"responses":{"200":{"description":"Signed URL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDownloadResponseDto"}}}},"400":{"description":"BAD_REQUEST — `version` is not a positive integer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND — the document or that version does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"INTRANET_STORAGE_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Download a document","tags":["Personal - Intranet"]}},"/v1/intranet/documents/{id}/stats":{"get":{"description":"How many active employees of the audience confirmed the current version, and who is missing (at most 500, with the last version each one confirmed). A document that asks for no confirmation answers no pending employees.","operationId":"IntranetDocumentsController_stats","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"Confirmations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntranetStatsResponseDto"}}}},"404":{"description":"INTRANET_DOCUMENT_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Document confirmations","tags":["Personal - Intranet"]}},"/v1/intranet/directory-settings":{"get":{"description":"The fields the employee directory shows besides the name, and the ones that can be added. Email and phone show only for employees who opted in from their intranet.","operationId":"IntranetDirectorySettingsController_get","parameters":[],"responses":{"200":{"description":"Directory settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectorySettingsResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get directory settings","tags":["Personal - Intranet"]},"put":{"description":"Sends the full list of fields to show, in order. Empty = name only.","operationId":"IntranetDirectorySettingsController_replace","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDirectorySettingsDto"}}}},"responses":{"200":{"description":"Directory settings after the change.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DirectorySettingsResponseDto"}}}},"400":{"description":"INTRANET_DIRECTORY_SETTINGS_INVALID — a field that does not exist, cannot be shown (CUIL, document, address, birth date, numeric/date custom fields) or is hidden in the employee field settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Replace directory settings","tags":["Personal - Intranet"]}},"/v1/attendance/overtime-policy":{"get":{"description":"How overtime is computed: basis (schedule or thresholds), daily and weekly thresholds, Saturday cutoff for 100 %, rounding, whether it needs approval, night reduction, the monthly / annual caps, the daily cap warning and where overtime goes (paid, hour bank or the approver's choice, with the bank multiplier). Defaults when never saved: the legal ones (Ley 11.544, LCT art. 200–201, Dto. 484/2000), no daily cap, paid.","operationId":"OvertimePolicyController_get","parameters":[],"responses":{"200":{"description":"Current policy (or the defaults).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimePolicyResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get the overtime policy","tags":["Personal - Asistencia"]},"put":{"description":"Fields left out keep their value. A change recomputes the overtime of the current month; earlier months keep what they had until recomputed. Collective agreements may set other rules: the policy is per organization.","operationId":"OvertimePolicyController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOvertimePolicyDto"}}}},"responses":{"200":{"description":"Policy after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimePolicyResponseDto"}}}},"400":{"description":"ATTENDANCE_OVERTIME_POLICY_INVALID — a field has the wrong type or range (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update the overtime policy","tags":["Personal - Asistencia"]}},"/v1/attendance/overtime":{"get":{"description":"Per employee: worked, overtime at 50 % and 100 % that counts, night minutes, minutes pending or rejected, overtime sent to the hour bank, and the usage of the monthly and annual caps (`near` from 80 %, `exceeded` past the cap — overtime is never truncated). `days` lists the days with overtime or an approval request, with their destination and the `DAILY_CAP_EXCEEDED` flag.","operationId":"OvertimeController_summary","parameters":[{"name":"month","required":false,"in":"query","description":"YYYY-MM (Buenos Aires). Default: the current month.","schema":{"example":"2026-10","type":"string"}},{"name":"site_id","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}},{"name":"employee_id","required":false,"in":"query","description":"Only this employee.","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Monthly overtime summary.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimeSummaryResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_MONTH — `month` is not YYYY-MM or is in the future.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND / EMPLOYEE_NOT_FOUND — the site or employee is not the organization's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Overtime by employee for a month","tags":["Personal - Asistencia"]}},"/v1/attendance/overtime/approvals":{"get":{"description":"Requests created when the policy requires approval: one per employee and day with overtime, newest date first (at most 200). Default status: pending.","operationId":"OvertimeController_approvals","parameters":[{"name":"status","required":false,"in":"query","schema":{"default":"pending","type":"string","enum":["pending","approved","rejected","all"]}},{"name":"from","required":false,"in":"query","description":"First date (YYYY-MM-DD).","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last date, inclusive (at most 62 days after `from`).","schema":{"example":"2026-10-31","type":"string"}},{"name":"employee_id","required":false,"in":"query","description":"Only this employee.","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimeApprovalListResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — bad range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List overtime approval requests","tags":["Personal - Asistencia"]}},"/v1/attendance/overtime/{employeeId}/{date}/approve":{"post":{"description":"The day's overtime starts counting (reports, caps, exports). Under `compensation: choose`, `destination` says whether it is paid or goes to the hour bank; under `bank` it always goes to the bank.","operationId":"OvertimeController_approve","parameters":[{"name":"employeeId","required":true,"in":"path","schema":{"type":"number"}},{"name":"date","required":true,"in":"path","schema":{"example":"2026-10-05","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewOvertimeDto"}}}},"responses":{"200":{"description":"The request after the decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimeApprovalResponseDto"}}}},"400":{"description":"ATTENDANCE_OVERTIME_DESTINATION_REQUIRED — the policy is `choose` and `destination` is missing or not pay / bank.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_OVERTIME_APPROVAL_NOT_FOUND — no overtime request for that employee and date in the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_OVERTIME_APPROVAL_NOT_PENDING — it was already approved or rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Approve a day's overtime","tags":["Personal - Asistencia"]}},"/v1/attendance/overtime/{employeeId}/{date}/reject":{"post":{"description":"The day's overtime does not count. If the day's minutes change later, a new pending request replaces it.","operationId":"OvertimeController_reject","parameters":[{"name":"employeeId","required":true,"in":"path","schema":{"type":"number"}},{"name":"date","required":true,"in":"path","schema":{"example":"2026-10-05","type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewOvertimeDto"}}}},"responses":{"200":{"description":"The request after the decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OvertimeApprovalResponseDto"}}}},"404":{"description":"ATTENDANCE_OVERTIME_APPROVAL_NOT_FOUND — no overtime request for that employee and date in the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_OVERTIME_APPROVAL_NOT_PENDING — it was already approved or rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Reject a day's overtime","tags":["Personal - Asistencia"]}},"/v1/attendance/hour-bank":{"get":{"description":"Balance (sum of every movement) and the movements, newest first (at most 500): overtime credits, leave debits and manual adjustments.","operationId":"AttendanceHourBankController_get","parameters":[{"name":"employee_id","required":true,"in":"query","description":"The employee whose bank to read.","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Balance and movements.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HourBankResponseDto"}}}},"400":{"description":"BAD_REQUEST — `employee_id` missing or not a positive integer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get an employee's hour bank","tags":["Personal - Asistencia"]}},"/v1/attendance/hour-bank/balances":{"get":{"description":"The balance of every active employee plus anyone with movements, sorted by last name.","operationId":"AttendanceHourBankController_balances","parameters":[{"name":"site_id","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}}],"responses":{"200":{"description":"Balances.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HourBankBalanceListDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — the site is not the organization's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List hour-bank balances","tags":["Personal - Asistencia"]}},"/v1/attendance/hour-bank/adjustments":{"post":{"description":"Appends a manual movement (+ credit, − debit) with a required note, e.g. an initial balance agreed with the employee. The ledger is append-only: a mistake is fixed with an opposite adjustment. It may leave the balance negative.","operationId":"AttendanceHourBankController_adjust","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateHourBankAdjustmentDto"}}}},"responses":{"201":{"description":"The movement.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HourBankMovementDto"}}}},"400":{"description":"ATTENDANCE_HOUR_BANK_ADJUSTMENT_INVALID — bad employee, minutes, date or note (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Adjust an employee's hour bank","tags":["Personal - Asistencia"]}},"/v1/attendance/leave-types":{"get":{"description":"The organization's leave types. The first read seeds the system catalog (vacaciones, enfermedad, nacimiento, matrimonio, fallecimiento, examen, sin goce, otra) with the LCT defaults.","operationId":"LeaveTypesController_list","parameters":[],"responses":{"200":{"description":"Leave types, by `sortOrder`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveTypeListResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List leave types","tags":["Personal - Licencias"]},"post":{"description":"A type of the organization's own (a collective agreement's leave, for instance).","operationId":"LeaveTypesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLeaveTypeDto"}}}},"responses":{"201":{"description":"The new type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveTypeResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_TYPE_INVALID — bad fields (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_TYPE_DUPLICATE — another type has that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Add a leave type","tags":["Personal - Licencias"]}},"/v1/attendance/leave-types/{id}":{"patch":{"description":"Any field but the catalog key. `active: false` hides it from new requests; existing requests keep it. Days already counted do not change.","operationId":"LeaveTypesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLeaveTypeDto"}}}},"responses":{"200":{"description":"The type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveTypeResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_TYPE_INVALID — bad fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_TYPE_NOT_FOUND — unknown or another organization's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_TYPE_DUPLICATE — another type has that name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a leave type","tags":["Personal - Licencias"]}},"/v1/attendance/leaves":{"get":{"description":"Leaves overlapping `from`…`to` (both optional; at most 366 days), by status, employee, type or site. Sorted by start date; at most 500 (`truncated`). `status=pending` is the approvals inbox.","operationId":"LeavesController_list","parameters":[{"name":"status","required":false,"in":"query","description":"Default: every status.","schema":{"type":"string","enum":["pending","approved","rejected","cancelled","all"]}},{"name":"from","required":false,"in":"query","description":"Leaves that end on or after this date.","schema":{"example":"2026-10-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Leaves that start on or before this date (range ≤ 366 days).","schema":{"example":"2026-12-31","type":"string"}},{"name":"employee_id","required":false,"in":"query","schema":{"example":12,"type":"number"}},{"name":"leave_type_id","required":false,"in":"query","schema":{"example":3,"type":"number"}},{"name":"branch_id","required":false,"in":"query","description":"Employees of this site.","schema":{"example":2,"type":"number"}}],"responses":{"200":{"description":"Leaves.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveListResponseDto"}}}},"400":{"description":"ATTENDANCE_INVALID_DATE_RANGE — bad range.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List leaves","tags":["Personal - Licencias"]},"post":{"description":"Loads a leave for an employee, approved at once unless `status: pending`. Same rules as an employee's request (overlap, balance, limits), up to 400 days back. An approved leave makes its days expected off: no absence, no no-show alert, no overtime.","operationId":"LeavesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLeaveDto"}}}},"responses":{"201":{"description":"The leave.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_INVALID — bad or out-of-range dates, an inactive type, or a rule of the type (minimum/maximum days, listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND or ATTENDANCE_LEAVE_TYPE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_OVERLAP (another pending or approved leave on those dates), ATTENDANCE_LEAVE_INSUFFICIENT_BALANCE (vacation balance) or ATTENDANCE_LEAVE_LIMIT_EXCEEDED (yearly limit of the type).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"422":{"description":"HOUR_BANK_INSUFFICIENT — the type consumes the hour bank and the balance does not cover the leave's planned minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Load a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/preview":{"get":{"description":"Days it would count, the vacation balance, the legal reminders and why it would be refused — without saving anything.","operationId":"LeavesController_preview","parameters":[{"name":"leave_type_id","required":true,"in":"query","schema":{"example":3,"type":"number"}},{"name":"from","required":true,"in":"query","schema":{"example":"2026-12-07","type":"string"}},{"name":"to","required":true,"in":"query","schema":{"example":"2026-12-20","type":"string"}},{"name":"period_year","required":false,"in":"query","schema":{"example":2026,"type":"number"}},{"name":"employee_id","required":true,"in":"query","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"The preview.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeavePreviewResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_INVALID — bad or out-of-range dates, an inactive type, or a rule of the type (minimum/maximum days, listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND or ATTENDANCE_LEAVE_TYPE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/{id}":{"get":{"description":"One leave with its type, reviewer, certificate metadata and legal reminders.","operationId":"LeavesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The leave.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND — the leave does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/{id}/approve":{"post":{"description":"Approves a pending leave. Its days become expected off and the work days in the range are recomputed. The employee is emailed.","operationId":"LeavesController_approve","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveDecisionDto"}}}},"responses":{"200":{"description":"The leave after the decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND — the leave does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_NOT_PENDING (already decided or cancelled), ATTENDANCE_LEAVE_CERTIFICATE_REQUIRED (the type needs one and none is attached), ATTENDANCE_LEAVE_INSUFFICIENT_BALANCE or ATTENDANCE_LEAVE_LIMIT_EXCEEDED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"422":{"description":"HOUR_BANK_INSUFFICIENT — the type consumes the hour bank and the balance does not cover the leave's planned minutes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Approve a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/{id}/reject":{"post":{"description":"Rejects a pending leave. The employee is emailed.","operationId":"LeavesController_reject","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveDecisionDto"}}}},"responses":{"200":{"description":"The leave after the decision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND — the leave does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_NOT_PENDING — already decided or cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Reject a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/{id}/cancel":{"post":{"description":"Cancels a pending or approved leave (never deleted). An approved one gives its days back to the balance, and its days go back to the schedule: past days without punches become absences again.","operationId":"LeavesController_cancel","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveDecisionDto"}}}},"responses":{"200":{"description":"The cancelled leave.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND — the leave does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_NOT_PENDING — rejected or already cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Cancel a leave","tags":["Personal - Licencias"]}},"/v1/attendance/leaves/{id}/certificate":{"post":{"description":"PDF, PNG or JPEG up to 10 MB; replaces the previous one. Private storage.","operationId":"LeavesController_uploadCertificate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"201":{"description":"The leave with its certificate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_CERTIFICATE_INVALID — no file, empty, or not a PDF, PNG or JPEG.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND — the leave does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_LEAVE_NOT_PENDING — rejected or cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"413":{"description":"PAYLOAD_TOO_LARGE — the file is over 10 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"ATTENDANCE_LEAVE_STORAGE_NOT_CONFIGURED — certificate storage is not available.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Attach a certificate","tags":["Personal - Licencias"]},"get":{"description":"A signed URL valid 5 minutes. Medical certificates are health data: request it on click, never cache it. Every download is audited.","operationId":"LeavesController_certificate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The signed URL.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveCertificateDownloadDto"}}}},"404":{"description":"ATTENDANCE_LEAVE_NOT_FOUND or ATTENDANCE_LEAVE_CERTIFICATE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"ATTENDANCE_LEAVE_STORAGE_NOT_CONFIGURED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Download a certificate","tags":["Personal - Licencias"]}},"/v1/attendance/leave-balances/import/template":{"get":{"description":"Columns legajo, cuil, empleado (reference, ignored), tipo, año, días, nota; one prefilled row per active employee with tipo Vacaciones and the current year. Fill `días` (a row without days is skipped) and upload it to the import.","operationId":"LeaveBalancesController_importTemplate","parameters":[{"name":"format","required":false,"in":"query","schema":{"default":"xlsx","type":"string","enum":["xlsx","csv"]}}],"responses":{"200":{"description":"The template, as an attachment."}},"security":[{"apiKey":[]}],"summary":"Download the balances import template","tags":["Personal - Licencias"]}},"/v1/attendance/leave-balances/import":{"post":{"description":"An .xlsx or .csv (≤ 1 MB, ≤ 2,000 rows) with legajo and/or CUIL, tipo, año, días and nota. `dryRun` true (default) only validates and reports each row; false writes every valid row as an append-only balance adjustment (`source: import`) in one transaction and leaves the invalid ones out.","operationId":"LeaveBalancesController_import","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"dryRun":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"Report per row.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveImportResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_IMPORT_INVALID — no file, not xlsx/csv, unreadable, a missing column or too many rows (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"413":{"description":"The file is above 1 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Import initial vacation balances","tags":["Personal - Licencias"]}},"/v1/attendance/leave-balances":{"get":{"description":"Vacation balance of a period (calendar year) for the active employees: entitlement by seniority at December 31 (LCT art. 150, or art. 153 proportional), adjustments, approved and pending days. Computed on read, never stored.","operationId":"LeaveBalancesController_list","parameters":[{"name":"year","required":false,"in":"query","description":"Default: the current year (Buenos Aires).","schema":{"example":2026,"type":"number"}},{"name":"branch_id","required":false,"in":"query","schema":{"example":2,"type":"number"}},{"name":"employee_id","required":false,"in":"query","schema":{"example":12,"type":"number"}}],"responses":{"200":{"description":"Balances, by last name.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveBalanceListResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — `employee_id` of another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List vacation balances","tags":["Personal - Licencias"]}},"/v1/attendance/leave-balances/adjustments":{"get":{"description":"The append-only ledger of an employee's manual adjustments, newest first.","operationId":"LeaveBalancesController_adjustments","parameters":[{"name":"employee_id","required":true,"in":"query","schema":{"example":12,"type":"number"}},{"name":"year","required":false,"in":"query","description":"Default: every year.","schema":{"example":2026,"type":"number"}}],"responses":{"200":{"description":"Adjustments.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveAdjustmentListResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List balance adjustments","tags":["Personal - Licencias"]},"post":{"description":"Adds (positive) or takes (negative) days to an employee's period: the initial balance when the module starts, a carry-over, a correction. Never edited or deleted: a mistake is fixed with an opposite adjustment.","operationId":"LeaveBalancesController_addAdjustment","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLeaveAdjustmentDto"}}}},"responses":{"201":{"description":"The adjustment.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaveAdjustmentResponseDto"}}}},"400":{"description":"ATTENDANCE_LEAVE_ADJUSTMENT_INVALID — zero days or no reason.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Adjust a vacation balance","tags":["Personal - Licencias"]}},"/v1/attendance/payroll-concepts":{"get":{"description":"Every figure the monthly export can carry (worked hours, overtime at 50 % and 100 % to pay, night hours, absences, lateness, hour-bank credit and debit, and one per leave type), with the organization's payroll concept code, label and whether it is exported. Never saved = enabled without a code (the column is named by its label).","operationId":"AttendancePayrollConceptsController_list","parameters":[],"responses":{"200":{"description":"Concepts, in export order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollConceptListDto"}}}}},"security":[{"apiKey":[]}],"summary":"List payroll concepts","tags":["Personal - Asistencia"]},"put":{"description":"Changes the listed sources only: `conceptCode` (≤ 20 characters, null = none), `label` (≤ 80, null = the default) and `enabled`. Two enabled sources cannot share a code.","operationId":"AttendancePayrollConceptsController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePayrollConceptsDto"}}}},"responses":{"200":{"description":"Every concept after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollConceptListDto"}}}},"400":{"description":"ATTENDANCE_PAYROLL_CONCEPTS_INVALID — unknown source, bad code or label, or a repeated code (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update payroll concepts","tags":["Personal - Asistencia"]}},"/v1/attendance/payroll-export/preview":{"get":{"description":"The rows and columns the export of a period will have, and its warnings: month in progress, open / incomplete / flagged days, pending overtime and leaves, employees without CUIL or legajo. Warnings never block the export.","operationId":"AttendancePayrollExportController_preview","parameters":[{"name":"period","required":false,"in":"query","description":"YYYY-MM (Buenos Aires), required; not after the current month.","schema":{"example":"2026-10","type":"string"}},{"name":"site_id","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}}],"responses":{"200":{"description":"Preview of the period.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollPreviewDto"}}}},"400":{"description":"ATTENDANCE_INVALID_MONTH — `period` is missing, not YYYY-MM or after the current month.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — `site_id` is not a branch of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview the monthly payroll export","tags":["Personal - Asistencia"]}},"/v1/attendance/payroll-export":{"get":{"description":"XLSX: sheet \"Novedades\" (legajo, name, CUIL, site, then one column per enabled concept, headed by its code or label) and sheet \"Detalle\" (one row per employee and day). CSV (UTF-8 with BOM): the first sheet only. Each export is recorded in the history.","operationId":"AttendancePayrollExportController_export","parameters":[{"name":"period","required":false,"in":"query","description":"YYYY-MM (Buenos Aires), required; not after the current month.","schema":{"example":"2026-10","type":"string"}},{"name":"site_id","required":false,"in":"query","description":"Only employees of this site (branch).","schema":{"example":3,"type":"number"}},{"name":"format","required":false,"in":"query","schema":{"default":"xlsx","type":"string","enum":["xlsx","csv"]}}],"responses":{"200":{"description":"The file, as an attachment."},"400":{"description":"ATTENDANCE_INVALID_MONTH — `period` is missing, not YYYY-MM or after the current month.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_BRANCH_NOT_FOUND — `site_id` is not a branch of the organization.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}},"text/csv":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Export the monthly payroll figures","tags":["Personal - Asistencia"]}},"/v1/attendance/payroll-exports":{"get":{"description":"Newest first, at most 100.","operationId":"AttendancePayrollExportController_history","parameters":[{"name":"period","required":false,"in":"query","description":"Only exports of this period.","schema":{"example":"2026-10","type":"string"}}],"responses":{"200":{"description":"Exports.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayrollExportHistoryDto"}}}},"400":{"description":"ATTENDANCE_INVALID_MONTH — `period` is not YYYY-MM.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"History of payroll exports","tags":["Personal - Asistencia"]}},"/v1/attendance/work-days/recompute":{"post":{"description":"Queues a background job that recomputes the work days (with the current schedules, breaks and overtime policy), the absences and the overtime of a date range of at most 93 days. Poll the job until `done` or `failed`. One job per organization at a time.","operationId":"AttendanceRecomputeController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRecomputeDto"}}}},"responses":{"202":{"description":"The queued job.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecomputeJobDto"}}}},"400":{"description":"ATTENDANCE_RECOMPUTE_INVALID — bad dates, a range above 93 days or bad employee ids (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — an employee of another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"ATTENDANCE_RECOMPUTE_IN_PROGRESS — another recompute of the organization is queued or running.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"503":{"description":"ATTENDANCE_RECOMPUTE_UNAVAILABLE — the job could not be queued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Recompute work days","tags":["Personal - Asistencia"]}},"/v1/attendance/work-days/recompute/preview":{"get":{"description":"Dry run of `POST /attendance/work-days/recompute` with the same parameters: simulates the recompute (nothing is written) and counts the work days whose worked minutes, status or counted overtime would change, and the overtime decisions that are kept. Takes at most ~20 s; past that `complete` is false and the counts are a lower bound.","operationId":"AttendanceRecomputeController_preview","parameters":[{"name":"from","required":true,"in":"query","description":"First date (YYYY-MM-DD).","schema":{"example":"2026-09-01","type":"string"}},{"name":"to","required":false,"in":"query","description":"Last date (default today). Same limits as the recompute.","schema":{"example":"2026-10-02","type":"string"}},{"name":"employee_ids","required":false,"in":"query","description":"Only these employees, comma-separated (≤ 500). Default: same as the recompute.","schema":{"example":"12,15","type":"string"}}],"responses":{"200":{"description":"The counts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecomputePreviewDto"}}}},"400":{"description":"ATTENDANCE_RECOMPUTE_INVALID — same validation as the recompute (listed in `details`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — an employee of another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Preview a recompute","tags":["Personal - Asistencia"]}},"/v1/attendance/work-days/recompute/{id}":{"get":{"description":"Status and progress (employees processed / total).","operationId":"AttendanceRecomputeController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The job.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecomputeJobDto"}}}},"404":{"description":"ATTENDANCE_RECOMPUTE_JOB_NOT_FOUND — unknown job or another organization's.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Get a recompute job","tags":["Personal - Asistencia"]}},"/v1/attendance/remote-sites":{"get":{"description":"Places where employees with remote check-in in `geofence` mode are measured (\"Casa\", \"Cliente X\"). A place without `employeeId` applies to every employee of the organization. `employee_id` returns the places that apply to that employee (theirs and the organization-wide ones). Archived ones only with `include_archived=true`.","operationId":"AttendanceRemoteSitesController_list","parameters":[{"name":"employee_id","required":false,"in":"query","description":"Only the places that apply to this employee: theirs and the organization-wide ones.","schema":{"example":12,"type":"integer"}},{"name":"include_archived","required":false,"in":"query","description":"Also return archived places (default false).","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Places, by label.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoteSiteListResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — `employee_id` is not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"List remote check-in places","tags":["Personal - Asistencia"]},"post":{"description":"Remote check-in never rejects by distance: outside every place's radius the event is recorded with OUTSIDE_REMOTE_SITE.","operationId":"AttendanceRemoteSitesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRemoteSiteDto"}}}},"responses":{"201":{"description":"The new place.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoteSiteResponseDto"}}}},"400":{"description":"BAD_REQUEST — label empty or longer than 80, latitude outside −90..90, longitude outside −180..180, or radiusM outside 20..5000.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"EMPLOYEE_NOT_FOUND — `employeeId` is not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Create a remote check-in place","tags":["Personal - Asistencia"]}},"/v1/attendance/remote-sites/{id}":{"patch":{"description":"Fields left out keep their value; `employeeId: null` makes it organization-wide.","operationId":"AttendanceRemoteSitesController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRemoteSiteDto"}}}},"responses":{"200":{"description":"The place after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoteSiteResponseDto"}}}},"400":{"description":"BAD_REQUEST — label empty or longer than 80, latitude outside −90..90, longitude outside −180..180, or radiusM outside 20..5000.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"ATTENDANCE_REMOTE_SITE_NOT_FOUND — the place does not exist or belongs to another organization. EMPLOYEE_NOT_FOUND — `employeeId` is not an employee of the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Update a remote check-in place","tags":["Personal - Asistencia"]},"delete":{"description":"The place stops applying; past events keep it. Archiving twice is a no-op.","operationId":"AttendanceRemoteSitesController_archive","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":"The archived place.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoteSiteResponseDto"}}}},"404":{"description":"ATTENDANCE_REMOTE_SITE_NOT_FOUND — the place does not exist or belongs to another organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Archive a remote check-in place","tags":["Personal - Asistencia"]}},"/v1/attendance/roster-sync":{"post":{"description":"Send the FULL desired roster — every site (branch) and every employee that should be active — whenever it changes and once a day; Peakly reconciles. Idempotent: a second identical run reports everything `unchanged`. Sites and employees are matched by `externalId` (stored as `providerId`), else linked to an unlinked branch with the same name, or an unlinked employee with the same DNI (else the same email), else created. Conservative: names, documents, emails, branch addresses, coordinates and geo settings already in Peakly are never overwritten — differences come back in `drift`. Phone and hire date are only filled when empty. Employees get the branch of their only site (none or several → no branch). Linked active employees missing from the payload are deactivated today; inactive ones present are reactivated. Linked sites missing from the payload get app check-in turned off. New sites with coordinates get app check-in on (radius 150 m, out-of-radius observed). Items that cannot be applied come back in `skipped` with a reason; they never fail the batch. `dryRun: true` returns the same report and writes nothing. `inviteNewEmployees: true` emails an invitation to each employee created by the run, after it commits.","operationId":"AttendanceRosterSyncController_sync","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RosterSyncRequestDto"}}}},"responses":{"200":{"description":"What was (or, on a dry run, would be) created, linked, changed and skipped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RosterSyncResponseDto"}}}},"400":{"description":"ROSTER_SYNC_EMPTY_SNAPSHOT — `sites` or `employees` is empty; ROSTER_SYNC_DUPLICATE_EXTERNAL_ID — an `externalId` repeats within `sites` or `employees` (listed in `details`); ROSTER_SYNC_MASS_DEACTIVATION — the run would deactivate more than half of the linked active employees and more than 5 (resend with `allowMassDeactivation: true`); BAD_REQUEST — body shape (lengths, max 500 sites / 2000 employees, `source` format, `hireDate` YYYY-MM-DD).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"409":{"description":"A concurrent write outside the sync took a document number, email or branch name between planning and writing; nothing was applied — retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"security":[{"apiKey":[]}],"summary":"Sync the roster from an external system","tags":["Personal - Asistencia"]}}},"info":{"title":"Peakly API","description":"# Peakly API\n\nThe Peakly API provides programmatic access to invoicing, customers, products, and more.\n\n## Authentication\n\nAuthenticate using an API key in the `X-API-Key` header:\n```\nX-API-Key: pk_...\n```\n\nAPI keys are scoped to an organization — the organization context is resolved automatically from the key.\n\nCreate and manage API keys via the `/v1/api-keys` endpoints.","version":"1.0","contact":{}},"tags":[{"name":"Common - Categorías Fiscales","description":"Look up the AFIP tax category (condición frente al IVA) you assign to a customer or to your own organization — Responsable Inscripto, Monotributo, Consumidor Final, Exento, Exportación, etc. The list is filtered to the categories valid for your organization. Use the `/monotributo` and `/exportacion` flag endpoints to detect categories that change invoicing rules — Monotributo hides IVA discrimination, Exportación routes receipts through the WSFEX export flow."},{"name":"Common - Certificados","description":"Manage the AFIP certificates your organization needs so AFIP can authorize the receipts you issue. Standard flow: `POST /certificates` with a `name`, download the generated CSR via `GET /certificates/:id/csr`, upload it to AFIP to obtain a `.crt`, post that file back via `POST /certificates/:id/upload-crt`, then call `POST /certificates/:id/validate-connection` to confirm AFIP accepts it. Keep an eye on `GET /certificates/expiration-status` so you can renew before a certificate expires — once it does, new receipts will pile up in `PENDIENTE_AFIP` (created but unauthorized) until you have a valid certificate again."},{"name":"Common - Combos","description":"Look up shared option lists you need to fill dropdowns and pick valid values when creating other resources — receipt types, sale conditions, IVA aliquots, and similar enums. Fetch the items for a combo, show them to the user, and send the picked id when creating a receipt or customer. The IVA combo is auto-filtered to match your organization's tax regime, so you don't need to pre-filter it client-side."},{"name":"Common - Contingencia CAEA","description":"Opt in to ARCA's CAEA contingency so receipts keep being issued when WSFE (online CAE) is down, instead of piling up in `PENDIENTE_AFIP`. Off by default: every organization authorizes online. `PUT /afip/caea-contingency` with `{ \"enabled\": true }` turns it on — Peakly then requests a CAEA every fortnight and informs ARCA of what it issued under it (or that nothing was issued). `GET /afip/caea-contingency` shows the CAEA in force, the next one and any rendición still pending. Needs a domestic electronic (WS) receipt book."},{"name":"Common - Cotizaciones","description":"Get the exchange rate to use when invoicing in a foreign currency. Pass the source and target currency ids (and optionally a date) and use the rate the API returns. The response is `null` when no rate is available for that day — fall back to a manual rate in your UI when that happens."},{"name":"Common - Exportaciones","description":"Download files the API generated for you asynchronously (CSV/Excel exports, large report renderings). Pass the `key` you received from the export endpoint to get back a signed URL valid for one hour — fetch the file from that URL within the hour. You can only download files that belong to your own organization."},{"name":"Common - Importaciones","description":"Bulk-import customers, products, and other resources from Excel/CSV files. Create a file import to upload a file and kick off a background job, then poll the import to track progress and download the result file (success rows + error rows) once it finishes. Imports go through the same validation as the standard create endpoints, so successful rows are equivalent to creating each resource by hand."},{"name":"Common - Localidades","description":"Look up Argentine provinces/regions and selected international destinations to fill the location field on customers, branches, and receipts. By default you get Argentine locations; pass `onlyExport=true` when issuing export invoices. The default location returned by `GET /locations/default` is the right pre-selection for new customer/branch forms."},{"name":"Common - Monedas","description":"Look up the currencies available for invoicing and reporting. Use `GET /currencies/favorites` to get the short list shown in dropdowns and `GET /currencies/default` to get the right pre-selection for new receipts (typically ARS)."},{"name":"Common - Padrón","description":"Look up an Argentine taxpayer by CUIT/CUIL to pre-fill customer details (fiscal name, tax category, address). You do **not** need to decide whether a receipt must be a Factura de Crédito Electrónica (FCE): send the kind of receipt you want (`factura`, `nota_credito`, `nota_debito`) and Peakly works the rest out on confirm, from the customer's padrón entry and the receipt total — FCE is a legal obligation that follows the amount and the taxpayer, not something you choose. `GET /taxpayer-registries/:taxId/fce-receiver?total=…` is available if you want to show it in your UI beforehand, but it is informational."},{"name":"Common - Sucursales","description":"Manage the physical branches/stores that issue receipts. Create one per location you operate from, then reference its id when creating receipts or assigning point-of-sale numbers. Branch names must be unique within the organization. Deleting a branch removes it from your active list while keeping past receipts linked to it."},{"name":"Ventas - Clientes","description":"Manage your customer master data — fiscal name, tax id, tax category, billing address, contact details. Customers are referenced by id from sales receipts; create or update one before issuing a receipt to a new buyer. The CSV export streams cursor-based, so you can pull the full customer book in a single request."},{"name":"Ventas - Cobranzas"},{"name":"Ventas - Comprobantes","description":"Issue and manage sales receipts — facturas A/B/C/E, notas de crédito, notas de débito, recibos, FCE/MiPyME. Standard flow: create the receipt as a draft, add line details and observations, then call `POST :id/confirm` to assign the next sequential number from the receipt book and trigger AFIP authorization. Drafts can be edited or deleted freely; once confirmed, the only way to reverse a receipt is by issuing a credit note. Bulk endpoints (email, void) run as background jobs you poll for progress. Getting receipts out as a file — CSV or a zip of PDFs — lives under **Ventas - Comprobantes - Exports**."},{"name":"Ventas - Comprobantes - Exports","description":"Get receipts out of the system as a file. `GET /export` streams a CSV of whatever your filters match; call `GET /export/columns` first if you want to choose which columns it carries, or pass a `preset`. Large result sets and high-volume organizations switch automatically to an async export — the same call answers `202` with a job to poll instead of streaming, so handle both. `POST /bulk-pdf` queues a zip of invoice PDFs for a list of receipts and always returns a job. Poll any of these jobs with `GET /bulk-actions/:jobId/status`."},{"name":"Ventas - Grupos Económicos"},{"name":"Ventas - Listas de Precios"},{"name":"Ventas - Remitos"},{"name":"Ventas - Reportes","description":"Pull the sales reports you need to close the month and feed downstream tools — Libro IVA Ventas, sales by product, sales by customer, outstanding receivables, IIBB by jurisdiction, dashboard KPIs, revenue trends with MoM/YoY, and the IVA Digital Ventas fixed-width exports. Most reports have both a JSON endpoint (in-app views) and a CSV export endpoint (for accountants)."},{"name":"Ventas - Suscripciones"},{"name":"Ventas - Talonarios","description":"Manage the receipt books (talonarios / puntos de venta) you issue receipts from. Each book is tied to a branch, a letter (A/B/C), and a point-of-sale number; sequential numbering is tracked per book. Use `POST /receipt-books/import-from-arca` to pull your registered points of sale directly from AFIP instead of entering them by hand."},{"name":"Stock - Categorías","description":"Group products under categories so they can be filtered in lists, reports, and the product picker. Categories are scoped to your organization."},{"name":"Stock - Depósitos"},{"name":"Stock - Movimientos","description":"Add manual stock adjustments and review the movement history for a product. Sales receipts and purchase receipts emit stock movements automatically; manual adjustments cover physical counts, breakage, and corrections. The history endpoint returns every movement for the product (manual + automatic) so current stock can be reconciled against its source events."},{"name":"Stock - Productos","description":"Manage your product catalog — sku, name, default price, IVA aliquot, category, stock-tracking flags. Products are referenced by id from sales-receipt detail lines and from stock movements. The search endpoint blends favorites, recently-used products, and fuzzy matching so the autocomplete in your UI returns relevant results fast."},{"name":"Stock - Sincronización"},{"name":"Compras - Categorías","description":"Group purchase receipts under categories (rubros) so they can be filtered in purchase reports and feed accounting. Categories are scoped to your organization. Deletes are soft, so historical receipts keep their category context."},{"name":"Compras - Comprobantes","description":"Record the supplier invoices (facturas, notas de crédito, recibos) you receive. Capture the supplier id, document type and number, line details, and totals; the API computes IVA and net amounts. The unpaid-by-supplier endpoint returns balances per supplier so you can build payment orders."},{"name":"Compras - Imputaciones"},{"name":"Compras - Órdenes de Pago"},{"name":"Compras - Otros Egresos"},{"name":"Compras - Proveedores","description":"Manage your supplier master data — fiscal name, CUIT, tax category, payment terms. Suppliers are referenced by id from purchase receipts and payment orders. Deletes are soft, so historical receipts keep their supplier context."},{"name":"Compras - Reportes"},{"name":"Accounting - Asientos","description":"Manage manual journal entries and read computed financial views over the journal — Profit & Loss for a date range and Balance Sheet at a point in time. Most journal entries are created automatically by the sales, purchase, and finance modules; this endpoint covers the manual adjustments your accountant posts at month-end."},{"name":"Accounting - Bloqueos","description":"Lock past accounting periods so journal entries with dates inside the lock window can't be created or modified. Use locks to freeze the books after a period close — adjustments must then be posted in a later period."},{"name":"Accounting - Costo de mercaderías vendidas"},{"name":"Accounting - Ejercicios","description":"Manage fiscal years (ejercicios contables). Create one per fiscal period with start/end dates, then call `POST :id/close` once the period is done so reports stop including in-progress entries and locks can be enforced over closed periods."},{"name":"Accounting - Plan de Cuentas","description":"Manage the chart of accounts (plan de cuentas) — the tree of accounts every journal entry posts against. Set the code, name, type (asset/liability/equity/income/expense), and parent account; entries automatically aggregate up the tree in reports."},{"name":"Accounting - Reportes","description":"Pull the formal accounting reports your accountant signs off on — Libro Mayor (general ledger with running balances), Libro Diario (chronological journal), and Balance de Sumas y Saldos (trial balance). Each report has both a JSON endpoint for in-app views and a CSV export endpoint."},{"name":"Finanzas - Bancos","description":"Manage the list of banks your organization operates with. Bank entries are referenced by id from bank accounts, third-party checks, and own checks."},{"name":"Finanzas - Cajas","description":"Manage cash registers (cajas) — physical or virtual cash drawers that hold money. Cash registers are referenced by id from fund movements; the histories endpoint returns the running balance and movement audit trail per register."},{"name":"Finanzas - Chequeras","description":"Manage your own checkbooks. Each checkbook tracks the issuing bank, account, and number range; own checks issued from the book draw down its sequential numbers."},{"name":"Finanzas - Cheques","description":"Manage third-party checks you receive from customers. Track the bank, number, due date, and current state (en cartera, depositado, endosado, rechazado, etc.). Checks are referenced from sales-receipt payment methods, deposits, and endorsements."},{"name":"Finanzas - Cheques Propios","description":"Manage your own checks issued to suppliers. Each check is drawn from a checkbook (which tracks sequential numbering) and references the receiving party."},{"name":"Finanzas - Cuentas Bancarias","description":"Manage the bank accounts your organization operates. Each account is tied to a bank and a currency; deposits, transfers, and bank movements reference the account by id. The histories endpoint returns the per-account movement log with running balance."},{"name":"Finanzas - Depósitos","description":"Manage check deposits to a bank account. A deposit groups one or more third-party checks (en cartera) and produces a fund movement on the destination account so balances stay in sync."},{"name":"Finanzas - Medios de Pago","description":"Manage the payment methods (cash, card, transfer, check, MP, etc.) your organization accepts and the per-method entries that capture provider-specific configuration (acquirer fees, settlement days, etc.). Payment methods are referenced from receipts when recording how a sale was collected."},{"name":"Finanzas - Movimientos de Fondos","description":"Manage fund movements — the generic ledger of money moving in and out of cash registers and bank accounts. Most movements are created automatically by other modules (receipts, deposits, transfers); this endpoint covers direct adjustments and the read view of the movement log."},{"name":"Finanzas - Pagos con Tarjeta","description":"Manage card payments (cobros con tarjeta) — captured at sale time, settled by the acquirer days later. The cancellations endpoint returns voided card payments so reports can net them out."},{"name":"Finanzas - Reportes"},{"name":"Finanzas - Retenciones","description":"Manage tax retentions (IVA, ganancias, IIBB, SUSS) you apply to supplier payments and the retention receipts (constancias de retención) you issue. Retention receipts are linked to the underlying purchase payment so reports can roll them up by period."},{"name":"Finanzas - Tarjetas de Crédito","description":"Manage the credit-card master data (issuer, brand, BIN, settlement plan) used by card-payment entries. The catalog drives dropdowns when recording a sale paid by card."},{"name":"Finanzas - Transferencias","description":"Manage bank transfers — money moving between two of your own accounts/registers. A transfer produces two fund movements (one debit, one credit) so balances stay in sync."},{"name":"Personal - Asistencia"},{"name":"Personal - Campos del legajo"},{"name":"Personal - Empleados"},{"name":"Personal - Intranet"},{"name":"Personal - Licencias"},{"name":"Procesos"},{"name":"Reportes - Grupos"},{"name":"Reportes - Personalizados"},{"name":"Sistema - Soporte"},{"name":"Integraciones - AFIP Comprobantes"},{"name":"Integraciones - Configuración"},{"name":"Integraciones - Mercado Pago","description":"Manage Mercado Pago integrations — the OAuth tokens, refresh tokens, and account ids your organization uses to charge customers via MP. Use the expiring-soon endpoint to surface configs that need re-auth before tokens lapse, and `POST :id/reset-auth` to clear a refresh token after a revocation."},{"name":"Integraciones - Uso de la API"}],"servers":[],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"ApiUsageAccessResponseDto":{"type":"object","properties":{"enabled":{"type":"boolean","example":true,"description":"Whether the organization has API usage monitoring."},"maxRangeDays":{"type":"number","example":31,"description":"Longest range, in days, of the request list."},"metricsMaxRangeDays":{"type":"number","example":31,"description":"Longest range, in days, of the metrics for this caller: 31, or 7 when scoped to an API key."},"hotWindowDays":{"type":"number","example":60,"description":"Days of requests that can be listed and opened."},"scope":{"type":"string","enum":["organization","api_key"],"example":"api_key","description":"`api_key`: only the requests made with the calling API key are visible."}},"required":["enabled","maxRangeDays","metricsMaxRangeDays","hotWindowDays","scope"]},"ErrorResponseDto":{"type":"object","properties":{"statusCode":{"type":"number","example":404,"description":"HTTP status code."},"error":{"type":"string","example":"AFIP_PERSONA_NOT_FOUND","description":"SCREAMING_SNAKE_CASE enum-style error code. Always machine-mappable. Examples: AFIP_PERSONA_NOT_FOUND, AFIP_WSCI_ERROR, INVALID_CUIT, DB_UNIQUE_VIOLATION, NOT_FOUND, BAD_REQUEST, UNAUTHORIZED."},"message":{"type":"string","example":"No AFIP taxpayer found for CUIT 20999999999.","description":"Developer-friendly English description of the error. Always present."},"providerMessage":{"type":"string","example":"No existe persona con ese Id","description":"Raw message from the upstream provider (AFIP, etc.) with envelope noise stripped. Present on errors that wrap a third-party failure; kept in the provider's original language."},"code":{"type":"number","example":10016,"description":"Numeric AFIP error code (e.g. 10016 for already-authorized). Only present on AFIP errors that carry a numeric code."},"details":{"example":["CUIT must contain 11 digits (received 9)."],"description":"Field-level validation reasons. Populated for validation errors and structured business errors.","type":"array","items":{"type":"string"}},"timestamp":{"type":"string","example":"2026-04-23T14:30:00.000Z","description":"ISO-8601 timestamp of when the error occurred."},"path":{"type":"string","example":"/v1/customers/lookup-cuit?cuit=20-99999999-9","description":"Request path that triggered the error."},"requestId":{"type":"string","example":"req-abc-123","description":"pino-http request ID for log correlation."}},"required":["statusCode","error","message","timestamp","path"]},"ApiUsageRangeDto":{"type":"object","properties":{"from":{"type":"string","example":"2026-09-01T00:00:00.000Z"},"to":{"type":"string","example":"2026-09-26T00:00:00.000Z"},"granularity":{"type":"string","enum":["hour","day"]},"timezone":{"type":"string","example":"America/Argentina/Buenos_Aires"}},"required":["from","to","granularity","timezone"]},"ApiUsageStatsDto":{"type":"object","properties":{"requests":{"type":"number","example":1200},"success2xx":{"type":"number","example":1150},"clientErrors4xx":{"type":"number","example":40,"description":"Status 400–498."},"serverErrors5xx":{"type":"number","example":2,"description":"Status ≥ 500."},"clientAborted499":{"type":"number","example":8,"description":"The client closed the connection before the answer (499)."},"aborted499CompletedOk":{"type":"number","example":7,"description":"Aborted, but the request was then completed with a 2xx."},"aborted499CompletedError":{"type":"number","example":1},"errorRate":{"type":"number","nullable":true,"example":0.035,"description":"(4xx + 5xx) / requests."},"serverErrorRate":{"type":"number","nullable":true,"example":0.0017},"abortRate":{"type":"number","nullable":true,"example":0.0067},"avgMs":{"type":"number","nullable":true,"example":310,"description":"Exact average (ms)."},"p50Ms":{"type":"number","nullable":true,"example":240},"p95Ms":{"type":"number","nullable":true,"example":820},"p99Ms":{"type":"number","nullable":true,"example":1900},"maxMs":{"type":"number","nullable":true,"example":5000,"description":"Exact maximum (ms)."},"percentilesApproximate":{"type":"boolean","example":true,"description":"True when the percentiles merge more than one hour (count-weighted mean of hourly percentiles)."}},"required":["requests","success2xx","clientErrors4xx","serverErrors5xx","clientAborted499","aborted499CompletedOk","aborted499CompletedError","errorRate","serverErrorRate","abortRate","avgMs","p50Ms","p95Ms","p99Ms","maxMs","percentilesApproximate"]},"ApiUsageTimeseriesPointDto":{"type":"object","properties":{"requests":{"type":"number","example":1200},"success2xx":{"type":"number","example":1150},"clientErrors4xx":{"type":"number","example":40,"description":"Status 400–498."},"serverErrors5xx":{"type":"number","example":2,"description":"Status ≥ 500."},"clientAborted499":{"type":"number","example":8,"description":"The client closed the connection before the answer (499)."},"aborted499CompletedOk":{"type":"number","example":7,"description":"Aborted, but the request was then completed with a 2xx."},"aborted499CompletedError":{"type":"number","example":1},"errorRate":{"type":"number","nullable":true,"example":0.035,"description":"(4xx + 5xx) / requests."},"serverErrorRate":{"type":"number","nullable":true,"example":0.0017},"abortRate":{"type":"number","nullable":true,"example":0.0067},"avgMs":{"type":"number","nullable":true,"example":310,"description":"Exact average (ms)."},"p50Ms":{"type":"number","nullable":true,"example":240},"p95Ms":{"type":"number","nullable":true,"example":820},"p99Ms":{"type":"number","nullable":true,"example":1900},"maxMs":{"type":"number","nullable":true,"example":5000,"description":"Exact maximum (ms)."},"percentilesApproximate":{"type":"boolean","example":true,"description":"True when the percentiles merge more than one hour (count-weighted mean of hourly percentiles)."},"bucketStart":{"type":"string","example":"2026-09-25T03:00:00.000Z"}},"required":["requests","success2xx","clientErrors4xx","serverErrors5xx","clientAborted499","aborted499CompletedOk","aborted499CompletedError","errorRate","serverErrorRate","abortRate","avgMs","p50Ms","p95Ms","p99Ms","maxMs","percentilesApproximate","bucketStart"]},"ApiUsageRouteStatsDto":{"type":"object","properties":{"requests":{"type":"number","example":1200},"success2xx":{"type":"number","example":1150},"clientErrors4xx":{"type":"number","example":40,"description":"Status 400–498."},"serverErrors5xx":{"type":"number","example":2,"description":"Status ≥ 500."},"clientAborted499":{"type":"number","example":8,"description":"The client closed the connection before the answer (499)."},"aborted499CompletedOk":{"type":"number","example":7,"description":"Aborted, but the request was then completed with a 2xx."},"aborted499CompletedError":{"type":"number","example":1},"errorRate":{"type":"number","nullable":true,"example":0.035,"description":"(4xx + 5xx) / requests."},"serverErrorRate":{"type":"number","nullable":true,"example":0.0017},"abortRate":{"type":"number","nullable":true,"example":0.0067},"avgMs":{"type":"number","nullable":true,"example":310,"description":"Exact average (ms)."},"p50Ms":{"type":"number","nullable":true,"example":240},"p95Ms":{"type":"number","nullable":true,"example":820},"p99Ms":{"type":"number","nullable":true,"example":1900},"maxMs":{"type":"number","nullable":true,"example":5000,"description":"Exact maximum (ms)."},"percentilesApproximate":{"type":"boolean","example":true,"description":"True when the percentiles merge more than one hour (count-weighted mean of hourly percentiles)."},"method":{"type":"string","example":"POST"},"route":{"type":"string","example":"/v1/sales/sales-receipts"}},"required":["requests","success2xx","clientErrors4xx","serverErrors5xx","clientAborted499","aborted499CompletedOk","aborted499CompletedError","errorRate","serverErrorRate","abortRate","avgMs","p50Ms","p95Ms","p99Ms","maxMs","percentilesApproximate","method","route"]},"ApiUsageMetricsResponseDto":{"type":"object","properties":{"range":{"$ref":"#/components/schemas/ApiUsageRangeDto"},"dataUpdatedAt":{"type":"string","nullable":true,"example":"2026-09-26T12:05:00.000Z","description":"When the data read was last refreshed (≤ 5 min behind); null without data."},"totals":{"$ref":"#/components/schemas/ApiUsageStatsDto"},"timeseries":{"description":"Every bucket of the range, empty ones included.","type":"array","items":{"$ref":"#/components/schemas/ApiUsageTimeseriesPointDto"}},"topRoutesByVolume":{"description":"Top 10 routes by request count.","type":"array","items":{"$ref":"#/components/schemas/ApiUsageRouteStatsDto"}},"slowestRoutes":{"description":"Top 10 routes by p95, among routes with ≥ 20 requests.","type":"array","items":{"$ref":"#/components/schemas/ApiUsageRouteStatsDto"}}},"required":["range","dataUpdatedAt","totals","timeseries","topRoutesByVolume","slowestRoutes"]},"ApiUsageRequestListItemDto":{"type":"object","properties":{"id":{"type":"number","example":912345},"createdAt":{"type":"string","example":"2026-09-25T14:03:11.482Z"},"method":{"type":"string","example":"POST"},"path":{"type":"string","example":"/v1/sales/sales-receipts","description":"As received, without query string."},"route":{"type":"string","example":"/v1/sales/sales-receipts","description":"Route template."},"statusCode":{"type":"number","nullable":true,"example":201},"durationMs":{"type":"number","nullable":true,"example":812},"requestId":{"type":"string","nullable":true,"description":"Our request id, for support."},"idempotencyKey":{"type":"string","nullable":true},"apiKeyId":{"type":"number","nullable":true,"description":"API key that made the request."},"providerId":{"type":"string","nullable":true,"example":"PY-1234567","description":"`providerId` of the request body."},"clientAbortedAt":{"type":"string","nullable":true,"description":"Set when the client closed the connection (499)."},"completedStatusCode":{"type":"number","nullable":true,"description":"What the request ended up answering after a 499."},"completedAt":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true,"description":"Truncated to 300 characters; full text in the detail."}},"required":["id","createdAt","method","path","route","statusCode","durationMs","requestId","idempotencyKey","apiKeyId","providerId","clientAbortedAt","completedStatusCode","completedAt","errorMessage"]},"ApiUsageRequestListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiUsageRequestListItemDto"}},"nextCursor":{"type":"string","nullable":true,"description":"Pass as `cursor` for the next page."},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"ApiUsageRequestDetailDto":{"type":"object","properties":{"id":{"type":"number","example":912345},"createdAt":{"type":"string","example":"2026-09-25T14:03:11.482Z"},"method":{"type":"string","example":"POST"},"path":{"type":"string","example":"/v1/sales/sales-receipts","description":"As received, without query string."},"route":{"type":"string","example":"/v1/sales/sales-receipts","description":"Route template."},"statusCode":{"type":"number","nullable":true,"example":201},"durationMs":{"type":"number","nullable":true,"example":812},"requestId":{"type":"string","nullable":true,"description":"Our request id, for support."},"idempotencyKey":{"type":"string","nullable":true},"apiKeyId":{"type":"number","nullable":true,"description":"API key that made the request."},"providerId":{"type":"string","nullable":true,"example":"PY-1234567","description":"`providerId` of the request body."},"clientAbortedAt":{"type":"string","nullable":true,"description":"Set when the client closed the connection (499)."},"completedStatusCode":{"type":"number","nullable":true,"description":"What the request ended up answering after a 499."},"completedAt":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true,"description":"Truncated to 300 characters; full text in the detail."},"ip":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"requestBody":{"type":"object","additionalProperties":true,"nullable":true,"description":"The JSON body as received, credentials redacted; `{ _omitted, _bytes }` when it exceeded the stored size."},"responseBody":{"type":"object","additionalProperties":true,"nullable":true,"description":"The JSON body we answered."},"storage":{"type":"string","enum":["hot","archive"],"example":"hot"}},"required":["id","createdAt","method","path","route","statusCode","durationMs","requestId","idempotencyKey","apiKeyId","providerId","clientAbortedAt","completedStatusCode","completedAt","errorMessage","ip","userAgent","requestBody","responseBody","storage"]},"CreateRangeExportDto":{"type":"object","properties":{"dateFrom":{"type":"string","example":"2026-06-01","description":"Inclusive start date (YYYY-MM-DD)."},"dateTo":{"type":"string","example":"2026-06-08","description":"Inclusive end date (YYYY-MM-DD). Must be >= dateFrom."}},"required":["dateFrom","dateTo"]},"TaxCategoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"abbreviation":{"type":"string","example":"RI"},"name":{"type":"string","example":"Responsable Inscripto"},"discriminates":{"type":"boolean","example":true},"liquidatesInternals":{"type":"boolean","example":false},"exemptVat":{"type":"boolean","example":false},"afipResponsibility":{"type":"string","example":"RI"},"isActive":{"type":"boolean","example":true},"isDefault":{"type":"boolean","example":false},"salesLetterId":{"type":"number","example":1},"purchaseLetterId":{"type":"number","example":1},"organizationCategoryId":{"type":"integer","nullable":true,"example":1}},"required":["id","abbreviation","name","discriminates","liquidatesInternals","exemptVat","afipResponsibility","isActive","isDefault","salesLetterId","purchaseLetterId","organizationCategoryId"]},"TaxCategoryExportacionResponseDto":{"type":"object","properties":{"exportacion":{"type":"boolean","example":false}},"required":["exportacion"]},"TaxCategoryMonotributoResponseDto":{"type":"object","properties":{"monotributo":{"type":"boolean","example":false}},"required":["monotributo"]},"CurrencyResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Peso Argentino"},"abbreviation":{"type":"string","example":"ARS"},"afipCode":{"type":"string","example":"PES"},"symbol":{"type":"string","example":"$"},"isDefault":{"type":"boolean","example":true},"isActive":{"type":"boolean","example":true},"receiptLetters":{"type":"string","nullable":true,"example":"A,B,C"}},"required":["id","name","abbreviation","afipCode","symbol","isDefault","isActive","receiptLetters"]},"DefaultCurrencyIdResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1}},"required":["id"]},"FavoriteCurrencyIdsResponseDto":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"number"},"example":[1,2]}},"required":["ids"]},"CertificateResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"internalKey":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"name":{"type":"string","example":"Certificado 2026"},"requestDate":{"type":"string","example":"2026-01-01T12:00:00.000Z"},"renewalDate":{"type":"string","nullable":true,"example":"2027-01-01T12:00:00.000Z"},"disabledDate":{"type":"string","nullable":true,"example":null},"isActive":{"type":"boolean","example":true},"userId":{"type":"number","example":1},"hasCsr":{"type":"boolean","example":true,"description":"True when a CSR has been generated. Download via `GET /certificates/:id/csr`."},"hasCrt":{"type":"boolean","example":true,"description":"True when AFIP's signed CRT has been uploaded. Download via `GET /certificates/:id/crt`."},"hasP12":{"type":"boolean","example":true,"description":"True when the P12 has been assembled — the certificate is ready to authorize receipts."}},"required":["id","internalKey","name","requestDate","renewalDate","disabledDate","isActive","userId","hasCsr","hasCrt","hasP12"]},"CertificateExpirationStatusDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Certificado 2026"},"renewalDate":{"type":"string","nullable":true,"example":"2027-01-01T12:00:00.000Z"},"daysUntilExpiry":{"type":"integer","nullable":true,"example":240},"isExpired":{"type":"boolean","nullable":true,"example":false},"hasP12":{"type":"boolean","example":true}},"required":["id","name","renewalDate","daysUntilExpiry","isExpired","hasP12"]},"CertificateServiceCheckDto":{"type":"object","properties":{"success":{"type":"boolean","example":true,"description":"Whether the certificate authenticated against this AFIP service."},"required":{"type":"boolean","example":true,"description":"Whether the organization needs this service, so a failure makes the overall `success` false. WSFE is always required; WSFEX only when the organization has an active export receipt book."},"error":{"type":"string","example":"AFIP rejected the certificate"}},"required":["success","required"]},"CertificateValidateConnectionServicesDto":{"type":"object","properties":{"wsfe":{"$ref":"#/components/schemas/CertificateServiceCheckDto"},"wsfex":{"$ref":"#/components/schemas/CertificateServiceCheckDto"}},"required":["wsfe","wsfex"]},"CertificateValidateConnectionResponseDto":{"type":"object","properties":{"success":{"type":"boolean","example":true,"description":"`true` when every required service authenticated."},"environment":{"type":"string","example":"production"},"services":{"$ref":"#/components/schemas/CertificateValidateConnectionServicesDto"}},"required":["success","environment","services"]},"CreateCertificateDto":{"type":"object","properties":{"name":{"type":"string","example":"Certificado 2026","description":"Display name for the certificate. Defaults to `Certificado {currentYear}` when blank."}}},"UpdateCertificateDto":{"type":"object","properties":{"name":{"type":"string","example":"Certificado 2026"},"isActive":{"type":"boolean","example":true,"description":"Toggle which certificate is used for invoicing. Only one should be active at a time."}}},"LocationResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Buenos Aires"},"province":{"type":"string","example":"Buenos Aires"},"isActive":{"type":"boolean","example":true},"isDefault":{"type":"boolean","example":false},"countryId":{"type":"number","example":1},"afipData":{"type":"string","nullable":true,"example":"1"},"grossIncomeCode":{"type":"string","nullable":true,"example":"901"}},"required":["id","name","province","isActive","isDefault","countryId","afipData","grossIncomeCode"]},"ComboItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"data":{"type":"string","example":"Factura A"},"additionalData":{"type":"string","nullable":true,"example":"FA"},"afipData":{"type":"string","nullable":true,"example":"1"},"isActive":{"type":"boolean","example":true},"comboId":{"type":"number","example":5}},"required":["id","data","additionalData","afipData","isActive","comboId"]},"ComboResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"name":{"type":"string","example":"Tipo de Comprobante de Venta"},"isActive":{"type":"boolean","example":true},"comboItems":{"type":"array","items":{"$ref":"#/components/schemas/ComboItemResponseDto"}}},"required":["id","name","isActive"]},"ExchangeRateResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"rate":{"type":"number","example":1050.5},"date":{"type":"string","example":"2026-05-03T00:00:00.000Z"},"fromCurrencyId":{"type":"number","example":1},"toCurrencyId":{"type":"number","example":2}},"required":["id","rate","date","fromCurrencyId","toCurrencyId"]},"FceReceiverResponseDto":{"type":"object","properties":{"taxId":{"type":"string","example":"20123456789"},"total":{"type":"number","example":1000000},"isFceReceiver":{"type":"boolean","example":true}},"required":["taxId","total","isFceReceiver"]},"TaxpayerRegistryResponseDto":{"type":"object","properties":{"taxId":{"type":"string","example":"20123456789"},"validFrom":{"type":"string","example":"2024-01-01T00:00:00.000Z"},"validTo":{"type":"string","example":"2099-12-31T00:00:00.000Z"},"multilateralAgreement":{"type":"boolean","example":false},"updatedAt":{"type":"string","example":"2026-05-03T00:00:00.000Z"},"perceptionRateBsas":{"type":"number","example":3.5},"perceptionRateCaba":{"type":"number","example":2},"retentionRateBsas":{"type":"number","example":1.5},"retentionRateCaba":{"type":"number","example":1.5},"isActive":{"type":"boolean","example":true},"isFceReceiver":{"type":"boolean","nullable":true,"example":true},"fceAmountFrom":{"type":"number","nullable":true,"example":546737}},"required":["taxId","validFrom","validTo","multilateralAgreement","updatedAt","perceptionRateBsas","perceptionRateCaba","retentionRateBsas","retentionRateCaba","isActive","isFceReceiver","fceAmountFrom"]},"ProductCategoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Bebidas"},"isActive":{"type":"boolean","example":true}},"required":["id","description","isActive"]},"CreateProductCategoryDto":{"type":"object","properties":{"description":{"type":"string"},"isActive":{"type":"boolean"}},"required":["description","isActive"]},"UpdateProductCategoryDto":{"type":"object","properties":{"description":{"type":"string"},"isActive":{"type":"boolean"}}},"ProductBulkDraftRowDto":{"type":"object","properties":{"key":{"type":"string","example":"7790001000012","description":"Value matched against the product: its barcode, its description or its numeric id (per matchBy)"},"description":{"type":"string","example":"Lavandina 1L","description":"New description (update) or description of the product to create"},"barcode":{"type":"string","example":"7790001000012","description":"Barcode to set (update) or of the product to create"},"costPrice":{"type":"number","nullable":true,"example":820.25,"description":"Cost price (>= 0). null clears it; omitted keeps the current value. A non-numeric or negative value makes the row an error instead of failing the request."},"unitPrice":{"type":"number","nullable":true,"example":1500.5,"description":"Sale price / unit price (>= 0). null clears it; omitted keeps the current value. A non-numeric or negative value makes the row an error."},"unitOfMeasureId":{"type":"integer","example":1,"description":"Unit of measure (combo item id). Created products without one get the organization's default unit."},"vatRateId":{"type":"integer","nullable":true,"example":5,"description":"VAT rate (combo item id); null clears it"},"categoryId":{"type":"integer","nullable":true,"example":3,"description":"Product category id; null/0 = no category"},"costCurrency":{"type":"string","example":"USD","description":"Currency of costPrice (ISO or AFIP code; ARS = the organization's currency). Omitted = the product's current cost currency. A foreign currency stores the cost in it and converts costPrice with the official AFIP rate."},"priceLists":{"type":"object","additionalProperties":{"type":"number"},"example":{"12":1800},"description":"Net manual price per named price list id (overrides the list rule for that product). Omitted lists stay as they are."}},"required":["key"]},"CreateProductBulkDraftDto":{"type":"object","properties":{"source":{"type":"string","example":"Lista de costos octubre.xlsx / Hoja1","description":"Where the rows come from","maxLength":200},"matchBy":{"type":"string","enum":["barcode","description","id","code"],"description":"Product field the row key is matched against: barcode (exact), description (case-, accent- and whitespace-insensitive, exact), id, or code (providerId first, then barcode)."},"createMissing":{"type":"boolean","default":false,"description":"Create a product for rows that match none (needs a description; with matchBy=description the key is used)."},"rows":{"minItems":1,"maxItems":2000,"type":"array","items":{"$ref":"#/components/schemas/ProductBulkDraftRowDto"}}},"required":["matchBy","rows"]},"ProductBulkSummaryDto":{"type":"object","properties":{"toUpdate":{"type":"number","example":40},"toCreate":{"type":"number","example":3},"unchanged":{"type":"number","example":70},"errors":{"type":"number","example":2}},"required":["toUpdate","toCreate","unchanged","errors"]},"ProductBulkSnapshotDto":{"type":"object","properties":{"description":{"type":"string","nullable":true,"example":"Lavandina 1L"},"costPrice":{"type":"number","nullable":true,"example":820.25},"unitPrice":{"type":"number","nullable":true,"example":1500.5},"costCurrency":{"type":"string","nullable":true,"example":null,"description":"Currency of costPrice (ISO code); null = the organization's currency."},"priceLists":{"type":"object","additionalProperties":{"type":"number","nullable":true},"example":{"12":1800},"description":"Net price per named price list id — only the lists the row names."}},"required":["description","costPrice","unitPrice"]},"ProductBulkDraftRowResponseDto":{"type":"object","properties":{"rowIndex":{"type":"number","example":0,"description":"0-based position of the row in the request"},"key":{"type":"string","example":"7790001000012"},"action":{"type":"string","enum":["update","create","unchanged","error"]},"productId":{"type":"integer","nullable":true,"example":15,"description":"Matched product (or the created one, after confirm)"},"before":{"nullable":true,"description":"Current values; null for created rows","allOf":[{"$ref":"#/components/schemas/ProductBulkSnapshotDto"}]},"after":{"description":"Values after confirming","allOf":[{"$ref":"#/components/schemas/ProductBulkSnapshotDto"}]},"error":{"type":"string","nullable":true,"example":null,"description":"Why the row is skipped (action=error)"}},"required":["rowIndex","key","action","productId","before","after","error"]},"ProductBulkDraftResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"3f1c2b7e-8d4a-4c1e-9a55-2b0d6f1e7c11"},"status":{"type":"string","enum":["draft","confirmed","discarded"]},"source":{"type":"string","nullable":true,"example":"Lista de costos octubre.xlsx / Hoja1"},"matchBy":{"type":"string","enum":["barcode","description","id","code"]},"createMissing":{"type":"boolean","example":false},"createdAt":{"type":"string","example":"2026-10-07T12:00:00.000Z"},"confirmedAt":{"type":"string","nullable":true,"example":null},"summary":{"$ref":"#/components/schemas/ProductBulkSummaryDto"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ProductBulkDraftRowResponseDto"}}},"required":["id","status","source","matchBy","createMissing","createdAt","confirmedAt","summary","rows"]},"ProductBulkFileColumnListDto":{"type":"object","properties":{"id":{"type":"number","example":12},"name":{"type":"string","example":"Mayorista"}},"required":["id","name"]},"ProductBulkFileColumnsDto":{"type":"object","properties":{"recognized":{"example":["Código","Precio","Mayorista"],"description":"Headers used.","type":"array","items":{"type":"string"}},"ignored":{"example":["Descripción"],"description":"Headers ignored (not a price, cost or list column).","type":"array","items":{"type":"string"}},"priceLists":{"description":"Named price lists matched by header.","type":"array","items":{"$ref":"#/components/schemas/ProductBulkFileColumnListDto"}}},"required":["recognized","ignored","priceLists"]},"ProductBulkFileDraftResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"3f1c2b7e-8d4a-4c1e-9a55-2b0d6f1e7c11"},"status":{"type":"string","enum":["draft","confirmed","discarded"]},"source":{"type":"string","nullable":true,"example":"Lista de costos octubre.xlsx / Hoja1"},"matchBy":{"type":"string","enum":["barcode","description","id","code"]},"createMissing":{"type":"boolean","example":false},"createdAt":{"type":"string","example":"2026-10-07T12:00:00.000Z"},"confirmedAt":{"type":"string","nullable":true,"example":null},"summary":{"$ref":"#/components/schemas/ProductBulkSummaryDto"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ProductBulkDraftRowResponseDto"}},"columns":{"$ref":"#/components/schemas/ProductBulkFileColumnsDto"}},"required":["id","status","source","matchBy","createMissing","createdAt","confirmedAt","summary","rows","columns"]},"ProductBulkUpdateFiltersDto":{"type":"object","properties":{"categoryId":{"type":"number","example":3,"description":"Only products of this category (rubro) id"},"supplierId":{"type":"number","example":7,"description":"Only products bought from this supplier (any non-deleted purchase line)"},"search":{"type":"string","example":"yerba","description":"Case-insensitive partial match on description or barcode","maxLength":200},"productIds":{"example":[12,15],"description":"Only these product ids (at most 2000)","type":"array","items":{"type":"number"}}}},"ProductBulkUpdatePreviewDto":{"type":"object","properties":{"field":{"type":"string","enum":["unitPrice","costPrice"],"example":"unitPrice","description":"Which product value to change"},"percent":{"type":"number","example":12.5,"minimum":-90,"maximum":1000,"description":"Percentage to apply (12.5 = +12.5 %, -5 = −5 %)"},"rounding":{"type":"string","enum":["none","integer","tens"],"default":"none","description":"none = 2 decimals; integer = whole units; tens = nearest 10"},"filters":{"description":"Which products; filters combine with AND. Products whose current value is null or 0 are skipped.","allOf":[{"$ref":"#/components/schemas/ProductBulkUpdateFiltersDto"}]}},"required":["field","percent","filters"]},"ProductBulkUpdateItemDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"code":{"type":"string","nullable":true,"example":"7790001000012","description":"Product code (barcode)"},"name":{"type":"string","example":"Yerba 1 kg"},"oldValue":{"type":"number","example":1000},"newValue":{"type":"number","example":1125}},"required":["productId","code","name","oldValue","newValue"]},"ProductBulkUpdatePreviewResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProductBulkUpdateItemDto"}},"count":{"type":"number","example":42,"description":"Number of products the update would change; send it back as expectedCount"}},"required":["items","count"]},"ProductBulkUpdateApplyDto":{"type":"object","properties":{"field":{"type":"string","enum":["unitPrice","costPrice"],"example":"unitPrice","description":"Which product value to change"},"percent":{"type":"number","example":12.5,"minimum":-90,"maximum":1000,"description":"Percentage to apply (12.5 = +12.5 %, -5 = −5 %)"},"rounding":{"type":"string","enum":["none","integer","tens"],"default":"none","description":"none = 2 decimals; integer = whole units; tens = nearest 10"},"filters":{"description":"Which products; filters combine with AND. Products whose current value is null or 0 are skipped.","allOf":[{"$ref":"#/components/schemas/ProductBulkUpdateFiltersDto"}]},"expectedCount":{"type":"number","example":42,"description":"The preview's count. When sent and the products matched now differ in number, the update is refused with 409 BULK_UPDATE_STALE."}},"required":["field","percent","filters"]},"ProductBulkUpdateApplyResponseDto":{"type":"object","properties":{"updated":{"type":"number","example":42,"description":"Products whose value was written"}},"required":["updated"]},"ProductComboComponentResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"code":{"type":"string","nullable":true,"example":"COCA-500","description":"The component's code (providerId)."},"barcode":{"type":"string","nullable":true,"example":"7790895000782","description":"The component's barcode."},"description":{"type":"string","example":"Coca 500 ml"},"quantity":{"type":"number","example":2,"description":"Units of this component in one combo."},"available":{"type":"number","nullable":true,"example":10,"description":"The component's stock (in the `warehouse_id` warehouse when filtered). null for a service."}},"required":["productId","code","barcode","description","quantity","available"]},"PurchaseForeignCostResponseDto":{"type":"object","properties":{"currencyId":{"type":"number","example":2,"description":"Currency of the product's latest purchase invoice in a foreign currency."},"lastCostForeign":{"type":"number","nullable":true,"example":10,"description":"Unit cost of the latest purchase invoice, in currencyId. null when the latest purchase was in the organization's currency."},"avgCostForeign":{"type":"number","nullable":true,"example":12,"description":"Weighted average cost in currencyId (only while the organization tracks stock; null when a rate was missing)."},"exchangeRate":{"type":"number","nullable":true,"example":1100,"description":"Official AFIP rate (pesos per unit of currencyId) used to convert the method's foreign cost into costPrice. null = costPrice stays in pesos."},"rateDate":{"type":"string","format":"date","nullable":true,"example":"2026-10-21","description":"Date (YYYY-MM-DD) of exchangeRate."}},"required":["currencyId","lastCostForeign","avgCostForeign","exchangeRate","rateDate"]},"ProductResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Widget A"},"barcode":{"type":"string","nullable":true,"example":"7890123456789"},"isActive":{"type":"boolean","example":true},"deletedAt":{"type":"string","nullable":true,"example":null},"vatRateId":{"type":"integer","nullable":true,"example":2},"unitOfMeasureId":{"type":"number","example":1},"categoryId":{"type":"integer","nullable":true,"example":3},"type":{"type":"string","nullable":true,"example":"Producto"},"quantity":{"type":"number","nullable":true,"example":100},"unitPrice":{"type":"number","nullable":true,"example":1500.5},"costPrice":{"type":"number","nullable":true,"example":820.25,"description":"Cost price of the product for the organization"},"lastCost":{"type":"number","nullable":true,"example":800,"description":"Read-only. Net unit cost of the latest purchase invoice line for this product. Feeds costPrice when the organization's costMethod is `last`."},"lastCostAt":{"type":"string","format":"date-time","nullable":true,"example":"2026-10-01T03:00:00.000Z","description":"Read-only. Date of the purchase receipt that set lastCost."},"avgCost":{"type":"number","nullable":true,"example":790.5,"description":"Read-only. Weighted average cost from purchase invoices, maintained only while the organization tracks stock. Feeds costPrice when costMethod is `average`."},"minStock":{"type":"number","nullable":true,"example":10,"description":"Minimum stock (reorder threshold). null = no threshold."},"isFavorite":{"type":"boolean","example":false},"lastUsedAt":{"type":"string","nullable":true,"example":"2026-04-12T10:00:00.000Z"},"useCount":{"type":"number","example":0},"providerId":{"type":"string","nullable":true,"example":"ext-sku-123"},"brand":{"type":"string","nullable":true,"example":"Acme","description":"Brand (free text)."},"manufacturer":{"type":"string","nullable":true,"example":"Acme Industries S.A.","description":"Manufacturer (free text)."},"costCurrencyId":{"type":"integer","nullable":true,"example":null,"description":"Currency the cost is loaded in. null = the organization's currency."},"costPriceForeign":{"type":"number","nullable":true,"example":null,"description":"Cost in costCurrencyId; null while the cost is in the organization's currency."},"costExchangeRate":{"type":"number","nullable":true,"example":null,"description":"Read-only. Official AFIP rate used in the last conversion of costPriceForeign into costPrice."},"costRateDate":{"type":"string","format":"date","nullable":true,"example":null,"description":"Read-only. Date (YYYY-MM-DD) of costExchangeRate."},"warehouseQuantity":{"type":"number","example":4,"description":"Stock in the `warehouse_id` filter's warehouse (GET /products only). Present only when that filter applies — organizations with more than one warehouse; `quantity` stays the total."},"isCombo":{"type":"boolean","example":true,"description":"Present (true) only on combo / kit products: products made of other products, with no stock of their own."},"components":{"description":"Combos only: what one unit of the combo is made of.","type":"array","items":{"$ref":"#/components/schemas/ProductComboComponentResponseDto"}},"comboAvailable":{"type":"integer","nullable":true,"example":5,"description":"Combos only: how many whole combos the components' stock allows — floor(min(component stock / quantity)) over the components that carry stock (null when none does). With `warehouse_id`, in that warehouse."},"purchaseForeignCost":{"description":"GET /products and GET /products/:id only. Present only for products bought in a foreign currency while the organization's costMethod is `last` or `average`: lastCost / avgCost stay in pesos at each purchase's rate, and costPrice follows this foreign cost × today's AFIP rate.","allOf":[{"$ref":"#/components/schemas/PurchaseForeignCostResponseDto"}]}},"required":["id","description","barcode","isActive","deletedAt","vatRateId","unitOfMeasureId","categoryId","type","quantity","unitPrice","costPrice","lastCost","lastCostAt","avgCost","minStock","isFavorite","lastUsedAt","useCount","providerId","brand","manufacturer","costCurrencyId","costPriceForeign","costExchangeRate","costRateDate"]},"ProductPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ProductResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"ProductSearchResultsResponseDto":{"type":"object","properties":{"favorites":{"description":"Products marked as favorites for the organization.","type":"array","items":{"$ref":"#/components/schemas/ProductResponseDto"}},"recents":{"description":"Recently used products, ordered by last-used date.","type":"array","items":{"$ref":"#/components/schemas/ProductResponseDto"}},"results":{"description":"Fuzzy-match results against description and barcode.","type":"array","items":{"$ref":"#/components/schemas/ProductResponseDto"}}},"required":["favorites","recents","results"]},"ProductFavoriteResponseDto":{"type":"object","properties":{"isFavorite":{"type":"boolean","example":true,"description":"New favorite state after the toggle."}},"required":["isFavorite"]},"ProductComponentInputDto":{"type":"object","properties":{"productId":{"type":"number","example":12,"description":"Component product id (same organization, not a combo)."},"quantity":{"type":"number","example":2,"description":"Units of the component in one combo (> 0, up to 5 decimals)."}},"required":["productId","quantity"]},"SetProductComponentsDto":{"type":"object","properties":{"components":{"description":"The full composition (replaces the current one, up to 50). An empty list turns the combo back into a simple product.","type":"array","items":{"$ref":"#/components/schemas/ProductComponentInputDto"}}},"required":["components"]},"CreateProductDto":{"type":"object","properties":{"description":{"type":"string","example":"Widget A","description":"Product description"},"unitOfMeasureId":{"type":"number","example":1,"description":"Unit of measure ID"},"barcode":{"type":"string","example":"7890123456789","nullable":true},"vatRateId":{"type":"integer","example":2,"nullable":true,"description":"VAT rate (combo) ID. Ignored for Monotributista organizations: always Sin IVA (92)."},"categoryId":{"type":"integer","example":3,"nullable":true,"description":"Product category ID; null/0 may resolve to Sin Rubro"},"type":{"type":"string","example":"Producto","nullable":true},"quantity":{"type":"number","example":1.5,"nullable":true},"unitPrice":{"type":"number","example":1500.5,"nullable":true,"description":"Default unit price for auto-populating receipt lines"},"costPrice":{"type":"number","example":820.25,"nullable":true,"description":"Cost price of the product for the organization (>= 0, up to 4 decimals). Send null on update to clear it."},"minStock":{"type":"number","example":10,"nullable":true,"description":"Minimum stock (reorder threshold, >= 0, up to 4 decimals). The product is listed in GET /stock/reorder and the weekly low-stock email when its quantity is at or below it. Send null to clear it."},"providerId":{"type":"object","example":"ext-sku-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this product). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"brand":{"type":"string","example":"Acme","nullable":true,"description":"Brand (free text). Send null to clear it."},"manufacturer":{"type":"string","example":"Acme Industries S.A.","nullable":true,"description":"Manufacturer (free text). Send null to clear it."},"costCurrencyId":{"type":"integer","example":2,"nullable":true,"description":"Currency the cost is loaded in (currency id). null = the organization's currency. With a foreign currency, send `costPriceForeign`: `costPrice` is then computed with the official AFIP rate of the day (a `costPrice` sent alongside is ignored) and refreshed daily. Changing to a foreign currency requires `costPriceForeign` in the same request (COST_PRICE_FOREIGN_REQUIRED when missing or null; to drop the cost, go back to null = organization currency). Only for organizations with costMethod `manual` that bill in ARS."},"costPriceForeign":{"type":"number","example":12.5,"nullable":true,"description":"Cost in `costCurrencyId` (>= 0, up to 4 decimals). Ignored while the cost is in the organization's currency."}},"required":["description","unitOfMeasureId"]},"UpdateProductDto":{"type":"object","properties":{"description":{"type":"string","example":"Widget A","description":"Product description"},"unitOfMeasureId":{"type":"number","example":1,"description":"Unit of measure ID"},"barcode":{"type":"string","example":"7890123456789","nullable":true},"vatRateId":{"type":"integer","example":2,"nullable":true,"description":"VAT rate (combo) ID. Ignored for Monotributista organizations: always Sin IVA (92)."},"categoryId":{"type":"integer","example":3,"nullable":true,"description":"Product category ID; null/0 may resolve to Sin Rubro"},"type":{"type":"string","example":"Producto","nullable":true},"quantity":{"type":"number","example":1.5,"nullable":true},"unitPrice":{"type":"number","example":1500.5,"nullable":true,"description":"Default unit price for auto-populating receipt lines"},"costPrice":{"type":"number","example":820.25,"nullable":true,"description":"Cost price of the product for the organization (>= 0, up to 4 decimals). Send null on update to clear it."},"minStock":{"type":"number","example":10,"nullable":true,"description":"Minimum stock (reorder threshold, >= 0, up to 4 decimals). The product is listed in GET /stock/reorder and the weekly low-stock email when its quantity is at or below it. Send null to clear it."},"providerId":{"type":"object","example":"ext-sku-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this product). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"brand":{"type":"string","example":"Acme","nullable":true,"description":"Brand (free text). Send null to clear it."},"manufacturer":{"type":"string","example":"Acme Industries S.A.","nullable":true,"description":"Manufacturer (free text). Send null to clear it."},"costCurrencyId":{"type":"integer","example":2,"nullable":true,"description":"Currency the cost is loaded in (currency id). null = the organization's currency. With a foreign currency, send `costPriceForeign`: `costPrice` is then computed with the official AFIP rate of the day (a `costPrice` sent alongside is ignored) and refreshed daily. Changing to a foreign currency requires `costPriceForeign` in the same request (COST_PRICE_FOREIGN_REQUIRED when missing or null; to drop the cost, go back to null = organization currency). Only for organizations with costMethod `manual` that bill in ARS."},"costPriceForeign":{"type":"number","example":12.5,"nullable":true,"description":"Cost in `costCurrencyId` (>= 0, up to 4 decimals). Ignored while the cost is in the organization's currency."}}},"AddManualStockChangeDto":{"type":"object","properties":{"quantity":{"type":"number","description":"Quantity adjustment (positive or negative)"},"text":{"type":"string","description":"Reason for the adjustment","maxLength":255},"warehouseId":{"type":"integer","example":12,"description":"Warehouse the adjustment lands in (organizations with more than one warehouse; ignored otherwise). Omitted = the primary warehouse. With forceStock, that warehouse's balance cannot go below zero."}},"required":["quantity"]},"StockChangeTransferRefDto":{"type":"object","properties":{"id":{"type":"string","example":"5b0c1f9e-4a0e-4a43-9a51-0c0f3f6f2d11"},"fromWarehouseId":{"type":"integer","nullable":true,"example":11},"toWarehouseId":{"type":"integer","nullable":true,"example":12},"note":{"type":"string","nullable":true,"example":"Reposición sucursal","description":"The transfer's note."}},"required":["id","fromWarehouseId","toWarehouseId","note"]},"StockChangeDocumentRefDto":{"type":"object","properties":{"kind":{"type":"string","enum":["sale","purchase"],"example":"purchase"},"id":{"type":"string","example":"1234","description":"sales_receipts.id (uuid) or purchase_receipts.id."},"label":{"type":"string","example":"Factura A 0003-00004567"},"counterparty":{"type":"string","nullable":true,"example":"Proveedor SA","description":"Supplier (purchase) or customer (sale)."}},"required":["kind","id","label","counterparty"]},"StockChangeResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"quantity":{"type":"number","example":-2,"description":"Quantity adjustment (positive for additions, negative for removals)"},"newBalance":{"type":"number","example":48,"description":"Stock level after this change"},"type":{"type":"string","example":"MANUAL","description":"Source of the change: SALE | PURCHASE | MANUAL | TRANSFER | DELIVERY_NOTE"},"text":{"type":"string","nullable":true,"example":"Manual adjustment after stocktake"},"productId":{"type":"number","example":1},"productDescription":{"type":"string","nullable":true,"example":"Camiseta talle M","description":"Product description (joined from product table)"},"comboProductId":{"type":"number","example":31,"description":"Present only on a component movement that came from selling a combo / kit product: the combo's id. A combo's own history (GET on the combo's id) lists exactly these rows — `productId` / `productDescription` are then the component's."},"comboDescription":{"type":"string","nullable":true,"example":"Combo Merienda","description":"With `comboProductId`: the combo's description."},"userId":{"type":"string","nullable":true,"example":"auth0|abc123","description":"User UUID who triggered the change (null for system changes)"},"typeLabel":{"type":"string","example":"NC Compra","description":"Display name of the movement when `type` alone is not enough: \"NC Compra\" on PURCHASE rows that come from a purchase credit note; \"Remito R 00001-00000012\" on DELIVERY_NOTE rows. Absent otherwise."},"deliveryNoteId":{"type":"string","format":"uuid","description":"Only on DELIVERY_NOTE rows: the delivery note (remito) that made the movement."},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse the movement hit; null = the primary warehouse. Only present for organizations with more than one warehouse."},"transfer":{"description":"Only on TRANSFER rows of multi-warehouse organizations: the transfer and both of its warehouses (explicit ids, the primary included).","allOf":[{"$ref":"#/components/schemas/StockChangeTransferRefDto"}]},"createdBy":{"type":"string","nullable":true,"example":"Juan Pérez","description":"Who made the movement (multi-warehouse organizations only); null when unknown (system, API key, older rows)."},"warehouseBalance":{"type":"number","example":7,"description":"Only with the `warehouse_id` filter (multi-warehouse organizations): the filtered warehouse's stock after this movement. `newBalance` stays the product's total."},"document":{"description":"Only on SALE / PURCHASE rows of multi-warehouse organizations: the receipt that moved the stock.","allOf":[{"$ref":"#/components/schemas/StockChangeDocumentRefDto"}]}},"required":["id","createdAt","quantity","newBalance","type","text","productId","productDescription","userId"]},"StockHistoryPageResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/StockChangeResponseDto"}},"total":{"type":"number","example":145,"description":"Total number of stock changes for this product"}},"required":["items","total"]},"StockSyncRowDto":{"type":"object","properties":{"key":{"type":"string","example":"7790001000012","description":"Value matched against the product (barcode, provider id, id or description, per matchBy)"},"quantity":{"example":12,"description":"ABSOLUTE target stock (decimal >= 0). Strings are read the Argentine way: \"12\", \"12,5\", \"1.234,5\", \"1.500\" (= 1500) and \"12.5\" are accepted; anything else is reported as invalid_quantity instead of failing the request.","oneOf":[{"type":"number"},{"type":"string"}]},"label":{"type":"string","example":"Lavandina 1L","description":"Human label of the row (shown when unmatched)"}},"required":["key","quantity"]},"CreateStockSyncDto":{"type":"object","properties":{"source":{"type":"string","example":"Planilla Stock / Hoja1","description":"Where the rows come from","maxLength":255},"matchBy":{"type":"string","enum":["auto","barcode","providerId","id","description"],"default":"auto","description":"Product field the row key is matched against. auto tries barcode, providerId, id (numeric) and description, in that order."},"rows":{"maxItems":5000,"type":"array","items":{"$ref":"#/components/schemas/StockSyncRowDto"}},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse being counted (organizations with more than one warehouse; ignored otherwise): the preview and the confirm compare each target against that warehouse's stock and only move it. Omitted = the primary warehouse (on update: keeps the draft's). 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization."}},"required":["rows"]},"StockSyncSummaryDto":{"type":"object","properties":{"rows":{"type":"number","example":120},"matched":{"type":"number","example":110},"changed":{"type":"number","example":40},"unchanged":{"type":"number","example":70},"unmatched":{"type":"number","example":10}},"required":["rows","matched","changed","unchanged","unmatched"]},"StockSyncItemDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"description":{"type":"string","example":"Lavandina 1L"},"barcode":{"type":"string","nullable":true,"example":"7790001000012"},"providerId":{"type":"string","nullable":true,"example":null},"rowKey":{"type":"string","example":"7790001000012"},"currentQuantity":{"type":"number","example":8,"description":"Product stock when the draft was created"},"targetQuantity":{"type":"number","example":12,"description":"Absolute target from the row"},"delta":{"type":"number","example":4,"description":"targetQuantity - currentQuantity (at draft time)"}},"required":["productId","description","barcode","providerId","rowKey","currentQuantity","targetQuantity","delta"]},"StockSyncUnmatchedDto":{"type":"object","properties":{"rowKey":{"type":"string","example":"LAV-2L"},"label":{"type":"string","nullable":true,"example":"Lavandina 2L"},"quantity":{"type":"number","nullable":true,"example":3},"reason":{"type":"string","enum":["not_found","ambiguous","invalid_quantity","duplicate_row"]}},"required":["rowKey","label","quantity","reason"]},"StockSyncAppliedDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"before":{"type":"number","example":8},"after":{"type":"number","example":12},"stockChangeId":{"type":"number","example":9876}},"required":["productId","before","after","stockChangeId"]},"StockSyncDriftDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"quantityAtDraft":{"type":"number","example":8},"quantityAtConfirm":{"type":"number","example":7}},"required":["productId","quantityAtDraft","quantityAtConfirm"]},"StockSyncSkippedDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"reason":{"type":"string","enum":["not_found"]}},"required":["productId","reason"]},"StockSyncResultDto":{"type":"object","properties":{"applied":{"type":"array","items":{"$ref":"#/components/schemas/StockSyncAppliedDto"}},"drift":{"description":"Products whose stock changed between draft and confirm; they were still set to the target","type":"array","items":{"$ref":"#/components/schemas/StockSyncDriftDto"}},"skipped":{"description":"Products of the draft deleted or deactivated before confirm; left untouched","type":"array","items":{"$ref":"#/components/schemas/StockSyncSkippedDto"}}},"required":["applied","drift","skipped"]},"StockSyncDraftResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"3f1c2b7e-8d4a-4c1e-9a55-2b0d6f1e7c11"},"status":{"type":"string","enum":["pending","applied","discarded","expired"]},"source":{"type":"string","nullable":true,"example":"Planilla Stock / Hoja1"},"matchBy":{"type":"string","enum":["auto","barcode","providerId","id","description"]},"createdAt":{"type":"string","example":"2026-10-03T12:00:00.000Z"},"expiresAt":{"type":"string","example":"2026-10-04T12:00:00.000Z"},"appliedAt":{"type":"string","nullable":true,"example":null},"createdByUserId":{"type":"number","nullable":true,"example":12},"agentRunId":{"type":"string","nullable":true,"example":null,"description":"Copiloto run that created the draft"},"trackStockEnabled":{"type":"boolean","description":"Whether the organization has stock tracking on (required to confirm)"},"summary":{"$ref":"#/components/schemas/StockSyncSummaryDto"},"items":{"description":"Omitted in list responses","type":"array","items":{"$ref":"#/components/schemas/StockSyncItemDto"}},"unmatched":{"description":"Omitted in list responses","type":"array","items":{"$ref":"#/components/schemas/StockSyncUnmatchedDto"}},"result":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/StockSyncResultDto"}]},"warehouseId":{"type":"integer","example":12,"description":"Warehouse being counted; only present when the draft has one (organizations with more than one warehouse)."}},"required":["id","status","source","matchBy","createdAt","expiresAt","appliedAt","createdByUserId","agentRunId","trackStockEnabled","summary","result"]},"StockSyncListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockSyncDraftResponseDto"}}},"required":["data"]},"StockCountSheetItemDto":{"type":"object","properties":{"id":{"type":"number","example":15},"description":{"type":"string","example":"Lavandina 1L"},"barcode":{"type":"string","nullable":true,"example":"7790001000012"},"providerId":{"type":"string","nullable":true,"example":null},"categoryId":{"type":"number","nullable":true,"example":3},"categoryName":{"type":"string","nullable":true,"example":"Limpieza"},"quantity":{"type":"number","example":8,"description":"Current stock"},"warehouseQuantity":{"type":"number","example":3,"description":"Stock in the `warehouse_id` filter's warehouse (omitted: the primary). Only present for organizations with more than one warehouse."}},"required":["id","description","barcode","providerId","categoryId","categoryName","quantity"]},"StockCountSheetResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/StockCountSheetItemDto"}},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":100},"total":{"type":"number","example":240}},"required":["items","page","pageSize","total"]},"UpdateStockSyncDto":{"type":"object","properties":{"source":{"type":"string","example":"Planilla Stock / Hoja1","description":"Where the rows come from","maxLength":255},"matchBy":{"type":"string","enum":["auto","barcode","providerId","id","description"],"default":"auto","description":"Product field the row key is matched against. auto tries barcode, providerId, id (numeric) and description, in that order."},"rows":{"maxItems":5000,"type":"array","items":{"$ref":"#/components/schemas/StockSyncRowDto"}},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse being counted (organizations with more than one warehouse; ignored otherwise): the preview and the confirm compare each target against that warehouse's stock and only move it. Omitted = the primary warehouse (on update: keeps the draft's). 404 WAREHOUSE_NOT_FOUND for a warehouse of another organization."}},"required":["rows"]},"StockReorderItemDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"code":{"type":"string","nullable":true,"example":"7790001000012","description":"Product code (barcode)"},"name":{"type":"string","example":"Yerba 1 kg","description":"Product description"},"categoryName":{"type":"string","nullable":true,"example":"Almacén"},"quantity":{"type":"number","example":2,"description":"Current stock"},"minStock":{"type":"number","example":10,"description":"Minimum stock (reorder threshold)"},"missing":{"type":"number","example":8,"description":"minStock − quantity"},"costPrice":{"type":"number","nullable":true,"example":1500},"lastCost":{"type":"number","nullable":true,"example":1480},"lastSupplierName":{"type":"string","nullable":true,"example":"Distribuidora Sur S.A.","description":"Supplier of the latest purchase receipt with a line for this product"}},"required":["productId","code","name","categoryName","quantity","minStock","missing","costPrice","lastCost","lastSupplierName"]},"StockReorderResponseDto":{"type":"object","properties":{"items":{"description":"At most 2000 items, most missing first","type":"array","items":{"$ref":"#/components/schemas/StockReorderItemDto"}},"total":{"type":"number","example":14,"description":"Number of products at or below their minimum"}},"required":["items","total"]},"StockReportWarehouseDto":{"type":"object","properties":{"id":{"type":"number","example":4},"name":{"type":"string","example":"Depósito Norte"},"isPrimary":{"type":"boolean","example":false,"description":"Whether it is the organization's primary warehouse"}},"required":["id","name","isPrimary"]},"StockValuationItemDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"code":{"type":"string","nullable":true,"example":"7790001000012","description":"Product code (barcode)"},"name":{"type":"string","example":"Yerba 1 kg"},"categoryName":{"type":"string","nullable":true,"example":"Almacén"},"quantity":{"type":"number","example":40,"description":"Current stock (negative values included)"},"unitCost":{"type":"number","nullable":true,"example":1500,"description":"Effective unit cost per the organization's costMethod"},"value":{"type":"number","nullable":true,"example":60000,"description":"quantity × unitCost (2 decimals); null without cost"},"costSource":{"type":"string","nullable":true,"enum":["cost_price","avg_cost","last_cost"],"example":"avg_cost","description":"Which product cost unitCost came from; null when the product has none"}},"required":["productId","code","name","categoryName","quantity","unitCost","value","costSource"]},"StockValuationTotalsDto":{"type":"object","properties":{"quantity":{"type":"number","example":120},"value":{"type":"number","example":185000.5,"description":"Sum of the items' value (items without cost add nothing)"},"productsWithoutCost":{"type":"number","example":3,"description":"Items with no cost to value them"}},"required":["quantity","value","productsWithoutCost"]},"StockValuationResponseDto":{"type":"object","properties":{"warehouse":{"description":"The warehouse the report is filtered to. Present only when the warehouse_id filter applies.","allOf":[{"$ref":"#/components/schemas/StockReportWarehouseDto"}]},"items":{"type":"array","items":{"$ref":"#/components/schemas/StockValuationItemDto"}},"totals":{"$ref":"#/components/schemas/StockValuationTotalsDto"}},"required":["items","totals"]},"StockMovementsItemDto":{"type":"object","properties":{"opening":{"type":"number","example":40,"description":"Stock at the start of `from` (Argentina time)"},"purchasesIn":{"type":"number","example":24,"description":"Units in from purchase invoices (PURCHASE movements with a positive quantity)"},"purchaseReturns":{"type":"number","example":2,"description":"Units out from purchase credit notes and voided, deleted or edited purchases (PURCHASE movements with a negative quantity), as a positive number"},"salesOut":{"type":"number","example":30,"description":"Units sold (SALE movements with a negative quantity), as a positive number"},"salesReturns":{"type":"number","example":1,"description":"Units back from sales credit notes that return goods and voided invoices (SALE movements with a positive quantity)"},"adjustments":{"type":"number","example":-3,"description":"Net manual adjustments (MANUAL movements: adjustments, stock sync, initial stock, product edits)"},"transfersIn":{"type":"number","example":5,"description":"Units received from other warehouses (TRANSFER movements in). Present only when the report is filtered to one warehouse."},"transfersOut":{"type":"number","example":2,"description":"Units sent to other warehouses (TRANSFER movements out), as a positive number. Present only when the report is filtered to one warehouse."},"closing":{"type":"number","example":30,"description":"Stock at the end of `to` (Argentina time). Equals opening + purchasesIn − purchaseReturns − salesOut + salesReturns + adjustments (+ transfersIn − transfersOut for one warehouse) while the ledger has no gaps"},"productId":{"type":"number","example":12},"code":{"type":"string","nullable":true,"example":"7790001000012","description":"Product code (barcode)"},"name":{"type":"string","example":"Yerba 1 kg","description":"Product description"},"categoryName":{"type":"string","nullable":true,"example":"Almacén"}},"required":["opening","purchasesIn","purchaseReturns","salesOut","salesReturns","adjustments","closing","productId","code","name","categoryName"]},"StockMovementsTotalsDto":{"type":"object","properties":{"opening":{"type":"number","example":40,"description":"Stock at the start of `from` (Argentina time)"},"purchasesIn":{"type":"number","example":24,"description":"Units in from purchase invoices (PURCHASE movements with a positive quantity)"},"purchaseReturns":{"type":"number","example":2,"description":"Units out from purchase credit notes and voided, deleted or edited purchases (PURCHASE movements with a negative quantity), as a positive number"},"salesOut":{"type":"number","example":30,"description":"Units sold (SALE movements with a negative quantity), as a positive number"},"salesReturns":{"type":"number","example":1,"description":"Units back from sales credit notes that return goods and voided invoices (SALE movements with a positive quantity)"},"adjustments":{"type":"number","example":-3,"description":"Net manual adjustments (MANUAL movements: adjustments, stock sync, initial stock, product edits)"},"transfersIn":{"type":"number","example":5,"description":"Units received from other warehouses (TRANSFER movements in). Present only when the report is filtered to one warehouse."},"transfersOut":{"type":"number","example":2,"description":"Units sent to other warehouses (TRANSFER movements out), as a positive number. Present only when the report is filtered to one warehouse."},"closing":{"type":"number","example":30,"description":"Stock at the end of `to` (Argentina time). Equals opening + purchasesIn − purchaseReturns − salesOut + salesReturns + adjustments (+ transfersIn − transfersOut for one warehouse) while the ledger has no gaps"}},"required":["opening","purchasesIn","purchaseReturns","salesOut","salesReturns","adjustments","closing"]},"StockMovementsResponseDto":{"type":"object","properties":{"from":{"type":"string","example":"2026-10-01"},"to":{"type":"string","example":"2026-10-31"},"warehouse":{"description":"The warehouse the report is filtered to. Present only when the warehouse_id filter applies.","allOf":[{"$ref":"#/components/schemas/StockReportWarehouseDto"}]},"items":{"description":"This page's products, by description","type":"array","items":{"$ref":"#/components/schemas/StockMovementsItemDto"}},"total":{"type":"number","example":57,"description":"Products in the report (all pages)"},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":100},"totals":{"description":"Sums over every product in the report, not just this page","allOf":[{"$ref":"#/components/schemas/StockMovementsTotalsDto"}]}},"required":["from","to","items","total","page","pageSize","totals"]},"StockTransferLineDto":{"type":"object","properties":{"productId":{"type":"number","example":15,"description":"Product to move (a product, not a service)."},"quantity":{"type":"number","example":4,"description":"Quantity to move (> 0, up to 5 decimals). Duplicated products are summed."}},"required":["productId","quantity"]},"CreateStockTransferDto":{"type":"object","properties":{"fromWarehouseId":{"type":"number","example":11,"description":"Source warehouse (the primary's explicit id included)."},"toWarehouseId":{"type":"number","example":12,"description":"Destination warehouse; must differ from the source."},"date":{"type":"string","example":"2026-10-20","description":"Transfer date (YYYY-MM-DD). Default: today in Argentina."},"note":{"type":"string","example":"Reposición semanal de la sucursal","maxLength":500},"lines":{"description":"1 to 500 lines.","type":"array","items":{"$ref":"#/components/schemas/StockTransferLineDto"}}},"required":["fromWarehouseId","toWarehouseId","lines"]},"StockTransferWarehouseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"name":{"type":"string","example":"Sucursal Norte"},"isPrimary":{"type":"boolean","example":false}},"required":["id","name","isPrimary"]},"StockTransferLineResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"productDescription":{"type":"string","example":"Yerba 1kg"},"barcode":{"type":"string","nullable":true,"example":"7790001000012"},"quantity":{"type":"number","example":4}},"required":["productId","productDescription","barcode","quantity"]},"StockTransferResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"5b0c1f9e-4a0e-4a43-9a51-0c0f3f6f2d11"},"status":{"type":"string","enum":["completed","voided"],"example":"completed"},"date":{"type":"string","example":"2026-10-20"},"note":{"type":"string","nullable":true,"example":null},"fromWarehouse":{"$ref":"#/components/schemas/StockTransferWarehouseDto"},"toWarehouse":{"$ref":"#/components/schemas/StockTransferWarehouseDto"},"createdByUserId":{"type":"integer","nullable":true,"example":7},"createdByName":{"type":"string","nullable":true,"example":"Ana Pérez","description":"Creator's full name."},"createdAt":{"type":"string","example":"2026-10-20T13:00:00.000Z"},"voidedAt":{"type":"string","nullable":true,"example":null},"lineCount":{"type":"number","example":2,"description":"Number of products moved."},"totalQuantity":{"type":"number","example":9,"description":"Sum of the quantities moved."},"lines":{"description":"Only in the detail.","type":"array","items":{"$ref":"#/components/schemas/StockTransferLineResponseDto"}}},"required":["id","status","date","note","fromWarehouse","toWarehouse","createdByUserId","createdByName","createdAt","voidedAt","lineCount","totalQuantity"]},"StockTransferListResponseDto":{"type":"object","properties":{"data":{"description":"Newest first (by date, then creation).","type":"array","items":{"$ref":"#/components/schemas/StockTransferResponseDto"}},"total":{"type":"number","example":37},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50}},"required":["data","total","page","pageSize"]},"PriceListItemResponseDto":{"type":"object","properties":{"id":{"type":"integer","nullable":true,"example":1,"description":"price_list_items row id, or null for a synthesized PRODUCT-scope row (products.unit_price fallback — not a persisted price-list row). Consumers upsert by productId+scope, not by id."},"productId":{"type":"number","example":12},"productDescription":{"type":"string","example":"Coca-Cola 500ml"},"price":{"type":"number","example":1500.5},"scope":{"type":"string","example":"C","enum":["D","C","G","L","PRODUCT"],"description":"Effective scope that produced this price: D=default, C=per-customer, G=per-economic-group, L=named price list of the customer or its group, PRODUCT=products.unit_price fallback (no price-list row)."},"customerId":{"type":"integer","nullable":true,"example":45},"economicGroupId":{"type":"integer","nullable":true,"example":null},"priceListId":{"type":"integer","nullable":true,"example":null,"description":"Named price list that produced the price (scope L), else null"}},"required":["id","productId","productDescription","price","scope","customerId","economicGroupId","priceListId"]},"ResolvedPriceResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"price":{"type":"number","nullable":true,"example":1500.5,"description":"Resolved price, or null when no price at any scope"},"source":{"type":"string","nullable":true,"enum":["C","G","L","D","PRODUCT"],"example":"C","description":"Which cascade step produced the price (null when price is null): C=customer special price, G=economic-group special price, L=named price list, D=default price, PRODUCT=products.unit_price"},"priceListId":{"type":"integer","nullable":true,"example":null,"description":"Named price list that produced the price (source L), else null"}},"required":["productId","price","source","priceListId"]},"UpsertPriceListItemDto":{"type":"object","properties":{"productId":{"type":"number","example":12,"description":"Product id"},"price":{"type":"number","example":1500.5,"description":"Price (> 0)"},"scope":{"type":"string","example":"D","enum":["D","C","G"],"description":"Scope: D=default, C=per-customer, G=per-economic-group"},"customerId":{"type":"number","example":45,"description":"Customer id — required when scope=C"},"economicGroupId":{"type":"number","example":7,"description":"Economic group id — required when scope=G"}},"required":["productId","price","scope"]},"EconomicGroupResponseDto":{"type":"object","properties":{"id":{"type":"number","example":7},"name":{"type":"string","example":"Grupo Supermercados"},"priceListId":{"type":"integer","nullable":true,"example":3,"description":"Named price list for the group's customers, or null"},"createdAt":{"type":"string","example":"2026-08-01T10:00:00.000Z"}},"required":["id","name","priceListId","createdAt"]},"CreateEconomicGroupDto":{"type":"object","properties":{"name":{"type":"string","example":"Grupo Supermercados","description":"Economic group name"},"priceListId":{"type":"integer","nullable":true,"example":3,"description":"Named price list for the group's customers (a customer's own list wins). Must belong to the organization and not be deleted."}},"required":["name"]},"UpdateEconomicGroupDto":{"type":"object","properties":{"name":{"type":"string","example":"Grupo Supermercados","description":"Economic group name"},"priceListId":{"type":"integer","nullable":true,"example":3,"description":"Named price list for the group's customers (a customer's own list wins). Omit to keep the current one, null to clear it. Must belong to the organization and not be deleted."}},"required":["name"]},"CategoryMarginResponseDto":{"type":"object","properties":{"categoryId":{"type":"number","example":3},"categoryName":{"type":"string","example":"Bebidas"},"marginPercent":{"type":"number","example":25}},"required":["categoryId","categoryName","marginPercent"]},"NamedPriceListResponseDto":{"type":"object","properties":{"id":{"type":"number","example":4},"name":{"type":"string","example":"Mayorista"},"marginPercent":{"type":"number","nullable":true,"example":30,"description":"List margin; null = manual list"},"rounding":{"type":"string","enum":["none","integer","tens"],"example":"integer"},"roundOnGross":{"type":"boolean","example":false},"categoryMargins":{"type":"array","items":{"$ref":"#/components/schemas/CategoryMarginResponseDto"}},"customerCount":{"type":"integer","example":12,"description":"Active customers assigned to this list (they lose it if the list is deleted)."},"groupCount":{"type":"integer","example":2,"description":"Economic groups assigned to this list (they lose it if the list is deleted)."},"createdAt":{"type":"string","example":"2026-10-16T10:00:00.000Z"},"updatedAt":{"type":"string","example":"2026-10-16T10:00:00.000Z"}},"required":["id","name","marginPercent","rounding","roundOnGross","categoryMargins","customerCount","groupCount","createdAt","updatedAt"]},"CreateNamedPriceListDto":{"type":"object","properties":{"name":{"type":"string","example":"Mayorista","maxLength":100},"marginPercent":{"type":"number","nullable":true,"example":30,"description":"Margin over cost in percent (30 = cost × 1.30). -90 to 1000, up to 4 decimals. Omit or null for a manual list (every price typed by hand)."},"rounding":{"type":"string","enum":["none","integer","tens"],"default":"none","description":"none = 2 decimals; integer = whole units; tens = nearest 10"},"roundOnGross":{"type":"boolean","default":false,"description":"Round the final price with VAT instead of the net price (the net is stored at 5 decimals)."}},"required":["name"]},"UpdateNamedPriceListDto":{"type":"object","properties":{"name":{"type":"string","example":"Mayorista","maxLength":100},"marginPercent":{"type":"number","nullable":true,"example":35,"description":"Margin over cost in percent (30 = cost × 1.30). -90 to 1000, up to 4 decimals. null turns the list manual (rule prices are dropped; manual prices stay)."},"rounding":{"type":"string","enum":["none","integer","tens"],"description":"none = 2 decimals; integer = whole units; tens = nearest 10"},"roundOnGross":{"type":"boolean","description":"Round the final price with VAT instead of the net price."}}},"CategoryMarginDto":{"type":"object","properties":{"categoryId":{"type":"number","example":3,"description":"Product category (rubro) id"},"marginPercent":{"type":"number","example":25,"description":"Margin over cost in percent (30 = cost × 1.30). -90 to 1000, up to 4 decimals."}},"required":["categoryId","marginPercent"]},"SetCategoryMarginsDto":{"type":"object","properties":{"margins":{"description":"The full set of category margins: categories left out lose theirs (they fall back to the list margin).","type":"array","items":{"$ref":"#/components/schemas/CategoryMarginDto"}}},"required":["margins"]},"NamedPriceListItemResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":12},"productCode":{"type":"string","nullable":true,"example":"7790001"},"productDescription":{"type":"string","example":"Coca-Cola 500ml"},"categoryId":{"type":"integer","nullable":true,"example":3},"categoryName":{"type":"string","nullable":true,"example":"Bebidas"},"cost":{"type":"number","nullable":true,"example":1000,"description":"products.cost_price (net)"},"noCost":{"type":"boolean","example":false,"description":"True when the product has no cost (NULL or 0): the rule cannot price it."},"marginPercent":{"type":"number","nullable":true,"example":30,"description":"Margin the rule applies to this product"},"marginOrigin":{"type":"string","nullable":true,"enum":["product","category","list"],"example":"category","description":"Where the margin comes from: the product's own, its category's, or the list's"},"price":{"type":"number","nullable":true,"example":1300,"description":"Net price in this list; null = no price"},"vatRate":{"type":"number","example":0.21,"description":"VAT rate applied to the final price (0 for a monotributista or exempt product)"},"priceWithVat":{"type":"number","nullable":true,"example":1573,"description":"Final price with VAT, 2 decimals"},"source":{"type":"string","nullable":true,"enum":["R","M"],"example":"R","description":"R = computed by the rule, M = typed by hand, null = no row"},"costBasis":{"type":"number","nullable":true,"example":1000,"description":"Cost the rule used for the stored price"}},"required":["productId","productCode","productDescription","categoryId","categoryName","cost","noCost","marginPercent","marginOrigin","price","vatRate","priceWithVat","source","costBasis"]},"NamedPriceListItemPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NamedPriceListItemResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"123"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"SetPriceListItemDto":{"type":"object","properties":{"mode":{"type":"string","enum":["rule","manual"],"example":"manual","description":"rule = priced from cost (optionally with its own margin); manual = fixed price that beats the rule."},"price":{"type":"number","example":1500,"description":"mode=manual: net price (> 0). Send this or priceWithVat."},"priceWithVat":{"type":"number","example":1815,"description":"mode=manual: final price with VAT (> 0); the net is derived with the product's VAT rate."},"marginPercent":{"type":"number","nullable":true,"example":40,"description":"mode=rule: this product's own margin. Margin over cost in percent (30 = cost × 1.30). -90 to 1000, up to 4 decimals. Omit or null to use the category / list margin."}},"required":["mode"]},"CustomerResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Distribuidora Norte SRL"},"taxId":{"type":"string","nullable":true,"example":"30345678901"},"postalCode":{"type":"string","nullable":true,"example":"C1043AAZ"},"city":{"type":"string","nullable":true,"example":"Buenos Aires"},"phone":{"type":"string","nullable":true,"example":"+54 11 4444-5555"},"email":{"type":"string","nullable":true,"example":"contacto@distribuidoranorte.com.ar"},"contractedSaleCondition":{"type":"integer","nullable":true,"example":1},"statisticalSaleCondition":{"type":"integer","nullable":true,"example":1},"isActive":{"type":"boolean","example":true},"taxCategoryId":{"type":"number","example":1},"masterId":{"type":"integer","nullable":true,"example":null},"priceListId":{"type":"integer","nullable":true,"example":null,"description":"Named price list; null = the economic group's list, then default prices"},"saleConditionId":{"type":"integer","nullable":true,"example":1},"locationId":{"type":"integer","nullable":true,"example":1},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234"},"documentTypeId":{"type":"number","example":80},"observations":{"type":"string","nullable":true,"example":null},"ignoresTaxes":{"type":"boolean","nullable":true,"example":false},"taxIdNumber":{"type":"string","nullable":true,"example":null},"providerId":{"type":"string","nullable":true,"example":"ext-sku-123","description":"External provider identifier — unique per organization."},"fiscalConfig":{"type":"object","additionalProperties":true,"nullable":true,"example":{"subjectToWithholding":true,"equivalenceSurcharge":false},"description":"Country-scoped RECIPIENT settings, scoped by the ORGANIZATION's country (not the customer's). ES: { subjectToWithholding, equivalenceSurcharge }."},"withholdingApplicable":{"type":"boolean","nullable":true,"example":true,"description":"SPAIN: whether invoices to this customer carry the issuer's IRPF withholding — `fiscalConfig.subjectToWithholding` when set, else derived from the tax id (a Spanish CIF = true; an EU VAT number, a NIF/NIE or no tax id = false). Use it (with the organization's `withholdingApplicable` / `defaultWithholdingRate`) to default or hide IRPF on the invoice form. NULL for organizations of any other country."},"shippingAddress":{"type":"string","nullable":true,"example":"Av. San Martín 456","description":"Shipping/delivery address"},"shippingCity":{"type":"string","nullable":true,"example":"Córdoba","description":"Shipping city"},"shippingPostalCode":{"type":"string","nullable":true,"example":"X5000","description":"Shipping postal code"},"shippingLocationId":{"type":"integer","nullable":true,"example":2,"description":"Shipping location (province) id"}},"required":["id","businessName","taxId","postalCode","city","phone","email","contractedSaleCondition","statisticalSaleCondition","isActive","taxCategoryId","masterId","priceListId","saleConditionId","locationId","address","documentTypeId","observations","ignoresTaxes","taxIdNumber","providerId","fiscalConfig","withholdingApplicable","shippingAddress","shippingCity","shippingPostalCode","shippingLocationId"]},"CustomerPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CuitLookupSuggestionDto":{"type":"object","properties":{"businessName":{"type":"string","example":"Distribuidora Norte SRL"},"address":{"type":"string","example":"Av. Corrientes 1234"},"postalCode":{"type":"string","example":"C1043AAZ"},"city":{"type":"string","example":"Buenos Aires"},"provinceId":{"type":"integer","example":1},"condicionIva":{"type":"string","enum":["RI","MO","EX","CF"],"example":"RI","description":"IVA condition derived from ARCA padrón."},"taxCategoryId":{"type":"integer","example":1,"description":"Internal tax category id, derived from the seller's regime crossed with the persona's IVA condition."}},"required":["businessName"]},"CuitLookupResponseDto":{"type":"object","properties":{"suggestion":{"nullable":true,"description":"Auto-fill suggestion built from ARCA padrón. `null` when the CUIT is not registered.","allOf":[{"$ref":"#/components/schemas/CuitLookupSuggestionDto"}]}},"required":["suggestion"]},"CustomerAccountRowResponseDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-01-15"},"kind":{"type":"string","enum":["receipt","credit_note","collection"],"description":"\"receipt\" = factura/nota débito (cargo), \"credit_note\" = nota crédito (crédito), \"collection\" = cobranza (crédito)"},"refId":{"type":"string","example":"a3b1c2d4-...","description":"ID of the source document (UUID for receipts, integer for collections)"},"description":{"type":"string","example":"Factura A 00001-00000123"},"debit":{"type":"number","example":12100,"description":"Amount the customer owes (invoices/debit notes)"},"credit":{"type":"number","example":0,"description":"Amount that reduces what the customer owes (NCs/collections)"},"balance":{"type":"number","example":12100,"description":"Running balance (positive = customer owes)"}},"required":["date","kind","refId","description","debit","credit","balance"]},"CustomerAccountResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerAccountRowResponseDto"}},"total":{"type":"number","example":42,"description":"Total number of movements (unpaged)"},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50},"openingBalance":{"type":"number","example":5000,"description":"Balance carried in from before `date_from` (positive = customer owes); 0 when no `date_from` is given. The first row's running balance starts here."},"finalBalance":{"type":"number","example":12100,"description":"Final running balance (positive = customer owes)"}},"required":["data","total","page","pageSize","openingBalance","finalBalance"]},"CreateCustomerDto":{"type":"object","properties":{"businessName":{"type":"string","example":"Distribuidora Norte SRL","description":"Customer's legal/business name. Required unless a valid `taxId` (CUIT) is provided — in that case it is auto-filled from ARCA's padrón."},"taxCategoryId":{"type":"number","example":8,"description":"Tax category id (combo). Must belong to the organization's regime — fetch valid ids via `GET /tax-categories`. Required unless a valid `taxId` (CUIT) is provided — in that case it is inferred from the customer's IVA condition in ARCA combined with the organization's regime."},"documentTypeId":{"type":"number","example":180,"description":"Document type id (combo). Fetch valid ids via `GET /combos/2/items`. When omitted, it is inferred from `taxId`: a valid 11-digit CUIT resolves to CUIT, 7–8 numeric digits resolve to DNI, anything else resolves to \"Sin identificar\"."},"taxId":{"type":"string","example":"30345678901","nullable":true,"description":"Tax ID (CUIT/CUIL/DNI). When 11 digits, validated as CUIT."},"address":{"type":"string","example":"Av. Corrientes 1234","nullable":true},"city":{"type":"string","example":"Buenos Aires","nullable":true},"postalCode":{"type":"string","example":"C1043AAZ","nullable":true},"phone":{"type":"string","example":"+54 11 4444-5555","nullable":true},"email":{"type":"string","example":"contacto@distribuidoranorte.com.ar","nullable":true},"masterId":{"type":"integer","example":1,"nullable":true,"description":"Economic group id (grupo económico) — must belong to the caller's organization. Used to scope shared price-list items (scope `G`)."},"priceListId":{"type":"integer","example":3,"nullable":true,"description":"Named price list (lista de precios) — must belong to the caller's organization and not be deleted. Invoices for this customer prefill from it; the customer's and its economic group's special prices still win. null = inherit the economic group's list."},"saleConditionId":{"type":"integer","example":1,"nullable":true,"description":"Default sale condition (combo) for this customer"},"locationId":{"type":"integer","example":1,"nullable":true,"description":"Location id"},"contractedSaleCondition":{"type":"integer","example":30,"nullable":true},"statisticalSaleCondition":{"type":"integer","example":30,"nullable":true},"isActive":{"type":"boolean","example":true,"default":true},"observations":{"type":"string","nullable":true},"ignoresTaxes":{"type":"boolean","nullable":true,"description":"When true, IVA is ignored on receipts for this customer"},"taxIdNumber":{"type":"string","example":"30345678901","nullable":true,"description":"Secondary tax id number, when applicable"},"providerId":{"type":"string","example":"ext-customer-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this customer). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"fiscalConfig":{"type":"object","example":{"subjectToWithholding":true,"equivalenceSurcharge":false},"nullable":true,"description":"Country-scoped RECIPIENT settings. ES: { subjectToWithholding, equivalenceSurcharge }. Scoped by the ORGANIZATION's country — an AR organization rejects any payload, and a Spanish organization billing a foreign customer still sets these (to false). Send null to clear."},"shippingAddress":{"type":"string","example":"Av. San Martín 456","nullable":true,"description":"Shipping/delivery address"},"shippingCity":{"type":"string","example":"Córdoba","nullable":true,"description":"Shipping city"},"shippingPostalCode":{"type":"string","example":"X5000","nullable":true,"description":"Shipping postal code"},"shippingLocationId":{"type":"integer","example":2,"nullable":true,"description":"Shipping location (province) id"}}},"UpdateCustomerDto":{"type":"object","properties":{"businessName":{"type":"string","example":"Distribuidora Norte SRL","description":"Customer's legal/business name. Required unless a valid `taxId` (CUIT) is provided — in that case it is auto-filled from ARCA's padrón."},"taxCategoryId":{"type":"number","example":8,"description":"Tax category id (combo). Must belong to the organization's regime — fetch valid ids via `GET /tax-categories`. Required unless a valid `taxId` (CUIT) is provided — in that case it is inferred from the customer's IVA condition in ARCA combined with the organization's regime."},"documentTypeId":{"type":"number","example":180,"description":"Document type id (combo). Fetch valid ids via `GET /combos/2/items`. When omitted, it is inferred from `taxId`: a valid 11-digit CUIT resolves to CUIT, 7–8 numeric digits resolve to DNI, anything else resolves to \"Sin identificar\"."},"taxId":{"type":"string","example":"30345678901","nullable":true,"description":"Tax ID (CUIT/CUIL/DNI). When 11 digits, validated as CUIT."},"address":{"type":"string","example":"Av. Corrientes 1234","nullable":true},"city":{"type":"string","example":"Buenos Aires","nullable":true},"postalCode":{"type":"string","example":"C1043AAZ","nullable":true},"phone":{"type":"string","example":"+54 11 4444-5555","nullable":true},"email":{"type":"string","example":"contacto@distribuidoranorte.com.ar","nullable":true},"masterId":{"type":"integer","example":1,"nullable":true,"description":"Economic group id (grupo económico) — must belong to the caller's organization. Used to scope shared price-list items (scope `G`)."},"priceListId":{"type":"integer","example":3,"nullable":true,"description":"Named price list (lista de precios) — must belong to the caller's organization and not be deleted. Invoices for this customer prefill from it; the customer's and its economic group's special prices still win. null = inherit the economic group's list."},"saleConditionId":{"type":"integer","example":1,"nullable":true,"description":"Default sale condition (combo) for this customer"},"locationId":{"type":"integer","example":1,"nullable":true,"description":"Location id"},"contractedSaleCondition":{"type":"integer","example":30,"nullable":true},"statisticalSaleCondition":{"type":"integer","example":30,"nullable":true},"isActive":{"type":"boolean","example":true,"default":true},"observations":{"type":"string","nullable":true},"ignoresTaxes":{"type":"boolean","nullable":true,"description":"When true, IVA is ignored on receipts for this customer"},"taxIdNumber":{"type":"string","example":"30345678901","nullable":true,"description":"Secondary tax id number, when applicable"},"providerId":{"type":"string","example":"ext-customer-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this customer). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"fiscalConfig":{"type":"object","example":{"subjectToWithholding":true,"equivalenceSurcharge":false},"nullable":true,"description":"Country-scoped RECIPIENT settings. ES: { subjectToWithholding, equivalenceSurcharge }. Scoped by the ORGANIZATION's country — an AR organization rejects any payload, and a Spanish organization billing a foreign customer still sets these (to false). Send null to clear."},"shippingAddress":{"type":"string","example":"Av. San Martín 456","nullable":true,"description":"Shipping/delivery address"},"shippingCity":{"type":"string","example":"Córdoba","nullable":true,"description":"Shipping city"},"shippingPostalCode":{"type":"string","example":"X5000","nullable":true,"description":"Shipping postal code"},"shippingLocationId":{"type":"integer","example":2,"nullable":true,"description":"Shipping location (province) id"}}},"SalesReceiptCreatorResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"fullName":{"type":"string","nullable":true,"example":"John Doe"}},"required":["id","fullName"]},"DashboardKpisResponseDto":{"type":"object","properties":{"totalInvoiced":{"type":"number","example":1500000,"description":"Total invoiced amount in the date range"},"receiptCount":{"type":"number","example":145,"description":"Receipt count in the date range"},"pendingCollection":{"type":"number","example":250000,"description":"Pending collection amount"},"previousPeriodTotal":{"type":"number","example":1200000,"description":"Total invoiced in previous comparable period"},"previousPeriodCount":{"type":"number","example":130,"description":"Receipt count in previous period (only present in summary_only mode)"}},"required":["totalInvoiced","receiptCount","pendingCollection","previousPeriodTotal"]},"StatusBreakdownRowResponseDto":{"type":"object","properties":{"status":{"type":"string","example":"Creada"},"count":{"type":"number","example":130},"total":{"type":"number","example":1450000}},"required":["status","count","total"]},"TimeSeriesRowResponseDto":{"type":"object","properties":{"period":{"type":"string","example":"2026-01-15","description":"Period start (YYYY-MM-DD or YYYY-MM)"},"count":{"type":"number","example":12},"total":{"type":"number","example":145000}},"required":["period","count","total"]},"TopCustomerRowResponseDto":{"type":"object","properties":{"customerId":{"type":"number","example":1},"customerName":{"type":"string","example":"Cliente S.A."},"receiptCount":{"type":"number","example":25},"total":{"type":"number","example":350000}},"required":["customerId","customerName","receiptCount","total"]},"RecentReceiptRowResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"date":{"type":"string","example":"2026-01-15"},"number":{"type":"string","example":"00001-00000123"},"customerName":{"type":"string","example":"Cliente S.A."},"total":{"type":"number","example":1210},"status":{"type":"string","example":"Creada"},"letter":{"type":"string","example":"A"}},"required":["id","date","number","customerName","total","status","letter"]},"ReceiptBookCountRowResponseDto":{"type":"object","properties":{"receiptBookId":{"type":"number","example":1},"receiptBookName":{"type":"string","example":"Talonario A"},"count":{"type":"number","example":145}},"required":["receiptBookId","receiptBookName","count"]},"DashboardStatsResponseDto":{"type":"object","properties":{"kpis":{"$ref":"#/components/schemas/DashboardKpisResponseDto"},"statusBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/StatusBreakdownRowResponseDto"}},"timeSeries":{"description":"Aggregated by group_by parameter (day | week | month)","type":"array","items":{"$ref":"#/components/schemas/TimeSeriesRowResponseDto"}},"monthlySeries":{"description":"Always aggregated by month","type":"array","items":{"$ref":"#/components/schemas/TimeSeriesRowResponseDto"}},"topCustomers":{"type":"array","items":{"$ref":"#/components/schemas/TopCustomerRowResponseDto"}},"trailing12MonthsTotal":{"type":"number","example":14500000},"recentReceipts":{"type":"array","items":{"$ref":"#/components/schemas/RecentReceiptRowResponseDto"}},"sameMonthLastYearTotal":{"type":"number","example":1100000},"countByReceiptBook":{"type":"array","items":{"$ref":"#/components/schemas/ReceiptBookCountRowResponseDto"}}},"required":["kpis","statusBreakdown","timeSeries","monthlySeries","topCustomers","trailing12MonthsTotal","recentReceipts","sameMonthLastYearTotal","countByReceiptBook"]},"VatSalesBookRowResponseDto":{"type":"object","properties":{"fecha":{"type":"string","example":"2026-01-15"},"razonSocial":{"type":"string","example":"Cliente S.A."},"cuit":{"type":"string","example":"20123456789"},"comprobante":{"type":"string","example":"Factura A"},"letraNumero":{"type":"string","example":"A 00001-00000123"},"importeExento":{"type":"number","example":0},"importeNoGravado":{"type":"number","example":0},"importeGravado":{"type":"number","example":1000},"importeIVA105":{"type":"number","example":0},"importeIVA21":{"type":"number","example":210},"importeIVA27":{"type":"number","example":0},"percepcionIIBB":{"type":"number","example":0},"percepcionIIBBArba":{"type":"number","example":0},"percepcionIIBBCaba":{"type":"number","example":0},"percepcionIVA":{"type":"number","example":0},"iva":{"type":"number","example":210},"total":{"type":"number","example":1210},"subTotal":{"type":"number","example":1000},"observacion":{"type":"string","nullable":true,"example":null},"estado":{"type":"string","example":"Creada"},"moneda":{"type":"string","example":"USD","description":"Foreign-currency receipts only: currency of the receipt (amounts are in pesos at `cotizacion`)"},"cotizacion":{"type":"number","example":1234.5,"description":"Foreign-currency receipts only: exchange rate applied"}},"required":["fecha","razonSocial","cuit","comprobante","letraNumero","importeExento","importeNoGravado","importeGravado","importeIVA105","importeIVA21","importeIVA27","percepcionIIBB","percepcionIIBBArba","percepcionIIBBCaba","percepcionIVA","iva","total","subTotal","observacion","estado"]},"VatSalesBookPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/VatSalesBookRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"ReportColumnResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"base21","description":"Row key this column reads"},"label":{"type":"string","example":"Base 21%","description":"Column header to display"}},"required":["id","label"]},"EsVatSalesBookRowResponseDto":{"type":"object","properties":{"fecha":{"type":"string","example":"15/01/2026","description":"DD/MM/YYYY"},"serieNumero":{"type":"string","example":"2026-000012","description":"Serie and number as issued"},"tipo":{"type":"string","example":"F1","description":"Document kind code: F1, F2, F3, R1–R5"},"tipoDescripcion":{"type":"string","example":"Factura"},"nif":{"type":"string","example":"B12345678"},"cliente":{"type":"string","example":"Cliente S.L."},"base21":{"type":"number","example":1000},"cuota21":{"type":"number","example":210},"base10":{"type":"number","example":0},"cuota10":{"type":"number","example":0},"base4":{"type":"number","example":0},"cuota4":{"type":"number","example":0},"baseOtrosTipos":{"type":"number","example":0,"description":"IVA base at any rate other than 21/10/4"},"cuotaOtrosTipos":{"type":"number","example":0,"description":"IVA cuota at any rate other than 21/10/4"},"recargoEquivalencia":{"type":"number","example":0,"description":"Cuota of the recargo de equivalencia (its base is the IVA base of the same rate)"},"baseExenta":{"type":"number","example":0,"description":"Exempt base (art. 20) plus exports / intra-EU supplies"},"baseNoSujeta":{"type":"number","example":0,"description":"Base not subject to IVA (art. 7)"},"baseInversionSujetoPasivo":{"type":"number","example":0,"description":"Base under reverse charge (inversión del sujeto pasivo)"},"retencionIrpf":{"type":"number","example":150,"description":"IRPF withheld; already subtracted from total"},"total":{"type":"number","example":1060},"estado":{"type":"string","example":"Creada"},"observacion":{"type":"string","nullable":true,"example":null}},"required":["fecha","serieNumero","tipo","tipoDescripcion","nif","cliente","base21","cuota21","base10","cuota10","base4","cuota4","baseOtrosTipos","cuotaOtrosTipos","recargoEquivalencia","baseExenta","baseNoSujeta","baseInversionSujetoPasivo","retencionIrpf","total","estado","observacion"]},"EsVatSalesBookPageResponseDto":{"type":"object","properties":{"layout":{"type":"string","enum":["ES"],"example":"ES"},"columns":{"description":"Columns to render, in order. Each `id` is a key of every row in `data`; `label` is the Spanish header. Sent on every page (also an empty one) so the table is fully driven by the response.","type":"array","items":{"$ref":"#/components/schemas/ReportColumnResponseDto"}},"data":{"type":"array","items":{"$ref":"#/components/schemas/EsVatSalesBookRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["layout","columns","data","nextCursor","hasMore"]},"SalesByProductRowResponseDto":{"type":"object","properties":{"idArticulo":{"type":"number","example":1},"descripcion":{"type":"string","example":"Camiseta Talle M"},"cantidad":{"type":"number","example":25},"total":{"type":"number","example":12500},"cost":{"type":"number","nullable":true,"example":7500,"description":"Sum of quantity × unit cost snapshotted on each line at confirmation (credit notes subtract). Null when no line in the group has a cost."},"margin":{"type":"number","nullable":true,"example":5000,"description":"total − cost. Null when cost is null."},"marginPct":{"type":"number","nullable":true,"example":0.4,"description":"margin / total (0.4 = 40%). Null when cost is null or total is 0."},"costCoverage":{"type":"number","nullable":true,"example":1,"description":"Fraction (0–1) of the sold quantity whose lines carry a cost. Below 1 the cost and margin are partial. Null when the group sold no quantity."},"mes":{"type":"number","example":1,"description":"Month number (1–12)"},"year":{"type":"number","example":2026}},"required":["idArticulo","descripcion","cantidad","total","cost","margin","marginPct","costCoverage","mes","year"]},"SalesByProductPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesByProductRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJtb250aCI6MX0="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"SalesByProductBarcodeRowResponseDto":{"type":"object","properties":{"sourceBarcode":{"type":"string","example":"7798165242344"},"storedBarcode":{"type":"string","example":"07798165242344"},"productId":{"type":"number","example":123},"description":{"type":"string","example":"Producto PEYA"},"taxTypeId":{"type":"number","nullable":true,"example":93},"quantity":{"type":"number","example":25},"netTotal":{"type":"number","example":1000},"grossTotal":{"type":"number","example":1105},"vatTotal":{"type":"number","example":105},"lineCount":{"type":"number","example":10},"receiptCount":{"type":"number","example":8}},"required":["sourceBarcode","storedBarcode","productId","description","taxTypeId","quantity","netTotal","grossTotal","vatTotal","lineCount","receiptCount"]},"SalesByProductBarcodePageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesByProductBarcodeRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJiIjoiNzc5ODE2NTI0MjM0NCJ9"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"SalesByCustomerRowResponseDto":{"type":"object","properties":{"clienteId":{"type":"number","example":1},"cliente":{"type":"string","example":"Cliente S.A."},"cantidad":{"type":"number","example":12,"description":"Number of receipts"},"subtotal":{"type":"number","example":100000},"total":{"type":"number","example":121000}},"required":["clienteId","cliente","cantidad","subtotal","total"]},"SalesByCustomerPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesByCustomerRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJ0b3RhbCI6MTAwfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"OutstandingReceivableRowResponseDto":{"type":"object","properties":{"cliente":{"type":"string","example":"Cliente S.A."},"fecha":{"type":"string","example":"2026-01-15"},"fechaVencimiento":{"type":"string","example":"2026-01-30"},"comprobante":{"type":"string","example":"00001-00000123"},"tipoComprobante":{"type":"string","example":"Factura A"},"importe":{"type":"number","example":1210},"contactoCobro":{"type":"string","nullable":true,"example":"cobranzas@cliente.com"},"observacion":{"type":"string","nullable":true,"example":null}},"required":["cliente","fecha","fechaVencimiento","comprobante","tipoComprobante","importe","contactoCobro","observacion"]},"OutstandingReceivablesAgingDto":{"type":"object","properties":{"current":{"type":"number","example":300000,"description":"Not due yet (due today or later)"},"days1To30":{"type":"number","example":150000,"description":"1 to 30 days past due"},"days31To60":{"type":"number","example":80000,"description":"31 to 60 days past due"},"days61To90":{"type":"number","example":0,"description":"61 to 90 days past due"},"over90":{"type":"number","example":410000,"description":"More than 90 days past due"}},"required":["current","days1To30","days31To60","days61To90","over90"]},"OutstandingReceivablesDebtorDto":{"type":"object","properties":{"customerId":{"type":"integer","nullable":true,"example":2033},"customerName":{"type":"string","example":"Cliente S.A."},"totalPending":{"type":"number","example":450000,"description":"Total pending balance of the customer"},"overdue":{"type":"number","example":150000,"description":"Part of the pending balance already past due"},"receiptCount":{"type":"number","example":2},"oldestOverdueDueDate":{"type":"string","nullable":true,"example":"2026-09-23","description":"Due date (YYYY-MM-DD) of the customer's oldest overdue receipt; null when nothing is overdue"}},"required":["customerId","customerName","totalPending","overdue","receiptCount","oldestOverdueDueDate"]},"OutstandingReceivablesSummaryDto":{"type":"object","properties":{"asOf":{"type":"string","example":"2026-10-03","description":"Argentina calendar day the aging is computed against (today)"},"receiptCount":{"type":"number","example":37},"customerCount":{"type":"number","example":12},"totalPending":{"type":"number","example":940000,"description":"Total pending collection (credit notes subtract)"},"overdue":{"type":"number","example":640000,"description":"Pending balance whose due date is before asOf"},"notYetDue":{"type":"number","example":300000,"description":"Pending balance due on asOf or later"},"aging":{"$ref":"#/components/schemas/OutstandingReceivablesAgingDto"},"topDebtors":{"description":"Top 10 customers by overdue amount, then by total pending","type":"array","items":{"$ref":"#/components/schemas/OutstandingReceivablesDebtorDto"}}},"required":["asOf","receiptCount","customerCount","totalPending","overdue","notYetDue","aging","topDebtors"]},"OutstandingReceivablePageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OutstandingReceivableRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6IjAwMDFhIn0="},"hasMore":{"type":"boolean","example":false},"summary":{"nullable":true,"description":"Totals over the whole outstanding set (not just this page). Present on the first page (no cursor) and with summary_only; null on later pages.","allOf":[{"$ref":"#/components/schemas/OutstandingReceivablesSummaryDto"}]}},"required":["data","nextCursor","hasMore","summary"]},"ReceivablesAgingBucketDto":{"type":"object","properties":{"key":{"type":"string","enum":["current","days1To30","days31To60","days61To90","over90"],"example":"days1To30","description":"current = not due yet (due today or later); days1To30 / days31To60 / days61To90 / over90 = days past the due date"},"total":{"type":"number","example":150000,"description":"Pending balance in the bucket (credit notes subtract)"},"count":{"type":"integer","example":4,"description":"Receipts with a pending balance in the bucket"}},"required":["key","total","count"]},"ReceivablesAgingDebtorDto":{"type":"object","properties":{"customerId":{"type":"integer","nullable":true,"example":2033},"customerName":{"type":"string","example":"Cliente S.A."},"overdue":{"type":"number","example":150000,"description":"Overdue pending balance of the customer"},"receiptCount":{"type":"integer","example":2,"description":"Overdue receipts of the customer"}},"required":["customerId","customerName","overdue","receiptCount"]},"ReceivablesUpcomingHorizonDto":{"type":"object","properties":{"key":{"type":"string","enum":["within30","within60","within90"],"example":"within30","description":"Cumulative horizon: within30 / within60 / within90 = due from `asOf` through `asOf` + 30 / 60 / 90 days (inclusive)"},"total":{"type":"number","example":120000,"description":"Pending balance falling due in the horizon (credit notes subtract)"},"count":{"type":"integer","example":3,"description":"Receipts with a pending balance falling due in the horizon"}},"required":["key","total","count"]},"ReceivablesAgingResponseDto":{"type":"object","properties":{"asOf":{"type":"string","example":"2026-10-03","description":"Argentina calendar day the aging is computed against (today)"},"total":{"type":"number","example":940000,"description":"Total pending collection — the same figure as the dashboard's pendingCollection"},"count":{"type":"integer","example":37,"description":"Receipts with a pending balance"},"buckets":{"description":"Always five buckets in order: current, days1To30, days31To60, days61To90, over90 (zero-filled)","type":"array","items":{"$ref":"#/components/schemas/ReceivablesAgingBucketDto"}},"topDebtors":{"description":"Top 5 customers by overdue balance (customers with nothing overdue are left out)","type":"array","items":{"$ref":"#/components/schemas/ReceivablesAgingDebtorDto"}},"upcoming":{"description":"Cash-flow horizons over the not-yet-due balance: always three cumulative entries in order within30, within60, within90 (zero-filled). Each is a subset of the `current` bucket.","type":"array","items":{"$ref":"#/components/schemas/ReceivablesUpcomingHorizonDto"}}},"required":["asOf","total","count","buckets","topDebtors","upcoming"]},"IIBBRowResponseDto":{"type":"object","properties":{"codigo":{"type":"string","example":"BSAS","description":"Jurisdiction code"},"descripcion":{"type":"string","example":"Buenos Aires"},"cantidad":{"type":"number","example":12},"total":{"type":"number","example":50000},"mes":{"type":"number","example":1,"description":"Month number (1–12)"},"year":{"type":"number","example":2026}},"required":["codigo","descripcion","cantidad","total","mes","year"]},"IIBBPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IIBBRowResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJtb250aCI6MX0="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"RevenueTrendRowResponseDto":{"type":"object","properties":{"period":{"type":"string","example":"2026-01","description":"YYYY-MM period"},"total":{"type":"number","example":125000},"count":{"type":"number","example":12,"description":"Number of receipts in this period"},"isForecast":{"type":"boolean","example":false,"description":"Whether this point is a forecast (last 3 entries)"}},"required":["period","total","count","isForecast"]},"RevenueTrendsResponseDto":{"type":"object","properties":{"trends":{"type":"array","items":{"$ref":"#/components/schemas/RevenueTrendRowResponseDto"}},"momChange":{"type":"number","nullable":true,"example":12.5,"description":"Month-over-month percentage change (null if no comparison available)"},"yoyChange":{"type":"number","nullable":true,"example":30.2,"description":"Year-over-year percentage change (null if no comparison available)"},"currentMonthTotal":{"type":"number","example":125000},"previousMonthTotal":{"type":"number","example":111000},"sameMonthLastYearTotal":{"type":"number","example":96000}},"required":["trends","momChange","yoyChange","currentMonthTotal","previousMonthTotal","sameMonthLastYearTotal"]},"MonotributoOrganizacionDto":{"type":"object","properties":{"razonSocial":{"type":"string","example":"Juan Pérez"},"cuit":{"type":"object","example":"20123456789","nullable":true}},"required":["razonSocial","cuit"]},"MonotributoPeriodoDto":{"type":"object","properties":{"label":{"type":"string","example":"1er semestre 2026 (Ene–Jun)"},"dateFrom":{"type":"string","example":"2026-01-01"},"dateTo":{"type":"string","example":"2026-06-30"}},"required":["label","dateFrom","dateTo"]},"MonotributoCategoriaDto":{"type":"object","properties":{"letra":{"type":"object","example":"D","nullable":true,"description":"Letra A–K normalizada del monotax_category actual, o null si el valor almacenado no tiene equivalente A–K."},"limiteAnual":{"type":"object","example":26212853.42,"nullable":true,"description":"Límite anual de ingresos brutos de la categoría, según la escala vigente a la fecha de fin del período. null si la letra es desconocida."},"caveat":{"type":"string","example":"categoría actual, no la vigente durante el período — sólo 1 de las 4 variables de ARCA","description":"Aclaración obligatoria: la categoría mostrada es la actual del contribuyente, no necesariamente la que estuvo vigente durante el período declarado, y no equivale al total facturado."}},"required":["letra","limiteAnual","caveat"]},"MonotributoClienteDto":{"type":"object","properties":{"razonSocial":{"type":"string","example":"Cliente S.A."},"cuit":{"type":"object","example":"30712345678","nullable":true},"total":{"type":"number","example":1500000},"cantidad":{"type":"number","example":12}},"required":["razonSocial","cuit","total","cantidad"]},"MonotributoVentasDto":{"type":"object","properties":{"total":{"type":"number","example":4500000},"cantidad":{"type":"number","example":87},"topClientes":{"type":"array","items":{"$ref":"#/components/schemas/MonotributoClienteDto"}}},"required":["total","cantidad","topClientes"]},"MonotributoProveedorDto":{"type":"object","properties":{"razonSocial":{"type":"string","example":"Proveedor S.R.L."},"cuit":{"type":"object","example":"30711111119","nullable":true},"total":{"type":"number","example":800000},"cantidad":{"type":"number","example":9}},"required":["razonSocial","cuit","total","cantidad"]},"MonotributoComprasDto":{"type":"object","properties":{"total":{"type":"number","example":1200000},"cantidad":{"type":"number","example":34},"topProveedores":{"type":"array","items":{"$ref":"#/components/schemas/MonotributoProveedorDto"}}},"required":["total","cantidad","topProveedores"]},"MonotributoDeclaracionResponseDto":{"type":"object","properties":{"organizacion":{"$ref":"#/components/schemas/MonotributoOrganizacionDto"},"periodo":{"$ref":"#/components/schemas/MonotributoPeriodoDto"},"categoria":{"$ref":"#/components/schemas/MonotributoCategoriaDto"},"ventas":{"$ref":"#/components/schemas/MonotributoVentasDto"},"compras":{"$ref":"#/components/schemas/MonotributoComprasDto"},"serviciosPublicos":{"type":"object","additionalProperties":true,"nullable":true,"default":null,"example":null,"description":"Energía eléctrica, alquileres devengados y superficie afectada — NO rastreados en v2. Siempre null hasta que exista carga manual (FB-5 follow-up)."}},"required":["organizacion","periodo","categoria","ventas","compras","serviciosPublicos"]},"ApplicationReceiptSlimResponseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"letter":{"type":"string","example":"A"},"number":{"type":"string","example":"00001-00000123"},"status":{"type":"string","example":"Creada"},"total":{"type":"number","example":1210},"totalPaid":{"type":"number","example":500},"typeId":{"type":"number","example":83},"supplierId":{"type":"number","example":1}},"required":["id","letter","number","status","total","totalPaid","typeId","supplierId"]},"PurchaseReceiptApplicationFxResponseDto":{"type":"object","properties":{"currencyId":{"type":"number","example":2,"description":"Currency of the foreign side"},"foreignSide":{"type":"string","example":"receipt","enum":["credit_note","receipt"],"description":"Which receipt is in the foreign currency"},"exchangeRate":{"type":"number","example":1100,"description":"Rate of the application"},"historicalRate":{"type":"number","example":1000,"description":"The foreign receipt's own (historical) rate"},"foreignAmount":{"type":"number","example":500,"description":"Units the foreign side moved (amount / exchangeRate)"},"fxDifference":{"type":"number","example":50000,"description":"Organization currency: historical value of the credit consumed − historical value of the debt cancelled (> 0 loss, < 0 gain)"},"journalEntryId":{"type":"integer","nullable":true,"example":812,"description":"Journal entry posting the difference (organizations with accounting)"}},"required":["currencyId","foreignSide","exchangeRate","historicalRate","foreignAmount","fxDifference","journalEntryId"]},"PurchaseReceiptApplicationResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"creditNoteId":{"type":"number","example":20},"appliedReceiptId":{"type":"number","example":12},"date":{"type":"string","example":"2026-07-09T00:00:00.000Z"},"amount":{"type":"number","nullable":true,"example":500},"creditNote":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ApplicationReceiptSlimResponseDto"}]},"appliedReceipt":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ApplicationReceiptSlimResponseDto"}]},"fx":{"description":"Only for an application between currencies (PAN-392b). Absent otherwise.","allOf":[{"$ref":"#/components/schemas/PurchaseReceiptApplicationFxResponseDto"}]}},"required":["id","creditNoteId","appliedReceiptId","date","amount"]},"CreatePurchaseReceiptApplicationDto":{"type":"object","properties":{"creditNoteId":{"type":"number","example":20,"description":"Credit note purchase receipt id (type NOTA_CREDITO)"},"appliedReceiptId":{"type":"number","example":12,"description":"Invoice purchase receipt id to discount"},"amount":{"type":"number","example":500,"description":"Amount to apply (> 0), in the receipts' currency; between currencies, in the organization's currency (see exchangeRate)."},"date":{"type":"string","example":"2026-07-09","description":"Application date (defaults to now)"},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."},"exchangeRate":{"type":"number","example":1100,"description":"Only when the credit note and the invoice are in different currencies (one of them in the organization's currency): rate of the application (organization-currency units per unit of the foreign side). `amount` is then in the organization's currency and the foreign side moves amount / exchangeRate; the difference with its historical rate is posted as an exchange difference. Omitted: the official AFIP rate cached for the application date, only for organizations in pesos (EXCHANGE_RATE_REQUIRED otherwise). Ignored for same-currency applications."}},"required":["creditNoteId","appliedReceiptId","amount"]},"ScanExtractedLineItemDto":{"type":"object","properties":{"description":{"type":"string"},"quantity":{"type":"number","nullable":true},"unitPrice":{"type":"number","nullable":true},"amount":{"type":"number"},"vatRatePercent":{"type":"number","nullable":true}},"required":["description","quantity","unitPrice","amount","vatRatePercent"]},"ScanExtractedInvoiceDto":{"type":"object","properties":{"supplierName":{"type":"object","nullable":true},"supplierCuit":{"type":"object","nullable":true},"supplierTaxCondition":{"type":"object","nullable":true},"letter":{"type":"object","nullable":true},"receiptTypeHint":{"type":"object","nullable":true},"pointOfSale":{"type":"object","nullable":true},"number":{"type":"object","nullable":true},"date":{"type":"object","nullable":true},"dueDate":{"type":"object","nullable":true},"currency":{"type":"object","nullable":true,"description":"ISO 4217 code, e.g. \"ARS\", \"USD\". Map it to a currency id with GET /currencies (abbreviation) and send it as `currencyId`."},"exchangeRate":{"type":"number","nullable":true,"description":"Exchange rate printed on a foreign-currency invoice, if any; send it as `exchangeRate`."},"lineItems":{"type":"array","items":{"$ref":"#/components/schemas/ScanExtractedLineItemDto"}},"subtotal":{"type":"number","nullable":true},"vat105":{"type":"number","nullable":true},"vat21":{"type":"number","nullable":true},"vat27":{"type":"number","nullable":true},"exemptAmount":{"type":"number","nullable":true},"nonTaxableAmount":{"type":"number","nullable":true},"grossIncomePerceptions":{"type":"number","nullable":true},"vatPerceptions":{"type":"number","nullable":true},"profitPerceptions":{"type":"number","nullable":true},"vatTotal":{"type":"number","nullable":true},"total":{"type":"number","nullable":true},"paymentCondition":{"type":"object","nullable":true},"confidence":{"type":"number"},"notes":{"type":"object","nullable":true}},"required":["supplierName","supplierCuit","supplierTaxCondition","letter","receiptTypeHint","pointOfSale","number","date","dueDate","currency","exchangeRate","lineItems","subtotal","vat105","vat21","vat27","exemptAmount","nonTaxableAmount","grossIncomePerceptions","vatPerceptions","profitPerceptions","vatTotal","total","paymentCondition","confidence","notes"]},"ScanSupplierMatchDto":{"type":"object","properties":{"id":{"type":"number"},"businessName":{"type":"string"},"taxId":{"type":"string"}},"required":["id","businessName","taxId"]},"ScanAttachmentDto":{"type":"object","properties":{"id":{"type":"number"},"originalFilename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"number"},"signedUrl":{"type":"string","description":"Short-lived signed download URL (1h)"}},"required":["id","originalFilename","contentType","sizeBytes","signedUrl"]},"PurchaseInvoiceScanResponseDto":{"type":"object","properties":{"extracted":{"$ref":"#/components/schemas/ScanExtractedInvoiceDto"},"supplierMatch":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ScanSupplierMatchDto"}]},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/ScanAttachmentDto"}}},"required":["extracted","supplierMatch","attachments"]},"PurchaseReceiptTaxBreakdownLineDto":{"type":"object","properties":{"kind":{"type":"string","enum":["IVA","IRPF"],"example":"IVA"},"rate":{"type":"number","example":21,"description":"Rate as a percentage"},"base":{"type":"number","example":1000,"description":"Net base the rate applied to, post-discount"},"amount":{"type":"number","example":210,"description":"Amount produced. Always >= 0 (IRPF too: it is subtracted from the total)."},"exemptionReason":{"type":"string","example":"Operación exenta de IVA (art. 20 Ley 37/1992)","description":"Legal cause of a 0% row: 924 Exento or 925 No sujeto."}},"required":["kind","rate","base","amount"]},"PurchaseReceiptSupplierResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Proveedor S.A."},"taxId":{"type":"string","nullable":true,"example":"30123456789"},"taxCategoryId":{"type":"number","example":1}},"required":["id","businessName","taxId","taxCategoryId"]},"PurchaseReceiptComboItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"data":{"type":"string","example":"Factura A"},"afipData":{"type":"string","nullable":true,"example":"1"},"additionalData":{"type":"string","nullable":true,"example":null},"comboId":{"type":"number","example":5},"isActive":{"type":"boolean","example":true}},"required":["id","data","afipData","additionalData","comboId","isActive"]},"PurchaseReceiptCategoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Insumos de oficina"},"accountId":{"type":"number","example":42}},"required":["id","description","accountId"]},"PurchaseReceiptProductResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"barcode":{"type":"string","nullable":true,"example":"7791234567890"},"description":{"type":"string","example":"Camiseta Talle M"}},"required":["id","barcode","description"]},"PurchaseReceiptDetailResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Servicio de hosting"},"total":{"type":"number","example":1000,"description":"Line NET total, after the line discount (VAT in `vat`)"},"unitPrice":{"type":"number","nullable":true,"example":1000,"description":"Net unit price before the line discount"},"quantity":{"type":"number","nullable":true,"example":1},"vat":{"type":"number","example":210},"discount":{"type":"integer","nullable":true,"example":null,"description":"Line discount percent (0–100); null = none"},"discountAmount":{"type":"number","nullable":true,"example":null,"description":"Line discount as an absolute net amount; null = none"},"purchaseReceiptId":{"type":"number","example":1},"taxTypeId":{"type":"number","example":1,"description":"Combo item id (TipoIva)"},"purchaseCategoryId":{"type":"integer","nullable":true,"example":1},"productId":{"type":"integer","nullable":true,"example":null},"taxType":{"$ref":"#/components/schemas/PurchaseReceiptComboItemResponseDto"},"purchaseCategory":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PurchaseReceiptCategoryResponseDto"}]},"product":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PurchaseReceiptProductResponseDto"}]}},"required":["id","description","total","unitPrice","quantity","vat","discount","discountAmount","purchaseReceiptId","taxTypeId","purchaseCategoryId","productId","taxType","purchaseCategory","product"]},"PurchaseReceiptResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"accountingDate":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"dueDate":{"type":"string","example":"2026-02-14T00:00:00.000Z"},"letter":{"type":"string","example":"A"},"number":{"type":"string","example":"00001-00000123"},"status":{"type":"string","example":"EMITIDO","description":"EMITIDO | ANULADO"},"subtotal":{"type":"number","example":1000},"vat":{"type":"number","example":210},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":210},"vat27":{"type":"number","example":0},"exemptAmount":{"type":"number","example":0},"nonTaxableAmount":{"type":"number","example":0},"total":{"type":"number","example":1210},"totalPaid":{"type":"number","example":0,"description":"Amount paid against this receipt"},"grossIncomePerceptions":{"type":"number","example":0},"vatPerceptions":{"type":"number","example":0},"profitPerceptions":{"type":"number","nullable":true,"example":null},"taxBreakdown":{"nullable":true,"description":"Spain: per-rate detail of the supplier invoice — one `IVA` row per tax code (highest rate first) and one `IRPF` row when there is a withholding. NULL on Argentine receipts (they use the `vat*` columns) and on Spanish receipts created without lines.","type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptTaxBreakdownLineDto"}},"withholdingTotal":{"type":"number","example":0,"description":"Spain: IRPF withheld from the supplier, stored POSITIVE and ALREADY SUBTRACTED from `total` — never subtract it again. 0 when nothing is withheld (always 0 in Argentina)."},"observation":{"type":"string","nullable":true,"example":null},"supplierId":{"type":"number","example":1},"typeId":{"type":"number","example":1,"description":"Combo item id (TipoComprobanteCompra)"},"purchaseConditionId":{"type":"number","example":1,"description":"Combo item id (CondicionCompraVenta)"},"journalEntryId":{"type":"integer","nullable":true,"example":null},"currencyId":{"type":"integer","nullable":true,"example":1,"description":"Currency id. null (receipts created before currencies existed) = the organization's currency."},"exchangeRate":{"type":"number","nullable":true,"example":1,"description":"Organization-currency units per unit of `currencyId`. null = 1."},"supplier":{"$ref":"#/components/schemas/PurchaseReceiptSupplierResponseDto"},"type":{"$ref":"#/components/schemas/PurchaseReceiptComboItemResponseDto"},"purchaseCondition":{"$ref":"#/components/schemas/PurchaseReceiptComboItemResponseDto"},"details":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptDetailResponseDto"}},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse the receipt's stock movement went to; null = the primary warehouse. Only in `GET /purchase-receipts/:id`, for organizations with more than one warehouse."}},"required":["id","date","accountingDate","dueDate","letter","number","status","subtotal","vat","vat105","vat21","vat27","exemptAmount","nonTaxableAmount","total","totalPaid","grossIncomePerceptions","vatPerceptions","profitPerceptions","taxBreakdown","withholdingTotal","observation","supplierId","typeId","purchaseConditionId","journalEntryId","currencyId","exchangeRate","supplier","type","purchaseCondition","details"]},"PurchaseReceiptPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"PurchaseReceiptDetailInputDto":{"type":"object","properties":{"description":{"type":"string","example":"Servicio de hosting"},"total":{"type":"number","example":1000,"description":"Line NET total (VAT travels in `vat`), after the line discount. Send 0 to auto-calculate from quantity * unitPrice. Derived server-side (the sent value is ignored) when the line has `discount`/`discountAmount`, and normalized from gross when the request sets `pricesIncludeVat` (then `total` is gross on a line without `unitPrice`)."},"unitPrice":{"type":"number","nullable":true,"example":1000,"description":"Unit price before the line discount. Net of VAT, or gross when the request sets `pricesIncludeVat` (stored net)."},"quantity":{"type":"number","nullable":true,"example":1},"vat":{"type":"number","example":210,"description":"VAT amount for this line, on the discounted net. Omitted = round2(net × rate of `taxTypeId`; 0 on letters C/E). Ignored (derived as gross − net) when the request sets `pricesIncludeVat`."},"taxTypeId":{"type":"number","example":1,"description":"Combo item id (TipoIva). Spain: 921 IVA 21%, 922 IVA 10%, 923 IVA 4%, 924 Exento, 925 No sujeto (926 ISP / 927 intracomunitaria are rejected: ES_PURCHASE_REVERSE_CHARGE_NOT_SUPPORTED)."},"purchaseCategoryId":{"type":"integer","nullable":true,"example":1},"productId":{"type":"integer","nullable":true,"example":null},"discount":{"type":"integer","nullable":true,"example":10,"description":"Line discount percent (integer, 0–100) of quantity × unitPrice, applied before VAT. Mutually exclusive with `discountAmount` (DISCOUNT_AND_AMOUNT_MUTUALLY_EXCLUSIVE); needs quantity and unitPrice (DISCOUNT_REQUIRES_UNIT_PRICE)."},"discountAmount":{"type":"number","nullable":true,"example":50,"description":"Line discount as an absolute amount (same units as unitPrice: net, or gross with `pricesIncludeVat`; stored net), capped at the line. Mutually exclusive with `discount`."}},"required":["description","total","taxTypeId"]},"CreatePurchaseReceiptDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T00:00:00.000Z","description":"Receipt date"},"accountingDate":{"format":"date-time","type":"string","example":"2026-01-15T00:00:00.000Z","description":"Accounting date"},"dueDate":{"type":"string","format":"date-time","nullable":true,"description":"Due date (defaults from the purchase condition's days, or the receipt date)"},"letter":{"type":"string","example":"A","description":"Receipt letter (A/B/C/M/E). Spain: the TipoFactura — F1, F2, F3, or R1–R5 for a rectificativa, which must use the credit-note `typeId` (ES_PURCHASE_INVALID_LETTER / ES_PURCHASE_DOCUMENT_TYPE_MISMATCH)."},"number":{"type":"string","example":"00001-00000123"},"subtotal":{"type":"number","example":1000,"description":"Ignored (recalculated) when `details` is sent"},"vat":{"type":"number","example":210,"description":"Ignored (recalculated) when `details` is sent"},"vat105":{"type":"number","example":0,"description":"Ignored (recalculated) when `details` is sent"},"vat21":{"type":"number","example":210,"description":"Ignored (recalculated) when `details` is sent"},"vat27":{"type":"number","example":0,"description":"Ignored (recalculated) when `details` is sent"},"exemptAmount":{"type":"number","example":0,"description":"Ignored (recalculated) when `details` is sent"},"nonTaxableAmount":{"type":"number","example":0,"description":"Ignored (recalculated) when `details` is sent"},"total":{"type":"number","example":1210,"description":"Ignored (recalculated) when `details` is sent"},"grossIncomePerceptions":{"type":"number","example":0},"vatPerceptions":{"type":"number","example":0},"profitPerceptions":{"type":"number","nullable":true,"example":null},"observation":{"type":"string","nullable":true,"example":null},"currencyId":{"type":"integer","nullable":true,"example":2,"description":"Currency id (GET /currencies). Omitted or null = the organization's currency (ARS for Argentina, EUR for Spain)."},"exchangeRate":{"type":"number","nullable":true,"example":1050.5,"description":"Organization-currency units per unit of `currencyId`. Required (> 0) when the currency is not the organization's; ignored (stored as 1) otherwise."},"supplierId":{"type":"number","example":1,"description":"Supplier id"},"typeId":{"type":"number","example":1,"description":"Combo item id (TipoComprobanteCompra)"},"purchaseConditionId":{"type":"number","example":1,"description":"Combo item id (CondicionCompraVenta)"},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","deprecated":true,"description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."},"details":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceiptDetailInputDto"}},"pricesIncludeVat":{"type":"boolean","example":false,"description":"True when the detail `unitPrice` / `discountAmount` (and `total` on lines without unitPrice) include VAT, as printed on a B/C invoice. Normalized to net per line from its `taxTypeId` rate (net = gross / (1 + rate), vat = gross − net); not persisted — stored amounts are always net. Default false."},"withholdingRate":{"type":"number","enum":[0,7,15],"nullable":true,"example":15,"description":"SPAIN ONLY. IRPF withheld from the supplier, as a PERCENTAGE: 0, 7 or 15. Optional — default: the supplier's `fiscalConfig.withholdingRate` when its `fiscalConfig.subjectToWithholding` is true, else 0. Applied on the net base of the lines, stored as the positive `withholdingTotal` and subtracted from `total`. Needs `details` (ES_PURCHASE_DETAILS_REQUIRED); rejected outside Spain (WITHHOLDING_NOT_SUPPORTED)."},"attachmentIds":{"description":"Ids of scan-time attachments to link to this receipt on creation","type":"array","items":{"type":"number"}},"warehouseId":{"type":"integer","example":12,"description":"Warehouse the goods enter (an NC de compra: leave) — organizations with more than one warehouse and stock tracking; ignored otherwise. Omitted = the primary warehouse. 404 WAREHOUSE_NOT_FOUND for a warehouse that is not an active one of this organization."}},"required":["date","accountingDate","letter","number","supplierId","typeId","purchaseConditionId"]},"UpdatePurchaseReceiptDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T00:00:00.000Z"},"accountingDate":{"format":"date-time","type":"string","example":"2026-01-15T00:00:00.000Z"},"dueDate":{"format":"date-time","type":"string","example":"2026-02-14T00:00:00.000Z"},"letter":{"type":"string","example":"A","description":"Receipt letter (A/B/C/M/E). Spain: F1, F2, F3 or R1–R5."},"number":{"type":"string","example":"00001-00000123"},"subtotal":{"type":"number","example":1000},"vat":{"type":"number","example":210},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":210},"vat27":{"type":"number","example":0},"exemptAmount":{"type":"number","example":0},"nonTaxableAmount":{"type":"number","example":0},"total":{"type":"number","example":1210},"grossIncomePerceptions":{"type":"number","example":0},"vatPerceptions":{"type":"number","example":0},"profitPerceptions":{"type":"number","nullable":true,"example":null},"observation":{"type":"string","nullable":true,"example":null},"currencyId":{"type":"integer","nullable":true,"example":2,"description":"Currency id (GET /currencies). null = back to the organization's currency; omitted = unchanged (ARS for Argentina, EUR for Spain)."},"exchangeRate":{"type":"number","nullable":true,"example":1050.5,"description":"Organization-currency units per unit of `currencyId`. Required (> 0) when the resulting currency is not the organization's; ignored (stored as 1) otherwise."},"supplierId":{"type":"number","example":1},"typeId":{"type":"number","example":1},"purchaseConditionId":{"type":"number","example":1},"lastUpdatedUserId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"User id (uuid) — audit only"},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Move the receipt's stock to another warehouse (organizations with more than one warehouse; ignored otherwise): the movement is reversed and recorded again in this one. null = the primary warehouse. 404 WAREHOUSE_NOT_FOUND for a warehouse that is not an active one of this organization."}}},"PurchasesByCategoryRowResponseDto":{"type":"object","properties":{"categoryId":{"type":"integer","nullable":true,"example":7,"description":"Purchase category id; null = uncategorized."},"rubro":{"type":"string","example":"Servicios","description":"Rubro name, or 'Sin rubro' for uncategorized lines."},"total":{"type":"number","example":125000,"description":"Net spend for the rubro over the range (NC de compra subtracted)."},"cantidad":{"type":"number","example":14,"description":"Distinct comprobantes touching this rubro."}},"required":["categoryId","rubro","total","cantidad"]},"VatBookRowResponseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"date":{"type":"string","example":"2026-07-01"},"type":{"type":"string","example":"Factura"},"letter":{"type":"string","example":"A"},"number":{"type":"string","example":"00001-00000123"},"supplierName":{"type":"string","example":"Proveedor S.A."},"supplierTaxId":{"type":"string","nullable":true,"example":"30123456789"},"net":{"type":"number","example":1000,"description":"Neto gravado (negative for credit notes)"},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":210},"vat27":{"type":"number","example":0},"exempt":{"type":"number","example":0},"nonTaxable":{"type":"number","example":0},"iibbPerceptions":{"type":"number","example":0},"vatPerceptions":{"type":"number","example":0},"profitPerceptions":{"type":"number","example":0},"total":{"type":"number","example":1210},"currencyCode":{"type":"string","example":"USD","description":"Foreign-currency receipts only: currency of the receipt (amounts are in the org's currency at `exchangeRate`)"},"exchangeRate":{"type":"number","example":1234.5,"description":"Foreign-currency receipts only: exchange rate applied"}},"required":["id","date","type","letter","number","supplierName","supplierTaxId","net","vat105","vat21","vat27","exempt","nonTaxable","iibbPerceptions","vatPerceptions","profitPerceptions","total"]},"VatBookTotalsResponseDto":{"type":"object","properties":{"net":{"type":"number","example":100000,"description":"Sum of neto gravado (NC negated)"},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":21000},"vat27":{"type":"number","example":0},"exempt":{"type":"number","example":0},"nonTaxable":{"type":"number","example":0},"iibbPerceptions":{"type":"number","example":0},"vatPerceptions":{"type":"number","example":0},"profitPerceptions":{"type":"number","example":0},"total":{"type":"number","example":121000}},"required":["net","vat105","vat21","vat27","exempt","nonTaxable","iibbPerceptions","vatPerceptions","profitPerceptions","total"]},"VatBookPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/VatBookRowResponseDto"}},"total":{"type":"number","example":145},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50},"totals":{"description":"Per-column sums over the whole date range (Libro IVA footer)","allOf":[{"$ref":"#/components/schemas/VatBookTotalsResponseDto"}]}},"required":["data","total","page","pageSize","totals"]},"SupplierAccountRowResponseDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-07-01"},"kind":{"type":"string","example":"receipt","description":"receipt | payment_order | fx_difference (exchange difference of a payment order over a foreign-currency receipt)"},"refId":{"type":"number","example":12,"description":"Receipt or payment order id"},"description":{"type":"string","example":"Factura A 00001-00000123"},"debit":{"type":"number","example":1210,"description":"Increases the debt with the supplier"},"credit":{"type":"number","example":0,"description":"Decreases the debt (payments, credit notes)"},"balance":{"type":"number","example":1210,"description":"Running balance (positive = owed to the supplier)"},"currencyCode":{"type":"string","example":"USD","description":"Foreign-currency receipts only: the receipt's currency. Debit/credit are in the organization's currency at the receipt's rate."},"amountOriginal":{"type":"number","example":1000,"description":"Foreign-currency receipts only: total in the receipt's currency"},"exchangeRate":{"type":"number","example":1000,"description":"Foreign-currency receipts only: the receipt's exchange rate"}},"required":["date","kind","refId","description","debit","credit","balance"]},"SupplierAccountPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SupplierAccountRowResponseDto"}},"total":{"type":"number","example":20},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50},"finalBalance":{"type":"number","example":1210,"description":"Final balance over ALL movements (not just this page)"}},"required":["data","total","page","pageSize","finalBalance"]},"PayableDueRowResponseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"date":{"type":"string","example":"2026-07-01"},"dueDate":{"type":"string","example":"2026-07-31"},"letter":{"type":"string","example":"A"},"number":{"type":"string","example":"00001-00000123"},"type":{"type":"string","example":"Factura"},"supplierId":{"type":"number","example":1},"supplierName":{"type":"string","example":"Proveedor S.A."},"total":{"type":"number","example":1210},"totalPaid":{"type":"number","example":210},"pending":{"type":"number","example":1000,"description":"Pending balance (total - totalPaid). Total, paid and pending are in the organization's currency (foreign receipts at the receipt's rate)."},"daysOverdue":{"type":"number","example":8,"description":"Days past due (negative = not yet due)"},"currencyCode":{"type":"string","example":"USD","description":"Foreign-currency receipts only: the receipt's currency"},"exchangeRate":{"type":"number","example":1000,"description":"Foreign-currency receipts only: the receipt's exchange rate"},"totalOriginal":{"type":"number","example":1000,"description":"Foreign-currency receipts only: total in the receipt's currency"},"pendingOriginal":{"type":"number","example":1000,"description":"Foreign-currency receipts only: pending in the receipt's currency"},"pendingOrgCurrency":{"type":"number","example":1000000,"description":"Foreign-currency receipts only: pending in the organization's currency (= pending)"}},"required":["id","date","dueDate","letter","number","type","supplierId","supplierName","total","totalPaid","pending","daysOverdue"]},"PayablesDuePageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PayableDueRowResponseDto"}},"total":{"type":"number","example":20},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50}},"required":["data","total","page","pageSize"]},"JournalAccountResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"code":{"type":"string","example":"1.1.01.001"},"name":{"type":"string","example":"Caja Pesos"},"category":{"type":"number","example":1,"description":"1=Activo, 2=Pasivo, 3=PN, 4=Resultado+, 5=Resultado-"},"current":{"type":"number","example":1},"subcategory":{"type":"number","example":1},"number":{"type":"number","example":1}},"required":["id","code","name","category","current","subcategory","number"]},"CreateJournalAccountDto":{"type":"object","properties":{"code":{"type":"string","description":"Account code (e.g. 1.1.01.001)"},"name":{"type":"string","description":"Account name"},"category":{"type":"number","description":"Category (1=Activo, 2=Pasivo, 3=PN, 4=Resultado+, 5=Resultado-)"},"current":{"type":"number"},"subcategory":{"type":"number"},"number":{"type":"number"}},"required":["code","name","category","current","subcategory","number"]},"UpdateJournalAccountDto":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"category":{"type":"number"},"current":{"type":"number"},"subcategory":{"type":"number"},"number":{"type":"number"}}},"JournalAccountDeletedResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}},"required":["deleted"]},"FiscalYearResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"startDate":{"type":"string","example":"2026-01-01T00:00:00.000Z"},"endDate":{"type":"string","example":"2026-12-31T23:59:59.000Z"},"name":{"type":"string","example":"Ejercicio 2026"},"isActive":{"type":"boolean","example":true},"isClosed":{"type":"boolean","example":false}},"required":["id","startDate","endDate","name","isActive","isClosed"]},"CreateFiscalYearDto":{"type":"object","properties":{"startDate":{"type":"string","description":"Start date (ISO string)"},"endDate":{"type":"string","description":"End date (ISO string)"},"name":{"type":"string"}},"required":["startDate","endDate","name"]},"UpdateFiscalYearDto":{"type":"object","properties":{"startDate":{"type":"string"},"endDate":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"}}},"CloseFiscalYearResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"startDate":{"type":"string","example":"2026-01-01T00:00:00.000Z"},"endDate":{"type":"string","example":"2026-12-31T23:59:59.000Z"},"name":{"type":"string","example":"Ejercicio 2026"},"isActive":{"type":"boolean","example":true},"isClosed":{"type":"boolean","example":false},"closingEntryId":{"type":"object","example":42,"nullable":true,"description":"ID of the generated CIERRE (refundición) journal entry, or null if no result accounts had non-zero balances, or if generate_closing_entry=false."},"aperturaEntryId":{"type":"object","example":43,"nullable":true,"description":"ID of the asiento de apertura generated for the SUCCESSOR fiscal year (the one starting the day after this year's end date), or null if no successor exists, its apertura already existed, or no patrimonial balances carried forward."}},"required":["id","startDate","endDate","name","isActive","isClosed","closingEntryId","aperturaEntryId"]},"OpenFiscalYearResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"startDate":{"type":"string","example":"2026-01-01T00:00:00.000Z"},"endDate":{"type":"string","example":"2026-12-31T23:59:59.000Z"},"name":{"type":"string","example":"Ejercicio 2026"},"isActive":{"type":"boolean","example":true},"isClosed":{"type":"boolean","example":false},"aperturaEntryId":{"type":"object","example":43,"nullable":true,"description":"ID of the generated asiento de apertura, or null if no patrimonial balances carried forward. If an apertura already existed, its id is returned."}},"required":["id","startDate","endDate","name","isActive","isClosed","aperturaEntryId"]},"JournalEntryItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"debit":{"type":"number","example":1000},"credit":{"type":"number","example":0},"ownCheckId":{"type":"integer","nullable":true,"example":null},"journalEntryId":{"type":"number","example":1},"accountId":{"type":"number","example":1}},"required":["id","debit","credit","ownCheckId","journalEntryId","accountId"]},"JournalEntryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"description":{"type":"string","example":"Cobranza factura 00001"},"module":{"type":"string","example":"ventas","description":"ventas | compras | tesoreria | manual"},"isManual":{"type":"boolean","nullable":true,"example":false},"operationType":{"type":"string","nullable":true,"example":"INVOICE"},"associatedReceipt":{"type":"integer","nullable":true,"example":123},"userId":{"type":"number","example":1},"fiscalYearId":{"type":"number","example":1},"items":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntryItemResponseDto"}}},"required":["id","createdAt","date","description","module","isManual","operationType","associatedReceipt","userId","fiscalYearId"]},"JournalEntryListResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntryResponseDto"}},"total":{"type":"number","example":145}},"required":["items","total"]},"ProfitAndLossRowResponseDto":{"type":"object","properties":{"accountId":{"type":"number","example":1},"code":{"type":"string","example":"4.1.01.001"},"name":{"type":"string","example":"Ventas"},"amount":{"type":"number","example":100000}},"required":["accountId","code","name","amount"]},"ProfitAndLossResponseDto":{"type":"object","properties":{"income":{"type":"array","items":{"$ref":"#/components/schemas/ProfitAndLossRowResponseDto"}},"expenses":{"type":"array","items":{"$ref":"#/components/schemas/ProfitAndLossRowResponseDto"}},"totalIncome":{"type":"number","example":100000},"totalExpenses":{"type":"number","example":60000},"netResult":{"type":"number","example":40000}},"required":["income","expenses","totalIncome","totalExpenses","netResult"]},"BalanceSheetRowResponseDto":{"type":"object","properties":{"accountId":{"type":"number","example":1},"code":{"type":"string","example":"1.1.01.001"},"name":{"type":"string","example":"Caja Pesos"},"balance":{"type":"number","example":50000}},"required":["accountId","code","name","balance"]},"BalanceSheetResponseDto":{"type":"object","properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/BalanceSheetRowResponseDto"}},"liabilities":{"type":"array","items":{"$ref":"#/components/schemas/BalanceSheetRowResponseDto"}},"equity":{"type":"array","items":{"$ref":"#/components/schemas/BalanceSheetRowResponseDto"}},"totalAssets":{"type":"number","example":250000},"totalLiabilities":{"type":"number","example":150000},"totalEquity":{"type":"number","example":100000}},"required":["assets","liabilities","equity","totalAssets","totalLiabilities","totalEquity"]},"JournalEntryItemDto":{"type":"object","properties":{"accountId":{"type":"number","description":"Journal account ID"},"debit":{"type":"number","description":"Debit amount"},"credit":{"type":"number","description":"Credit amount"},"ownCheckId":{"type":"integer","description":"Own check ID (optional)"}},"required":["accountId","debit","credit"]},"CreateJournalEntryDto":{"type":"object","properties":{"date":{"type":"string","description":"Entry date (ISO string)"},"description":{"type":"string","description":"Entry description"},"fiscalYearId":{"type":"number","description":"Fiscal year ID"},"items":{"description":"Debit/credit line items","type":"array","items":{"$ref":"#/components/schemas/JournalEntryItemDto"}}},"required":["date","description","fiscalYearId","items"]},"JournalEntryDeletedResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}},"required":["deleted"]},"AccountingLockResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"startDate":{"type":"string","example":"2026-01-01T00:00:00.000Z"},"endDate":{"type":"string","example":"2026-03-31T23:59:59.000Z"},"name":{"type":"string","example":"Q1 2026 Cierre"},"isActive":{"type":"boolean","example":true},"fiscalYearId":{"type":"number","example":1}},"required":["id","startDate","endDate","name","isActive","fiscalYearId"]},"CreateAccountingLockDto":{"type":"object","properties":{"startDate":{"type":"string","description":"Start date (ISO string)"},"endDate":{"type":"string","description":"End date (ISO string)"},"name":{"type":"string","description":"Lock name"},"fiscalYearId":{"type":"number","description":"Fiscal year ID"}},"required":["startDate","endDate","name","fiscalYearId"]},"UpdateAccountingLockDto":{"type":"object","properties":{"startDate":{"type":"string"},"endDate":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"}}},"AccountingLockDeletedResponseDto":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}},"required":["deleted"]},"GeneralLedgerRowResponseDto":{"type":"object","properties":{"accountCode":{"type":"string","example":"1.1.01.001"},"accountName":{"type":"string","example":"Caja Pesos"},"date":{"type":"string","example":"2026-01-15"},"description":{"type":"string","example":"Cobranza factura 00001"},"debit":{"type":"number","example":1000},"credit":{"type":"number","example":0},"balance":{"type":"number","example":50000,"description":"Running balance after this movement"}},"required":["accountCode","accountName","date","description","debit","credit","balance"]},"GeneralLedgerPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GeneralLedgerRowResponseDto"}},"total":{"type":"number","example":145},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50}},"required":["data","total","page","pageSize"]},"DailyBookRowResponseDto":{"type":"object","properties":{"entryId":{"type":"number","example":1},"date":{"type":"string","example":"2026-01-15"},"description":{"type":"string","example":"Cobranza factura 00001"},"accountCode":{"type":"string","example":"1.1.01.001"},"accountName":{"type":"string","example":"Caja Pesos"},"debit":{"type":"number","example":1000},"credit":{"type":"number","example":0}},"required":["entryId","date","description","accountCode","accountName","debit","credit"]},"DailyBookPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DailyBookRowResponseDto"}},"total":{"type":"number","example":145},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50}},"required":["data","total","page","pageSize"]},"TrialBalanceRowResponseDto":{"type":"object","properties":{"accountCode":{"type":"string","example":"1.1.01.001"},"accountName":{"type":"string","example":"Caja Pesos"},"category":{"type":"string","example":"Activo","description":"Activo | Pasivo | Patrimonio Neto | Resultado Positivo | Resultado Negativo"},"totalDebit":{"type":"number","example":100000},"totalCredit":{"type":"number","example":50000},"balance":{"type":"number","example":50000}},"required":["accountCode","accountName","category","totalDebit","totalCredit","balance"]},"TrialBalanceTotalsDto":{"type":"object","properties":{"totalDebit":{"type":"number","example":150000,"description":"Total Debe. By double-entry equals totalCredit."},"totalCredit":{"type":"number","example":150000,"description":"Total Haber. By double-entry equals totalDebit."},"totalSaldoDeudor":{"type":"number","example":90000,"description":"Sum of the deudor (debit) saldos"},"totalSaldoAcreedor":{"type":"number","example":90000,"description":"Sum of the acreedor (credit) saldos"}},"required":["totalDebit","totalCredit","totalSaldoDeudor","totalSaldoAcreedor"]},"TrialBalanceReportResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TrialBalanceRowResponseDto"}},"total":{"type":"number","example":145},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50},"totals":{"description":"Totals row (total debe = total haber)","allOf":[{"$ref":"#/components/schemas/TrialBalanceTotalsDto"}]}},"required":["data","total","page","pageSize","totals"]},"BalanceComprobacionRowDto":{"type":"object","properties":{"accountCode":{"type":"string","example":"1.1.01.001"},"accountName":{"type":"string","example":"Caja Pesos"},"category":{"type":"string","example":"Activo","description":"Activo | Pasivo | Patrimonio Neto | Resultado Positivo | Resultado Negativo"},"sumDebit":{"type":"number","example":100000,"description":"Sumas — Debe"},"sumCredit":{"type":"number","example":50000,"description":"Sumas — Haber"},"saldoDeudor":{"type":"number","example":50000,"description":"Saldos — Deudor"},"saldoAcreedor":{"type":"number","example":0,"description":"Saldos — Acreedor"},"resultadoPerdida":{"type":"number","example":0,"description":"Resultado — Pérdida (only for account types 4/5)"},"resultadoGanancia":{"type":"number","example":0,"description":"Resultado — Ganancia (only for account types 4/5)"},"balanceActivo":{"type":"number","example":50000,"description":"Patrimonial — Activo (only for account types 1/2/3)"},"balancePasivo":{"type":"number","example":0,"description":"Patrimonial — Pasivo (only for account types 1/2/3)"}},"required":["accountCode","accountName","category","sumDebit","sumCredit","saldoDeudor","saldoAcreedor","resultadoPerdida","resultadoGanancia","balanceActivo","balancePasivo"]},"BalanceComprobacionTotalsDto":{"type":"object","properties":{"sumDebit":{"type":"number","example":100000},"sumCredit":{"type":"number","example":100000},"saldoDeudor":{"type":"number","example":60000},"saldoAcreedor":{"type":"number","example":60000},"resultadoPerdida":{"type":"number","example":20000},"resultadoGanancia":{"type":"number","example":20000},"balanceActivo":{"type":"number","example":40000},"balancePasivo":{"type":"number","example":40000}},"required":["sumDebit","sumCredit","saldoDeudor","saldoAcreedor","resultadoPerdida","resultadoGanancia","balanceActivo","balancePasivo"]},"BalanceComprobacionResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BalanceComprobacionRowDto"}},"totals":{"description":"Totals per column","allOf":[{"$ref":"#/components/schemas/BalanceComprobacionTotalsDto"}]}},"required":["data","totals"]},"TrialBalanceTreeNodeDto":{"type":"object","properties":{"code":{"type":"string","example":"4.1","description":"Account code or prefix"},"name":{"type":"string","example":"Ventas","description":"Account name or code prefix if no named account"},"category":{"type":"string","example":"Resultado Positivo","description":"Category label — only present on leaf nodes"},"totalDebit":{"type":"number","example":150000},"totalCredit":{"type":"number","example":50000},"balance":{"type":"number","example":100000},"isLeaf":{"type":"boolean","example":true,"description":"True when this node is a leaf (actual account with movements)"},"children":{"description":"Child nodes (empty for leaf nodes)","type":"array","items":{"$ref":"#/components/schemas/TrialBalanceTreeNodeDto"}}},"required":["code","name","totalDebit","totalCredit","balance","isLeaf","children"]},"CmvEligibleDto":{"type":"object","properties":{"trackStock":{"type":"boolean","example":true,"description":"Stock tracking is on (required to generate)."}},"required":["trackStock"]},"CmvProductDto":{"type":"object","properties":{"productId":{"type":"number","example":17},"description":{"type":"string","example":"Tornillo 3/8"},"quantity":{"type":"number","example":40,"description":"Net quantity: sold − returned by credit notes that return stock."},"cost":{"type":"number","example":9000,"description":"Net cost: Σ quantity × unit cost, credit notes subtract."}},"required":["productId","description","quantity","cost"]},"CmvMissingCostDto":{"type":"object","properties":{"lines":{"type":"number","example":3,"description":"Product lines without a cost snapshot (excluded from the entry)."},"receipts":{"type":"number","example":2,"description":"Receipts that carry at least one of those lines."},"amount":{"type":"number","example":15400.5,"description":"Net line totals of those lines (credit notes subtract), in the organization's currency."}},"required":["lines","receipts","amount"]},"CmvAccountRefDto":{"type":"object","properties":{"id":{"type":"number","example":120},"code":{"type":"string","example":"5.5.001"},"name":{"type":"string","example":"Costo de Mercaderías Vendidas"}},"required":["id","code","name"]},"CmvAccountsDto":{"type":"object","properties":{"cmv":{"nullable":true,"description":"Account debited; null when neither configured nor the default code exists.","allOf":[{"$ref":"#/components/schemas/CmvAccountRefDto"}]},"inventory":{"nullable":true,"description":"Inventory account credited; null when neither configured nor the default code exists.","allOf":[{"$ref":"#/components/schemas/CmvAccountRefDto"}]}},"required":["cmv","inventory"]},"CmvExistingEntryDto":{"type":"object","properties":{"id":{"type":"number","example":3021},"date":{"type":"string","example":"2026-10-31"},"amount":{"type":"number","example":9000}},"required":["id","date","amount"]},"CmvPreviewResponseDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-10"},"dateFrom":{"type":"string","example":"2026-10-01"},"dateTo":{"type":"string","example":"2026-10-31","description":"Last day of the month (inclusive); the entry's date."},"eligible":{"$ref":"#/components/schemas/CmvEligibleDto"},"total":{"type":"number","example":9000,"description":"salesCost − returnsCost (negative when more cost came back than went out)."},"salesCost":{"type":"number","example":10000,"description":"Σ quantity × unit cost over the month's issued Facturas."},"returnsCost":{"type":"number","example":1000,"description":"Same over credit notes that return stock (positive)."},"products":{"description":"Per product, by net cost descending.","type":"array","items":{"$ref":"#/components/schemas/CmvProductDto"}},"missingCost":{"$ref":"#/components/schemas/CmvMissingCostDto"},"accounts":{"$ref":"#/components/schemas/CmvAccountsDto"},"journalEntry":{"nullable":true,"description":"The month's current CMV entry, if any.","allOf":[{"$ref":"#/components/schemas/CmvExistingEntryDto"}]},"locked":{"type":"boolean","example":false,"description":"The month is in a locked period or closed fiscal year: it cannot be (re)generated."},"lockReason":{"type":"string","example":null,"nullable":true}},"required":["month","dateFrom","dateTo","eligible","total","salesCost","returnsCost","products","missingCost","accounts","journalEntry","locked","lockReason"]},"GenerateCmvDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-10","description":"Month to generate (YYYY-MM). Not after the current month (Buenos Aires)."}},"required":["month"]},"CmvGenerateResponseDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-10"},"total":{"type":"number","example":9000},"journalEntryId":{"type":"number","example":3022,"nullable":true,"description":"The posted entry; null when the month's CMV is 0 (nothing posted)."},"replacedJournalEntryId":{"type":"number","example":3021,"nullable":true,"description":"The previous entry of the month that was replaced, if any."},"missingCost":{"$ref":"#/components/schemas/CmvMissingCostDto"}},"required":["month","total","journalEntryId","replacedJournalEntryId","missingCost"]},"CmvDefaultCodesDto":{"type":"object","properties":{"cmvCode":{"type":"string","example":"5.5.001"},"inventoryCode":{"type":"string","example":"1.1.4.001"}},"required":["cmvCode","inventoryCode"]},"CmvSettingsResponseDto":{"type":"object","properties":{"cmvAccountId":{"type":"number","example":null,"nullable":true},"inventoryAccountId":{"type":"number","example":null,"nullable":true},"defaults":{"description":"Codes used when an account is not configured.","allOf":[{"$ref":"#/components/schemas/CmvDefaultCodesDto"}]}},"required":["cmvAccountId","inventoryAccountId","defaults"]},"UpdateCmvSettingsDto":{"type":"object","properties":{"cmvAccountId":{"type":"object","example":120,"nullable":true,"description":"Journal account the CMV entry debits. `null` = the chart's default code. Omitted = unchanged."},"inventoryAccountId":{"type":"object","example":45,"nullable":true,"description":"Inventory account the CMV entry credits (Mercaderías). `null` = the chart's default code. Omitted = unchanged."}}},"SupplierResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Distribuidora Norte SRL"},"taxId":{"type":"string","nullable":true,"example":"30345678901"},"postalCode":{"type":"string","nullable":true,"example":"C1043AAZ"},"city":{"type":"string","nullable":true,"example":"Buenos Aires"},"phone":{"type":"string","nullable":true,"example":"+54 11 4444-5555"},"email":{"type":"string","nullable":true,"example":"compras@distribuidoranorte.com.ar"},"taxCategoryId":{"type":"number","example":1},"locationId":{"type":"integer","nullable":true,"example":1},"purchaseConditionId":{"type":"number","example":1},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234"},"createdAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"observations":{"type":"string","nullable":true,"example":null},"lastUpdatedUserId":{"type":"string","nullable":true,"example":"auth0|abc"},"userId":{"type":"string","nullable":true,"example":"auth0|abc"},"accountType":{"type":"string","nullable":true,"example":"CHECKING"},"accountCode":{"type":"string","nullable":true,"example":"0000123456"},"accountBank":{"type":"string","nullable":true,"example":"Banco Galicia"},"documentTypeId":{"type":"number","example":80},"fiscalConfig":{"type":"object","additionalProperties":true,"nullable":true,"example":{"subjectToWithholding":true,"withholdingRate":15},"description":"Country-scoped supplier settings, by the ORGANIZATION's country. ES: { subjectToWithholding, withholdingRate } — its invoices carry an IRPF withholding at that percent (7 or 15). NULL = nothing configured."}},"required":["id","businessName","taxId","postalCode","city","phone","email","taxCategoryId","locationId","purchaseConditionId","address","createdAt","deletedAt","updatedAt","observations","lastUpdatedUserId","userId","accountType","accountCode","accountBank","documentTypeId","fiscalConfig"]},"SupplierPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SupplierResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateSupplierDto":{"type":"object","properties":{"businessName":{"type":"string","example":"Distribuidora Norte SRL","description":"Supplier's legal/business name. Required unless a valid `taxId` (CUIT) is provided — in that case it is auto-filled from ARCA's padrón."},"taxCategoryId":{"type":"number","example":8,"description":"Tax category id. Must belong to the organization's regime — fetch valid ids via `GET /tax-categories`. Required unless a valid `taxId` (CUIT) is provided — in that case it is inferred from the supplier's IVA condition in ARCA combined with the organization's regime."},"purchaseConditionId":{"type":"number","example":1,"description":"Purchase condition (combo) id. Fetch valid ids via `GET /combos/CondicionCompraVenta/items`."},"documentTypeId":{"type":"number","example":180,"description":"Document type id (combo). Fetch valid ids via `GET /combos/2/items`. When omitted, it is inferred from `taxId`: a valid 11-digit CUIT resolves to CUIT, 7–8 numeric digits resolve to DNI, anything else resolves to \"Sin identificar\"."},"taxId":{"type":"string","example":"30345678901","nullable":true,"description":"Tax ID. Argentina: CUIT, validated when 11 digits. Spain: a NIF / NIE / CIF (control character checked) or an EU VAT number, stored normalized (`ESB12345674` → `B12345674`) and duplicate-checked on that form (INVALID_NIF)."},"address":{"type":"string","example":"Av. Corrientes 1234","nullable":true},"city":{"type":"string","example":"Buenos Aires","nullable":true},"postalCode":{"type":"string","example":"C1043AAZ","nullable":true},"phone":{"type":"string","example":"+54 11 4444-5555","nullable":true},"email":{"type":"string","example":"contacto@distribuidoranorte.com.ar","nullable":true},"locationId":{"type":"integer","example":1,"nullable":true,"description":"Location id"},"observations":{"type":"string","nullable":true},"accountType":{"type":"string","example":"CHECKING","nullable":true},"accountCode":{"type":"string","example":"0000123456","nullable":true},"accountBank":{"type":"string","example":"Banco Galicia","nullable":true},"fiscalConfig":{"type":"object","example":{"subjectToWithholding":true,"withholdingRate":15},"nullable":true,"description":"Country-scoped supplier settings, by the ORGANIZATION's country. ES: { subjectToWithholding: boolean, withholdingRate: 0 | 7 | 15 } — IRPF withheld on its invoices (rate defaults to 15 when subject). An Argentine organization rejects any payload (INVALID_FISCAL_CONFIG). Send null to clear."}},"required":["purchaseConditionId"]},"GetOrCreateSupplierDto":{"type":"object","properties":{"taxId":{"type":"string","example":"30345678901","description":"CUIT of the supplier to look up or create."},"businessName":{"type":"string"},"address":{"type":"string"},"taxCategoryId":{"type":"number"},"purchaseConditionId":{"type":"number"},"documentTypeId":{"type":"number"},"locationId":{"type":"number"},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."}},"required":["taxId"]},"BulkDeleteSuppliersDto":{"type":"object","properties":{"ids":{"description":"Supplier ids to soft-delete (1-200)","type":"array","items":{"type":"number"}}},"required":["ids"]},"BulkDeleteSuppliersResponseDto":{"type":"object","properties":{"deleted":{"type":"number","example":3,"description":"Number of suppliers that were soft-deleted."}},"required":["deleted"]},"UpdateSupplierDto":{"type":"object","properties":{"businessName":{"type":"string","example":"Distribuidora Norte SRL","description":"Supplier's legal/business name. Required unless a valid `taxId` (CUIT) is provided — in that case it is auto-filled from ARCA's padrón."},"taxCategoryId":{"type":"number","example":8,"description":"Tax category id. Must belong to the organization's regime — fetch valid ids via `GET /tax-categories`. Required unless a valid `taxId` (CUIT) is provided — in that case it is inferred from the supplier's IVA condition in ARCA combined with the organization's regime."},"purchaseConditionId":{"type":"number","example":1,"description":"Purchase condition (combo) id. Fetch valid ids via `GET /combos/CondicionCompraVenta/items`."},"documentTypeId":{"type":"number","example":180,"description":"Document type id (combo). Fetch valid ids via `GET /combos/2/items`. When omitted, it is inferred from `taxId`: a valid 11-digit CUIT resolves to CUIT, 7–8 numeric digits resolve to DNI, anything else resolves to \"Sin identificar\"."},"taxId":{"type":"string","example":"30345678901","nullable":true,"description":"Tax ID. Argentina: CUIT, validated when 11 digits. Spain: a NIF / NIE / CIF (control character checked) or an EU VAT number, stored normalized (`ESB12345674` → `B12345674`) and duplicate-checked on that form (INVALID_NIF)."},"address":{"type":"string","example":"Av. Corrientes 1234","nullable":true},"city":{"type":"string","example":"Buenos Aires","nullable":true},"postalCode":{"type":"string","example":"C1043AAZ","nullable":true},"phone":{"type":"string","example":"+54 11 4444-5555","nullable":true},"email":{"type":"string","example":"contacto@distribuidoranorte.com.ar","nullable":true},"locationId":{"type":"integer","example":1,"nullable":true,"description":"Location id"},"observations":{"type":"string","nullable":true},"accountType":{"type":"string","example":"CHECKING","nullable":true},"accountCode":{"type":"string","example":"0000123456","nullable":true},"accountBank":{"type":"string","example":"Banco Galicia","nullable":true},"fiscalConfig":{"type":"object","example":{"subjectToWithholding":true,"withholdingRate":15},"nullable":true,"description":"Country-scoped supplier settings, by the ORGANIZATION's country. ES: { subjectToWithholding: boolean, withholdingRate: 0 | 7 | 15 } — IRPF withheld on its invoices (rate defaults to 15 when subject). An Argentine organization rejects any payload (INVALID_FISCAL_CONFIG). Send null to clear."}}},"ProviderConfigResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"hasAuthKey":{"type":"boolean","example":true,"description":"Whether an auth key is stored. The key itself is write-only and never returned."},"string1":{"type":"string","nullable":true,"example":null},"string2":{"type":"string","nullable":true,"example":null},"string3":{"type":"string","nullable":true,"example":null},"provider":{"type":"string","example":"TIENDANUBE"},"lastUpdatedUserId":{"type":"integer","nullable":true,"example":7},"userId":{"type":"integer","nullable":true,"example":1}},"required":["id","createdAt","deletedAt","updatedAt","hasAuthKey","string1","string2","string3","provider","lastUpdatedUserId","userId"]},"IntegrationStatusResponseDto":{"type":"object","properties":{"sparkpost":{"type":"boolean","example":true},"tiendanube":{"type":"boolean","example":false}},"required":["sparkpost","tiendanube"]},"OAuthUrlResponseDto":{"type":"object","properties":{"url":{"type":"string","example":"https://peakly.ar/api/integrations/oauth/mercadopago/start?organization_id=123","description":"Navigate the authenticated browser here to establish browser binding and start the OAuth flow."}},"required":["url"]},"CreateProviderConfigDto":{"type":"object","properties":{"provider":{"type":"string","example":"TIENDANUBE","description":"Provider identifier (e.g. SPARKPOST, TIENDANUBE, MERCADOPAGO)."},"authKey":{"type":"string","nullable":true,"description":"OAuth/API auth key."},"string1":{"type":"string","nullable":true,"description":"Generic provider field 1 (provider-specific)."},"string2":{"type":"string","nullable":true,"description":"Generic provider field 2 (provider-specific)."},"string3":{"type":"string","nullable":true,"description":"Generic provider field 3 (provider-specific)."}},"required":["provider"]},"UpdateProviderConfigDto":{"type":"object","properties":{"provider":{"type":"string","example":"TIENDANUBE","description":"Provider identifier (e.g. SPARKPOST, TIENDANUBE, MERCADOPAGO)."},"authKey":{"type":"string","nullable":true,"description":"OAuth/API auth key."},"string1":{"type":"string","nullable":true,"description":"Generic provider field 1 (provider-specific)."},"string2":{"type":"string","nullable":true,"description":"Generic provider field 2 (provider-specific)."},"string3":{"type":"string","nullable":true,"description":"Generic provider field 3 (provider-specific)."}}},"CreateMercadoPagoPreferenceDto":{"type":"object","properties":{"salesReceiptId":{"type":"string","example":"3f2504e0-4f89-41d3-9a0c-0305e82c3301","description":"UUID of the sales receipt to be paid. Must be a collectible receipt (Creada, saldo > 0). Stamped as the preference's external_reference so the settle webhook can map the payment back to it."}},"required":["salesReceiptId"]},"MercadoPagoPreferenceResponseDto":{"type":"object","properties":{"preferenceId":{"type":"string","example":"123456789-3f2504e0-4f89-41d3-9a0c-0305e82c3301","description":"MercadoPago preference id."},"initPoint":{"type":"string","example":"https://www.mercadopago.com.ar/checkout/v1/redirect?pref_id=...","description":"Production checkout URL to redirect the customer to."},"sandboxInitPoint":{"type":"string","example":"https://sandbox.mercadopago.com.ar/checkout/v1/redirect?pref_id=...","description":"Sandbox checkout URL (test mode)."}},"required":["preferenceId","initPoint","sandboxInitPoint"]},"ReceiptBookBaseResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Sucursal Centro - WS"},"prefix":{"type":"string","example":"0001"},"pointOfSale":{"type":"number","example":1},"isExport":{"type":"boolean","nullable":true,"example":false},"createdAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"type":{"type":"string","nullable":true,"example":"WS"},"lastUpdatedUserId":{"type":"integer","nullable":true,"example":7},"userId":{"type":"integer","nullable":true,"example":1},"branchId":{"type":"integer","nullable":true,"example":1},"lastInvoiceA":{"type":"integer","nullable":true,"example":100},"lastInvoiceB":{"type":"integer","nullable":true,"example":100},"lastInvoiceC":{"type":"integer","nullable":true,"example":100},"lastCreditNoteA":{"type":"integer","nullable":true,"example":10},"lastCreditNoteB":{"type":"integer","nullable":true,"example":10},"lastCreditNoteC":{"type":"integer","nullable":true,"example":10},"lastDebitNoteA":{"type":"integer","nullable":true,"example":5},"lastDebitNoteB":{"type":"integer","nullable":true,"example":5},"lastDebitNoteC":{"type":"integer","nullable":true,"example":5},"backofficeIds":{"type":"string","nullable":true,"example":null}},"required":["id","description","prefix","pointOfSale","isExport","createdAt","deletedAt","updatedAt","type","lastUpdatedUserId","userId","branchId","lastInvoiceA","lastInvoiceB","lastInvoiceC","lastCreditNoteA","lastCreditNoteB","lastCreditNoteC","lastDebitNoteA","lastDebitNoteB","lastDebitNoteC","backofficeIds"]},"MercadoPagoConfigResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"createInvoice":{"type":"boolean","example":true},"includePaymentButton":{"type":"string","example":"ALWAYS"},"lastUpdatedUserId":{"type":"integer","nullable":true,"example":7},"userId":{"type":"integer","nullable":true,"example":1},"receiptBookId":{"type":"integer","nullable":true,"example":1},"receiptBook":{"nullable":true,"description":"Eagerly-loaded receipt book used for auto-created MP invoices. `null` when `receiptBookId` is unset.","allOf":[{"$ref":"#/components/schemas/ReceiptBookBaseResponseDto"}]},"mpUserId":{"type":"string","nullable":true,"example":"1234567890"},"publicKey":{"type":"string","nullable":true,"example":"APP_USR-pub-***"},"bankAccountId":{"type":"integer","nullable":true,"example":12,"description":"Treasury bank account used to book the automatic cobranza created by the settle-only Mercado Pago IPN webhook. `null` when no MP bank account has been chosen — the webhook cannot settle payments until this is set."},"isConfigured":{"type":"boolean","example":true,"description":"Whether this organization has completed the Mercado Pago OAuth flow. Use this to gate the payment button UI without exposing the underlying credentials."},"hasExpired":{"type":"boolean","example":false,"description":"True when the access token is past its expiration. Prompt the user to reconnect when this is `true`."}},"required":["id","createdAt","deletedAt","updatedAt","createInvoice","includePaymentButton","lastUpdatedUserId","userId","receiptBookId","receiptBook","mpUserId","publicKey","bankAccountId","isConfigured","hasExpired"]},"CreateMercadoPagoConfigDto":{"type":"object","properties":{"createInvoice":{"type":"boolean","example":true,"description":"When true, an invoice is automatically created on successful Mercado Pago payments."},"includePaymentButton":{"type":"string","example":"ALWAYS","description":"Whether to include a Mercado Pago payment button on emailed receipts (e.g. ALWAYS, NEVER, OPTIONAL)."},"receiptBookId":{"type":"integer","example":1,"nullable":true,"description":"Receipt book to use for auto-created invoices."},"accessToken":{"type":"string","nullable":true,"description":"Mercado Pago access token (returned by OAuth)."},"refreshToken":{"type":"string","nullable":true,"description":"Mercado Pago refresh token (returned by OAuth)."},"expiresAt":{"type":"string","format":"date-time","nullable":true},"publicKey":{"type":"string","nullable":true,"description":"Public key for the MP integration"},"bankAccountId":{"type":"integer","example":12,"nullable":true,"description":"Treasury bank account used to settle Mercado Pago payments received via the IPN webhook. Required for automatic cobranzas to be created."}},"required":["createInvoice","includePaymentButton"]},"UpdateMercadoPagoConfigDto":{"type":"object","properties":{"createInvoice":{"type":"boolean","example":true,"description":"When true, an invoice is automatically created on successful Mercado Pago payments."},"includePaymentButton":{"type":"string","example":"ALWAYS","description":"Whether to include a Mercado Pago payment button on emailed receipts (e.g. ALWAYS, NEVER, OPTIONAL)."},"receiptBookId":{"type":"integer","example":1,"nullable":true,"description":"Receipt book to use for auto-created invoices."},"accessToken":{"type":"string","nullable":true,"description":"Mercado Pago access token (returned by OAuth)."},"refreshToken":{"type":"string","nullable":true,"description":"Mercado Pago refresh token (returned by OAuth)."},"expiresAt":{"type":"string","format":"date-time","nullable":true},"publicKey":{"type":"string","nullable":true,"description":"Public key for the MP integration"},"bankAccountId":{"type":"integer","example":12,"nullable":true,"description":"Treasury bank account used to settle Mercado Pago payments received via the IPN webhook. Required for automatic cobranzas to be created."}}},"CollectionCustomerResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Cliente S.A."},"taxId":{"type":"string","nullable":true,"example":"30123456789"}},"required":["id","businessName","taxId"]},"CollectionComboItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":100},"data":{"type":"string","example":"Recibo"}},"required":["id","data"]},"CollectionReceiptItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"collectionId":{"type":"number","example":5},"salesReceiptId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000"},"amount":{"type":"number","example":1210.5,"description":"Amount collected against the receipt in this collection"},"collected":{"type":"number","example":1210.5,"description":"Receipt total_collected at the time of the collection"},"salesReceipt":{"type":"object","description":"Slim sales receipt (number, letter, total, totalCollected, status)"}},"required":["id","collectionId","salesReceiptId","amount","collected"]},"CollectionPaymentEntryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":33,"description":"Payment method entry id"},"description":{"type":"string","example":"Cobranza Nro.:5 de Cliente S.A."},"amount":{"type":"number","example":1210.5},"date":{"type":"string","example":"2026-08-01T00:00:00.000Z"},"entryType":{"type":"string","example":"Ingreso"},"paymentMethodId":{"type":"number","example":3},"referenceNumber":{"type":"number","example":0,"description":"Check / retention receipt id (0 when N/A)"},"externalEntityId":{"type":"integer","nullable":true,"example":2,"description":"Cash register / bank account / retention id"}},"required":["id","description","amount","date","entryType","paymentMethodId","referenceNumber","externalEntityId"]},"PaymentOrderPaymentFxResponseDto":{"type":"object","properties":{"currencyId":{"type":"number","example":2,"description":"Currency of the bank account or cash register"},"exchangeRate":{"type":"number","example":1100,"description":"Rate of the payment (organization-currency units per unit)"},"foreignAmount":{"type":"number","example":1000,"description":"Units of the account's currency that left it (or entered it, for a collection); the entry amount stays in the organization's currency"}},"required":["currencyId","exchangeRate","foreignAmount"]},"CollectionPaymentItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"collectionId":{"type":"number","example":5},"paymentMethodEntryId":{"type":"number","example":33},"paymentMethodEntry":{"$ref":"#/components/schemas/CollectionPaymentEntryResponseDto"},"fx":{"description":"Payments into a bank account or cash register in a foreign currency only (PAN-420). Absent otherwise.","allOf":[{"$ref":"#/components/schemas/PaymentOrderPaymentFxResponseDto"}]}},"required":["id","collectionId","paymentMethodEntryId"]},"CollectionResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"referenceNumber":{"type":"integer","nullable":true,"example":45,"description":"v1 NumeroReferencia"},"number":{"type":"string","nullable":true,"example":"0001-00000045","description":"Talonario receipt number"},"date":{"type":"string","example":"2026-08-01T00:00:00.000Z"},"createdAt":{"type":"string","example":"2026-08-01T10:00:00.000Z"},"total":{"type":"number","example":1210.5},"detail":{"type":"string","nullable":true,"example":"Cobranza facturas julio"},"status":{"type":"string","example":"Cobrada","description":"Cobrada | Anulada"},"typeId":{"type":"number","example":100},"customerId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":100},"customer":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CollectionCustomerResponseDto"}]},"type":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/CollectionComboItemResponseDto"}]},"receiptItems":{"type":"array","items":{"$ref":"#/components/schemas/CollectionReceiptItemResponseDto"}},"paymentItems":{"type":"array","items":{"$ref":"#/components/schemas/CollectionPaymentItemResponseDto"}}},"required":["id","referenceNumber","number","date","createdAt","total","detail","status","typeId","customerId","journalEntryId","customer","type"]},"CollectionPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CollectionResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"123"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CollectionNextReferenceResponseDto":{"type":"object","properties":{"nextReference":{"type":"number","example":46,"description":"Next reference number for a new collection"}},"required":["nextReference"]},"CollectionReceiptInputDto":{"type":"object","properties":{"salesReceiptId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Sales receipt id (UUID)"},"amount":{"type":"number","example":1210.5,"description":"Amount to collect against the receipt (> 0)"}},"required":["salesReceiptId","amount"]},"IngresoPaymentInputDto":{"type":"object","properties":{"paymentMethodId":{"type":"number","example":3,"description":"Payment method id"},"amount":{"type":"number","example":1210.5,"description":"Payment amount (> 0)"},"date":{"type":"string","example":"2026-08-01","description":"Payment date (defaults to the collection date)"},"description":{"type":"string","example":"Transferencia BBVA","description":"Entry description (defaults to the movement concept)"},"referenceNumber":{"type":"number","example":55,"description":"Reference id (check / retention receipt) — see payment type"},"externalEntityId":{"type":"number","example":2,"description":"External entity id (cash register / bank account / retention) — see payment type"},"exchangeRate":{"type":"number","example":1100,"description":"Bank account (TRANSFERENCIA / PAGO_ONLINE) or cash register (EFECTIVO) in a foreign currency only: rate of this payment (organization-currency units per unit of the account's currency). Omitted: the official AFIP rate cached for the payment's date (default: the collection's date), only for organizations in pesos (EXCHANGE_RATE_REQUIRED otherwise). Ignored for accounts in the organization's currency."},"foreignAmount":{"type":"number","example":1000,"description":"Bank account / cash register in a foreign currency only: units of the account's currency that enter it (its balance moves by this). `amount` stays in the organization's currency. Omitted: amount / exchangeRate. Sent with exchangeRate, foreignAmount × exchangeRate must equal amount (PAYMENT_FX_MISMATCH)."}},"required":["paymentMethodId","amount"]},"CreateCollectionDto":{"type":"object","properties":{"customerId":{"type":"number","example":1,"description":"Customer id"},"date":{"type":"string","example":"2026-08-01","description":"Collection date (ISO 8601)"},"detail":{"type":"string","example":"Cobranza facturas julio","nullable":true},"typeId":{"type":"number","example":100,"description":"Collection type combo item id (ComboType.TipoCobranza = 10)"},"number":{"type":"string","example":"0001-00000045","description":"Talonario receipt number (client-provided). Optional.","nullable":true},"receipts":{"type":"array","items":{"$ref":"#/components/schemas/CollectionReceiptInputDto"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/IngresoPaymentInputDto"}},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."}},"required":["customerId","date","typeId","receipts","payments"]},"PaymentOrderSupplierResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Proveedor S.A."},"taxId":{"type":"string","nullable":true,"example":"30123456789"}},"required":["id","businessName","taxId"]},"PaymentOrderComboItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":110},"data":{"type":"string","example":"Orden de Pago"}},"required":["id","data"]},"PaymentOrderReceiptFxResponseDto":{"type":"object","properties":{"currencyId":{"type":"number","example":4,"description":"Currency of the receipt"},"exchangeRate":{"type":"number","example":1100,"description":"Rate of the payment"},"receiptExchangeRate":{"type":"number","example":1000,"description":"The receipt's own (historical) rate"},"foreignAmount":{"type":"number","example":500,"description":"Units of the receipt's currency cancelled (amount / exchangeRate)"},"fxDifference":{"type":"number","example":50000,"description":"Exchange difference in the organization's currency: amount − foreignAmount × receiptExchangeRate (> 0 loss, < 0 gain)"}},"required":["currencyId","exchangeRate","receiptExchangeRate","foreignAmount","fxDifference"]},"PaymentOrderReceiptItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"paymentOrderId":{"type":"number","example":5},"purchaseReceiptId":{"type":"number","example":12},"amount":{"type":"number","example":1210.5,"description":"Amount paid against the receipt in this order"},"paid":{"type":"number","example":1210.5,"description":"Receipt total_paid at the time of the payment"},"purchaseReceipt":{"type":"object","description":"Slim purchase receipt (number, letter, total, totalPaid, status)"},"fx":{"description":"Foreign-currency receipts only: the conversion of `amount`. Absent for receipts in the organization's currency.","allOf":[{"$ref":"#/components/schemas/PaymentOrderReceiptFxResponseDto"}]}},"required":["id","paymentOrderId","purchaseReceiptId","amount","paid"]},"PaymentOrderPaymentEntryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":33,"description":"Payment method entry id"},"description":{"type":"string","example":"Orden de Pago Nro.:5 a Proveedor S.A."},"amount":{"type":"number","example":1210.5},"date":{"type":"string","example":"2026-07-09T00:00:00.000Z"},"entryType":{"type":"string","example":"Egreso"},"paymentMethodId":{"type":"number","example":3},"referenceNumber":{"type":"number","example":0,"description":"Check / own check / retention receipt id (0 when N/A)"},"externalEntityId":{"type":"integer","nullable":true,"example":2,"description":"Cash register / bank account / retention id"}},"required":["id","description","amount","date","entryType","paymentMethodId","referenceNumber","externalEntityId"]},"PaymentOrderPaymentItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"paymentOrderId":{"type":"number","example":5},"paymentMethodEntryId":{"type":"number","example":33},"paymentMethodEntry":{"$ref":"#/components/schemas/PaymentOrderPaymentEntryResponseDto"},"fx":{"description":"Payments from a bank account or cash register in a foreign currency only (PAN-392a / PAN-420). Absent otherwise.","allOf":[{"$ref":"#/components/schemas/PaymentOrderPaymentFxResponseDto"}]}},"required":["id","paymentOrderId","paymentMethodEntryId"]},"PaymentOrderResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"number":{"type":"string","nullable":true,"example":"5","description":"v1 parity: number = id"},"date":{"type":"string","example":"2026-07-09T00:00:00.000Z"},"createdAt":{"type":"string","example":"2026-07-09T10:00:00.000Z"},"total":{"type":"number","example":1210.5},"detail":{"type":"string","nullable":true,"example":"Pago facturas junio"},"status":{"type":"string","example":"Creada","description":"Creada | Anulada"},"typeId":{"type":"number","example":110},"supplierId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":100},"supplier":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PaymentOrderSupplierResponseDto"}]},"type":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PaymentOrderComboItemResponseDto"}]},"receiptItems":{"type":"array","items":{"$ref":"#/components/schemas/PaymentOrderReceiptItemResponseDto"}},"paymentItems":{"type":"array","items":{"$ref":"#/components/schemas/PaymentOrderPaymentItemResponseDto"}}},"required":["id","number","date","createdAt","total","detail","status","typeId","supplierId","journalEntryId","supplier","type"]},"PaymentOrderPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentOrderResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"123"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"PaymentOrderReceiptInputDto":{"type":"object","properties":{"purchaseReceiptId":{"type":"number","example":12,"description":"Purchase receipt id"},"amount":{"type":"number","example":1210.5,"description":"Amount to pay against the receipt (> 0), always in the organization's currency — also for a receipt in a foreign currency."},"exchangeRate":{"type":"number","example":1100,"description":"Foreign-currency receipts only: rate of this payment (organization-currency units per unit of the receipt's currency). The receipt's pending balance goes down by amount / exchangeRate and the difference with the receipt's own rate is posted as an exchange difference. Omitted: the official AFIP rate cached for the order's date, only for organizations in pesos (EXCHANGE_RATE_REQUIRED when there is none, and always for other currencies). Ignored for receipts in the organization's currency."}},"required":["purchaseReceiptId","amount"]},"PaymentOrderPaymentInputDto":{"type":"object","properties":{"paymentMethodId":{"type":"number","example":3,"description":"Payment method id"},"amount":{"type":"number","example":1210.5,"description":"Payment amount (> 0)"},"date":{"type":"string","example":"2026-07-09","description":"Payment date (defaults to the order date)"},"description":{"type":"string","example":"Transferencia BBVA","description":"Entry description (defaults to the movement concept)"},"referenceNumber":{"type":"number","example":55,"description":"Reference id (check / own check / retention receipt) — see payment type"},"externalEntityId":{"type":"number","example":2,"description":"External entity id (cash register / bank account / retention) — see payment type"},"exchangeRate":{"type":"number","example":1100,"description":"Bank account (TRANSFERENCIA / PAGO_ONLINE) or cash register (EFECTIVO) in a foreign currency only: rate of this payment (organization-currency units per unit of the account's currency). Omitted: the official AFIP rate cached for the payment's date (default: the document's date), only for organizations in pesos (EXCHANGE_RATE_REQUIRED otherwise). Ignored for accounts in the organization's currency."},"foreignAmount":{"type":"number","example":1000,"description":"Bank account / cash register in a foreign currency only: units of the account's currency that leave it (its balance moves by this). `amount` stays in the organization's currency. Omitted: amount / exchangeRate. Sent with exchangeRate, foreignAmount × exchangeRate must equal amount (PAYMENT_FX_MISMATCH)."}},"required":["paymentMethodId","amount"]},"CreatePaymentOrderDto":{"type":"object","properties":{"supplierId":{"type":"number","example":1,"description":"Supplier id"},"date":{"type":"string","example":"2026-07-09","description":"Order date (ISO 8601)"},"detail":{"type":"string","example":"Pago facturas junio","nullable":true},"typeId":{"type":"number","example":110,"description":"Payment order type combo item id (ComboType.TipoOrdenPago = 11)"},"receipts":{"type":"array","items":{"$ref":"#/components/schemas/PaymentOrderReceiptInputDto"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/PaymentOrderPaymentInputDto"}},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."}},"required":["supplierId","date","typeId","receipts","payments"]},"PaymentMethodResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Efectivo Pesos"},"isActive":{"type":"boolean","example":true},"currencyId":{"type":"number","example":1},"paymentMethodTypeId":{"type":"number","example":1,"description":"Combo item id (payment method type)"}},"required":["id","name","isActive","currencyId","paymentMethodTypeId"]},"CreatePaymentMethodDto":{"type":"object","properties":{"name":{"type":"string","example":"Efectivo Pesos","description":"Payment method name"},"currencyId":{"type":"number","example":1,"description":"Currency id"},"paymentMethodTypeId":{"type":"number","example":1,"description":"Payment method type combo item id"},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the payment method is active. Defaults to true on create; toggle via PATCH or DELETE."}},"required":["name","currencyId","paymentMethodTypeId"]},"UpdatePaymentMethodDto":{"type":"object","properties":{"name":{"type":"string","example":"Efectivo Pesos","description":"Payment method name"},"currencyId":{"type":"number","example":1,"description":"Currency id"},"paymentMethodTypeId":{"type":"number","example":1,"description":"Payment method type combo item id"},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the payment method is active. Defaults to true on create; toggle via PATCH or DELETE."}}},"PaymentMethodEntryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Pago contado"},"operationNumber":{"type":"string","nullable":true,"example":"OP-12345"},"referenceNumber":{"type":"number","example":1001},"amount":{"type":"number","example":1500.5},"date":{"type":"string","example":"2026-01-15T10:00:00.000Z"},"createdAt":{"type":"string","example":"2026-01-15T10:00:00.000Z"},"entryType":{"type":"string","example":"income"},"accountId":{"type":"number","example":1},"paymentMethodId":{"type":"number","example":1},"externalEntityId":{"type":"integer","nullable":true,"example":42}},"required":["id","description","operationNumber","referenceNumber","amount","date","createdAt","entryType","accountId","paymentMethodId","externalEntityId"]},"CreatePaymentMethodEntryDto":{"type":"object","properties":{"description":{"type":"string","example":"Pago contado","description":"Entry description"},"referenceNumber":{"type":"number","example":1001,"description":"Reference number"},"amount":{"type":"number","example":1500.5,"description":"Entry amount (decimal)"},"date":{"format":"date-time","type":"string","example":"2025-04-28T10:00:00Z","description":"Entry date (ISO)"},"entryType":{"type":"string","example":"income","description":"Entry type (e.g. income, expense)"},"accountId":{"type":"number","example":1,"description":"Accounting account id"},"paymentMethodId":{"type":"number","example":1,"description":"Payment method id"},"operationNumber":{"type":"string","example":"OP-12345","nullable":true,"description":"Operation number"},"externalEntityId":{"type":"integer","example":42,"nullable":true,"description":"External entity id (if linked to a receipt or other entity)"}},"required":["description","referenceNumber","amount","date","entryType","accountId","paymentMethodId"]},"UpdatePaymentMethodEntryDto":{"type":"object","properties":{"description":{"type":"string","example":"Pago contado","description":"Entry description"},"referenceNumber":{"type":"number","example":1001,"description":"Reference number"},"amount":{"type":"number","example":1500.5,"description":"Entry amount (decimal)"},"date":{"format":"date-time","type":"string","example":"2025-04-28T10:00:00Z","description":"Entry date (ISO)"},"entryType":{"type":"string","example":"income","description":"Entry type (e.g. income, expense)"},"accountId":{"type":"number","example":1,"description":"Accounting account id"},"paymentMethodId":{"type":"number","example":1,"description":"Payment method id"},"operationNumber":{"type":"string","example":"OP-12345","nullable":true,"description":"Operation number"},"externalEntityId":{"type":"integer","example":42,"nullable":true,"description":"External entity id (if linked to a receipt or other entity)"}}},"BankResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Banco Nacion"},"isActive":{"type":"boolean","example":true},"locationId":{"type":"integer","nullable":true,"example":1,"description":"Province (location) id; null for banks of a Spanish organization"}},"required":["id","name","isActive","locationId"]},"CreateBankDto":{"type":"object","properties":{"name":{"type":"string","example":"Banco Nacion","description":"Bank name"},"locationId":{"type":"integer","nullable":true,"example":1,"description":"Province (location) id. Required for Argentine organizations (missing → 400 BANK_LOCATION_REQUIRED); optional for Spanish ones, whose banks have no location."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the bank is active. Defaults to true on create; toggle via PATCH or DELETE."}},"required":["name"]},"UpdateBankDto":{"type":"object","properties":{"name":{"type":"string","example":"Banco Nacion","description":"Bank name"},"locationId":{"type":"integer","nullable":true,"example":1,"description":"Province (location) id. Required for Argentine organizations (missing → 400 BANK_LOCATION_REQUIRED); optional for Spanish ones, whose banks have no location."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the bank is active. Defaults to true on create; toggle via PATCH or DELETE."}}},"BankAccountResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"number":{"type":"string","example":"0001-12345-6"},"name":{"type":"string","example":"Cuenta Corriente Pesos"},"balance":{"type":"number","nullable":true,"example":100000.5},"issuesChecks":{"type":"boolean","nullable":true,"example":true},"isActive":{"type":"boolean","example":true},"bankId":{"type":"number","example":1},"currencyId":{"type":"number","example":1},"accountId":{"type":"number","example":1},"onlinePayment":{"type":"boolean","nullable":true,"example":false}},"required":["id","number","name","balance","issuesChecks","isActive","bankId","currencyId","accountId","onlinePayment"]},"CreateBankAccountDto":{"type":"object","properties":{"number":{"type":"string","example":"0001-12345-6","description":"Bank account number"},"name":{"type":"string","example":"Cuenta Corriente Pesos","description":"Friendly name"},"bankId":{"type":"integer","example":1,"description":"Bank id. Missing or < 1 → 400 BANK_ACCOUNT_BANK_REQUIRED; another organization's → 400 BANK_NOT_FOUND."},"currencyId":{"type":"number","example":1,"description":"Currency id"},"accountId":{"type":"integer","example":1,"description":"Accounting (journal) account id. Missing or < 1 → a Spanish organization gets its 572 \"Bancos\" account; otherwise 400 BANK_ACCOUNT_ACCOUNT_REQUIRED. Another organization's → 400 JOURNAL_ACCOUNT_NOT_FOUND."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the account is active. Defaults to true on create; toggle via PATCH or DELETE."},"balance":{"type":"number","example":100000.5,"nullable":true,"description":"Current balance"},"issuesChecks":{"type":"boolean","nullable":true,"description":"Whether this account issues checks"},"onlinePayment":{"type":"boolean","nullable":true,"description":"Whether the account is enabled for online payments"}},"required":["number","name","bankId","currencyId"]},"UpdateBankAccountDto":{"type":"object","properties":{"number":{"type":"string","example":"0001-12345-6","description":"Bank account number"},"name":{"type":"string","example":"Cuenta Corriente Pesos","description":"Friendly name"},"bankId":{"type":"integer","example":1,"description":"Bank id. Missing or < 1 → 400 BANK_ACCOUNT_BANK_REQUIRED; another organization's → 400 BANK_NOT_FOUND."},"currencyId":{"type":"number","example":1,"description":"Currency id"},"accountId":{"type":"integer","example":1,"description":"Accounting (journal) account id. Missing or < 1 → a Spanish organization gets its 572 \"Bancos\" account; otherwise 400 BANK_ACCOUNT_ACCOUNT_REQUIRED. Another organization's → 400 JOURNAL_ACCOUNT_NOT_FOUND."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the account is active. Defaults to true on create; toggle via PATCH or DELETE."},"issuesChecks":{"type":"boolean","nullable":true,"description":"Whether this account issues checks"},"onlinePayment":{"type":"boolean","nullable":true,"description":"Whether the account is enabled for online payments"},"balance":{"type":"number","deprecated":true,"nullable":true,"example":100000.5,"description":"Read-only. The balance changes only through treasury movements. Sending the current value is ignored; any other value → 400 BANK_ACCOUNT_BALANCE_NOT_EDITABLE."}}},"BankAccountHistoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"concept":{"type":"string","example":"Depósito en efectivo"},"date":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"amount":{"type":"number","example":50000},"balance":{"type":"number","example":150000},"bankAccountId":{"type":"number","example":1}},"required":["id","concept","date","amount","balance","bankAccountId"]},"CashRegisterResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Caja Central"},"funds":{"type":"number","example":50000},"isActive":{"type":"boolean","example":true},"accountId":{"type":"number","example":1},"currencyId":{"type":"integer","nullable":true,"example":null,"description":"Currency of the cash register. Null = the organization's currency. A cash register in another currency keeps `funds` and its history in that currency; payments and fund movements on it move it by their `foreignAmount`."},"currencyLocked":{"type":"boolean","example":false,"description":"True once the cash register has movements or a balance other than zero: from then on `currencyId` cannot change (400 CASH_REGISTER_CURRENCY_LOCKED)."}},"required":["id","name","funds","isActive","accountId","currencyId","currencyLocked"]},"CreateCashRegisterDto":{"type":"object","properties":{"name":{"type":"string","example":"Caja Central","description":"Cash register name"},"funds":{"type":"number","example":50000,"description":"Current funds (decimal), in the cash register's currency (`currencyId`; the organization's when omitted)."},"accountId":{"type":"integer","example":1,"description":"Accounting (journal) account id. Missing or < 1 → a Spanish organization gets its 570 \"Caja, euros\" account; otherwise 400 CASH_REGISTER_ACCOUNT_REQUIRED. An id of another organization → 400 JOURNAL_ACCOUNT_NOT_FOUND."},"currencyId":{"type":"integer","nullable":true,"example":2,"description":"Currency of the cash register (e.g. a caja in dollars). Omitted or null = the organization's currency. It can only change while the cash register has no movements and a zero balance (400 CASH_REGISTER_CURRENCY_LOCKED otherwise); an unknown id → 400 CASH_REGISTER_CURRENCY_NOT_FOUND."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the cash register is active. Defaults to true on create; toggle via PATCH or DELETE."}},"required":["name","funds"]},"UpdateCashRegisterDto":{"type":"object","properties":{"name":{"type":"string","example":"Caja Central","description":"Cash register name"},"accountId":{"type":"integer","example":1,"description":"Accounting (journal) account id. Missing or < 1 → a Spanish organization gets its 570 \"Caja, euros\" account; otherwise 400 CASH_REGISTER_ACCOUNT_REQUIRED. An id of another organization → 400 JOURNAL_ACCOUNT_NOT_FOUND."},"currencyId":{"type":"integer","nullable":true,"example":2,"description":"Currency of the cash register (e.g. a caja in dollars). Omitted or null = the organization's currency. It can only change while the cash register has no movements and a zero balance (400 CASH_REGISTER_CURRENCY_LOCKED otherwise); an unknown id → 400 CASH_REGISTER_CURRENCY_NOT_FOUND."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the cash register is active. Defaults to true on create; toggle via PATCH or DELETE."},"funds":{"type":"number","deprecated":true,"example":50000,"description":"Read-only. Funds change only through treasury movements. Sending the current value is ignored; any other value → 400 CASH_REGISTER_FUNDS_NOT_EDITABLE."}}},"CashRegisterHistoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"concept":{"type":"string","example":"Cierre de caja"},"date":{"type":"string","example":"2026-01-15T18:00:00.000Z"},"amount":{"type":"number","example":12500},"balance":{"type":"number","example":62500},"cashRegisterId":{"type":"number","example":1}},"required":["id","concept","date","amount","balance","cashRegisterId"]},"CheckResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"dueDate":{"type":"string","nullable":true,"example":"2026-02-15T00:00:00.000Z"},"clearedDate":{"type":"string","nullable":true,"example":null},"amount":{"type":"number","example":50000},"number":{"type":"string","example":"00012345"},"status":{"type":"string","example":"PENDING"},"accountNumber":{"type":"string","nullable":true,"example":"0123-4-56789012-3"},"isOwn":{"type":"boolean","example":false,"description":"True = own check; false = third-party"},"bankId":{"type":"number","example":1},"customerId":{"type":"number","example":12},"userId":{"type":"string","example":"auth0|abc"}},"required":["id","createdAt","date","dueDate","clearedDate","amount","number","status","accountNumber","isOwn","bankId","customerId","userId"]},"CheckPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CheckResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateCheckDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Check date (ISO 8601)"},"amount":{"type":"number","example":50000,"description":"Check amount"},"number":{"type":"string","example":"00012345","description":"Check number"},"status":{"type":"string","example":"Cartera","enum":["Borrador","Cartera"],"description":"Initial check status. Only Borrador and Cartera can be set on create: Depositado comes from the deposit flow (which credits the bank), Devuelto from POST /:id/return, Entregado from a payment order and Anulado from a void."},"isOwn":{"type":"boolean","example":false,"description":"True if it is an own check (issued); false for third-party checks"},"bankId":{"type":"number","example":1,"description":"Bank id"},"customerId":{"type":"number","example":12,"description":"Customer id"},"dueDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Due date (ISO 8601)"},"clearedDate":{"type":"string","example":"2026-02-20T12:00:00Z","nullable":true,"description":"Cleared date (ISO 8601)"},"accountNumber":{"type":"string","example":"0123-4-56789012-3","nullable":true,"description":"Bank account number"}},"required":["date","amount","number","status","isOwn","bankId","customerId"]},"UpdateCheckDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Check date (ISO 8601)"},"amount":{"type":"number","example":50000,"description":"Check amount"},"number":{"type":"string","example":"00012345","description":"Check number"},"isOwn":{"type":"boolean","example":false,"description":"True if it is an own check (issued); false for third-party checks"},"bankId":{"type":"number","example":1,"description":"Bank id"},"customerId":{"type":"number","example":12,"description":"Customer id"},"dueDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Due date (ISO 8601)"},"clearedDate":{"type":"string","example":"2026-02-20T12:00:00Z","nullable":true,"description":"Cleared date (ISO 8601)"},"accountNumber":{"type":"string","example":"0123-4-56789012-3","nullable":true,"description":"Bank account number"},"status":{"type":"string","example":"Entregado","enum":["Borrador","Cartera","Entregado","Depositado","Devuelto","Anulado"],"description":"New check status. Only transitions with no treasury side effect are accepted; Depositado and Devuelto are reached through the deposit flow and POST /:id/return respectively."}}},"ReturnCheckDto":{"type":"object","properties":{"returnDate":{"format":"date-time","type":"string","example":"2026-06-15T00:00:00Z","description":"Date the check was rejected/returned (ISO 8601)"}},"required":["returnDate"]},"OwnCheckResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"amount":{"type":"number","example":50000},"number":{"type":"number","example":12345},"status":{"type":"string","example":"PENDING"},"paymentDate":{"type":"string","nullable":true,"example":"2026-02-15T00:00:00.000Z"},"supplierId":{"type":"integer","nullable":true,"example":5},"userId":{"type":"string","example":"auth0|abc"},"bankAccountId":{"type":"number","example":1}},"required":["id","createdAt","date","amount","number","status","paymentDate","supplierId","userId","bankAccountId"]},"OwnCheckPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OwnCheckResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateOwnCheckDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Check date (ISO 8601)"},"amount":{"type":"number","example":50000,"description":"Check amount"},"number":{"type":"number","example":12345,"description":"Check number"},"status":{"type":"string","example":"PENDING","description":"Check status"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"paymentDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Payment date (ISO 8601)"},"supplierId":{"type":"integer","example":5,"nullable":true,"description":"Supplier id"}},"required":["date","amount","number","status","bankAccountId"]},"UpdateOwnCheckDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Check date (ISO 8601)"},"amount":{"type":"number","example":50000,"description":"Check amount"},"number":{"type":"number","example":12345,"description":"Check number"},"status":{"type":"string","example":"PENDING","description":"Check status"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"paymentDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Payment date (ISO 8601)"},"supplierId":{"type":"integer","example":5,"nullable":true,"description":"Supplier id"}}},"ConfirmPaymentDto":{"type":"object","properties":{"paymentDate":{"format":"date-time","type":"string","example":"2026-03-20T00:00:00Z","description":"Date on which the bank debited the check (ISO 8601)"}},"required":["paymentDate"]},"ExchangeOwnCheckDto":{"type":"object","properties":{"newNumber":{"type":"number","example":2002,"description":"New check number"},"newBankAccountId":{"type":"number","example":5,"description":"Bank account id for the new check"},"newDate":{"format":"date-time","type":"string","example":"2026-04-15T00:00:00Z","description":"Date of the new check (ISO 8601)"}},"required":["newNumber","newBankAccountId","newDate"]},"ExchangeOwnCheckResponseDto":{"type":"object","properties":{"oldCheck":{"$ref":"#/components/schemas/OwnCheckResponseDto"},"newCheck":{"$ref":"#/components/schemas/OwnCheckResponseDto"}},"required":["oldCheck","newCheck"]},"CheckbookResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"numberFrom":{"type":"number","example":1},"numberTo":{"type":"number","example":50},"name":{"type":"string","example":"Chequera 001"},"bankAccountId":{"type":"number","example":1}},"required":["id","numberFrom","numberTo","name","bankAccountId"]},"CreateCheckbookDto":{"type":"object","properties":{"name":{"type":"string","example":"Chequera 001","description":"Checkbook friendly name"},"numberFrom":{"type":"number","example":1,"description":"First check number in the book"},"numberTo":{"type":"number","example":50,"description":"Last check number in the book"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id this checkbook belongs to"}},"required":["name","numberFrom","numberTo","bankAccountId"]},"UpdateCheckbookDto":{"type":"object","properties":{"name":{"type":"string","example":"Chequera 001","description":"Checkbook friendly name"},"numberFrom":{"type":"number","example":1,"description":"First check number in the book"},"numberTo":{"type":"number","example":50,"description":"Last check number in the book"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id this checkbook belongs to"}}},"DepositResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"concept":{"type":"string","nullable":true,"example":"Depósito mostrador"},"creditDate":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"createdAt":{"type":"string","example":"2026-01-15T10:00:00.000Z"},"depositDate":{"type":"string","example":"2026-01-14T12:00:00.000Z"},"ticketNumber":{"type":"string","example":"TKT-00012345"},"total":{"type":"number","example":25000.5},"accountId":{"type":"number","example":1,"description":"Bank account id receiving the deposit"},"journalEntryId":{"type":"integer","nullable":true,"example":100},"userId":{"type":"string","example":"auth0|abc"}},"required":["id","concept","creditDate","createdAt","depositDate","ticketNumber","total","accountId","journalEntryId","userId"]},"DepositPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DepositResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"DepositItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"checkId":{"type":"number","example":12},"depositId":{"type":"integer","nullable":true,"example":1}},"required":["id","checkId","depositId"]},"CreateDepositDto":{"type":"object","properties":{"creditDate":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Credit date (ISO 8601)"},"depositDate":{"format":"date-time","type":"string","example":"2026-01-14T12:00:00Z","description":"Deposit date (ISO 8601)"},"ticketNumber":{"type":"string","example":"TKT-00012345","description":"Deposit ticket number"},"total":{"type":"number","example":25000.5,"description":"Total deposit amount"},"accountId":{"type":"number","example":1,"description":"Bank account id receiving the deposit"},"concept":{"type":"string","example":"Depósito mostrador","nullable":true},"checkIds":{"example":[12,15],"description":"Third-party check ids (in Cartera) to include in the deposit. When present, the total is computed from the checks, each check is marked as Depositado, and an accounting entry is auto-generated (v1 AddDeposito flow).","type":"array","items":{"type":"number"}}},"required":["creditDate","depositDate","ticketNumber","total","accountId"]},"UpdateDepositDto":{"type":"object","properties":{"creditDate":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Credit date (ISO 8601)"},"depositDate":{"format":"date-time","type":"string","example":"2026-01-14T12:00:00Z","description":"Deposit date (ISO 8601)"},"ticketNumber":{"type":"string","example":"TKT-00012345","description":"Deposit ticket number"},"total":{"type":"number","example":25000.5,"description":"Total deposit amount"},"accountId":{"type":"number","example":1,"description":"Bank account id receiving the deposit"},"concept":{"type":"string","example":"Depósito mostrador","nullable":true},"checkIds":{"example":[12,15],"description":"Third-party check ids (in Cartera) to include in the deposit. When present, the total is computed from the checks, each check is marked as Depositado, and an accounting entry is auto-generated (v1 AddDeposito flow).","type":"array","items":{"type":"number"}}}},"TransferResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"amount":{"type":"number","example":75000},"status":{"type":"string","example":"PENDING"},"bankAccountId":{"type":"number","example":1},"customerId":{"type":"integer","nullable":true,"example":12},"supplierId":{"type":"integer","nullable":true,"example":null},"userId":{"type":"string","example":"auth0|abc"}},"required":["id","createdAt","date","amount","status","bankAccountId","customerId","supplierId","userId"]},"TransferPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TransferResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateTransferDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Transfer date (ISO 8601)"},"amount":{"type":"number","example":75000,"description":"Transfer amount"},"status":{"type":"string","example":"PENDING","description":"Transfer status"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"customerId":{"type":"integer","example":12,"nullable":true,"description":"Customer id (for incoming transfers)"},"supplierId":{"type":"integer","example":7,"nullable":true,"description":"Supplier id (for outgoing transfers)"}},"required":["date","amount","status","bankAccountId"]},"UpdateTransferDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Transfer date (ISO 8601)"},"amount":{"type":"number","example":75000,"description":"Transfer amount"},"status":{"type":"string","example":"PENDING","description":"Transfer status"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"customerId":{"type":"integer","example":12,"nullable":true,"description":"Customer id (for incoming transfers)"},"supplierId":{"type":"integer","example":7,"nullable":true,"description":"Supplier id (for outgoing transfers)"}}},"FundMovementFxResponseDto":{"type":"object","properties":{"currencyId":{"type":"number","example":2,"description":"Currency of the movement's account(s) in a foreign currency"},"exchangeRate":{"type":"number","example":1000,"description":"Rate of the movement (organization-currency units per unit)"},"foreignAmount":{"type":"number","example":100,"description":"Units of that currency each foreign-currency account moved; `amount` (and the journal entry) stays in the organization's currency"}},"required":["currencyId","exchangeRate","foreignAmount"]},"FundMovementResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"date":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"creditDate":{"type":"string","nullable":true,"example":"2026-01-16T12:00:00.000Z"},"concept":{"type":"string","nullable":true,"example":"Acreditación cliente"},"amount":{"type":"number","example":15000.5,"description":"Amount in the organization's currency (what the journal entry posts)"},"bankAccountId":{"type":"number","example":1},"destinationAccountId":{"type":"integer","nullable":true,"example":2},"movementTypeId":{"type":"number","example":12,"description":"Combo item id (movement type)"},"cashRegisterId":{"type":"integer","nullable":true,"example":null},"journalEntryId":{"type":"integer","nullable":true,"example":null},"userId":{"type":"string","example":"auth0|abc"},"fx":{"description":"Movements on a bank account or cash register in a foreign currency only (PAN-420). Absent otherwise.","allOf":[{"$ref":"#/components/schemas/FundMovementFxResponseDto"}]}},"required":["id","date","createdAt","creditDate","concept","amount","bankAccountId","destinationAccountId","movementTypeId","cashRegisterId","journalEntryId","userId"]},"FundMovementPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FundMovementResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateFundMovementDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Movement date (ISO 8601)"},"amount":{"type":"number","example":15000.5,"description":"Movement amount"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"movementTypeId":{"type":"number","example":12,"description":"Movement type id (combo item)"},"creditDate":{"type":"string","example":"2026-01-16T12:00:00Z","nullable":true,"description":"Credit date (ISO 8601)"},"concept":{"type":"string","example":"Acreditación cliente","nullable":true},"destinationAccountId":{"type":"integer","example":2,"nullable":true,"description":"Destination bank account id (for transfers)"},"cashRegisterId":{"type":"integer","example":3,"nullable":true,"description":"Cash register id"},"exchangeRate":{"type":"number","example":1000,"description":"Bank account / cash register in a foreign currency only: rate of the movement (organization-currency units per unit of that currency). Omitted: the official AFIP rate cached for the movement's date, only for organizations in pesos (EXCHANGE_RATE_REQUIRED otherwise). Ignored when every account is in the organization's currency."},"foreignAmount":{"type":"number","example":100,"description":"Bank account / cash register in a foreign currency only: units of that currency each foreign account moves (e.g. dollars bought into a USD cash register). `amount` stays in the organization's currency. Omitted: amount / exchangeRate. Sent with exchangeRate, foreignAmount × exchangeRate must equal amount (PAYMENT_FX_MISMATCH)."}},"required":["date","amount","bankAccountId","movementTypeId"]},"UpdateFundMovementDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Movement date (ISO 8601)"},"amount":{"type":"number","example":15000.5,"description":"Movement amount"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id"},"movementTypeId":{"type":"number","example":12,"description":"Movement type id (combo item)"},"creditDate":{"type":"string","example":"2026-01-16T12:00:00Z","nullable":true,"description":"Credit date (ISO 8601)"},"concept":{"type":"string","example":"Acreditación cliente","nullable":true},"destinationAccountId":{"type":"integer","example":2,"nullable":true,"description":"Destination bank account id (for transfers)"},"cashRegisterId":{"type":"integer","example":3,"nullable":true,"description":"Cash register id"}}},"CreditCardResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"number":{"type":"string","example":"Visa Black"},"status":{"type":"string","example":"active"},"bankAccountId":{"type":"number","example":1},"accountId":{"type":"number","example":1}},"required":["id","number","status","bankAccountId","accountId"]},"CreateCreditCardDto":{"type":"object","properties":{"number":{"type":"string","example":"4111111111111111","description":"Credit card number or identifier"},"status":{"type":"string","example":"active","description":"Card status (e.g. active, blocked)"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id linked to this card"},"accountId":{"type":"number","example":1,"description":"Accounting account id"}},"required":["number","status","bankAccountId","accountId"]},"UpdateCreditCardDto":{"type":"object","properties":{"number":{"type":"string","example":"4111111111111111","description":"Credit card number or identifier"},"status":{"type":"string","example":"active","description":"Card status (e.g. active, blocked)"},"bankAccountId":{"type":"number","example":1,"description":"Bank account id linked to this card"},"accountId":{"type":"number","example":1,"description":"Accounting account id"}}},"CardPaymentResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"cancelledDate":{"type":"string","nullable":true,"example":null},"total":{"type":"number","example":18000.5},"number":{"type":"string","nullable":true,"example":"AUTH-987654"},"totalCancelled":{"type":"number","example":0},"status":{"type":"string","example":"PENDING"},"installments":{"type":"number","example":3},"cancelledInstallments":{"type":"number","example":0},"detail":{"type":"string","nullable":true,"example":"Visa Crédito 6 cuotas"},"creditCardId":{"type":"number","example":1},"userId":{"type":"string","example":"auth0|abc"}},"required":["id","createdAt","date","cancelledDate","total","number","totalCancelled","status","installments","cancelledInstallments","detail","creditCardId","userId"]},"CardPaymentPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CardPaymentResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ=="},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CardCancellationResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-02-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-02-15T12:00:00.000Z"},"amount":{"type":"number","example":6000},"installments":{"type":"number","example":1},"cardPaymentId":{"type":"number","example":1},"paymentMethodEntryId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":null},"userId":{"type":"string","example":"auth0|abc"}},"required":["id","createdAt","date","amount","installments","cardPaymentId","paymentMethodEntryId","journalEntryId","userId"]},"CreateCardCancellationDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-06-01T00:00:00Z","description":"Cancellation date (ISO 8601)"},"amount":{"type":"number","example":6000,"description":"Amount being cancelled"},"installments":{"type":"number","example":3,"description":"Number of installments being cancelled"},"paymentMethodId":{"type":"number","example":3,"description":"Payment method used to pay the card — an Egreso treasury entry is created from it, referencing the card's bank account (v1: CancelacionTarjeta.Valor)"}},"required":["date","amount","installments","paymentMethodId"]},"CreateCardPaymentDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Card payment date (ISO 8601)"},"total":{"type":"number","example":18000.5,"description":"Total payment amount"},"totalCancelled":{"type":"number","example":0,"description":"Total amount already cancelled"},"status":{"type":"string","example":"PENDING","description":"Payment status"},"installments":{"type":"number","example":3,"description":"Total number of installments"},"cancelledInstallments":{"type":"number","example":0,"description":"Installments already cancelled"},"creditCardId":{"type":"number","example":1,"description":"Credit card id"},"cancelledDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Cancelled date (ISO 8601)"},"number":{"type":"string","example":"AUTH-987654","nullable":true,"description":"Authorization / payment number"},"detail":{"type":"string","example":"Visa Crédito 6 cuotas","nullable":true}},"required":["date","total","totalCancelled","status","installments","cancelledInstallments","creditCardId"]},"UpdateCardPaymentDto":{"type":"object","properties":{"date":{"format":"date-time","type":"string","example":"2026-01-15T12:00:00Z","description":"Card payment date (ISO 8601)"},"total":{"type":"number","example":18000.5,"description":"Total payment amount"},"totalCancelled":{"type":"number","example":0,"description":"Total amount already cancelled"},"status":{"type":"string","example":"PENDING","description":"Payment status"},"installments":{"type":"number","example":3,"description":"Total number of installments"},"cancelledInstallments":{"type":"number","example":0,"description":"Installments already cancelled"},"creditCardId":{"type":"number","example":1,"description":"Credit card id"},"cancelledDate":{"type":"string","example":"2026-02-15T12:00:00Z","nullable":true,"description":"Cancelled date (ISO 8601)"},"number":{"type":"string","example":"AUTH-987654","nullable":true,"description":"Authorization / payment number"},"detail":{"type":"string","example":"Visa Crédito 6 cuotas","nullable":true}}},"RetentionResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"abbreviation":{"type":"string","example":"RG-IIBB"},"description":{"type":"string","example":"Retención IIBB CABA"},"isActive":{"type":"boolean","example":true},"isValue":{"type":"boolean","example":false,"description":"True = fixed value; false = percentage"},"accountId":{"type":"number","example":100},"jurisdictionId":{"type":"number","example":1},"depositAccountId":{"type":"number","example":200}},"required":["id","abbreviation","description","isActive","isValue","accountId","jurisdictionId","depositAccountId"]},"RetentionReceiptResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"total":{"type":"number","example":1500},"number":{"type":"string","nullable":true,"example":"00001-00000123"},"status":{"type":"string","example":"EMITIDO"},"retentionNumber":{"type":"string","nullable":true,"example":"00001-00000456"},"userId":{"type":"string","nullable":true,"example":"auth0|abc"},"retentionId":{"type":"number","example":1},"customerId":{"type":"integer","nullable":true,"example":1},"supplierId":{"type":"integer","nullable":true,"example":null},"paymentOrderId":{"type":"integer","nullable":true,"example":null,"description":"Payment order (OP) that practiced this retention"},"baseAmount":{"type":"number","nullable":true,"example":100000,"description":"Informational base amount (certificate only)"},"rate":{"type":"number","nullable":true,"example":3,"description":"Informational rate % (certificate only)"}},"required":["id","createdAt","date","total","number","status","retentionNumber","userId","retentionId","customerId","supplierId","paymentOrderId","baseAmount","rate"]},"CreateRetentionReceiptDto":{"type":"object","properties":{"retentionId":{"type":"number","example":1,"description":"Retention type id (must exist + be active)"},"supplierId":{"type":"number","example":12,"description":"Supplier id (sujeto retenido) — required for a retención practicada"},"total":{"type":"number","example":3000,"description":"Withheld amount (manual, v1 parity — no calc engine)"},"date":{"type":"string","example":"2026-01-15T12:00:00Z","description":"Retention date (ISO 8601)"},"number":{"type":"string","nullable":true,"example":"00001-00000123","description":"User comprobante number"},"baseAmount":{"type":"number","example":100000,"description":"Informational base amount (certificate only, not used to recompute total)"},"rate":{"type":"number","example":3,"description":"Informational rate % (certificate only, not used to recompute total)"}},"required":["retentionId","supplierId","total","date"]},"RetentionReportRetentionDto":{"type":"object","properties":{"id":{"type":"number","example":1},"abbreviation":{"type":"string","example":"IIBB"},"description":{"type":"string","example":"Retención Ingresos Brutos"},"jurisdictionId":{"type":"integer","nullable":true,"example":2}},"required":["id","abbreviation","description","jurisdictionId"]},"RetentionReportPartyDto":{"type":"object","properties":{"id":{"type":"number","example":12},"businessName":{"type":"string","example":"Proveedor SA"},"taxId":{"type":"string","nullable":true,"example":"30-12345678-9"}},"required":["id","businessName","taxId"]},"RetentionReceiptReportRowDto":{"type":"object","properties":{"id":{"type":"number","example":1},"date":{"type":"string","example":"2026-01-15T00:00:00.000Z"},"total":{"type":"number","example":1500},"number":{"type":"string","nullable":true,"example":"00001-00000123"},"status":{"type":"string","example":"Recibido"},"retentionNumber":{"type":"string","nullable":true,"example":"00001-00000456"},"retentionId":{"type":"number","example":1},"customerId":{"type":"integer","nullable":true,"example":1},"supplierId":{"type":"integer","nullable":true,"example":null},"retention":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/RetentionReportRetentionDto"}]},"supplier":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/RetentionReportPartyDto"}]},"customer":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/RetentionReportPartyDto"}]}},"required":["id","date","total","number","status","retentionNumber","retentionId","customerId","supplierId","retention","supplier","customer"]},"CreateRetentionDto":{"type":"object","properties":{"abbreviation":{"type":"string","example":"RG-IIBB","description":"Short abbreviation"},"description":{"type":"string","example":"Retención IIBB CABA","description":"Retention description"},"isValue":{"type":"boolean","example":false,"description":"Whether the retention is treated as a value (vs percentage)"},"accountId":{"type":"number","example":100,"description":"Contra-account (activo a computar) id. Optional — resolved by code 1.1.3 from the org's journal_accounts when omitted."},"jurisdictionId":{"type":"number","example":1,"description":"Jurisdiction (location) id"},"depositAccountId":{"type":"number","example":200,"description":"Contra-account (pasivo a depositar) id. Optional — resolved by code 1.2.3 from the org's journal_accounts when omitted."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the retention is active. Defaults to true on create; toggle via PATCH or DELETE."}},"required":["abbreviation","description","isValue","jurisdictionId"]},"UpdateRetentionDto":{"type":"object","properties":{"abbreviation":{"type":"string","example":"RG-IIBB","description":"Short abbreviation"},"description":{"type":"string","example":"Retención IIBB CABA","description":"Retention description"},"isValue":{"type":"boolean","example":false,"description":"Whether the retention is treated as a value (vs percentage)"},"accountId":{"type":"number","example":100,"description":"Contra-account (activo a computar) id. Optional — resolved by code 1.1.3 from the org's journal_accounts when omitted."},"jurisdictionId":{"type":"number","example":1,"description":"Jurisdiction (location) id"},"depositAccountId":{"type":"number","example":200,"description":"Contra-account (pasivo a depositar) id. Optional — resolved by code 1.2.3 from the org's journal_accounts when omitted."},"isActive":{"type":"boolean","example":true,"default":true,"description":"Whether the retention is active. Defaults to true on create; toggle via PATCH or DELETE."}}},"TreasuryMovementRowResponseDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-01-15"},"description":{"type":"string","example":"Cobranza FC 00001-00001234"},"paymentMethodName":{"type":"string","example":"Efectivo"},"entryType":{"type":"string","example":"Ingreso","description":"Ingreso | Egreso"},"amount":{"type":"number","example":15000},"reference":{"type":"string","example":"42"}},"required":["date","description","paymentMethodName","entryType","amount","reference"]},"TreasuryMovementsResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TreasuryMovementRowResponseDto"}},"total":{"type":"number","example":145},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50},"totalIngresos":{"type":"number","example":250000,"description":"Total of Ingreso entries in the date range"},"totalEgresos":{"type":"number","example":125000,"description":"Total of Egreso entries in the date range"}},"required":["data","total","page","pageSize","totalIngresos","totalEgresos"]},"CashflowAccountRowDto":{"type":"object","properties":{"accountId":{"type":"number","example":42,"description":"Shared account id (account_id) the caja/banco maps to"},"accountName":{"type":"string","example":"Caja Central"},"accountKind":{"type":"string","example":"caja","enum":["caja","banco"],"description":"Kind of account: caja (cash register) or banco (bank account)"},"inflow":{"type":"number","example":250000,"description":"Sum of Ingreso amounts in the period"},"outflow":{"type":"number","example":125000,"description":"Sum of Egreso amounts in the period"},"net":{"type":"number","example":125000,"description":"inflow − outflow"}},"required":["accountId","accountName","accountKind","inflow","outflow","net"]},"CashflowTotalsDto":{"type":"object","properties":{"totalInflow":{"type":"number","example":250000},"totalOutflow":{"type":"number","example":125000},"netFlow":{"type":"number","example":125000,"description":"totalInflow − totalOutflow"}},"required":["totalInflow","totalOutflow","netFlow"]},"CashflowPeriodDto":{"type":"object","properties":{"dateFrom":{"type":"string","example":"2026-01-01"},"dateTo":{"type":"string","example":"2026-01-31"}},"required":["dateFrom","dateTo"]},"CashflowResponseDto":{"type":"object","properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/CashflowAccountRowDto"}},"totals":{"$ref":"#/components/schemas/CashflowTotalsDto"},"period":{"$ref":"#/components/schemas/CashflowPeriodDto"}},"required":["accounts","totals","period"]},"AfipComprobantesStatusResponseDto":{"type":"object","properties":{"provider":{"type":"string","example":"AFIP_COMPROBANTES"},"available":{"type":"boolean","example":false,"description":"True once credentials + scraper are live."},"reason":{"type":"string","example":"Pendiente de credenciales AFIP de solo lectura.","description":"Why it is (un)available."}},"required":["provider","available","reason"]},"ReceiptBookResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Sucursal Centro - WS"},"prefix":{"type":"string","example":"0001"},"pointOfSale":{"type":"number","example":1},"isExport":{"type":"boolean","nullable":true,"example":false},"createdAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"type":{"type":"string","nullable":true,"example":"WS"},"lastUpdatedUserId":{"type":"integer","nullable":true,"example":7},"userId":{"type":"integer","nullable":true,"example":1},"branchId":{"type":"integer","nullable":true,"example":1},"lastInvoiceA":{"type":"integer","nullable":true,"example":100},"lastInvoiceB":{"type":"integer","nullable":true,"example":100},"lastInvoiceC":{"type":"integer","nullable":true,"example":100},"lastCreditNoteA":{"type":"integer","nullable":true,"example":10},"lastCreditNoteB":{"type":"integer","nullable":true,"example":10},"lastCreditNoteC":{"type":"integer","nullable":true,"example":10},"lastDebitNoteA":{"type":"integer","nullable":true,"example":5},"lastDebitNoteB":{"type":"integer","nullable":true,"example":5},"lastDebitNoteC":{"type":"integer","nullable":true,"example":5},"backofficeIds":{"type":"string","nullable":true,"example":null},"isDisabled":{"type":"boolean","example":false,"description":"True when the organization disabled this receipt book (\"No usado en Peakly\"): it stays listed, but creating, confirming or voiding with a credit note against it answers 400 RECEIPT_BOOK_DISABLED. Toggle it with POST /receipt-books/{id}/disable and POST /receipt-books/{id}/enable."},"disabledReason":{"type":"string","nullable":true,"example":null,"description":"Why the book was disabled (default \"No usado en Peakly\"); null when it is enabled."}},"required":["id","description","prefix","pointOfSale","isExport","createdAt","deletedAt","updatedAt","type","lastUpdatedUserId","userId","branchId","lastInvoiceA","lastInvoiceB","lastInvoiceC","lastCreditNoteA","lastCreditNoteB","lastCreditNoteC","lastDebitNoteA","lastDebitNoteB","lastDebitNoteC","backofficeIds","isDisabled","disabledReason"]},"ImportFromArcaResponseDto":{"type":"object","properties":{"created":{"type":"number","example":3,"description":"Number of newly created receipt books"},"skipped":{"type":"number","example":1,"description":"Number of points of sale skipped because a receipt book for them already exists (enabled or disabled) or the number is outside 1–99998"},"skippedInactive":{"type":"number","example":2,"description":"Number of points of sale ARCA reports as blocked (Bloqueado = S) or discharged (FchBaja set); they are not imported"},"warnings":{"example":["No se pudieron consultar los puntos de venta de exportación (WSFEX): Certificado no autorizado"],"description":"Non-fatal problems, in Spanish: one web service (WSFE or WSFEX) failed while the other answered, so only the other one's points of sale were imported. Empty when both answered. If both fail the request answers 502 ARCA_POINTS_OF_SALE_UNAVAILABLE instead.","type":"array","items":{"type":"string"}},"receiptBooks":{"description":"Final state of all receipt books after the import","type":"array","items":{"$ref":"#/components/schemas/ReceiptBookResponseDto"}}},"required":["created","skipped","skippedInactive","warnings","receiptBooks"]},"CreateReceiptBookDto":{"type":"object","properties":{"description":{"type":"string","example":"Sucursal Centro - WS","description":"Display name for the receipt book."},"prefix":{"type":"string","example":"0001","description":"Prefix used to compose receipt numbers (e.g. `0001-00000123`). Unique per organization. For Argentina it must be the point of sale with four digits up to 9999 and five from 10000 (`10000`); anything else is INVALID_RECEIPT_BOOK_PREFIX. Spain: the invoice series (free text)."},"pointOfSale":{"type":"number","example":1,"minimum":1,"maximum":99998,"description":"AFIP point of sale (Punto de Venta) number, 1–99998. Unique per organization. Receipt numbers write it with four digits up to 9999 (`0001-00000123`) and five from 10000 (`10000-00000123`)."},"type":{"type":"string","enum":["WS","WS_MOCK","EN_LINEA","PRE_IMPRESOS","AUTOGESTION"],"example":"WS","nullable":true,"description":"Point of sale type (WS = AFIP web service, WS_MOCK = synthetic, EN_LINEA = online, PRE_IMPRESOS = printed, AUTOGESTION = self-managed: numbered by Peakly, final on confirm, no tax authority). Allowed values depend on the organization's country: Argentina accepts WS/WS_MOCK/EN_LINEA/PRE_IMPRESOS; Spain accepts only AUTOGESTION (the default when omitted). WS/WS_MOCK outside Argentina → ELECTRONIC_EMISSION_NOT_AVAILABLE. WS_MOCK is for testing only: in production it is refused (INVALID_RECEIPT_BOOK_TYPE) unless the book already is WS_MOCK."},"isExport":{"type":"object","example":false,"nullable":true,"description":"When true, routes to WSFEX (export) instead of WSFE (domestic)."},"branchId":{"type":"integer","example":1,"nullable":true,"description":"Branch (Sucursal) id"}},"required":["description","prefix","pointOfSale"]},"UpdateReceiptBookDto":{"type":"object","properties":{"description":{"type":"string","example":"Sucursal Centro - WS","description":"Display name for the receipt book."},"prefix":{"type":"string","example":"0001","description":"Prefix used to compose receipt numbers (e.g. `0001-00000123`). Unique per organization. For Argentina it must be the point of sale with four digits up to 9999 and five from 10000 (`10000`); anything else is INVALID_RECEIPT_BOOK_PREFIX. Spain: the invoice series (free text)."},"pointOfSale":{"type":"number","example":1,"minimum":1,"maximum":99998,"description":"AFIP point of sale (Punto de Venta) number, 1–99998. Unique per organization. Receipt numbers write it with four digits up to 9999 (`0001-00000123`) and five from 10000 (`10000-00000123`)."},"type":{"type":"string","enum":["WS","WS_MOCK","EN_LINEA","PRE_IMPRESOS","AUTOGESTION"],"example":"WS","nullable":true,"description":"Point of sale type (WS = AFIP web service, WS_MOCK = synthetic, EN_LINEA = online, PRE_IMPRESOS = printed, AUTOGESTION = self-managed: numbered by Peakly, final on confirm, no tax authority). Allowed values depend on the organization's country: Argentina accepts WS/WS_MOCK/EN_LINEA/PRE_IMPRESOS; Spain accepts only AUTOGESTION (the default when omitted). WS/WS_MOCK outside Argentina → ELECTRONIC_EMISSION_NOT_AVAILABLE. WS_MOCK is for testing only: in production it is refused (INVALID_RECEIPT_BOOK_TYPE) unless the book already is WS_MOCK."},"isExport":{"type":"object","example":false,"nullable":true,"description":"When true, routes to WSFEX (export) instead of WSFE (domestic)."},"branchId":{"type":"integer","example":1,"nullable":true,"description":"Branch (Sucursal) id"},"lastInvoiceA":{"type":"integer","example":100,"nullable":true,"description":"Last issued Factura A number"},"lastInvoiceB":{"type":"integer","example":100,"nullable":true,"description":"Last issued Factura B number"},"lastInvoiceC":{"type":"integer","example":100,"nullable":true,"description":"Last issued Factura C number"},"lastCreditNoteA":{"type":"integer","example":10,"nullable":true,"description":"Last issued Nota de Crédito A number"},"lastCreditNoteB":{"type":"integer","example":10,"nullable":true},"lastCreditNoteC":{"type":"integer","example":10,"nullable":true},"lastDebitNoteA":{"type":"integer","example":5,"nullable":true,"description":"Last issued Nota de Débito A number"},"lastDebitNoteB":{"type":"integer","example":5,"nullable":true},"lastDebitNoteC":{"type":"integer","example":5,"nullable":true},"backofficeIds":{"type":"string","nullable":true,"description":"Comma-separated backoffice ids for cross-system reconciliation"}}},"DisableReceiptBookDto":{"type":"object","properties":{"reason":{"type":"string","example":"No usado en Peakly","maxLength":255,"description":"Why the book is disabled. Defaults to \"No usado en Peakly\" when omitted or blank."}}},"ImportPreviewRowDto":{"type":"object","properties":{"rowNumber":{"type":"number","example":2,"description":"1-indexed row where the comprobante starts."},"success":{"type":"boolean","example":true,"description":"Whether this comprobante would import."},"message":{"type":"string","example":"Válido — se importaría","description":"Per-row outcome or the reason it would fail."}},"required":["rowNumber","success","message"]},"ImportPreviewResponseDto":{"type":"object","properties":{"total":{"type":"number","example":10,"description":"Total comprobantes detected (grouped rows)."},"valid":{"type":"number","example":9,"description":"Comprobantes that would import cleanly."},"errors":{"type":"number","example":1,"description":"Comprobantes that would fail with an error."},"results":{"description":"Per-comprobante result.","type":"array","items":{"$ref":"#/components/schemas/ImportPreviewRowDto"}},"truncated":{"type":"boolean","example":false,"description":"True when the file has more comprobantes than the preview can validate in one request (capped at MAX_PREVIEW_GROUPS); `valid`/`errors`/`results` then only cover the first MAX_PREVIEW_GROUPS comprobantes, not the full `total`."}},"required":["total","valid","errors","results","truncated"]},"CreateFileImportDto":{"type":"object","properties":{"path":{"type":"string","example":"12/1714300000000_customers-2026-04-28.xlsx","description":"Storage key of the file to import (must already exist). Must be under the organization's own prefix (`<organizationId>/<file>`); anything else is rejected with `INVALID_IMPORT_PATH`."},"type":{"type":"string","enum":["COMPROBANTES_VENTA","COMPROBANTES_COMPRA","purchase-receipts","CLIENTES","PROVEEDORES","PRODUCTOS","PAYROLL"],"example":"CLIENTES","description":"Import type. Must match the file's contents."},"originalFilename":{"type":"string","example":"customers-2026.xlsx","nullable":true},"userId":{"type":"integer","example":42,"nullable":true,"description":"Acting user id"}},"required":["path","type"]},"UpdateFileImportDto":{"type":"object","properties":{"originalFilename":{"type":"string","example":"customers-2026.xlsx","nullable":true},"status":{"type":"string","example":"PROCESSED","description":"Import status (PENDING, PROCESSED, FAILED, etc.)."},"totalCount":{"type":"integer","example":100,"nullable":true},"importedCount":{"type":"integer","example":95,"nullable":true},"errorCount":{"type":"integer","example":5,"nullable":true}}},"BranchResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Sucursal Centro"},"address":{"type":"string","example":"Av. Corrientes 1234"},"email":{"type":"string","nullable":true,"example":"sucursal@empresa.com.ar"},"phone1":{"type":"string","nullable":true,"example":"+54 11 4444-5555"},"phone2":{"type":"string","nullable":true,"example":null},"phone3":{"type":"string","nullable":true,"example":null},"city":{"type":"string","example":"Buenos Aires"},"postalCode":{"type":"string","example":"C1043AAZ"},"locationId":{"type":"number","example":1},"consumerLegend":{"type":"string","nullable":true,"example":"147 - Teléfono Gratuito CABA, Área de Defensa y Protección al Consumidor","description":"Consumer-defense legend printed on every receipt issued from this branch's points of sale. Null prints nothing. In Buenos Aires province the Línea 148 legend replaces it when that rule applies."},"providerId":{"type":"string","nullable":true,"example":"sede-k57abc","description":"Id of the branch in an external system that syncs its roster (`POST /attendance/roster-sync`). Unique per organization among live branches; read-only."},"createdAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"deletedAt":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-02-15T12:00:00.000Z"},"lastUpdatedUserId":{"type":"integer","nullable":true,"example":7},"userId":{"type":"integer","nullable":true,"example":1}},"required":["id","name","address","email","phone1","phone2","phone3","city","postalCode","locationId","consumerLegend","providerId","createdAt","deletedAt","updatedAt","lastUpdatedUserId","userId"]},"CreateBranchDto":{"type":"object","properties":{"name":{"type":"string","example":"Sucursal Centro","description":"Display name for the branch — must not match another branch in your organization."},"address":{"type":"string","example":"Av. Corrientes 1234","description":"Street address shown on receipts."},"city":{"type":"string","example":"Buenos Aires","description":"City."},"postalCode":{"type":"string","example":"C1043AAZ","description":"Postal code (CP)."},"locationId":{"type":"number","example":1,"description":"Province/region id from `GET /locations`."},"email":{"type":"string","example":"sucursal@empresa.com.ar","nullable":true},"phone1":{"type":"string","example":"+54 11 4444-5555","nullable":true},"phone2":{"type":"string","example":"+54 11 4444-6666","nullable":true},"phone3":{"type":"string","example":"+54 11 4444-7777","nullable":true},"consumerLegend":{"type":"string","nullable":true,"maxLength":500,"example":"147 - Teléfono Gratuito CABA, Área de Defensa y Protección al Consumidor","description":"Consumer-defense legend printed on every receipt issued from this branch's points of sale (any receiver, any receipt type). Trimmed; empty or whitespace-only is saved as null, which prints nothing. Line breaks are kept. In Buenos Aires province the Línea 148 legend replaces it when that rule applies; both never print."}},"required":["name","address","city","postalCode","locationId"]},"UpdateBranchDto":{"type":"object","properties":{"name":{"type":"string","example":"Sucursal Centro","description":"Display name for the branch — must not match another branch in your organization."},"address":{"type":"string","example":"Av. Corrientes 1234","description":"Street address shown on receipts."},"city":{"type":"string","example":"Buenos Aires","description":"City."},"postalCode":{"type":"string","example":"C1043AAZ","description":"Postal code (CP)."},"locationId":{"type":"number","example":1,"description":"Province/region id from `GET /locations`."},"email":{"type":"string","example":"sucursal@empresa.com.ar","nullable":true},"phone1":{"type":"string","example":"+54 11 4444-5555","nullable":true},"phone2":{"type":"string","example":"+54 11 4444-6666","nullable":true},"phone3":{"type":"string","example":"+54 11 4444-7777","nullable":true},"consumerLegend":{"type":"string","nullable":true,"maxLength":500,"example":"147 - Teléfono Gratuito CABA, Área de Defensa y Protección al Consumidor","description":"Consumer-defense legend printed on every receipt issued from this branch's points of sale (any receiver, any receipt type). Trimmed; empty or whitespace-only is saved as null, which prints nothing. Line breaks are kept. In Buenos Aires province the Línea 148 legend replaces it when that rule applies; both never print."}}},"BulkActionReceiptStatusResponseDto":{"type":"object","properties":{"status":{"type":"string","example":"done","description":"pending | done | skipped | failed"},"error":{"type":"string","nullable":true,"example":null},"customerName":{"type":"string","nullable":true,"example":"Cliente S.A."},"receiptNumber":{"type":"string","nullable":true,"example":"00001-00000123"}},"required":["status"]},"ReceiptEmissionBreachDto":{"type":"object","properties":{"code":{"type":"string","example":"RECEIVER_VAT_CONDITION_INVALID_FOR_CLASS","description":"Stable code — the same one the 400 carries as `error`."},"message":{"type":"string","description":"User-facing message (Spanish)."},"blocking":{"type":"boolean","description":"True when create()/confirm() would refuse the receipt."}},"required":["code","message","blocking"]},"NextReceiptNumberResponseDto":{"type":"object","properties":{"letter":{"type":"string","example":"A","description":"Receipt letter (A, B, C, M, E)"},"number":{"type":"string","example":"00001-00000124","description":"Formatted receipt number for preview"},"nextSequential":{"type":"number","example":124,"description":"Next sequential number to assign"},"withholdingRate":{"type":"number","enum":[0,7,15],"example":15,"description":"SPAIN ONLY (absent elsewhere). IRPF percent a new invoice for this customer gets when the request omits `withholdingRate` — the organization's rate (15 for an autónomo that configured none) when the customer withholds (`withholdingApplicable`), else 0. Use it as the form's default instead of re-deriving it."},"applySurcharge":{"type":"boolean","example":false,"description":"SPAIN ONLY (absent elsewhere). Default `applySurcharge` for this customer (recargo de equivalencia)."},"requiredLetter":{"type":"string","example":"A","description":"ARGENTINA, `receipt_type=factura` only (absent elsewhere). The class create()/confirm() will issue after the fiscal rules (e.g. A for an RI invoicing a monotributista since 2021-07-01). It can differ from `letter`."},"breaches":{"description":"ARGENTINA, `receipt_type=factura` only. RG 5616 breaches create()/confirm() would raise for this customer + book + `requiredLetter` today, in Spanish. `blocking` ones are refused with a 400 before a number is taken.","type":"array","items":{"$ref":"#/components/schemas/ReceiptEmissionBreachDto"}}},"required":["letter","number","nextSequential"]},"ExportColumnResponseDto":{"type":"object","properties":{"key":{"type":"string","example":"date","description":"Column key"},"header":{"type":"string","example":"Fecha","description":"Human-readable column header"}},"required":["key","header"]},"AsyncExportAcceptedResponseDto":{"type":"object","properties":{"message":{"type":"string","example":"Exportación en progreso"},"jobId":{"type":"string","description":"Bulk-action job id. Poll GET /bulk-actions/:jobId/status for progress."},"totalCount":{"type":"number","description":"Total rows queued for export."}},"required":["message"]},"SalesReceiptTaxBreakdownLineDto":{"type":"object","properties":{"kind":{"type":"string","enum":["IVA","RECARGO_EQUIVALENCIA","IRPF"],"example":"IVA"},"rate":{"type":"number","example":21,"description":"Rate as a percentage"},"base":{"type":"number","example":1000,"description":"Net base the rate applied to, post-discount"},"amount":{"type":"number","example":210,"description":"Amount produced. Always >= 0 (IRPF too: it is subtracted from the total)."},"exemptionReason":{"type":"string","example":"Inversión del sujeto pasivo (art. 84.Uno.2º Ley 37/1992)","description":"Legal cause of a 0% line, printed on the invoice. Chosen through the line's `taxTypeId`: 924 Exento, 925 No sujeto, 926 Inversión del sujeto pasivo, 927 Exportación / entrega intracomunitaria."}},"required":["kind","rate","base","amount"]},"SalesReceiptCustomerResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"businessName":{"type":"string","example":"Cliente S.A."},"taxId":{"type":"string","nullable":true,"example":"20123456789"},"postalCode":{"type":"string","nullable":true,"example":"1414"},"city":{"type":"string","nullable":true,"example":"Buenos Aires"},"phone":{"type":"string","nullable":true,"example":"+541112345678"},"email":{"type":"string","nullable":true,"example":"cliente@example.com"},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234"},"taxCategoryId":{"type":"number","example":1},"documentTypeId":{"type":"number","example":1},"isActive":{"type":"boolean","example":true}},"required":["id","businessName","taxId","postalCode","city","phone","email","address","taxCategoryId","documentTypeId","isActive"]},"SalesReceiptUserResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"fullName":{"type":"string","nullable":true,"example":"John Doe"},"email":{"type":"string","nullable":true,"example":"user@example.com"}},"required":["id","fullName","email"]},"SalesReceiptCurrencyResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Pesos Argentinos"},"abbreviation":{"type":"string","example":"ARS"},"symbol":{"type":"string","example":"$"}},"required":["id","name","abbreviation","symbol"]},"SalesReceiptDetailResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"type":{"type":"string","enum":["product","observation"],"example":"product","description":"`product`: a billable line. `observation`: a free-text row printed in place on the PDF — only `description` is meaningful; quantity, prices and totals are 0 and productId/taxTypeId are null. Lines are returned in the order they were written."},"quantity":{"type":"number","example":2},"description":{"type":"string","example":"Product description"},"unitPrice":{"type":"number","example":100.5},"total":{"type":"number","example":201},"productId":{"type":"integer","nullable":true,"example":1},"taxTypeId":{"type":"integer","nullable":true,"example":2},"totalWithVat":{"type":"number","nullable":true,"example":243.21},"discount":{"type":"integer","nullable":true,"example":10},"discountAmount":{"type":"number","nullable":true,"example":20.1}},"required":["id","type","quantity","description","unitPrice","total","productId","taxTypeId","totalWithVat","discount","discountAmount"]},"SalesReceiptObservationResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Free-form observation text"}},"required":["id","description"]},"SalesReceiptCreditNoteRefDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"number":{"type":"string","example":"0151-00026731"},"letter":{"type":"string","nullable":true,"example":"B"},"status":{"type":"string","example":"Imputado"},"total":{"type":"number","example":12000}},"required":["id","number","letter","status","total"]},"SalesReceiptAssociatedRefDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"number":{"type":"string","example":"0151-00026731"},"letter":{"type":"string","nullable":true,"example":"B"},"status":{"type":"string","example":"Imputado"},"total":{"type":"number","example":12000},"typeId":{"type":"integer","nullable":true,"example":6}},"required":["id","number","letter","status","total","typeId"]},"ConsignmentSettlementDeductionResponseDto":{"type":"object","properties":{"position":{"type":"integer","example":0,"description":"Order of the deduction on the settlement."},"kind":{"type":"string","enum":["commission","expense"],"example":"commission"},"description":{"type":"string","example":"Comisión 8%"},"rate":{"type":"number","nullable":true,"example":8,"description":"Percentage over the goods' taxable net; null for a fixed amount."},"vatRate":{"type":"number","example":0,"description":"Always 0: in the general modality a deduction has no VAT of its own; it reduces the goods' taxable base."},"netAmount":{"type":"number","example":800,"description":"Amount of the deduction."},"vatAmount":{"type":"number","example":0,"description":"Always 0 (general modality)."},"totalAmount":{"type":"number","example":800,"description":"netAmount + vatAmount (= netAmount)."},"appliesToVatRate":{"type":"number","nullable":true,"enum":[21,10.5,27],"example":10.5,"description":"Goods VAT rate whose taxable base this deduction reduces. null: prorated across every VAT rate of the goods by base."}},"required":["position","kind","description","rate","vatRate","netAmount","vatAmount","totalAmount","appliesToVatRate"]},"ConsignmentSettlementVatLineResponseDto":{"type":"object","properties":{"vatRate":{"type":"number","example":10.5},"taxableNet":{"type":"number","example":3050035,"description":"The goods' taxable net at this rate minus its share of the deductions."},"vatAmount":{"type":"number","example":320253.68,"description":"VAT recomputed on taxableNet."}},"required":["vatRate","taxableNet","vatAmount"]},"ConsignmentSettlementResponseDto":{"type":"object","properties":{"deductions":{"type":"array","items":{"$ref":"#/components/schemas/ConsignmentSettlementDeductionResponseDto"}},"deductionsTotal":{"type":"number","example":1117307,"description":"Sum of the deductions' totals."},"taxableNet":{"type":"number","example":3050035,"description":"ImpNeto reported to ARCA: the goods' taxable net minus the deductions."},"vatAmount":{"type":"number","example":320253.68,"description":"ImpIVA reported to ARCA: VAT recomputed on taxableNet."},"vatBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/ConsignmentSettlementVatLineResponseDto"}},"exemptAmount":{"type":"number","example":0,"description":"ImpOpEx reported to ARCA (exempt goods)."},"nonTaxableAmount":{"type":"number","example":0,"description":"ImpTotConc reported to ARCA (non-taxable goods)."},"netAmount":{"type":"number","example":3370288.68,"description":"Líquido producto owed to the consignor, the ImpTotal reported to ARCA: taxableNet + vatAmount + exempt + non-taxable (general modality of Libro IVA Digital Anexo VII)."}},"required":["deductions","deductionsTotal","taxableNet","vatAmount","vatBreakdown","exemptAmount","nonTaxableAmount","netAmount"]},"SalesReceiptResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"peaklyOldId":{"type":"integer","nullable":true,"example":null},"date":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"dueDate":{"type":"string","example":"2026-01-30T12:00:00.000Z"},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"number":{"type":"string","example":"00001-00000123"},"letter":{"type":"string","example":"A"},"letterVariant":{"type":"string","nullable":true,"enum":["operacion_sujeta_a_retencion"],"example":null,"description":"RG 5762/2025: `operacion_sujeta_a_retencion` when the receipt is a class A \"con leyenda\" (letter A on ARCA CbteTipo 51–53, the successor of Factura M); null on any other receipt."},"classLegend":{"type":"string","nullable":true,"example":null,"description":"Legend the class A \"con leyenda\" must carry next to the letter (\"OPERACIÓN SUJETA A RETENCIÓN\"); null when `letterVariant` is null."},"status":{"type":"string","example":"Creada","enum":["Borrador","Pendiente_Afip","Creada","Cobrada","Imputado","Anulado"],"description":"Receipt status:\n- `Borrador`: draft, no number or CAE yet.\n- `Pendiente_Afip`: numbered and waiting for AFIP authorization (CAE).\n- `Creada`: authorized by AFIP (has CAE), with an open balance.\n- `Cobrada`: authorized invoice/debit note whose balance is fully settled — by collections or by a credit note imputed against it.\n- `Imputado`: authorized credit note fully applied against the receipt(s) it cancels.\n- `Anulado`: voided, only for receipts without a CAE — a receipt from a non-electronic book, or (Spain) a receipt voided by its rectificativa. A receipt with a CAE is never `Anulado`: voided through `POST /:id/void`, an invoice or debit note ends `Cobrada` with its credit note imputed against it, and a credit note ends `Imputado` against the debit note that voids it."},"exchangeRate":{"type":"number","nullable":true,"example":1,"description":"Currency exchange rate"},"cancellationInSameCurrency":{"type":"boolean","nullable":true,"example":false,"description":"RG 5616: cancel the foreign-currency receipt in the same currency"},"returnsStock":{"type":"boolean","example":true,"description":"Solo aplica a Notas de Crédito: false = bonificación/ajuste sin devolución de mercadería, no mueve stock"},"collectionEmail":{"type":"string","nullable":true,"example":"customer@example.com"},"subtotal":{"type":"number","example":1000},"vat":{"type":"number","example":210},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":210},"vat27":{"type":"number","example":0},"exemptAmount":{"type":"number","example":0},"nonTaxableAmount":{"type":"number","example":0},"total":{"type":"number","example":1210},"totalCollected":{"type":"number","example":0,"description":"Amount already collected against this receipt"},"observation":{"type":"string","nullable":true,"example":null},"cae":{"type":"string","nullable":true,"example":"75123456789012","description":"AFIP CAE number"},"caeExpiration":{"type":"string","nullable":true,"example":"2026-01-25T00:00:00.000Z"},"customerId":{"type":"number","example":1},"typeId":{"type":"number","example":1,"description":"Receipt type combo item ID"},"saleConditionId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":null},"currencyId":{"type":"integer","nullable":true,"example":1},"userId":{"type":"number","example":1},"receiptBookId":{"type":"number","example":1},"emailSentAt":{"type":"string","nullable":true,"example":null},"discount":{"type":"number","nullable":true,"example":0},"preSendEmailAt":{"type":"string","nullable":true,"example":null},"errorMessage":{"type":"string","nullable":true,"example":null,"description":"Last error recorded on the receipt: the AFIP authorization error while `Pendiente_Afip`, the email delivery error once issued. Always null for `Borrador`."},"serviceStartDate":{"type":"string","nullable":true,"example":null},"serviceEndDate":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"providerId":{"type":"string","nullable":true,"example":"ext-receipt-123","description":"External provider identifier (unique per organization)."},"vatPerceptions":{"type":"number","nullable":true,"example":0},"grossIncomePerceptions":{"type":"number","nullable":true,"example":0},"totalDiscount":{"type":"number","nullable":true,"example":0},"discountAmount":{"type":"number","nullable":true,"example":0},"taxableAmount105":{"type":"number","nullable":true,"example":0},"taxableAmount21":{"type":"number","nullable":true,"example":1000},"taxableAmount27":{"type":"number","nullable":true,"example":0},"subtotalWithoutDiscount":{"type":"number","nullable":true,"example":1000},"vatWithoutDiscount":{"type":"number","nullable":true,"example":210},"associatedReceiptId":{"type":"string","nullable":true,"example":null,"description":"Original receipt UUID for credit/debit notes"},"realTotal":{"type":"number","nullable":true,"example":null},"grossIncomePerceptionsBsas":{"type":"number","nullable":true,"example":0},"grossIncomePerceptionsCaba":{"type":"number","nullable":true,"example":0},"exportData":{"type":"object","additionalProperties":true,"nullable":true,"example":{"incotermsCode":"FOB","incotermsDescription":"Free on Board"},"description":"WSFEX data. Newly issued electronic exports include server-generated version and recipientSnapshot (businessName/address); these read-only fields are ignored when supplied on create/update."},"taxBreakdown":{"nullable":true,"description":"Per-rate tax detail as the country's tax engine computed it. NULL on Argentine receipts (they use the `vat*` / `taxableAmount*` columns). Spain: one `IVA` row per tax code, a `RECARGO_EQUIVALENCIA` row per taxed rate when the surcharge applies, and one `IRPF` row when there is a withholding.","type":"array","items":{"$ref":"#/components/schemas/SalesReceiptTaxBreakdownLineDto"}},"surchargeTotal":{"type":"number","nullable":true,"example":0,"description":"Spain: recargo de equivalencia, ADDED to `total`. NULL where the concept does not exist (Argentina)."},"withholdingTotal":{"type":"number","nullable":true,"example":150,"description":"Spain: IRPF withholding, stored POSITIVE and ALREADY SUBTRACTED from `total` — never subtract it again. NULL where the concept does not exist (Argentina)."},"rectificationReason":{"type":"string","nullable":true,"example":"Anulación de la factura FA/2","description":"Spain, rectificativas: why the document rectifies its invoice (RD 1619/2012 art. 15). A void's rectificativa defaults to \"Anulación de la factura <number>\". NULL on invoices and on Argentine receipts."},"customer":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptCustomerResponseDto"}]},"type":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ComboItemResponseDto"}]},"saleCondition":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ComboItemResponseDto"}]},"user":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptUserResponseDto"}]},"currency":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptCurrencyResponseDto"}]},"details":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptDetailResponseDto"}},"observations":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptObservationResponseDto"}},"fullDiscountReversal":{"type":"boolean","example":false,"description":"Read-only. True on an invoice issued at its gross amount because its discounts covered the whole sale (\"descuento total\"); an automatic credit note for the same total cancels it once authorized."},"cancelledByCreditNotes":{"description":"Invoices only, on `GET /sales-receipts` and `GET /sales-receipts/:id`. Authorized credit notes (with CAE, not Borrador/Anulado) whose `associatedReceiptId` is this invoice, oldest first.","type":"array","items":{"$ref":"#/components/schemas/SalesReceiptCreditNoteRefDto"}},"creditedAmount":{"type":"number","example":12000,"description":"Invoices only, on list/detail. Sum of `cancelledByCreditNotes[].total`."},"pdfAvailable":{"type":"boolean","example":true,"description":"Whether `GET /sales-receipts/:id/pdf` can render this receipt now. Argentina: false while the receipt is `Borrador` or `Pendiente_Afip` (AFIP must authorize it first). Other countries (no authorization step): always true, drafts included — a draft PDF is marked as such."},"creditNoteCoverage":{"type":"string","enum":["none","partial","full"],"example":"full","description":"Invoices only, on list/detail. `full` when `creditedAmount` covers the invoice total (±0.01) — the invoice is cancelled 100% by credit notes; `partial` when some but not all of it is credited."},"associatedReceipt":{"nullable":true,"description":"Only on `GET /sales-receipts/:id`. The receipt referenced by `associatedReceiptId` (the invoice a credit/debit note corrects); null when there is none.","allOf":[{"$ref":"#/components/schemas/SalesReceiptAssociatedRefDto"}]},"consignmentSettlement":{"nullable":true,"description":"Only on `GET /sales-receipts/:id` and `POST /sales-receipts`. The deductions of a Cuenta de Venta y Líquido Producto and the net amount owed to the consignor; null for every other receipt type.","allOf":[{"$ref":"#/components/schemas/ConsignmentSettlementResponseDto"}]}},"required":["id","peaklyOldId","date","dueDate","createdAt","number","letter","letterVariant","classLegend","status","exchangeRate","cancellationInSameCurrency","returnsStock","collectionEmail","subtotal","vat","vat105","vat21","vat27","exemptAmount","nonTaxableAmount","total","totalCollected","observation","cae","caeExpiration","customerId","typeId","saleConditionId","journalEntryId","currencyId","userId","receiptBookId","emailSentAt","discount","preSendEmailAt","errorMessage","serviceStartDate","serviceEndDate","updatedAt","providerId","vatPerceptions","grossIncomePerceptions","totalDiscount","discountAmount","taxableAmount105","taxableAmount21","taxableAmount27","subtotalWithoutDiscount","vatWithoutDiscount","associatedReceiptId","realTotal","grossIncomePerceptionsBsas","grossIncomePerceptionsCaba","exportData","customer","type","saleCondition","user","currency","details","observations","fullDiscountReversal"]},"SalesReceiptPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJpZCI6MTIzfQ==","description":"Opaque cursor for the next page (null if no more pages)"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"VoidSalesReceiptDto":{"type":"object","properties":{"createCreditNote":{"type":"boolean","description":"Auto-create a compensating credit note for the full amount (default: true)","default":true},"rectificationReason":{"type":"string","maxLength":500,"example":"Operación cancelada por el cliente","description":"SPAIN ONLY. Reason stored on the void's rectificativa (`rectificationReason`) and printed on its PDF. Default: \"Anulación de la factura <number>\". For a non-Spanish organization → FIELD_NOT_SUPPORTED_FOR_COUNTRY."}}},"VoidSalesReceiptResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"peaklyOldId":{"type":"integer","nullable":true,"example":null},"date":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"dueDate":{"type":"string","example":"2026-01-30T12:00:00.000Z"},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"number":{"type":"string","example":"00001-00000123"},"letter":{"type":"string","example":"A"},"letterVariant":{"type":"string","nullable":true,"enum":["operacion_sujeta_a_retencion"],"example":null,"description":"RG 5762/2025: `operacion_sujeta_a_retencion` when the receipt is a class A \"con leyenda\" (letter A on ARCA CbteTipo 51–53, the successor of Factura M); null on any other receipt."},"classLegend":{"type":"string","nullable":true,"example":null,"description":"Legend the class A \"con leyenda\" must carry next to the letter (\"OPERACIÓN SUJETA A RETENCIÓN\"); null when `letterVariant` is null."},"status":{"type":"string","example":"Creada","enum":["Borrador","Pendiente_Afip","Creada","Cobrada","Imputado","Anulado"],"description":"Receipt status:\n- `Borrador`: draft, no number or CAE yet.\n- `Pendiente_Afip`: numbered and waiting for AFIP authorization (CAE).\n- `Creada`: authorized by AFIP (has CAE), with an open balance.\n- `Cobrada`: authorized invoice/debit note whose balance is fully settled — by collections or by a credit note imputed against it.\n- `Imputado`: authorized credit note fully applied against the receipt(s) it cancels.\n- `Anulado`: voided, only for receipts without a CAE — a receipt from a non-electronic book, or (Spain) a receipt voided by its rectificativa. A receipt with a CAE is never `Anulado`: voided through `POST /:id/void`, an invoice or debit note ends `Cobrada` with its credit note imputed against it, and a credit note ends `Imputado` against the debit note that voids it."},"exchangeRate":{"type":"number","nullable":true,"example":1,"description":"Currency exchange rate"},"cancellationInSameCurrency":{"type":"boolean","nullable":true,"example":false,"description":"RG 5616: cancel the foreign-currency receipt in the same currency"},"returnsStock":{"type":"boolean","example":true,"description":"Solo aplica a Notas de Crédito: false = bonificación/ajuste sin devolución de mercadería, no mueve stock"},"collectionEmail":{"type":"string","nullable":true,"example":"customer@example.com"},"subtotal":{"type":"number","example":1000},"vat":{"type":"number","example":210},"vat105":{"type":"number","example":0},"vat21":{"type":"number","example":210},"vat27":{"type":"number","example":0},"exemptAmount":{"type":"number","example":0},"nonTaxableAmount":{"type":"number","example":0},"total":{"type":"number","example":1210},"totalCollected":{"type":"number","example":0,"description":"Amount already collected against this receipt"},"observation":{"type":"string","nullable":true,"example":null},"cae":{"type":"string","nullable":true,"example":"75123456789012","description":"AFIP CAE number"},"caeExpiration":{"type":"string","nullable":true,"example":"2026-01-25T00:00:00.000Z"},"customerId":{"type":"number","example":1},"typeId":{"type":"number","example":1,"description":"Receipt type combo item ID"},"saleConditionId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":null},"currencyId":{"type":"integer","nullable":true,"example":1},"userId":{"type":"number","example":1},"receiptBookId":{"type":"number","example":1},"emailSentAt":{"type":"string","nullable":true,"example":null},"discount":{"type":"number","nullable":true,"example":0},"preSendEmailAt":{"type":"string","nullable":true,"example":null},"errorMessage":{"type":"string","nullable":true,"example":null,"description":"Last error recorded on the receipt: the AFIP authorization error while `Pendiente_Afip`, the email delivery error once issued. Always null for `Borrador`."},"serviceStartDate":{"type":"string","nullable":true,"example":null},"serviceEndDate":{"type":"string","nullable":true,"example":null},"updatedAt":{"type":"string","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"providerId":{"type":"string","nullable":true,"example":"ext-receipt-123","description":"External provider identifier (unique per organization)."},"vatPerceptions":{"type":"number","nullable":true,"example":0},"grossIncomePerceptions":{"type":"number","nullable":true,"example":0},"totalDiscount":{"type":"number","nullable":true,"example":0},"discountAmount":{"type":"number","nullable":true,"example":0},"taxableAmount105":{"type":"number","nullable":true,"example":0},"taxableAmount21":{"type":"number","nullable":true,"example":1000},"taxableAmount27":{"type":"number","nullable":true,"example":0},"subtotalWithoutDiscount":{"type":"number","nullable":true,"example":1000},"vatWithoutDiscount":{"type":"number","nullable":true,"example":210},"associatedReceiptId":{"type":"string","nullable":true,"example":null,"description":"Original receipt UUID for credit/debit notes"},"realTotal":{"type":"number","nullable":true,"example":null},"grossIncomePerceptionsBsas":{"type":"number","nullable":true,"example":0},"grossIncomePerceptionsCaba":{"type":"number","nullable":true,"example":0},"exportData":{"type":"object","additionalProperties":true,"nullable":true,"example":{"incotermsCode":"FOB","incotermsDescription":"Free on Board"},"description":"WSFEX data. Newly issued electronic exports include server-generated version and recipientSnapshot (businessName/address); these read-only fields are ignored when supplied on create/update."},"taxBreakdown":{"nullable":true,"description":"Per-rate tax detail as the country's tax engine computed it. NULL on Argentine receipts (they use the `vat*` / `taxableAmount*` columns). Spain: one `IVA` row per tax code, a `RECARGO_EQUIVALENCIA` row per taxed rate when the surcharge applies, and one `IRPF` row when there is a withholding.","type":"array","items":{"$ref":"#/components/schemas/SalesReceiptTaxBreakdownLineDto"}},"surchargeTotal":{"type":"number","nullable":true,"example":0,"description":"Spain: recargo de equivalencia, ADDED to `total`. NULL where the concept does not exist (Argentina)."},"withholdingTotal":{"type":"number","nullable":true,"example":150,"description":"Spain: IRPF withholding, stored POSITIVE and ALREADY SUBTRACTED from `total` — never subtract it again. NULL where the concept does not exist (Argentina)."},"rectificationReason":{"type":"string","nullable":true,"example":"Anulación de la factura FA/2","description":"Spain, rectificativas: why the document rectifies its invoice (RD 1619/2012 art. 15). A void's rectificativa defaults to \"Anulación de la factura <number>\". NULL on invoices and on Argentine receipts."},"customer":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptCustomerResponseDto"}]},"type":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ComboItemResponseDto"}]},"saleCondition":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ComboItemResponseDto"}]},"user":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptUserResponseDto"}]},"currency":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/SalesReceiptCurrencyResponseDto"}]},"details":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptDetailResponseDto"}},"observations":{"type":"array","items":{"$ref":"#/components/schemas/SalesReceiptObservationResponseDto"}},"fullDiscountReversal":{"type":"boolean","example":false,"description":"Read-only. True on an invoice issued at its gross amount because its discounts covered the whole sale (\"descuento total\"); an automatic credit note for the same total cancels it once authorized."},"cancelledByCreditNotes":{"description":"Invoices only, on `GET /sales-receipts` and `GET /sales-receipts/:id`. Authorized credit notes (with CAE, not Borrador/Anulado) whose `associatedReceiptId` is this invoice, oldest first.","type":"array","items":{"$ref":"#/components/schemas/SalesReceiptCreditNoteRefDto"}},"creditedAmount":{"type":"number","example":12000,"description":"Invoices only, on list/detail. Sum of `cancelledByCreditNotes[].total`."},"pdfAvailable":{"type":"boolean","example":true,"description":"Whether `GET /sales-receipts/:id/pdf` can render this receipt now. Argentina: false while the receipt is `Borrador` or `Pendiente_Afip` (AFIP must authorize it first). Other countries (no authorization step): always true, drafts included — a draft PDF is marked as such."},"creditNoteCoverage":{"type":"string","enum":["none","partial","full"],"example":"full","description":"Invoices only, on list/detail. `full` when `creditedAmount` covers the invoice total (±0.01) — the invoice is cancelled 100% by credit notes; `partial` when some but not all of it is credited."},"associatedReceipt":{"nullable":true,"description":"Only on `GET /sales-receipts/:id`. The receipt referenced by `associatedReceiptId` (the invoice a credit/debit note corrects); null when there is none.","allOf":[{"$ref":"#/components/schemas/SalesReceiptAssociatedRefDto"}]},"consignmentSettlement":{"nullable":true,"description":"Only on `GET /sales-receipts/:id` and `POST /sales-receipts`. The deductions of a Cuenta de Venta y Líquido Producto and the net amount owed to the consignor; null for every other receipt type.","allOf":[{"$ref":"#/components/schemas/ConsignmentSettlementResponseDto"}]},"creditNoteId":{"type":"string","nullable":true,"example":"550e8400-e29b-41d4-a716-446655440000","description":"ID of the auto-generated credit note (null if pre-impreso receipt was voided directly)"}},"required":["id","peaklyOldId","date","dueDate","createdAt","number","letter","letterVariant","classLegend","status","exchangeRate","cancellationInSameCurrency","returnsStock","collectionEmail","subtotal","vat","vat105","vat21","vat27","exemptAmount","nonTaxableAmount","total","totalCollected","observation","cae","caeExpiration","customerId","typeId","saleConditionId","journalEntryId","currencyId","userId","receiptBookId","emailSentAt","discount","preSendEmailAt","errorMessage","serviceStartDate","serviceEndDate","updatedAt","providerId","vatPerceptions","grossIncomePerceptions","totalDiscount","discountAmount","taxableAmount105","taxableAmount21","taxableAmount27","subtotalWithoutDiscount","vatWithoutDiscount","associatedReceiptId","realTotal","grossIncomePerceptionsBsas","grossIncomePerceptionsCaba","exportData","customer","type","saleCondition","user","currency","details","observations","fullDiscountReversal","creditNoteId"]},"ImputationItemDto":{"type":"object","properties":{"targetReceiptId":{"type":"string","description":"UUID of the invoice/debit note to apply the credit note against","example":"550e8400-e29b-41d4-a716-446655440000"},"amount":{"type":"number","description":"Amount of the credit note to apply against this receipt","example":1500.5}},"required":["targetReceiptId","amount"]},"CreateImputationsDto":{"type":"object","properties":{"creditNoteId":{"type":"string","description":"UUID of the credit note being applied","example":"550e8400-e29b-41d4-a716-446655440000"},"items":{"minItems":1,"type":"array","items":{"$ref":"#/components/schemas/ImputationItemDto"}}},"required":["creditNoteId","items"]},"ImputationReceiptRefDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"number":{"type":"string","example":"0001-00001234"},"letter":{"type":"string","example":"A"},"status":{"type":"string","example":"Creada"},"total":{"type":"number","example":12100.5}},"required":["id","number","letter","status","total"]},"ImputationResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"date":{"type":"string","example":"2026-07-02T12:00:00.000Z"},"amount":{"type":"number","example":1500.5},"creditNote":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ImputationReceiptRefDto"}]},"targetReceipt":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ImputationReceiptRefDto"}]}},"required":["id","date","amount","creditNote","targetReceipt"]},"CreateImputationsResponseDto":{"type":"object","properties":{"imputations":{"type":"array","items":{"$ref":"#/components/schemas/ImputationResponseDto"}}},"required":["imputations"]},"AuthorizeAfipResponseDto":{"type":"object","properties":{"success":{"type":"boolean","example":true,"description":"Whether AFIP returned a valid CAE"},"cae":{"type":"string","example":"75123456789012"},"caeExpiration":{"type":"string","example":"2026-01-25T00:00:00.000Z"},"error":{"type":"string","example":"Comprobante rechazado por AFIP","description":"AFIP error message when success is false"}},"required":["success"]},"SendEmailDto":{"type":"object","properties":{"email":{"type":"string","description":"Override recipient email address"},"subject":{"type":"string","description":"Override email subject"}}},"SendEmailResponseDto":{"type":"object","properties":{"message":{"type":"string","example":"Email sending triggered"},"receiptId":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"triggerId":{"type":"string","example":"run_abc123","description":"Trigger.dev run identifier"}},"required":["message","receiptId","triggerId"]},"ResendEmailResponseDto":{"type":"object","properties":{"message":{"type":"string","example":"Email reenviado"},"receiptId":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"}},"required":["message","receiptId"]},"TrackingEventResponseDto":{"type":"object","properties":{"viewedAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"ipAddress":{"type":"string","nullable":true,"example":"200.123.45.67"},"userAgent":{"type":"string","nullable":true,"example":"Mozilla/5.0 (...)"}},"required":["viewedAt","ipAddress","userAgent"]},"TrackingEventsResponseDto":{"type":"object","properties":{"trackingEnabled":{"type":"boolean","example":true,"description":"Whether email tracking is enabled for this organization"},"events":{"type":"array","items":{"$ref":"#/components/schemas/TrackingEventResponseDto"}}},"required":["trackingEnabled","events"]},"BulkEmailDto":{"type":"object","properties":{"receiptIds":{"example":["uuid-1","uuid-2"],"description":"Array of sales receipt UUIDs to email (1–200)","type":"array","items":{"type":"string"}}},"required":["receiptIds"]},"BulkActionJobCreatedResponseDto":{"type":"object","properties":{"jobId":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000","description":"Bulk action job UUID"},"totalCount":{"type":"number","example":25,"description":"Number of receipts queued in the job"}},"required":["jobId","totalCount"]},"BulkPdfDto":{"type":"object","properties":{"receiptIds":{"example":["uuid-1","uuid-2"],"description":"Array of sales receipt UUIDs to generate PDFs for (1–100)","type":"array","items":{"type":"string"}}},"required":["receiptIds"]},"BulkVoidDto":{"type":"object","properties":{"receiptIds":{"example":["uuid-1","uuid-2"],"description":"Array of sales receipt UUIDs to void (1–50)","type":"array","items":{"type":"string"}}},"required":["receiptIds"]},"BulkActionStatusResponseDto":{"type":"object","properties":{"jobId":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"type":{"type":"string","example":"bulk_email","description":"bulk_email | bulk_pdf | bulk_void"},"status":{"type":"string","example":"in_progress","description":"pending | in_progress | completed | failed"},"totalCount":{"type":"number","example":25},"doneCount":{"type":"number","example":10},"skippedCount":{"type":"number","example":0},"failedCount":{"type":"number","example":0},"receiptStatuses":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/BulkActionReceiptStatusResponseDto"},"description":"Per-receipt status keyed by receipt UUID","example":{"uuid-1":{"status":"done"},"uuid-2":{"status":"pending"}}},"downloadUrl":{"type":"string","nullable":true,"example":null,"description":"Download URL for bulk PDF jobs (null until completed)"},"createdAt":{"type":"string","example":"2026-01-15T12:00:00.000Z"},"completedAt":{"type":"string","nullable":true,"example":null}},"required":["jobId","type","status","totalCount","doneCount","skippedCount","failedCount","receiptStatuses","downloadUrl","createdAt","completedAt"]},"SalesReceiptCustomerDto":{"type":"object","properties":{"name":{"type":"string","example":"Juan Pérez","description":"Nombre y apellido del comprador."},"address":{"type":"string","example":"Salta 2678 Depto. 1B","description":"Domicilio."},"city":{"type":"string","example":"Vicente López","description":"Localidad."},"postalCode":{"type":"string","example":"B1636","description":"Código postal."},"phone":{"type":"string","example":"+541164731337","description":"Teléfono de contacto."},"email":{"type":"string","example":"juan.perez@gmail.com","description":"Buyer email, stored on the customer record. When omitted, the receipt's `collectionEmail` is used instead — send this explicitly when `collectionEmail` is a per-order alias you do not want kept as the customer's permanent address."}}},"SettlementDeductionInputDto":{"type":"object","properties":{"kind":{"type":"string","enum":["commission","expense"],"example":"commission","description":"`commission`: the consignee's commission. `expense`: an expense charged to the consignor (freight, storage…)."},"description":{"type":"string","example":"Comisión 8%","maxLength":255,"description":"Text printed on the settlement for this deduction."},"rate":{"type":"number","example":8,"minimum":0,"maximum":100,"description":"Percentage over the taxable net of the goods sold. Send either `rate` or `netAmount`, not both."},"netAmount":{"type":"number","example":1500,"minimum":0,"description":"Fixed amount of the deduction. Send either `rate` or `netAmount`, not both."},"vatRate":{"type":"number","enum":[0],"default":0,"example":0,"description":"Only 0 (or omitted): the settlement is issued in the general modality, where a deduction has no VAT of its own and reduces the goods' taxable base. A deduction with its own VAT is refused."},"appliesToVatRate":{"type":"number","nullable":true,"enum":[21,10.5,27],"example":10.5,"description":"Goods VAT rate (21, 10.5 or 27) whose taxable base this deduction reduces, for a settlement whose goods carry several VAT rates. A `rate` deduction is then a percentage of that rate's taxable net. Omitted or null: the deduction is prorated across every VAT rate of the goods by base. Refused when the goods have no taxable net at that rate or the deductions allocated to it exceed it."}},"required":["kind","description"]},"ConsignmentSettlementInputDto":{"type":"object","properties":{"deductions":{"description":"Commission and expenses deducted from the goods sold. Can be empty.","type":"array","items":{"$ref":"#/components/schemas/SettlementDeductionInputDto"}}},"required":["deductions"]},"SalesReceiptExportDataDto":{"type":"object","properties":{"exportType":{"type":"number","enum":[1,2,4],"description":"WSFEX concept: 1 goods, 2 services, 4 other. Required on electronic export emission."},"destinationCountryCode":{"type":"number","description":"ARCA destination country code (FEXGetPARAM_DST_pais), not a local location id. Required on emission."},"paymentMethod":{"type":"string","maxLength":50,"description":"WSFEX Forma_pago. Required for invoices; not inferred from the due date."},"countryCuit":{"type":"string","pattern":"^[0-9]{11}$","description":"Country/contributor CUIT from FEXGetPARAM_DST_CUIT. If omitted, a numeric 11-digit customer taxId is used. At least this or taxIdNumber is required on emission."},"taxIdNumber":{"type":"string","maxLength":50,"description":"Foreign buyer tax identifier (Id_impositivo); defaults to customer.taxIdNumber on emission."},"incotermsCode":{"type":"string","maxLength":3,"description":"ARCA incoterm code. Required for goods invoices; use the WSFEX catalog."},"incotermsDescription":{"type":"string","maxLength":20,"description":"Complementary incoterm information, not its full name. Requires incotermsCode."},"languageId":{"type":"number","enum":[1,2,3],"description":"Document language: 1 Spanish (default), 2 English, 3 Portuguese."}}},"CreateSalesReceiptDetailDto":{"type":"object","properties":{"type":{"type":"string","enum":["product","observation"],"default":"product","example":"product","description":"Line type. `product` (default) is a billable line. `observation` is a free-text row printed in place on the PDF, between the product lines, in the order sent: it carries only `description` (required, 1–255 characters after trimming), is never sent to AFIP, creates no product and does not count towards totals. Sending `productId`, `barcode`, a non-zero `quantity` / `unitPrice` / `unitPriceWithVat`, `taxTypeId`, `discount` or `discountAmount` on an observation line is rejected with DETAIL_OBSERVATION_FIELDS_NOT_ALLOWED."},"quantity":{"type":"number","example":2,"description":"Quantity. Required on product lines (the default type); omit it on observation lines."},"description":{"type":"string","example":"Product description","description":"Line description. Optional when productId is provided (the product's description is used). When productId is omitted, this is required: the server matches an existing product by exact (case-insensitive) description, or creates a new one."},"unitPrice":{"type":"number","example":100.5,"nullable":true,"description":"Unit price. **Read the unit carefully: it depends on the receipt letter.** For a Factura B with VAT (the letter that prints VAT inside the price) send the price INCLUDING VAT — the figure the customer sees. For A, C, E and for any line at 0% send it NET, without VAT. The letter is derived server-side from the customer's tax category, so the same payload means different things for different customers: if you invoice both, key this off the letter you expect. Optional — when omitted (null/undefined), the server resolves it from the price-list cascade (customer > economic group > default > product unit price). An explicit value (including 0) is used as-is and never overwritten. Must be >= 0 when provided. Note that `discountAmount` on the same line follows this same unit."},"barcode":{"type":"string","example":"7790040999015","nullable":true,"description":"Product barcode (EAN). When sent, the product is matched by barcode before falling back to the description — a barcode identifies the item precisely, a printed description does not. Ignored when `productId` is given. If no product carries that barcode, resolution continues by description as usual, and a product created from the line records the barcode."},"unitPriceWithVat":{"type":"number","example":12850,"nullable":true,"description":"Unit price INCLUDING VAT — the figure you show the customer. The server divides it by the line's VAT rate and uses the net for the receipt, so the result is identical to sending the same price as `unitPrice` on a letter that expects gross. Use whichever you hold: `unitPrice` if you keep net prices, `unitPriceWithVat` if you keep retail ones. Send one or the other, never both — the request is rejected if both are present, because they express the same figure in different units and silently preferring one would be a surprise the size of the VAT rate. On a line with no VAT the two are the same number."},"productId":{"type":"integer","example":1,"nullable":true,"description":"Product ID. Optional — when omitted and a description is provided, the server matches by description or creates the product on the fly."},"taxTypeId":{"type":"integer","example":94,"nullable":true,"description":"VAT rate for the line, as a combo item id (combo 9, `TipoIva`). The most frequent ones, inlined so you don't have to look them up:\n\n| id | rate |\n|----|------|\n| 90 | No Gravado (0%) |\n| 91 | Exento (0%) |\n| 92 | Sin IVA (0%) |\n| 93 | 10,5% |\n| 94 | 21% |\n| 95 | 27% |\n| 96 | 5% |\n| 97 | 2,5% |\n\nThis table is a snapshot — call `GET /v1/combos/9/items` for the live list (`organization_is_monotributista=true` narrows it to what your organization can sell with).\n\nIgnored for Monotributista organizations: always Sin IVA (92), whatever is sent.\n\nThe three 0% entries are not interchangeable: they all land in AFIP's non-taxable bucket but state different reasons, and *Sin IVA* (92) means the issuer is outside the VAT regime.\n\nWhen omitted, the rate is taken from the product's configured VAT rate; if neither is available the line falls back to 21% and the receipt records which rate was used."},"discount":{"type":"integer","example":10,"nullable":true,"description":"Line discount percent (integer, 0–100). Mutually exclusive with `discountAmount` on the same line. Persisted as INT, so fractional values would round and produce different totals on confirm — pass `discountAmount` for fractional precision."},"discountAmount":{"type":"number","example":50,"nullable":true,"description":"Line discount absolute amount (ARS). Mutually exclusive with `discount` (%) on the same line."}}},"CreateSalesReceiptObservationDto":{"type":"object","properties":{"description":{"type":"string","example":"Optional observation text","description":"Observation description"}},"required":["description"]},"CreateSalesReceiptDto":{"type":"object","properties":{"customerId":{"type":"integer","example":1,"description":"Customer ID. Optional — when omitted and `customerTaxId` is provided, the server matches an existing customer by tax id in this organization, or creates one on the fly using ARCA padrón data."},"customerTaxId":{"type":"string","example":"30712345670","description":"Customer tax id. Optional when `customerId` is provided. Accepts a CUIT (11 digits + AFIP check digit) or a DNI (7-8 digits). When `customerId` is omitted, the server matches an existing active customer in this organization by `taxId`, or creates one: a CUIT is completed from ARCA padrón (businessName, taxCategoryId, address) and gets the letter its tax condition implies; a DNI means Consumidor Final, so letter B, and takes its name from `customerName`."},"customerName":{"type":"string","deprecated":true,"example":"Juan Pérez","description":"DEPRECATED — use `customer.name`, which does the same and travels with the rest of the buyer's data. Still honoured; when both are sent, `customer.name` wins."},"customer":{"description":"Buyer details, used ONLY when `customerTaxId` forces the server to create a new customer. Never modifies an existing one. For a CUIT the ARCA padrón stays authoritative for name, address, city and postal code; only `phone` is taken from here.","allOf":[{"$ref":"#/components/schemas/SalesReceiptCustomerDto"}]},"receiptBookId":{"type":"number","example":1,"description":"Receipt book ID"},"saleConditionId":{"type":"number","example":1,"description":"Sale condition (combo item). Optional — defaults to 10 ('Contado'). Values as of 2026-09-08: 10 = Contado, 11 = 7 Días, 12 = 15 Días, 13 = 30 Días, 14 = 45 Días, 15 = 60 Días, 16 = 90 Días, 17 = 120 Días, 18 = 150 Días, 19 = Tarjeta de Crédito. That list is a snapshot, not a contract — call `GET /combos/CondicionCompraVenta/items` for the live one. The condition also sets `dueDate` when you omit it: Contado and Tarjeta de Crédito bill same-day, the rest add their days to `date`."},"date":{"type":"string","example":"2026-01-15T12:00:00Z","description":"Receipt date (default: now)"},"dueDate":{"type":"string","example":"2026-01-30T12:00:00Z","description":"Due date. Optional — defaults to the receipt date plus the sale condition's payment days (Contado → same day, 30 días → date + 30, etc.)."},"serviceStartDate":{"type":"string","example":"2026-01-01T12:00:00Z","description":"Service period start date (required for service organizations)"},"serviceEndDate":{"type":"string","example":"2026-01-31T12:00:00Z","description":"Service period end date (required for service organizations)"},"observation":{"type":"string","example":"PY_2026090412345;610324","nullable":true,"description":"Free-text note stored on the receipt itself. This is the field integrations use to carry their own reference — the v1 PedidosYa integration writes `<orderId>;<restaurantId>` here, so sending the same shape keeps a receipt issued through this API traceable the same way. Not printed on the invoice PDF. Max 2000 characters. Distinct from `observations`, which is a list of separate notes."},"collectionEmail":{"type":"string","example":"customer@example.com","nullable":true,"description":"Semicolon-separated emails for collection"},"currencyId":{"type":"integer","example":1,"nullable":true,"description":"Currency ID"},"exchangeRate":{"type":"number","example":1,"nullable":true,"description":"Exchange rate"},"cancellationInSameCurrency":{"type":"boolean","nullable":true,"description":"RG 5616: whether the foreign-currency receipt will be cancelled in the same currency"},"returnsStock":{"type":"boolean","default":true,"example":true,"description":"Solo aplica a Notas de Crédito: false = bonificación/ajuste sin devolución de mercadería, no mueve stock"},"receiptType":{"type":"string","example":"factura","enum":["factura","nota_credito","nota_debito"],"description":"Receipt type group (default: factura)"},"isDraft":{"type":"boolean","example":false,"description":"Create as draft (BORRADOR) without triggering AFIP"},"providerId":{"type":"object","example":"ext-receipt-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this receipt). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"associatedReceiptId":{"type":"string","nullable":true,"example":null,"description":"For credit/debit notes: UUID of the original sales receipt this NC/ND is applied against. Required for FCE NC/ND. The associated receipt must belong to the same customer."},"consignmentSettlement":{"description":"Issue a Cuenta de Venta y Líquido Producto (consignment settlement, class A or B) instead of a plain invoice: the detail lines are the goods sold on behalf of the consignor (the customer) and `deductions` are the commission and expenses deducted from them. Only for invoices (`receiptType` `factura`), without `associatedReceiptId`, and only when the organization has consignment settlements enabled. It can be saved as a draft (`isDraft: true`): the deductions are stored with the draft, follow its lines while it is edited and are issued unchanged when it is confirmed.","allOf":[{"$ref":"#/components/schemas/ConsignmentSettlementInputDto"}]},"exportData":{"description":"WSFEX data. On electronic emission requires exportType, destinationCountryCode, buyer identity and paymentMethod for invoices; goods invoices also require incotermsCode. Drafts may be incomplete.","example":{"incotermsCode":"FOB","incotermsDescription":"Free on Board"},"allOf":[{"$ref":"#/components/schemas/SalesReceiptExportDataDto"}]},"discount":{"type":"number","example":10,"nullable":true,"description":"Header-level discount percent (0–100). Mutually exclusive with `discountAmount`."},"discountAmount":{"type":"number","example":250,"nullable":true,"description":"Header-level discount absolute amount (ARS). Mutually exclusive with `discount` (%)."},"vatPerceptions":{"type":"number","example":3,"nullable":true,"description":"VAT perception rate (%). The amount added to the receipt total is rate × taxable base. Manual only; it is not auto-populated from the taxpayer registry."},"grossIncomePerceptions":{"type":"number","example":4.5,"nullable":true,"description":"Total IIBB (gross income) perception rate (%). Usually Bsas + Caba. The amount added to the receipt total is rate × taxable base."},"grossIncomePerceptionsBsas":{"type":"number","example":2,"nullable":true,"description":"IIBB Buenos Aires perception rate (%)."},"grossIncomePerceptionsCaba":{"type":"number","example":2.5,"nullable":true,"description":"IIBB CABA perception rate (%)."},"documentKind":{"type":"string","enum":["F1","F2","F3","R1","R2","R3","R4","R5"],"example":"F1","description":"SPAIN ONLY. TipoFactura of the document. Optional — default: `F1` (factura completa) when the customer has a NIF, `F2` (simplificada) when it does not; for `receiptType: \"nota_credito\"` the rectificativa matching the rectified invoice (`R5` for an `F2`, else `R4`). `F1` requires a customer with a tax id. R1–R5 are only valid with `receiptType: \"nota_credito\"`. Spain has no debit note. Sending it for a non-Spanish organization returns FIELD_NOT_SUPPORTED_FOR_COUNTRY."},"withholdingRate":{"type":"number","enum":[0,7,15],"nullable":true,"example":15,"description":"SPAIN ONLY. IRPF withholding as a PERCENTAGE: 0, 7 or 15. Optional — default: the organization's `fiscalConfig.withholdingRate` when the customer's `fiscalConfig.subjectToWithholding` is true, else 0; a credit note defaults to the rectified invoice's rate. Applied on the net base, stored as the positive `withholdingTotal` and subtracted from `total`. Only a persona física issuer can be withheld (ES_WITHHOLDING_NOT_ALLOWED)."},"applySurcharge":{"type":"boolean","nullable":true,"example":false,"description":"SPAIN ONLY. Charge recargo de equivalencia (5.2% / 1.4% / 0.5% paired with IVA 21 / 10 / 4) on the taxed lines. Optional — default: the customer's `fiscalConfig.equivalenceSurcharge`; a credit note defaults to the rectified invoice. Stored as `surchargeTotal` and added to `total`. Requires at least one taxed line (ES_SURCHARGE_NOT_APPLICABLE)."},"rectificationReason":{"type":"string","nullable":true,"maxLength":500,"example":"Error en el precio unitario de la línea 2","description":"SPAIN ONLY, credit notes only. Why the rectificativa rectifies its invoice (RD 1619/2012 art. 15), printed on the PDF next to the rectified invoice's number and date. Optional; trimmed, empty → null. On an invoice → ES_RECTIFICATION_REASON_NOT_APPLICABLE; for a non-Spanish organization → FIELD_NOT_SUPPORTED_FOR_COUNTRY."},"details":{"description":"Receipt detail lines (required for non-draft)","type":"array","items":{"$ref":"#/components/schemas/CreateSalesReceiptDetailDto"}},"observations":{"deprecated":true,"description":"DEPRECATED — send `details` entries with `type: \"observation\"` instead, which keep their position among the product lines. Each note sent here is converted into an observation line appended after `details` and printed on the PDF. Responses keep returning `observations` only for legacy notes stored before this change.","type":"array","items":{"$ref":"#/components/schemas/CreateSalesReceiptObservationDto"}}},"required":["receiptBookId"]},"UpdateSalesReceiptDto":{"type":"object","properties":{"observation":{"type":"string","example":"General observation","nullable":true},"collectionEmail":{"type":"string","example":"customer@example.com","nullable":true},"providerId":{"type":"object","example":"ext-receipt-123","nullable":true,"description":"External provider identifier (e.g. your own ID for this receipt). Unique per organization — a duplicate returns PROVIDER_ID_DUPLICATE. For safe retries, prefer the `Idempotency-Key` header instead."},"expectedUpdatedAt":{"type":"string","example":"2026-01-15T12:00:00.000Z","description":"Optimistic concurrency token for drafts: the `updatedAt` of the version you last read. When sent and the receipt is still a draft, the update is applied only if the draft has not changed since (millisecond precision); otherwise nothing is written and the API answers 409 DRAFT_CONFLICT. Omit it to keep the last-write-wins behavior. Ignored for non-draft receipts."},"customerId":{"type":"number","example":1,"description":"Customer ID (draft only)"},"customerTaxId":{"type":"string","example":"30712345670","description":"Customer tax id. Optional alternative to `customerId` (draft only). Accepts a CUIT (11 digits + AFIP check digit) or a DNI (7-8 digits). When provided without `customerId`, the server matches an existing active customer in this organization by `taxId`, or creates one: a CUIT is completed from the ARCA padrón, a DNI becomes Consumidor Final and takes its name from `customerName`."},"customerName":{"type":"string","deprecated":true,"example":"Juan Pérez","description":"DEPRECATED — use `customer.name`. Still honoured; when both are sent, `customer.name` wins."},"customer":{"description":"Buyer details, used ONLY when `customerTaxId` forces the server to create a new customer. Never modifies an existing one. For a CUIT the ARCA padrón stays authoritative for name, address, city and postal code; only `phone` is taken from here.","allOf":[{"$ref":"#/components/schemas/SalesReceiptCustomerDto"}]},"receiptBookId":{"type":"number","example":1,"description":"Receipt book ID (draft only)"},"saleConditionId":{"type":"number","example":1,"description":"Sale condition ID (draft only)"},"date":{"type":"string","example":"2026-01-15T12:00:00Z","description":"Receipt date (draft only)"},"dueDate":{"type":"string","example":"2026-01-30T12:00:00Z","description":"Due date (draft only)"},"serviceStartDate":{"type":"string","example":"2026-01-01T12:00:00Z","description":"Service period start date (draft only)"},"serviceEndDate":{"type":"string","example":"2026-01-31T12:00:00Z","description":"Service period end date (draft only)"},"currencyId":{"type":"integer","example":1,"nullable":true,"description":"Currency ID (draft only)"},"exchangeRate":{"type":"number","example":1,"nullable":true,"description":"Exchange rate (draft only)"},"cancellationInSameCurrency":{"type":"boolean","nullable":true,"description":"RG 5616: whether the foreign-currency receipt will be cancelled in the same currency"},"returnsStock":{"type":"boolean","default":true,"example":true,"description":"Solo aplica a Notas de Crédito: false = bonificación/ajuste sin devolución de mercadería, no mueve stock"},"exportData":{"description":"WSFEX data (draft only). Replaces the object; partial data is allowed until emission. See CreateSalesReceiptDto.exportData.","example":{"incotermsCode":"FOB","incotermsDescription":"Free on Board"},"allOf":[{"$ref":"#/components/schemas/SalesReceiptExportDataDto"}]},"receiptType":{"type":"string","example":"factura","enum":["factura","nota_credito","nota_debito"],"description":"Receipt type group — recomputes typeId based on current letter (draft only)"},"associatedReceiptId":{"type":"string","nullable":true,"example":null,"description":"For credit/debit notes only: UUID of the original sales receipt this NC/ND is applied against. Pass null to clear. Validated on confirm."},"discount":{"type":"number","example":10,"nullable":true,"description":"Header-level discount percent (0–100). Draft only. Mutually exclusive with `discountAmount`."},"discountAmount":{"type":"number","example":250,"nullable":true,"description":"Header-level discount absolute amount (ARS). Draft only. Mutually exclusive with `discount` (%)."},"vatPerceptions":{"type":"number","example":3,"nullable":true,"description":"VAT perception rate (%). Draft only."},"grossIncomePerceptions":{"type":"number","example":4.5,"nullable":true,"description":"Total IIBB perception rate (%). Draft only."},"grossIncomePerceptionsBsas":{"type":"number","example":2,"nullable":true,"description":"IIBB Buenos Aires perception rate (%). Draft only."},"grossIncomePerceptionsCaba":{"type":"number","example":2.5,"nullable":true,"description":"IIBB CABA perception rate (%). Draft only."},"documentKind":{"type":"string","enum":["F1","F2","F3","R1","R2","R3","R4","R5"],"example":"F1","description":"SPAIN ONLY. TipoFactura of the document. Draft only. Optional — default: `F1` (factura completa) when the customer has a NIF, `F2` (simplificada) when it does not; for `receiptType: \"nota_credito\"` the rectificativa matching the rectified invoice (`R5` for an `F2`, else `R4`). `F1` requires a customer with a tax id. R1–R5 are only valid with `receiptType: \"nota_credito\"`. Spain has no debit note. Sending it for a non-Spanish organization returns FIELD_NOT_SUPPORTED_FOR_COUNTRY."},"withholdingRate":{"type":"number","enum":[0,7,15],"nullable":true,"example":15,"description":"SPAIN ONLY. IRPF withholding as a PERCENTAGE: 0, 7 or 15. Draft only. Optional — default: the organization's `fiscalConfig.withholdingRate` when the customer's `fiscalConfig.subjectToWithholding` is true, else 0; a credit note defaults to the rectified invoice's rate. Applied on the net base, stored as the positive `withholdingTotal` and subtracted from `total`. Only a persona física issuer can be withheld (ES_WITHHOLDING_NOT_ALLOWED)."},"applySurcharge":{"type":"boolean","nullable":true,"example":false,"description":"SPAIN ONLY. Charge recargo de equivalencia (5.2% / 1.4% / 0.5% paired with IVA 21 / 10 / 4) on the taxed lines. Draft only. Optional — default: the customer's `fiscalConfig.equivalenceSurcharge`; a credit note defaults to the rectified invoice. Stored as `surchargeTotal` and added to `total`. Requires at least one taxed line (ES_SURCHARGE_NOT_APPLICABLE)."},"rectificationReason":{"type":"string","nullable":true,"maxLength":500,"example":"Error en el precio unitario de la línea 2","description":"SPAIN ONLY, credit notes only. Why the rectificativa rectifies its invoice (RD 1619/2012 art. 15), printed on the PDF next to the rectified invoice's number and date. Optional; trimmed, empty → null. On an invoice → ES_RECTIFICATION_REASON_NOT_APPLICABLE; for a non-Spanish organization → FIELD_NOT_SUPPORTED_FOR_COUNTRY."},"consignmentSettlement":{"description":"Draft of a Cuenta de Venta y Líquido Producto only: replaces its deductions (commission and expenses). When omitted, the stored deductions are kept, and a percentage (`rate`) deduction is recalculated over the new lines if `details` or the discount change. A draft cannot become a consignment settlement, nor stop being one, through this field: create a new receipt instead.","allOf":[{"$ref":"#/components/schemas/ConsignmentSettlementInputDto"}]},"details":{"description":"Replace all detail lines atomically (draft only)","type":"array","items":{"$ref":"#/components/schemas/CreateSalesReceiptDetailDto"}},"observations":{"deprecated":true,"description":"DEPRECATED — send `details` entries with `type: \"observation\"` instead. Drafts and pre-printed `Creada` receipts only (ignored otherwise). With `details`, the notes are appended after them as observation lines; without `details`, they replace the receipt's existing observation lines, which are appended after the product lines.","type":"array","items":{"$ref":"#/components/schemas/CreateSalesReceiptObservationDto"}}}},"SubscriptionInvoiceItemDto":{"type":"object","properties":{"type":{"type":"string","enum":["product","observation"],"default":"product","description":"`product` (default) or `observation`: a free-text line copied in place onto every emitted invoice. An observation item carries only `description` (1–255 characters); any product, price, quantity, tax or discount field is rejected."},"description":{"type":"string","example":"Asesoramiento"},"quantity":{"type":"number","example":1,"default":1},"unitPrice":{"type":"number","example":561600,"description":"Required on product items (the default type); omit it on observation items."},"productId":{"type":"object","nullable":true},"taxTypeId":{"type":"object","description":"IVA combo item id. Ignored for Monotributista organizations: always Sin IVA (92).","nullable":true},"discount":{"type":"object","description":"Per-line discount %","minimum":0,"maximum":100},"discountAmount":{"type":"object","description":"Per-line discount amount (ARS, or the template's `priceCurrencyId` currency when set)"}},"required":["description"]},"SubscriptionInvoiceDto":{"type":"object","properties":{"receiptBookId":{"type":"number","description":"Receipt book (talonario) id","example":25},"receiptType":{"type":"string","enum":["factura","nota_credito","nota_debito"],"default":"factura"},"saleConditionId":{"type":"object","nullable":true},"currencyId":{"type":"object","nullable":true},"exchangeRate":{"type":"object","nullable":true},"priceCurrencyId":{"type":"object","nullable":true,"description":"Currency (id) the item prices and discount amounts of this template are expressed in, e.g. USD. The receipt is still issued in the receipt currency (`currencyId`, default the organization's pesos): on every emission the amounts are converted at the AFIP rate of the emission day (the latest earlier rate when that day's is not synced yet) and one observation line is appended, e.g. `USD 800,00 · Cotización AFIP $ 1.541,00 (27/10/2026)`. If no rate is available the period fails and stays due for retry; nothing is emitted unconverted. Must be an active currency, different from the receipt currency; the receipt currency must be pesos and `exchangeRate` must be omitted. Omit or null for prices in the receipt currency."},"isServicePeriod":{"type":"boolean","description":"When true, the emitted receipt gets serviceStartDate/serviceEndDate = the billed period.","default":false},"observation":{"type":"object","maxLength":500,"nullable":true},"discount":{"type":"object","description":"Header discount %","minimum":0,"maximum":100},"discountAmount":{"type":"object","description":"Header discount amount (ARS, or the `priceCurrencyId` currency when set)"},"items":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionInvoiceItemDto"}}},"required":["receiptBookId","items"]},"CreateSubscriptionDto":{"type":"object","properties":{"customerId":{"type":"number","description":"Customer to bill","example":1174},"name":{"type":"string","example":"PIOSCA mensual"},"recurrenceUnit":{"type":"string","enum":["DAY","WEEK","MONTH","QUARTER","YEAR"],"example":"MONTH"},"recurrenceInterval":{"type":"number","description":"Every N units","default":1,"minimum":1},"startDate":{"type":"string","description":"Anchor / first-emission date (YYYY-MM-DD)","example":"2026-08-01"},"dayOfPeriod":{"type":"object","description":"Fixed day of the period (day-of-month for MONTH/QUARTER/YEAR, 1..7 for WEEK). Omit to roll from startDate.","nullable":true},"endDate":{"type":"object","description":"Stop date (YYYY-MM-DD)","nullable":true},"maxOccurrences":{"type":"object","description":"Stop after N emissions","nullable":true,"minimum":1},"sendEmail":{"type":"boolean","description":"Auto-send emitted invoices by email","default":true},"collectionEmail":{"type":"object","description":"Recipient override (`;`-separated); else customer.email","nullable":true,"maxLength":500},"invoices":{"description":"One or more invoice templates","type":"array","items":{"$ref":"#/components/schemas/SubscriptionInvoiceDto"}}},"required":["customerId","name","recurrenceUnit","startDate","invoices"]},"SubscriptionInvoiceItemResponseDto":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"type":{"type":"string","enum":["product","observation"]},"description":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"},"productId":{"type":"object","nullable":true},"taxTypeId":{"type":"object","nullable":true},"discount":{"type":"object","nullable":true},"discountAmount":{"type":"object","nullable":true}},"required":["id","position","type","description","quantity","unitPrice"]},"SubscriptionInvoiceResponseDto":{"type":"object","properties":{"id":{"type":"string"},"position":{"type":"number"},"receiptBookId":{"type":"number"},"receiptType":{"type":"string"},"saleConditionId":{"type":"object","nullable":true},"currencyId":{"type":"object","nullable":true},"exchangeRate":{"type":"object","nullable":true},"priceCurrencyId":{"type":"object","nullable":true,"description":"Currency (id) the item prices are expressed in; converted to the receipt currency at the AFIP rate on each emission. Null = the receipt currency."},"isServicePeriod":{"type":"boolean"},"observation":{"type":"object","nullable":true},"discount":{"type":"object","nullable":true},"discountAmount":{"type":"object","nullable":true},"items":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionInvoiceItemResponseDto"}}},"required":["id","position","receiptBookId","receiptType","isServicePeriod","items"]},"SubscriptionResponseDto":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"number"},"name":{"type":"string"},"status":{"type":"string"},"recurrenceUnit":{"type":"string"},"recurrenceInterval":{"type":"number"},"startDate":{"type":"string"},"dayOfPeriod":{"type":"object","nullable":true},"nextRunDate":{"type":"string"},"endDate":{"type":"object","nullable":true},"maxOccurrences":{"type":"object","nullable":true},"occurrencesCount":{"type":"number"},"sendEmail":{"type":"boolean"},"collectionEmail":{"type":"object","nullable":true},"lastRunAt":{"type":"object","nullable":true},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionInvoiceResponseDto"}}},"required":["id","customerId","name","status","recurrenceUnit","recurrenceInterval","startDate","nextRunDate","occurrencesCount","sendEmail","invoices"]},"UpdateSubscriptionDto":{"type":"object","properties":{"name":{"type":"string"},"recurrenceUnit":{"type":"string","enum":["DAY","WEEK","MONTH","QUARTER","YEAR"]},"recurrenceInterval":{"type":"number","minimum":1},"startDate":{"type":"string"},"dayOfPeriod":{"type":"object","nullable":true},"endDate":{"type":"object","nullable":true},"maxOccurrences":{"type":"object","nullable":true,"minimum":1},"sendEmail":{"type":"boolean"},"collectionEmail":{"type":"object","nullable":true,"maxLength":500},"invoices":{"description":"If provided, replaces the invoice templates","type":"array","items":{"$ref":"#/components/schemas/SubscriptionInvoiceDto"}}}},"SubscriptionRunResponseDto":{"type":"object","properties":{"id":{"type":"string"},"periodKey":{"type":"string"},"emissionDate":{"type":"string"},"status":{"type":"string"},"receiptIds":{"type":"array","items":{"type":"string"}},"error":{"type":"object","nullable":true},"createdAt":{"format":"date-time","type":"string"}},"required":["id","periodKey","emissionDate","status","receiptIds","createdAt"]},"SubscriptionRunNowResponseDto":{"type":"object","properties":{"status":{"type":"string","description":"EMITTED (all invoices created) | PARTIAL | FAILED | SKIPPED (period already emitted) | NOT_ELIGIBLE (paused / non-migrated B1 org / legacy-sync / archived / past end)"},"periodKey":{"type":"object","nullable":true},"receiptIds":{"description":"Receipts created (or replayed) this run","type":"array","items":{"type":"string"}},"error":{"type":"object","nullable":true}},"required":["status","receiptIds"]},"SupportEligibilityResponseDto":{"type":"object","properties":{"canCreate":{"type":"boolean"}},"required":["canCreate"]},"SupportTicketListItemDto":{"type":"object","properties":{"number":{"type":"string","description":"Número decimal exacto del ticket."},"title":{"type":"string"},"state":{"type":"string","enum":["new","on_peakly","on_customer","on_hold","closed"]},"priority":{"type":"string","enum":["critical","high","medium","low"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"unread":{"type":"boolean"}},"required":["number","title","state","priority","createdAt","updatedAt","unread"]},"SupportTicketListResponseDto":{"type":"object","properties":{"canCreate":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/SupportTicketListItemDto"}},"nextCursor":{"type":"string","nullable":true}},"required":["canCreate","items","nextCursor"]},"CreateSupportTicketDto":{"type":"object","properties":{"message":{"type":"string","minLength":10,"maxLength":20000,"description":"Mensaje del solicitante; el título se deriva de su primera línea."},"priority":{"type":"string","enum":["critical","high","medium","low"]},"idempotencyKey":{"type":"string","minLength":1,"maxLength":64,"description":"Clave estable para reintentar el mismo envío sin duplicarlo."},"pageUrl":{"type":"string","maxLength":2000,"description":"Ruta de la app desde donde se abrió la consulta; contexto no confiable."}},"required":["message","priority","idempotencyKey"]},"SupportTicketCreatedResponseDto":{"type":"object","properties":{"number":{"type":"string","description":"Correlativo decimal como string para conservar precisión bigint."},"created":{"type":"boolean"}},"required":["number","created"]},"SupportTicketResponseDto":{"type":"object","properties":{"number":{"type":"string","description":"Número decimal exacto del ticket."},"title":{"type":"string"},"state":{"type":"string","enum":["new","on_peakly","on_customer","on_hold","closed"]},"priority":{"type":"string","enum":["critical","high","medium","low"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["number","title","state","priority","createdAt","updatedAt"]},"SupportAttachmentResponseDto":{"type":"object","properties":{"path":{"type":"string","description":"Ruta privada, no URL pública; descargar mediante el endpoint autenticado."},"name":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"number"},"sha256":{"type":"string"}},"required":["path","name","mimeType","size","sha256"]},"SupportMessageResponseDto":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["customer","staff","system"]},"body":{"type":"string"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/SupportAttachmentResponseDto"}},"authorUserId":{"type":"number","nullable":true},"authorName":{"type":"string","nullable":true},"authorEmail":{"type":"string","nullable":true},"staffEmail":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","role","body","attachments","authorUserId","authorName","authorEmail","staffEmail","createdAt"]},"SupportTicketDetailResponseDto":{"type":"object","properties":{"canCreate":{"type":"boolean"},"ticket":{"$ref":"#/components/schemas/SupportTicketResponseDto"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/SupportMessageResponseDto"}},"nextMessageId":{"type":"string","nullable":true}},"required":["canCreate","ticket","messages","nextMessageId"]},"ReplySupportTicketDto":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":20000},"idempotencyKey":{"type":"string","minLength":1,"maxLength":64}},"required":["message","idempotencyKey"]},"SupportTicketClosedResponseDto":{"type":"object","properties":{"number":{"type":"string"},"state":{"type":"string","enum":["closed"]}},"required":["number","state"]},"PurchaseCategoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"description":{"type":"string","example":"Insumos de oficina"},"accountId":{"type":"number","example":42,"description":"Linked journal account id"},"createdAt":{"type":"string","format":"date-time","nullable":true,"example":"2026-01-15T12:00:00.000Z"},"updatedAt":{"type":"string","format":"date-time","nullable":true,"example":null},"deletedAt":{"type":"string","format":"date-time","nullable":true,"example":null}},"required":["id","description","accountId","createdAt","updatedAt","deletedAt"]},"CreatePurchaseCategoryDto":{"type":"object","properties":{"description":{"type":"string"},"accountId":{"type":"number"}},"required":["description","accountId"]},"UpdatePurchaseCategoryDto":{"type":"object","properties":{"description":{"type":"string"},"accountId":{"type":"number"}}},"IncomeGroupResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Ventas de servicios"},"parentId":{"type":"integer","nullable":true,"example":null,"description":"Parent node id; null = root."},"productId":{"type":"integer","nullable":true,"example":12,"description":"Product id when this node is a leaf; null for group nodes."}},"required":["id","name","parentId","productId"]},"CreateIncomeGroupDto":{"type":"object","properties":{"name":{"type":"string","example":"Ventas de servicios"},"parentId":{"type":"object","description":"Parent node id; null/omitted = root node.","nullable":true},"productId":{"type":"object","description":"Product id; set ⇒ this node is a leaf that aggregates the product's sales.","nullable":true}},"required":["name"]},"UpdateIncomeGroupDto":{"type":"object","properties":{"name":{"type":"string"},"parentId":{"type":"object","nullable":true},"productId":{"type":"object","nullable":true}}},"ExpenseGroupResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Costos operativos"},"parentId":{"type":"integer","nullable":true,"example":null},"purchaseCategoryId":{"type":"integer","nullable":true,"example":7,"description":"Purchase category id when this node is a leaf; null for group nodes."}},"required":["id","name","parentId","purchaseCategoryId"]},"CreateExpenseGroupDto":{"type":"object","properties":{"name":{"type":"string","example":"Costos operativos"},"parentId":{"type":"object","description":"Parent node id; null/omitted = root node.","nullable":true},"purchaseCategoryId":{"type":"object","description":"Purchase category id; set ⇒ leaf that aggregates the rubro's purchases.","nullable":true}},"required":["name"]},"UpdateExpenseGroupDto":{"type":"object","properties":{"name":{"type":"string"},"parentId":{"type":"object","nullable":true},"purchaseCategoryId":{"type":"object","nullable":true}}},"ManagementReportNodeDto":{"type":"object","properties":{"id":{"type":"number","example":1},"name":{"type":"string","example":"Ventas de servicios"},"leafId":{"type":"integer","nullable":true,"example":12,"description":"Leaf source id (product / purchase category); null for group nodes."},"amount":{"type":"number","example":125000,"description":"Net amount over the range (leaf = its sales/purchases, group = Σ children)."},"children":{"description":"Child nodes.","type":"array","items":{"$ref":"#/components/schemas/ManagementReportNodeDto"}}},"required":["id","name","leafId","amount","children"]},"IncomeExpenseReportDto":{"type":"object","properties":{"income":{"type":"array","items":{"$ref":"#/components/schemas/ManagementReportNodeDto"}},"expense":{"type":"array","items":{"$ref":"#/components/schemas/ManagementReportNodeDto"}},"totalIncome":{"type":"number","example":500000},"totalExpense":{"type":"number","example":320000},"result":{"type":"number","example":180000,"description":"totalIncome − totalExpense."}},"required":["income","expense","totalIncome","totalExpense","result"]},"ExpenseCategoryResponseDto":{"type":"object","properties":{"id":{"type":"number","example":4},"description":{"type":"string","example":"Gastos de oficina"},"accountId":{"type":"number","example":42}},"required":["id","description","accountId"]},"ExpenseItemResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"otherExpenseId":{"type":"number","example":7},"purchaseCategoryId":{"type":"number","example":4},"description":{"type":"string","example":"Librería"},"total":{"type":"number","example":500},"purchaseCategory":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/ExpenseCategoryResponseDto"}]}},"required":["id","otherExpenseId","purchaseCategoryId","description","total"]},"ExpensePaymentResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1},"otherExpenseId":{"type":"number","example":7},"paymentMethodEntryId":{"type":"number","example":33},"paymentMethodEntry":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PaymentOrderPaymentEntryResponseDto"}]},"fx":{"description":"Payments from a bank account or cash register in a foreign currency only (PAN-420). Absent otherwise.","allOf":[{"$ref":"#/components/schemas/PaymentOrderPaymentFxResponseDto"}]}},"required":["id","otherExpenseId","paymentMethodEntryId"]},"ExpenseResponseDto":{"type":"object","properties":{"id":{"type":"number","example":7},"referenceNumber":{"type":"integer","nullable":true,"example":7,"description":"v1 parity: defaults to id"},"observation":{"type":"string","nullable":true,"example":"Gastos varios de oficina"},"date":{"type":"string","example":"2026-07-09T00:00:00.000Z"},"accountingDate":{"type":"string","example":"2026-07-09T00:00:00.000Z"},"createdAt":{"type":"string","example":"2026-07-09T10:00:00.000Z"},"status":{"type":"string","example":"Creada","description":"Creada | Anulada | Pagada"},"total":{"type":"number","example":500},"supplierId":{"type":"number","example":1},"journalEntryId":{"type":"integer","nullable":true,"example":100},"supplier":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/PaymentOrderSupplierResponseDto"}]},"items":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseItemResponseDto"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/ExpensePaymentResponseDto"}}},"required":["id","referenceNumber","observation","date","accountingDate","createdAt","status","total","supplierId","journalEntryId","supplier"]},"ExpensePageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"123"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"ExpenseItemInputDto":{"type":"object","properties":{"purchaseCategoryId":{"type":"number","example":4,"description":"Purchase category (rubro) id"},"description":{"type":"string","example":"Librería"},"total":{"type":"number","example":500,"description":"Item total (> 0)"}},"required":["purchaseCategoryId","description","total"]},"EgresoPaymentInputDto":{"type":"object","properties":{"paymentMethodId":{"type":"number","example":3,"description":"Payment method id"},"amount":{"type":"number","example":1210.5,"description":"Payment amount (> 0)"},"date":{"type":"string","example":"2026-07-09","description":"Payment date (defaults to the order date)"},"description":{"type":"string","example":"Transferencia BBVA","description":"Entry description (defaults to the movement concept)"},"referenceNumber":{"type":"number","example":55,"description":"Reference id (check / own check / retention receipt) — see payment type"},"externalEntityId":{"type":"number","example":2,"description":"External entity id (cash register / bank account / retention) — see payment type"},"exchangeRate":{"type":"number","example":1100,"description":"Bank account (TRANSFERENCIA / PAGO_ONLINE) or cash register (EFECTIVO) in a foreign currency only: rate of this payment (organization-currency units per unit of the account's currency). Omitted: the official AFIP rate cached for the payment's date (default: the document's date), only for organizations in pesos (EXCHANGE_RATE_REQUIRED otherwise). Ignored for accounts in the organization's currency."},"foreignAmount":{"type":"number","example":1000,"description":"Bank account / cash register in a foreign currency only: units of the account's currency that leave it (its balance moves by this). `amount` stays in the organization's currency. Omitted: amount / exchangeRate. Sent with exchangeRate, foreignAmount × exchangeRate must equal amount (PAYMENT_FX_MISMATCH)."}},"required":["paymentMethodId","amount"]},"CreateExpenseDto":{"type":"object","properties":{"supplierTaxId":{"type":"string","example":"30711610126","description":"Supplier by CUIT. Reuses the supplier if it exists, otherwise creates it from ARCA padrón data. Lets a client load an expense from a scanned receipt without a prior round-trip. Ignored when `supplierId` is sent."},"supplierId":{"type":"number","example":1,"description":"Supplier id. Optional when `supplierTaxId` is sent."},"date":{"type":"string","example":"2026-07-09","description":"Expense date (ISO 8601)"},"accountingDate":{"type":"string","example":"2026-07-09","description":"Accounting date (ISO 8601)"},"observation":{"type":"string","example":"Gastos varios de oficina","nullable":true},"referenceNumber":{"type":"number","example":123,"description":"Reference number (defaults to the expense id, v1 parity)"},"items":{"type":"array","items":{"$ref":"#/components/schemas/ExpenseItemInputDto"}},"payments":{"type":"array","items":{"$ref":"#/components/schemas/EgresoPaymentInputDto"}},"userId":{"type":"string","example":"5c1f9f3e-0000-0000-0000-000000000000","description":"Responsible user (auth uuid). Must be an active member of your organization, otherwise the request fails with RESPONSIBLE_USER_NOT_IN_ORGANIZATION. Sessions (web app, Slack, assistant) always record the signed-in user and ignore this field. An API key call that omits it records the user who created the key."}},"required":["date","accountingDate","items","payments"]},"WarehouseResponseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"name":{"type":"string","example":"Sucursal Norte"},"isPrimary":{"type":"boolean","example":false,"description":"The primary warehouse: fixed (renamable, never archived); its balance is the total minus the other warehouses."},"archivedAt":{"type":"string","nullable":true,"example":null},"createdAt":{"type":"string","example":"2026-10-19T12:00:00.000Z"}},"required":["id","name","isPrimary","archivedAt","createdAt"]},"WarehouseListResponseDto":{"type":"object","properties":{"data":{"description":"Primary first, then by name. Empty for an organization with a single (implicit) warehouse.","type":"array","items":{"$ref":"#/components/schemas/WarehouseResponseDto"}}},"required":["data"]},"ReceiptBookWarehouseResponseDto":{"type":"object","properties":{"receiptBookId":{"type":"number","example":3},"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse the point of sale sells from. On a write, the primary's id when it was cleared; null when the organization has a single warehouse."}},"required":["receiptBookId","warehouseId"]},"ReceiptBookWarehouseListResponseDto":{"type":"object","properties":{"data":{"description":"Points of sale with a warehouse other than the primary. Any point of sale not listed sells from the primary.","type":"array","items":{"$ref":"#/components/schemas/ReceiptBookWarehouseResponseDto"}}},"required":["data"]},"CreateWarehouseDto":{"type":"object","properties":{"name":{"type":"string","example":"Sucursal Norte","maxLength":120,"description":"Name of the new warehouse."},"primaryName":{"type":"string","example":"Depósito principal","maxLength":120,"description":"Only used when this is the organization's FIRST extra warehouse: the name given to the primary warehouse, which keeps all the current stock. Default \"Depósito principal\"."}},"required":["name"]},"UpdateWarehouseDto":{"type":"object","properties":{"name":{"type":"string","example":"Depósito central","maxLength":120}},"required":["name"]},"WarehouseBalanceDto":{"type":"object","properties":{"warehouseId":{"type":"number","example":12},"name":{"type":"string","example":"Sucursal Norte"},"isPrimary":{"type":"boolean","example":false},"quantity":{"type":"number","example":4,"description":"Stock of the product in this warehouse."}},"required":["warehouseId","name","isPrimary","quantity"]},"ProductBalancesResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"total":{"type":"number","example":10,"description":"Total stock (products.quantity)."},"warehouses":{"description":"Per active warehouse, primary first. Empty for an organization with a single warehouse (the total is all there is).","type":"array","items":{"$ref":"#/components/schemas/WarehouseBalanceDto"}}},"required":["productId","total","warehouses"]},"SetReceiptBookWarehouseDto":{"type":"object","properties":{"warehouseId":{"type":"integer","nullable":true,"example":12,"description":"Warehouse the point of sale sells from: its invoices take the stock out of it, and its credit notes return it there (unless they return to the warehouse their invoice left from). null or the primary's id = the primary warehouse."}},"required":["warehouseId"]},"DeliveryNoteBookResponseDto":{"type":"object","properties":{"id":{"type":"number","example":3},"name":{"type":"string","example":"Remitos"},"pointOfSale":{"type":"number","example":1},"nextNumber":{"type":"number","example":13,"description":"Number the next note of this book will get."},"warehouseId":{"type":"number","nullable":true,"example":null},"cai":{"type":"string","nullable":true,"example":null},"caiDueDate":{"type":"string","nullable":true,"example":null},"archivedAt":{"type":"string","nullable":true,"format":"date-time","example":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","pointOfSale","nextNumber","warehouseId","cai","caiDueDate","archivedAt","createdAt"]},"DeliveryNoteBookListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryNoteBookResponseDto"}}},"required":["data"]},"CreateDeliveryNoteBookDto":{"type":"object","properties":{"name":{"type":"string","example":"Remitos","maxLength":120},"pointOfSale":{"type":"number","example":1,"minimum":1,"maximum":99999,"description":"Point of sale printed on the notes (00001)."},"warehouseId":{"type":"object","nullable":true,"example":null,"description":"Default warehouse of the notes (null = the primary). Only used with more than one warehouse."},"cai":{"type":"object","nullable":true,"example":"51234567890123","maxLength":20,"description":"CAI of pre-printed notes: with it the notes print as letter R, without it as X."},"caiDueDate":{"type":"object","nullable":true,"example":"2027-06-30","description":"CAI due date (YYYY-MM-DD)."}},"required":["name","pointOfSale"]},"UpdateDeliveryNoteBookDto":{"type":"object","properties":{"name":{"type":"string","example":"Remitos","maxLength":120},"warehouseId":{"type":"object","nullable":true,"description":"Default warehouse (null = the primary)."},"cai":{"type":"object","nullable":true,"maxLength":20},"caiDueDate":{"type":"object","nullable":true,"example":"2027-06-30"},"archived":{"type":"boolean","description":"true archives the book (its numbering is kept; with no active book the organization stops issuing delivery notes); false reactivates it (needs stock tracking and its point of sale free)."}}},"DeliveryNoteLineDto":{"type":"object","properties":{"productId":{"type":"number","example":15,"description":"Product (not a service). A combo moves its components."},"quantity":{"type":"number","example":4,"description":"Quantity (> 0, up to 5 decimals)."},"description":{"type":"string","maxLength":500,"description":"Printed description; default the product's."}},"required":["productId","quantity"]},"CreateDeliveryNoteDto":{"type":"object","properties":{"kind":{"type":"string","enum":["delivery","customer_return"],"example":"delivery","description":"`delivery` takes the goods out of stock; `customer_return` puts them back."},"bookId":{"type":"number","example":3,"description":"Delivery-note book (GET /sales/delivery-note-books)."},"date":{"type":"string","example":"2026-10-21","description":"Date (YYYY-MM-DD). Default: today in Argentina."},"customerId":{"type":"number","example":42},"warehouseId":{"type":"object","nullable":true,"description":"Warehouse (only with more than one warehouse). Default: the book's, else the primary."},"deliveryAddress":{"type":"string","maxLength":500,"example":"Av. Corrientes 1234, CABA"},"carrier":{"type":"string","maxLength":255,"example":"Transporte Sur SRL"},"observation":{"type":"string","maxLength":1000},"lines":{"description":"1 to 500 lines.","type":"array","items":{"$ref":"#/components/schemas/DeliveryNoteLineDto"}}},"required":["kind","bookId","customerId","lines"]},"DeliveryNoteCustomerDto":{"type":"object","properties":{"id":{"type":"number","example":42},"businessName":{"type":"string","nullable":true,"example":"QA Cliente"},"taxId":{"type":"string","nullable":true,"example":"20111111112"}},"required":["id","businessName","taxId"]},"DeliveryNoteInvoiceRefDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"label":{"type":"string","example":"Factura C 00002-00000005"},"status":{"type":"string","example":"Creada"},"date":{"type":"string","nullable":true,"example":"2026-10-21"},"total":{"type":"number","example":4000}},"required":["id","label","status","date","total"]},"DeliveryNoteLineResponseDto":{"type":"object","properties":{"productId":{"type":"number","example":15},"description":{"type":"string","example":"Coca 2,25 L"},"code":{"type":"string","nullable":true,"example":"7790895000997"},"quantity":{"type":"number","example":4}},"required":["productId","description","code","quantity"]},"DeliveryNoteResponseDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["delivery","customer_return","reception"]},"status":{"type":"string","enum":["issued","voided"]},"state":{"type":"string","enum":["pending","invoiced","voided","issued"],"description":"pending = delivery to invoice; invoiced = linked to a live receipt (not voided nor fully cancelled by credit notes that return no goods); voided; issued = a customer return."},"letter":{"type":"string","enum":["R","X"],"description":"R when the book has a CAI, X otherwise."},"pointOfSale":{"type":"number","example":1},"number":{"type":"number","example":12},"formattedNumber":{"type":"string","example":"00001-00000012"},"label":{"type":"string","example":"R 00001-00000012"},"date":{"type":"string","example":"2026-10-21"},"bookId":{"type":"number","example":3},"customer":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/DeliveryNoteCustomerDto"}]},"warehouseId":{"type":"number","nullable":true,"description":"Null = the primary warehouse."},"deliveryAddress":{"type":"string","nullable":true},"carrier":{"type":"string","nullable":true},"observation":{"type":"string","nullable":true},"createdByName":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"voidedAt":{"type":"string","nullable":true,"format":"date-time"},"lineCount":{"type":"number","example":2},"totalQuantity":{"type":"number","example":5},"invoices":{"description":"Receipts that invoiced the note (voided ones included).","type":"array","items":{"$ref":"#/components/schemas/DeliveryNoteInvoiceRefDto"}},"lines":{"description":"Only in the detail.","type":"array","items":{"$ref":"#/components/schemas/DeliveryNoteLineResponseDto"}}},"required":["id","kind","status","state","letter","pointOfSale","number","formattedNumber","label","date","bookId","customer","warehouseId","deliveryAddress","carrier","observation","createdByName","createdAt","voidedAt","lineCount","totalQuantity","invoices"]},"DeliveryNoteListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryNoteResponseDto"}},"total":{"type":"number","example":1},"page":{"type":"number","example":1},"pageSize":{"type":"number","example":50}},"required":["data","total","page","pageSize"]},"InvoiceDeliveryNotesDto":{"type":"object","properties":{"deliveryNoteIds":{"description":"1 to 100 delivery notes of the same customer.","type":"array","items":{"type":"string","format":"uuid"}},"receipt":{"description":"The invoice, exactly as POST /sales/sales-receipts takes it. Always a confirmed Factura (no draft, no associated receipt) to the notes' customer.","allOf":[{"$ref":"#/components/schemas/CreateSalesReceiptDto"}]}},"required":["deliveryNoteIds","receipt"]},"CaeaAuthorizationSummaryDto":{"type":"object","properties":{"caea":{"type":"string","example":"36429063241234","description":"The CAEA code granted by ARCA."},"periodo":{"type":"number","example":202610,"description":"Period, YYYYMM."},"orden":{"type":"number","enum":[1,2],"example":2,"description":"Fortnight: 1 = days 1–15, 2 = day 16 to month end."},"validFrom":{"type":"string","example":"2026-10-16","description":"First day of the CAEA's validity (YYYY-MM-DD)."},"validTo":{"type":"string","example":"2026-10-31","description":"Last day of the CAEA's validity (YYYY-MM-DD)."},"reportDeadline":{"type":"string","example":"2026-11-08","description":"Last day to inform ARCA what was issued under it (FchTopeInf, YYYY-MM-DD)."}},"required":["caea","periodo","orden","validFrom","validTo","reportDeadline"]},"CaeaContingencyStatusDto":{"type":"object","properties":{"enabled":{"type":"boolean","example":false,"description":"Whether the organization runs the CAEA contingency. Off by default: receipts are authorized online (CAE)."},"available":{"type":"boolean","example":true,"description":"Whether the contingency can be turned on: the organization has at least one domestic electronic (WS) receipt book that is not for export."},"current":{"nullable":true,"description":"The CAEA covering today (Argentina), if already granted.","allOf":[{"$ref":"#/components/schemas/CaeaAuthorizationSummaryDto"}]},"next":{"nullable":true,"description":"Next fortnight's CAEA, if already requested.","allOf":[{"$ref":"#/components/schemas/CaeaAuthorizationSummaryDto"}]},"pendingReports":{"type":"number","example":0,"description":"Rendiciones still to inform to ARCA: receipts issued under CAEA plus 'sin movimiento' reports."},"erroredReports":{"type":"number","example":0,"description":"Of the pending ones, those ARCA rejected (need attention)."}},"required":["enabled","available","current","next","pendingReports","erroredReports"]},"UpdateCaeaContingencyDto":{"type":"object","properties":{"enabled":{"type":"boolean","example":true,"description":"true turns the CAEA contingency on for the organization (Peakly requests a CAEA every fortnight and issues with it when ARCA's WSFE does not answer); false stops requesting future periods — what was already granted or issued keeps being informed to ARCA."}},"required":["enabled"]},"ImportDraftSourceDto":{"type":"object","properties":{"resourceId":{"type":"string","example":"5b0e8c1a-2f4d-4e6b-9a3c-7d1e2f3a4b5c","description":"Spreadsheet registered in the organization's Google connection: Peakly resource id or Google spreadsheet id"},"sheet":{"type":"string","example":"Clientes","description":"Tab title"},"headerRow":{"type":"number","example":1,"default":1,"description":"Header row (1-based); data starts on the next row"},"mapping":{"type":"object","additionalProperties":{"type":"string"},"example":{"taxId":"NIF","name":"Razón social","email":"E-mail"},"description":"Field → column (header name or column letter). Fields per kind — customers: taxId, name, email, phone, address, city, postalCode, province (required: taxId, name). sales: date, number, customerTaxId, customerName, description, net, vatRate, vat, total, cae, caeExpiration (required: date, customerTaxId, vatRate, total; number too with salesMode issued, and cae + caeExpiration per row for an Argentine organization; with options.salesKind cvlp also commission, commissionRate, commissionDescription, expenses, expensesDescription). purchases: date, number, supplierTaxId, supplierName, letter, description, net, vatRate, vat, total (required: date, number, supplierTaxId, vatRate, total)."}},"required":["resourceId","sheet","mapping"]},"ImportDraftOptionsDto":{"type":"object","properties":{"salesMode":{"type":"string","enum":["draft","issued"],"default":"draft","description":"Sales only. `draft`: the sales were not invoiced yet and are created as Borrador (never issued automatically). `issued`: the sales were already invoiced outside Peakly and are registered as issued (`Creada`) with the sheet's number, without ARCA / VERI*FACTU; the series counter moves up to the highest number imported. Needs `number` mapped; Argentina also needs `cae` and `caeExpiration` per row, Spain refuses them."},"salesKind":{"type":"string","enum":["cvlp"],"description":"Sales only (PAN-843). Omitted: ordinary invoices. `cvlp`: Cuentas de Venta y Líquido Producto (ARCA 60/61) created as Borrador only (never `issued`, never authorized automatically), for an Argentine organization enabled to issue them. The customer is the comitente (letter A → 60, B → 61; C / E are row errors). Extra mapping fields: `commission` (net amount) or `commissionRate` (% of the goods' taxable net), optional `commissionDescription` (the commission's line, default \"Comisión\"), `expenses` (net amount), `expensesDescription`. Deductions carry no VAT of their own (modalidad general): they reduce the goods' taxable base and VAT is recomputed on the rest. Rows sharing a `number` (same date and comitente) form one CVLP with one goods line per row; each row's commission / expenses reduce only that row's VAT rate (PAN-915). The first row of a liquidation carries `settlement` (goods total, deductions, líquido producto = the CVLP's ImpTotal)."},"receiptBookId":{"type":"number","example":12,"description":"Sales only (required): receipt book / series the receipts are created in"},"purchaseConditionId":{"type":"number","example":30,"description":"Purchases: purchase condition (combo item) of every receipt. Without it every row is `missing_field:purchaseCondition`."}}},"CreateImportDraftDto":{"type":"object","properties":{"kind":{"type":"string","enum":["customers","sales","purchases"],"description":"What the tab holds"},"source":{"$ref":"#/components/schemas/ImportDraftSourceDto"},"options":{"$ref":"#/components/schemas/ImportDraftOptionsDto"}},"required":["kind","source"]},"ImportDraftSourceResponseDto":{"type":"object","properties":{"resourceId":{"type":"string","example":"5b0e8c1a-2f4d-4e6b-9a3c-7d1e2f3a4b5c"},"sheet":{"type":"string","example":"Clientes"},"headerRow":{"type":"number","example":1},"mapping":{"type":"object","additionalProperties":{"type":"string"},"example":{"taxId":"NIF","name":"Razón social"}}},"required":["resourceId","sheet","headerRow","mapping"]},"ImportSummaryDto":{"type":"object","properties":{"total":{"type":"number","example":120},"create":{"type":"number","example":100},"existing":{"type":"number","example":15},"duplicate":{"type":"number","example":2},"error":{"type":"number","example":3},"totalAmount":{"type":"string","example":"152340.50","description":"Sales / purchases: sum of `total` over the rows to create"}},"required":["total","create","existing","duplicate","error"]},"ImportSkippedRowDto":{"type":"object","properties":{"rowNumber":{"type":"number","example":7},"reason":{"type":"string","example":"customer_not_found"}},"required":["rowNumber","reason"]},"ImportResultDto":{"type":"object","properties":{"created":{"type":"number","example":100},"skipped":{"type":"array","items":{"$ref":"#/components/schemas/ImportSkippedRowDto"}}},"required":["created","skipped"]},"ImportRowSettlementDto":{"type":"object","properties":{"goodsTotal":{"type":"number","example":4604912.91,"description":"Goods total (net + VAT)"},"deductionsTotal":{"type":"number","example":1117307,"description":"Commission + expenses (no VAT of their own)"},"netAmount":{"type":"number","example":3370288.68,"description":"Líquido producto = the CVLP's ImpTotal: (goods' taxable net − deductions) + VAT recomputed on it, plus any exempt / untaxed amount"},"rowNumbers":{"example":[2,3],"description":"Sheet rows forming this liquidation (rows sharing a number, PAN-915); absent on a one-row liquidation","type":"array","items":{"type":"number"}}},"required":["goodsTotal","deductionsTotal","netAmount"]},"ImportRowResponseDto":{"type":"object","properties":{"rowNumber":{"type":"number","example":2,"description":"Sheet row number (1-based)"},"input":{"type":"object","additionalProperties":{"type":"string","nullable":true},"example":{"taxId":"B12345674","name":"Ferretería Sol SL"},"description":"Mapped cells of the row (empty = null)"},"action":{"type":"string","enum":["create","existing","duplicate","error"]},"matchId":{"type":"integer","nullable":true,"example":15,"description":"Matched customer (customers, sales) or supplier (purchases); after confirm, the created customer / supplier"},"reasons":{"example":["customer_not_found"],"description":"Reason codes: invalid_tax_id, unknown_vat_rate, customer_not_found, duplicate_row, already_exists, missing_field:<field>, invalid_date, invalid_amount, amount_mismatch, invalid_letter; issued sales: invalid_number, missing_sales_letter, invalid_cae, invalid_cae_expiration, cae_not_allowed; CVLP (salesKind cvlp): missing_sales_letter, cvlp_invalid_letter, cvlp_commission_ambiguous, invalid_commission, invalid_commission_rate, invalid_expenses, invalid_deduction_vat_rate (a deduction VAT rate other than empty / 0: deductions carry no VAT of their own), cvlp_deductions_exceed_total (deductions above the goods' taxable net), cvlp_group_date_mismatch / cvlp_group_customer_mismatch (rows sharing a number with another date / comitente), cvlp_group_incomplete (another row of the same liquidation has an error); write_failed:<ERROR_CODE> (after confirm)","type":"array","items":{"type":"string"}},"warnings":{"example":[],"description":"Non-blocking notes (supplier_will_be_created, field_ignored:province, date_before_last_issued, cvlp_without_commission, cvlp_grouped_line…)","type":"array","items":{"type":"string"}},"settlement":{"description":"CVLP imports only (salesKind cvlp), on the first row of each liquidation that plans: goods total, deductions and líquido producto of the whole liquidation. Absent otherwise (including the other rows of a grouped liquidation, which warn cvlp_grouped_line).","allOf":[{"$ref":"#/components/schemas/ImportRowSettlementDto"}]}},"required":["rowNumber","input","action","matchId","reasons","warnings"]},"ImportDraftResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"3f1c2b7e-8d4a-4c1e-9a55-2b0d6f1e7c11"},"kind":{"type":"string","enum":["customers","sales","purchases"]},"status":{"type":"string","enum":["draft","confirmed","discarded"]},"source":{"$ref":"#/components/schemas/ImportDraftSourceResponseDto"},"options":{"$ref":"#/components/schemas/ImportDraftOptionsDto"},"summary":{"$ref":"#/components/schemas/ImportSummaryDto"},"result":{"nullable":true,"description":"Set once confirmed","allOf":[{"$ref":"#/components/schemas/ImportResultDto"}]},"agentRunId":{"type":"string","nullable":true,"example":null,"description":"Copiloto run that created the draft"},"createdAt":{"type":"string","example":"2026-10-11T12:00:00.000Z"},"confirmedAt":{"type":"string","nullable":true,"example":null},"discardedAt":{"type":"string","nullable":true,"example":null},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ImportRowResponseDto"}}},"required":["id","kind","status","source","options","summary","result","agentRunId","createdAt","confirmedAt","discardedAt","rows"]},"ImportDraftSummaryResponseDto":{"type":"object","properties":{"id":{"type":"string","example":"3f1c2b7e-8d4a-4c1e-9a55-2b0d6f1e7c11"},"kind":{"type":"string","enum":["customers","sales","purchases"]},"status":{"type":"string","enum":["draft","confirmed","discarded"]},"source":{"$ref":"#/components/schemas/ImportDraftSourceResponseDto"},"options":{"$ref":"#/components/schemas/ImportDraftOptionsDto"},"summary":{"$ref":"#/components/schemas/ImportSummaryDto"},"result":{"nullable":true,"description":"Set once confirmed","allOf":[{"$ref":"#/components/schemas/ImportResultDto"}]},"agentRunId":{"type":"string","nullable":true,"example":null,"description":"Copiloto run that created the draft"},"createdAt":{"type":"string","example":"2026-10-11T12:00:00.000Z"},"confirmedAt":{"type":"string","nullable":true,"example":null},"discardedAt":{"type":"string","nullable":true,"example":null}},"required":["id","kind","status","source","options","summary","result","agentRunId","createdAt","confirmedAt","discardedAt"]},"ImportDraftListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ImportDraftSummaryResponseDto"}},"total":{"type":"number","example":3}},"required":["data","total"]},"BulkActionDto":{"type":"object","properties":{"jobId":{"type":"string","description":"Bulk action job UUID"},"type":{"type":"string","enum":["sales-receipts-bulk-email","sales-receipts-bulk-pdf","sales-receipts-bulk-void","sales-receipts-csv-export"]},"status":{"type":"string","enum":["queued","running","completed","failed","cancelled"]},"totalCount":{"type":"number"},"doneCount":{"type":"number"},"skippedCount":{"type":"number"},"failedCount":{"type":"number"},"receiptStatuses":{"type":"object","description":"Per-receipt status map. Populated for bulk-email/pdf/void; null for csv-export.","nullable":true},"downloadUrl":{"type":"object","nullable":true},"errorMessage":{"type":"object","nullable":true},"resourceContext":{"type":"object","description":"Free-form context useful for rendering the row in the UI.","nullable":true},"createdBy":{"type":"object","nullable":true},"createdAt":{"type":"string"},"completedAt":{"type":"object","nullable":true}},"required":["jobId","type","status","totalCount","doneCount","skippedCount","failedCount","createdAt"]},"BulkActionListResponseDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BulkActionDto"}},"nextCursor":{"type":"object","nullable":true},"activeCount":{"type":"number","description":"Count of non-terminal jobs (queued + running) within the same scope. Drives the sidebar badge — intentionally NOT affected by the `type` filter so the badge reflects all active jobs even when the list is filtered to one type."}},"required":["items","activeCount"]},"EnumOptionDto":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]},"DatasetFieldDto":{"type":"object","properties":{"key":{"type":"string","example":"customer"},"label":{"type":"string","example":"Cliente"},"type":{"type":"string","enum":["string","date","number","money","enum","entity"]},"filterable":{"type":"boolean"},"groupable":{"type":"boolean"},"operators":{"type":"array","items":{"type":"string","enum":["eq","neq","in","nin","between","gt","gte","lt","lte","contains"]}},"granularities":{"type":"array","items":{"type":"string","enum":["day","week","month","quarter","year"]}},"options":{"type":"array","items":{"$ref":"#/components/schemas/EnumOptionDto"}},"lookup":{"type":"string","enum":["products","product_categories","customers","branches","receipt_books","employees","leave_types","users","currencies","provinces"],"description":"For entity fields: `GET /v1/reports/lookups/{lookup}`."}},"required":["key","label","type","filterable","groupable","operators"]},"DatasetMeasureDto":{"type":"object","properties":{"key":{"type":"string","example":"total"},"label":{"type":"string","example":"Total"},"type":{"type":"string","enum":["int","money","hours","number"]},"description":{"type":"string"}},"required":["key","label","type"]},"ReportFilterDto":{"type":"object","properties":{"field":{"type":"string","example":"date","description":"Field key from the dataset catalog."},"op":{"type":"string","enum":["eq","neq","in","nin","between","gt","gte","lt","lte","contains"],"example":"between"},"value":{"description":"`between` → [from, to] inclusive (dates \"YYYY-MM-DD\"); `in`/`nin` → array; other operators → a single value. Entity values are ids.","oneOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"}]}}],"example":["2026-09-01","2026-09-30"]}},"required":["field","op","value"]},"ReportGroupByDto":{"type":"object","properties":{"field":{"type":"string","example":"date"},"granularity":{"type":"string","enum":["day","week","month","quarter","year"],"description":"Date fields only; default \"day\"."}},"required":["field"]},"ReportSortDto":{"type":"object","properties":{"by":{"type":"string","example":"total","description":"A measure key or a grouped column key (`date__month`)."},"dir":{"type":"string","enum":["asc","desc"]}},"required":["by","dir"]},"ReportViewConfigDto":{"type":"object","properties":{"type":{"type":"string","enum":["table","pivot","bar","line","pie","kpi"]},"pivotColumn":{"type":"string","description":"Grouped column shown across in a pivot. Stored only; the API does not interpret it."}},"required":["type"]},"ReportSpecDto":{"type":"object","properties":{"dataset":{"type":"string","enum":["sales","attendance","leaves","sales-products"],"example":"sales"},"filters":{"description":"A `between` filter on the dataset's date field is mandatory.","type":"array","items":{"$ref":"#/components/schemas/ReportFilterDto"}},"groupBy":{"description":"0 to 3 levels.","type":"array","items":{"$ref":"#/components/schemas/ReportGroupByDto"}},"measures":{"example":["count","total"],"description":"1 to 8 measure keys.","type":"array","items":{"type":"string"}},"sort":{"type":"array","items":{"$ref":"#/components/schemas/ReportSortDto"}},"limit":{"type":"number","minimum":1,"maximum":10000,"default":1000,"description":"Maximum grouped rows returned."},"currency":{"type":"string","enum":["original","ars"],"default":"ars","description":"Sales only. `ars` converts foreign-currency receipts with their own exchange rate."},"view":{"description":"Stored with the spec; ignored by the query.","allOf":[{"$ref":"#/components/schemas/ReportViewConfigDto"}]}},"required":["dataset","filters","groupBy","measures"]},"DatasetDto":{"type":"object","properties":{"key":{"type":"string","enum":["sales","attendance","leaves","sales-products"]},"label":{"type":"string","example":"Ventas"},"description":{"type":"string"},"permission":{"type":"string","example":"reports:sales","description":"Permission needed to query the dataset."},"dateField":{"type":"string","example":"date"},"maxRangeDays":{"type":"number","example":366,"description":"Longest date range allowed for this organization."},"fields":{"type":"array","items":{"$ref":"#/components/schemas/DatasetFieldDto"}},"measures":{"type":"array","items":{"$ref":"#/components/schemas/DatasetMeasureDto"}},"defaultSpec":{"$ref":"#/components/schemas/ReportSpecDto"}},"required":["key","label","description","permission","dateField","maxRangeDays","fields","measures","defaultSpec"]},"DatasetListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DatasetDto"}}},"required":["data"]},"LookupListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EnumOptionDto"}}},"required":["data"]},"ReportColumnDto":{"type":"object","properties":{"key":{"type":"string","example":"date__month"},"label":{"type":"string","example":"Fecha (mes)"},"kind":{"type":"string","enum":["dimension","measure"]},"type":{"type":"string","example":"date"}},"required":["key","label","kind","type"]},"ReportMetaDto":{"type":"object","properties":{"rowCount":{"type":"number"},"truncated":{"type":"boolean","description":"More grouped rows exist than `limit`."},"source":{"type":"string","enum":["base","rollup"]},"tookMs":{"type":"number"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["rowCount","truncated","source","tookMs","warnings"]},"ReportResultDto":{"type":"object","properties":{"columns":{"description":"Dimensions first (groupBy order), then measures (request order).","type":"array","items":{"$ref":"#/components/schemas/ReportColumnDto"}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"}]}},"description":"One object per group keyed by column key. Dates → period start \"YYYY-MM-DD\"; entities → label plus `{key}__id`; enums → option label; measures → numbers (2 decimals for money and hours)."},"totals":{"type":"object","additionalProperties":{"type":"number"},"description":"Each measure over every matching row, not only the returned ones."},"meta":{"$ref":"#/components/schemas/ReportMetaDto"}},"required":["columns","rows","totals","meta"]},"ExportReportDto":{"type":"object","properties":{"spec":{"$ref":"#/components/schemas/ReportSpecDto"},"format":{"type":"string","enum":["csv","xlsx"]},"fileName":{"type":"string","example":"ventas-septiembre","description":"File name without extension."}},"required":["spec","format"]},"ReportTemplateDto":{"type":"object","properties":{"key":{"type":"string","example":"ventas-por-mes"},"name":{"type":"string"},"description":{"type":"string"},"spec":{"$ref":"#/components/schemas/ReportSpecDto"}},"required":["key","name","description","spec"]},"ReportTemplateListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReportTemplateDto"}}},"required":["data"]},"ReportViewResponseDto":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"dataset":{"type":"string","enum":["sales","attendance","leaves","sales-products"]},"spec":{"$ref":"#/components/schemas/ReportSpecDto"},"visibility":{"type":"string","enum":["private","organization"]},"pinned":{"type":"boolean"},"ownerUserId":{"type":"number"},"ownerName":{"type":"string","nullable":true},"isOwner":{"type":"boolean"},"templateKey":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","dataset","spec","visibility","pinned","ownerUserId","ownerName","isOwner","templateKey","createdAt","updatedAt"]},"ReportViewListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReportViewResponseDto"}}},"required":["data"]},"CreateReportViewDto":{"type":"object","properties":{"name":{"type":"string","maxLength":120,"example":"Ventas por mes"},"spec":{"$ref":"#/components/schemas/ReportSpecDto"},"visibility":{"type":"string","enum":["private","organization"]},"pinned":{"type":"boolean","default":false,"description":"Pinned views show in the menu."},"templateKey":{"type":"string","example":"ventas-por-mes","description":"Template the view was created from."}},"required":["name","spec","visibility"]},"UpdateReportViewDto":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"spec":{"$ref":"#/components/schemas/ReportSpecDto"},"visibility":{"type":"string","enum":["private","organization"]},"pinned":{"type":"boolean"}}},"EmployeeResponseDto":{"type":"object","properties":{"id":{"type":"number","example":12},"employeeNumber":{"type":"string","nullable":true,"example":"A-0042","description":"Número de legajo interno."},"providerId":{"type":"string","nullable":true,"example":"cuidadora-k57abc","description":"Id of the employee in an external system that syncs its roster (`POST /attendance/roster-sync`). Unique per organization; read-only."},"firstName":{"type":"string","example":"María"},"lastName":{"type":"string","example":"González"},"documentType":{"type":"string","enum":["DNI","LE","LC","CI","PASSPORT"],"example":"DNI"},"documentNumber":{"type":"string","example":"30123456","description":"Normalized: digits only for DNI/LE/LC."},"cuil":{"type":"string","nullable":true,"example":"27301234568","description":"11 digits, no dashes."},"email":{"type":"string","example":"maria.gonzalez@empresa.com.ar","description":"Always lower-case."},"phone":{"type":"string","nullable":true,"example":"+54 11 5555-1234"},"birthDate":{"type":"string","nullable":true,"example":"1990-04-12","description":"YYYY-MM-DD"},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234, CABA"},"branchId":{"type":"integer","nullable":true,"example":3},"supervisorId":{"type":"integer","nullable":true,"example":7},"hasFamilyDependants":{"type":"boolean","nullable":true,"example":false,"description":"\"Cargas de familia\" (LCT art. 208 doubles the paid sick-leave period). Null = not informed (treated as false)."},"hireDate":{"type":"string","nullable":true,"example":"2024-03-01","description":"YYYY-MM-DD"},"terminationDate":{"type":"string","nullable":true,"example":null,"description":"YYYY-MM-DD; set when the employee is deactivated."},"status":{"type":"string","enum":["active","inactive"],"example":"active"},"customFields":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"}]},"example":{"custom_talle_remera":"M"},"description":"Values of the organization's custom fields, keyed by field key."},"hasUserAccount":{"type":"boolean","example":false,"description":"True once the employee has linked a user account (accepted an invitation)."},"hasKioskPin":{"type":"boolean","example":false,"description":"True when the employee set a kiosk PIN (to check in with document number + PIN where the branch allows it). Read-only; the PIN itself is never returned."},"remoteMode":{"type":"string","enum":["none","geofence","free"],"example":"none","description":"Remote check-in (without the kiosk QR, away from the branch): `none` (off, default), `geofence` (measured against the remote sites that apply to the employee) or `free` (anywhere). Every remote check is recorded as observed."},"createdAt":{"type":"string","example":"2026-09-26T12:00:00.000Z"},"updatedAt":{"type":"string","example":"2026-09-26T12:00:00.000Z"},"createdByUserId":{"type":"integer","nullable":true,"example":5},"updatedByUserId":{"type":"integer","nullable":true,"example":5}},"required":["id","employeeNumber","providerId","firstName","lastName","documentType","documentNumber","cuil","email","phone","birthDate","address","branchId","supervisorId","hasFamilyDependants","hireDate","terminationDate","status","customFields","hasUserAccount","hasKioskPin","remoteMode","createdAt","updatedAt","createdByUserId","updatedByUserId"]},"EmployeePageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EmployeeResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"eyJsIjoiZ29uemFsZXoiLCJmIjoibWFyaWEiLCJpZCI6MTJ9"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"EmployeeImportRowResultDto":{"type":"object","properties":{"rowNumber":{"type":"number","example":2,"description":"Spreadsheet row number (row 1 = headers)."},"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Creado","description":"Creado / Actualizado / Válido, or the error in Spanish."},"employeeId":{"type":"integer","nullable":true,"example":12,"description":"Employee id (null in dry runs and on errors)."}},"required":["rowNumber","success","message","employeeId"]},"EmployeeImportResultDto":{"type":"object","properties":{"total":{"type":"number","example":25,"description":"Data rows in the file."},"imported":{"type":"number","example":24,"description":"Rows imported (or, in a dry run, rows that would import)."},"errors":{"type":"number","example":1},"dryRun":{"type":"boolean","example":false},"results":{"type":"array","items":{"$ref":"#/components/schemas/EmployeeImportRowResultDto"}},"resultPath":{"type":"string","nullable":true,"example":"3274/1727366400000_empleados_resultado.xlsx","description":"Storage key of the result spreadsheet (download with GET /file-imports/download?key=…). Null in dry runs or when storage is not configured."}},"required":["total","imported","errors","dryRun","results","resultPath"]},"CreateEmployeeDto":{"type":"object","properties":{"employeeNumber":{"type":"string","nullable":true,"example":"A-0042","maxLength":30},"firstName":{"type":"string","example":"María","maxLength":120},"lastName":{"type":"string","example":"González","maxLength":120},"documentType":{"type":"string","enum":["DNI","LE","LC","CI","PASSPORT"],"default":"DNI"},"documentNumber":{"type":"string","example":"30.123.456","description":"DNI: 7–8 digits (dots allowed). Stored normalized.","maxLength":20},"cuil":{"type":"string","nullable":true,"example":"27-30123456-8","description":"Dashes optional. Validated (check digit, person prefix, matches DNI)."},"email":{"type":"string","example":"maria.gonzalez@empresa.com.ar","maxLength":255},"phone":{"type":"string","nullable":true,"example":"+54 11 5555-1234","maxLength":40},"birthDate":{"type":"string","nullable":true,"example":"1990-04-12","description":"YYYY-MM-DD"},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234, CABA","maxLength":255},"branchId":{"type":"integer","nullable":true,"example":3,"description":"Active branch of the organization."},"supervisorId":{"type":"integer","nullable":true,"example":7,"description":"Active employee of the organization (not the employee itself)."},"hasFamilyDependants":{"type":"boolean","nullable":true,"example":false,"description":"\"Cargas de familia\" (field `family_dependants`; ignored when the organization hides it)."},"hireDate":{"type":"string","nullable":true,"example":"2024-03-01","description":"YYYY-MM-DD"},"customFields":{"type":"object","additionalProperties":true,"example":{"custom_talle_remera":"M"},"description":"Custom field values keyed by field key. On update, merged into the stored values; a key set to null or \"\" is removed."}},"required":["firstName","lastName","documentNumber","email"]},"UpdateEmployeeDto":{"type":"object","properties":{"employeeNumber":{"type":"string","nullable":true,"example":"A-0042","maxLength":30},"firstName":{"type":"string","example":"María","maxLength":120},"lastName":{"type":"string","example":"González","maxLength":120},"documentType":{"type":"string","enum":["DNI","LE","LC","CI","PASSPORT"],"default":"DNI"},"documentNumber":{"type":"string","example":"30.123.456","description":"DNI: 7–8 digits (dots allowed). Stored normalized.","maxLength":20},"cuil":{"type":"string","nullable":true,"example":"27-30123456-8","description":"Dashes optional. Validated (check digit, person prefix, matches DNI)."},"email":{"type":"string","example":"maria.gonzalez@empresa.com.ar","maxLength":255},"phone":{"type":"string","nullable":true,"example":"+54 11 5555-1234","maxLength":40},"birthDate":{"type":"string","nullable":true,"example":"1990-04-12","description":"YYYY-MM-DD"},"address":{"type":"string","nullable":true,"example":"Av. Corrientes 1234, CABA","maxLength":255},"branchId":{"type":"integer","nullable":true,"example":3,"description":"Active branch of the organization."},"supervisorId":{"type":"integer","nullable":true,"example":7,"description":"Active employee of the organization (not the employee itself)."},"hasFamilyDependants":{"type":"boolean","nullable":true,"example":false,"description":"\"Cargas de familia\" (field `family_dependants`; ignored when the organization hides it)."},"hireDate":{"type":"string","nullable":true,"example":"2024-03-01","description":"YYYY-MM-DD"},"customFields":{"type":"object","additionalProperties":true,"example":{"custom_talle_remera":"M"},"description":"Custom field values keyed by field key. On update, merged into the stored values; a key set to null or \"\" is removed."},"remoteMode":{"type":"string","enum":["none","geofence","free"],"example":"geofence","description":"Remote check-in mode. Changing it also requires the `attendance:manage` permission (403 otherwise; sending the current value needs nothing extra). Remote sites: `/attendance/remote-sites`."}}},"DeactivateEmployeeDto":{"type":"object","properties":{"terminationDate":{"type":"string","example":"2026-09-30","description":"YYYY-MM-DD. Defaults to today (Argentina)."}}},"EmployeeFieldDto":{"type":"object","properties":{"key":{"type":"string","example":"cuil"},"label":{"type":"string","example":"CUIL"},"type":{"type":"string","enum":["text","number","date","select","cuil","email","branch","employee","boolean"],"example":"cuil","description":"`branch` / `employee` are id references (branch picker / employee picker). `boolean` (yes/no) is only the base field `family_dependants`."},"options":{"nullable":true,"example":null,"description":"Allowed values for `select` fields.","type":"array","items":{"type":"string"}},"visibility":{"type":"string","enum":["required","optional","hidden"],"example":"required"},"editableByEmployee":{"type":"boolean","example":false,"description":"Whether the employee may edit it from the employee portal."},"sortOrder":{"type":"number","example":20},"isSystem":{"type":"boolean","example":false,"description":"System fields are always required and cannot be configured."},"isCustom":{"type":"boolean","example":false}},"required":["key","label","type","options","visibility","editableByEmployee","sortOrder","isSystem","isCustom"]},"EmployeeFieldSettingsResponseDto":{"type":"object","properties":{"systemFields":{"description":"Name, document and email — always required, not configurable.","type":"array","items":{"$ref":"#/components/schemas/EmployeeFieldDto"}},"fields":{"description":"Configurable base fields and custom fields, sorted by sortOrder.","type":"array","items":{"$ref":"#/components/schemas/EmployeeFieldDto"}}},"required":["systemFields","fields"]},"EmployeeFieldSettingInputDto":{"type":"object","properties":{"key":{"type":"string","example":"custom_talle_remera","description":"A base field key or `custom_[a-z0-9_]{1,50}`."},"label":{"type":"string","nullable":true,"example":"Talle de remera","description":"Required for custom fields. For base fields, overrides the default label (null = default)."},"type":{"type":"string","enum":["text","number","date","select","cuil"],"description":"Required for custom fields; ignored for base fields (their type is fixed)."},"options":{"nullable":true,"example":["S","M","L"],"description":"Required for `select` custom fields.","type":"array","items":{"type":"string"}},"visibility":{"type":"string","enum":["required","optional","hidden"]},"editableByEmployee":{"type":"boolean","default":false},"sortOrder":{"type":"number","example":20,"description":"Display order. Defaults to the position in the list."}},"required":["key","visibility"]},"UpdateEmployeeFieldSettingsDto":{"type":"object","properties":{"fields":{"description":"The full configurable list. Base fields left out go back to their defaults; custom fields left out are deleted (stored values stay on the employees but are no longer shown or validated).","type":"array","items":{"$ref":"#/components/schemas/EmployeeFieldSettingInputDto"}}},"required":["fields"]},"InviteEmployeeDto":{"type":"object","properties":{"sendEmail":{"type":"boolean","default":true,"description":"Send the invitation email to the employee. `false` only issues the invitation and returns its link (to share it another way)."}}},"EmployeeInvitationCreatedDto":{"type":"object","properties":{"invitationId":{"type":"number","example":31},"expiresAt":{"type":"string","example":"2026-10-03T12:00:00.000Z"},"email":{"type":"string","example":"maria.gonzalez@empresa.com.ar","description":"Address the invitation is for (the employee's email)."},"inviteUrl":{"type":"string","example":"https://peakly.ar/equipo/invitacion/3q2-7wEj…","description":"Acceptance link. Carries the one-time code: share it only with the employee."},"emailSent":{"type":"boolean","description":"Whether the invitation email was sent (false when `sendEmail` was false or delivery failed)."}},"required":["invitationId","expiresAt","email","inviteUrl","emailSent"]},"EmployeeInvitationStatusDto":{"type":"object","properties":{"invitationId":{"type":"number","example":31},"email":{"type":"string","example":"maria.gonzalez@empresa.com.ar"},"status":{"type":"string","enum":["pending","expired","accepted","revoked"],"example":"pending"},"expiresAt":{"type":"string","example":"2026-10-03T12:00:00.000Z"},"createdAt":{"type":"string","example":"2026-09-26T12:00:00.000Z"},"acceptedAt":{"type":"string","nullable":true,"example":null},"revokedAt":{"type":"string","nullable":true,"example":null}},"required":["invitationId","email","status","expiresAt","createdAt","acceptedAt","revokedAt"]},"EmployeeInvitationLatestDto":{"type":"object","properties":{"invitation":{"nullable":true,"description":"The employee's most recent invitation, or null if none was ever sent.","allOf":[{"$ref":"#/components/schemas/EmployeeInvitationStatusDto"}]}},"required":["invitation"]},"EmployeeDeviceResponseDto":{"type":"object","properties":{"id":{"type":"number","example":7},"employeeId":{"type":"number","example":12},"label":{"type":"string","nullable":true,"example":"iPhone de María"},"userAgent":{"type":"string","nullable":true,"description":"Browser user agent at registration."},"status":{"type":"string","enum":["active","pending_approval","revoked"],"example":"active","description":"`active` — the employee clocks in with it (at most one per employee); `pending_approval` — registered while another device was active, waits for an admin; `revoked` — no longer usable."},"transports":{"example":["internal","hybrid"],"description":"Authenticator transports reported at registration.","type":"array","items":{"type":"string"}},"approvedByUserId":{"type":"integer","nullable":true,"example":null},"approvedAt":{"type":"string","nullable":true,"example":null},"revokedAt":{"type":"string","nullable":true,"example":null},"lastUsedAt":{"type":"string","nullable":true,"example":null},"createdAt":{"type":"string","example":"2026-09-26T12:00:00.000Z"}},"required":["id","employeeId","label","userAgent","status","transports","approvedByUserId","approvedAt","revokedAt","lastUsedAt","createdAt"]},"EmployeeDeviceListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EmployeeDeviceResponseDto"}}},"required":["data"]},"SiteKiosksSummaryDto":{"type":"object","properties":{"active":{"type":"number","example":1,"description":"Paired kiosks."},"pending":{"type":"number","example":0,"description":"Kiosks waiting to be paired."},"revoked":{"type":"number","example":0,"description":"Revoked kiosks."},"lastSeenAt":{"type":"string","format":"date-time","nullable":true,"description":"Latest heartbeat among the branch's active kiosks."}},"required":["active","pending","revoked","lastSeenAt"]},"AttendanceSiteResponseDto":{"type":"object","properties":{"branchId":{"type":"number","example":3},"branchName":{"type":"string","example":"Sucursal Centro"},"configured":{"type":"boolean","description":"False while the branch uses the defaults (no settings saved yet)."},"latitude":{"type":"number","nullable":true,"example":-34.603722,"description":"Site latitude; null = no geofence."},"longitude":{"type":"number","nullable":true,"example":-58.381592},"radiusM":{"type":"number","example":150,"description":"Geofence radius in meters (20–5000)."},"allowedIps":{"example":["190.2.3.0/24"],"description":"CIDRs check-ins are expected from; empty = no IP rule.","type":"array","items":{"type":"string"}},"photoMode":{"type":"string","enum":["off","evidence"],"description":"`evidence`: the kiosk photographs every check-in."},"photoRetentionDays":{"type":"number","example":90,"description":"Days photos are kept (1–730)."},"pinFallbackEnabled":{"type":"boolean","example":false,"description":"The branch's kiosks also accept a check with document number + PIN (for employees without a phone). Every PIN check is flagged for review and asks for an evidence photo."},"geoCheckinEnabled":{"type":"boolean","example":false,"description":"Employees may check in from the Peakly app with their phone's location against this site's geofence, without scanning the kiosk QR (passkey still required). Needs latitude and longitude. Every such check carries the `GEO_NO_QR` flag."},"geoPolicy":{"type":"string","enum":["reject","observe"],"example":"reject","description":"An app location check-in out of the radius: `reject` refuses it (nothing is recorded), `observe` records it flagged for review (`OUT_OF_RADIUS`)."},"updatedAt":{"type":"string","format":"date-time","nullable":true},"kiosks":{"$ref":"#/components/schemas/SiteKiosksSummaryDto"}},"required":["branchId","branchName","configured","latitude","longitude","radiusM","allowedIps","photoMode","photoRetentionDays","pinFallbackEnabled","geoCheckinEnabled","geoPolicy","updatedAt","kiosks"]},"AttendanceSiteListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AttendanceSiteResponseDto"}}},"required":["data"]},"UpdateAttendanceSiteDto":{"type":"object","properties":{"latitude":{"type":"number","nullable":true,"example":-34.603722,"description":"-90 to 90. Send with longitude."},"longitude":{"type":"number","nullable":true,"example":-58.381592,"description":"-180 to 180. Send with latitude."},"radiusM":{"type":"number","example":150,"minimum":20,"maximum":5000},"allowedIps":{"example":["190.2.3.0/24","200.1.1.1"],"description":"IPv4/IPv6 addresses or CIDRs (max 50). A bare address means /32 (or /128). Empty array removes the rule.","type":"array","items":{"type":"string"}},"photoMode":{"type":"string","enum":["off","evidence"]},"photoRetentionDays":{"type":"number","example":90,"minimum":1,"maximum":730},"pinFallbackEnabled":{"type":"boolean","example":true,"description":"Accept document number + PIN checks on this branch's kiosks (always flagged for review)."},"geoCheckinEnabled":{"type":"boolean","example":true,"description":"Allow check-ins from the app with the phone's location (no QR). The site must have latitude and longitude."},"geoPolicy":{"type":"string","enum":["reject","observe"],"description":"Out of the radius: `reject` (default) or `observe` (record it flagged)."}}},"KioskResponseDto":{"type":"object","properties":{"id":{"type":"number","example":7},"branchId":{"type":"number","example":3},"branchName":{"type":"string","example":"Sucursal Centro"},"name":{"type":"string","example":"Entrada principal"},"status":{"type":"string","enum":["pending","active","revoked"],"description":"`pending` until paired, `active` while paired, `revoked` for good."},"lastSeenAt":{"type":"string","format":"date-time","nullable":true,"description":"Last heartbeat."},"online":{"type":"boolean","description":"Active and heard from in the last 10 minutes."},"pairingExpiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Expiry of the current (unused) pairing code, if one is outstanding."},"createdAt":{"type":"string","format":"date-time"},"revokedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","branchId","branchName","name","status","lastSeenAt","online","pairingExpiresAt","createdAt","revokedAt"]},"KioskListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KioskResponseDto"}}},"required":["data"]},"CreateKioskDto":{"type":"object","properties":{"branchId":{"type":"number","example":3,"description":"Branch the kiosk stands in."},"name":{"type":"string","example":"Entrada principal","maxLength":80}},"required":["branchId","name"]},"KioskPairingResponseDto":{"type":"object","properties":{"kiosk":{"$ref":"#/components/schemas/KioskResponseDto"},"pairingCode":{"type":"string","example":"K7M2XQ9P","description":"One-time code to type on the tablet at /kiosco. Shown only now; valid 10 minutes."},"pairingExpiresAt":{"type":"string","format":"date-time"}},"required":["kiosk","pairingCode","pairingExpiresAt"]},"AttendanceDayKpisDto":{"type":"object","properties":{"present":{"type":"number","example":18,"description":"Active employees with a worked day on the date (absences excluded)."},"working":{"type":"number","example":11,"description":"Of them, with an open segment right now."},"notCheckedIn":{"type":"number","example":4,"description":"Active employees with no events on the date, no approved leave and a shift that day (or no schedule at all)."},"noShift":{"type":"number","example":6,"description":"Active employees with no events and no shift that day: a day off, a holiday or no slot on that weekday."},"flagged":{"type":"number","example":2,"description":"Work days with an event awaiting review."},"absent":{"type":"number","example":1,"description":"Absences (a past day with a shift and no punch)."},"late":{"type":"number","example":3,"description":"Work days that started late (past the tolerance)."},"onLeave":{"type":"number","example":2,"description":"F2.4: active employees with an approved leave on the date."}},"required":["present","working","notCheckedIn","noShift","flagged","absent","late","onLeave"]},"AttendanceDayEmployeeDto":{"type":"object","properties":{"id":{"type":"number","example":12},"firstName":{"type":"string","example":"María"},"lastName":{"type":"string","example":"González"},"documentNumber":{"type":"string","example":"30123456"},"branchId":{"type":"number","nullable":true}},"required":["id","firstName","lastName","documentNumber","branchId"]},"WorkDaySegmentDto":{"type":"object","properties":{"in":{"type":"string","format":"date-time","nullable":true,"description":"Entry; null = exit without entry."},"out":{"type":"string","format":"date-time","nullable":true,"description":"Exit; null = still open or missing."},"inEventId":{"type":"number","nullable":true},"outEventId":{"type":"number","nullable":true}},"required":["in","out","inEventId","outEventId"]},"DayPlanSlotDto":{"type":"object","properties":{"startTime":{"type":"string","example":"09:00"},"endTime":{"type":"string","example":"18:00","description":"Not after `startTime` = crosses midnight."},"breakMinutes":{"type":"number","example":60,"description":"Unpaid break planned inside the slot (C1). Present only when above 0."}},"required":["startTime","endTime"]},"DayPlanDto":{"type":"object","properties":{"source":{"type":"string","enum":["schedule","override","day_off","leave","holiday","none"],"description":"`schedule` (the assigned schedule's slots), `override` (a one-off shift), `day_off`, `leave` (an approved leave, F2.4), `holiday`, `none` (no plan)."},"scheduleId":{"type":"number","nullable":true},"scheduleName":{"type":"string","nullable":true,"example":"Lunes a viernes 9 a 18"},"toleranceMinutes":{"type":"number","example":15},"slots":{"type":"array","items":{"$ref":"#/components/schemas/DayPlanSlotDto"}},"holiday":{"type":"string","nullable":true,"description":"Holiday name, when the day is one."},"overrideId":{"type":"number","nullable":true},"leaveId":{"type":"number","nullable":true,"description":"F2.4: the approved leave, only when `source = 'leave'`."},"leave":{"type":"string","nullable":true,"example":"Vacaciones","description":"F2.4: its type's name, only when `source = 'leave'`."}},"required":["source","scheduleId","scheduleName","toleranceMinutes","slots","holiday","overrideId"]},"WorkDayResponseDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-09-26","description":"Buenos Aires date of the first entry."},"firstIn":{"type":"string","format":"date-time","nullable":true},"lastOut":{"type":"string","format":"date-time","nullable":true},"workedMinutes":{"type":"number","example":480,"description":"Minutes of closed segments, minus `unpaidBreakMinutes` (organizations with `unpaidBreakMode: scheduled`)."},"unpaidBreakMinutes":{"type":"number","example":0,"description":"Minutes deducted for a planned unpaid break that was not punched (C1); always 0 with `unpaidBreakMode: none`."},"segments":{"type":"array","items":{"$ref":"#/components/schemas/WorkDaySegmentDto"}},"status":{"type":"string","enum":["ok","open","incomplete","flagged","absent"],"description":"`incomplete` (missing entry/exit, or open > 16 h) › `flagged` (an event awaits review) › `open` (working now) › `ok`; `absent` = a past day with a shift and no punch (a row without events, F2.1)."},"expectedMinutes":{"type":"number","example":540,"description":"Minutes the day's plan expected (0 without a plan, or for days computed before F2.1)."},"lateMinutes":{"type":"number","example":0,"description":"Minutes late past the tolerance (summed over the day's slots)."},"earlyLeaveMinutes":{"type":"number","example":0,"description":"Minutes left early past the tolerance (summed over the day's slots)."},"absence":{"type":"boolean","example":false,"description":"True for an absence row (`status = 'absent'`)."},"plan":{"nullable":true,"description":"The plan that ruled the day; null for days computed before F2.1.","allOf":[{"$ref":"#/components/schemas/DayPlanDto"}]},"overtime50Minutes":{"type":"number","example":60,"description":"Overtime at 50 % that counts (F2.3; with required approval, only once approved). 0 for days computed before F2.3."},"overtime100Minutes":{"type":"number","example":0,"description":"Overtime at 100 % that counts (Saturday after the cutoff, Sunday, holiday)."},"nightMinutes":{"type":"number","example":0,"description":"Minutes worked between 21:00 and 06:00 (LCT art. 200)."},"riskMax":{"type":"number","example":0,"description":"Highest risk score among the day's events."},"runningSince":{"type":"string","format":"date-time","nullable":true,"description":"Entry of the segment still open (< 16 h), for a running clock."}},"required":["date","firstIn","lastOut","workedMinutes","unpaidBreakMinutes","segments","status","expectedMinutes","lateMinutes","earlyLeaveMinutes","absence","plan","overtime50Minutes","overtime100Minutes","nightMinutes","riskMax","runningSince"]},"AttendanceDayLastEventDto":{"type":"object","properties":{"id":{"type":"number","example":1042},"kind":{"type":"string","enum":["in","out"]},"occurredAt":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["qr","pin","correction","app_geo","remote"],"description":"How the employee checked: kiosk QR, kiosk DNI + PIN, an approved correction, the app with location (`app_geo`), or remotely (`remote`, always observed)."},"flagged":{"type":"boolean"},"riskFlags":{"type":"array","items":{"type":"string"}}},"required":["id","kind","occurredAt","source","flagged","riskFlags"]},"LeaveSummaryDto":{"type":"object","properties":{"id":{"type":"number","example":17},"leaveTypeId":{"type":"number","example":3},"systemKey":{"type":"string","enum":["vacaciones","enfermedad","nacimiento","matrimonio","fallecimiento","examen","sin_goce","otra"],"nullable":true},"name":{"type":"string","example":"Vacaciones"},"fromDate":{"type":"string","example":"2026-12-07"},"toDate":{"type":"string","example":"2026-12-20"},"status":{"type":"string","enum":["pending","approved","rejected","cancelled"]}},"required":["id","leaveTypeId","systemKey","name","fromDate","toDate","status"]},"AttendanceDayRowDto":{"type":"object","properties":{"employee":{"$ref":"#/components/schemas/AttendanceDayEmployeeDto"},"workDay":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/WorkDayResponseDto"}]},"plan":{"nullable":true,"description":"The employee's plan for the date: the work day's stored plan when there is one, otherwise resolved from the schedule, overrides, holidays and leaves (so a row nobody checked in on still shows its shift or day off).","allOf":[{"$ref":"#/components/schemas/DayPlanDto"}]},"lastEvent":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/AttendanceDayLastEventDto"}]},"leave":{"nullable":true,"description":"F2.4: the approved leave covering the date or, without one, a pending request covering it (`status` tells them apart).","allOf":[{"$ref":"#/components/schemas/LeaveSummaryDto"}]}},"required":["employee","workDay","plan","lastEvent","leave"]},"AttendanceDaysResponseDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-09-26"},"kpis":{"description":"Over every active employee (after branch filter, before status filter).","allOf":[{"$ref":"#/components/schemas/AttendanceDayKpisDto"}]},"rows":{"type":"array","items":{"$ref":"#/components/schemas/AttendanceDayRowDto"}}},"required":["date","kpis","rows"]},"AttendanceEventReviewDto":{"type":"object","properties":{"id":{"type":"number","example":4},"decision":{"type":"string","enum":["ok","invalid"]},"note":{"type":"string","nullable":true},"reviewedByUserId":{"type":"number","nullable":true},"reviewedAt":{"type":"string","format":"date-time"}},"required":["id","decision","note","reviewedByUserId","reviewedAt"]},"AttendanceEventResponseDto":{"type":"object","properties":{"id":{"type":"number","example":1042},"employeeId":{"type":"number","example":12},"kind":{"type":"string","enum":["in","out"]},"occurredAt":{"type":"string","format":"date-time","description":"Server time of the check."},"source":{"type":"string","enum":["qr","pin","correction","app_geo","remote"],"description":"How the employee checked: kiosk QR, kiosk DNI + PIN, an approved correction, the app with location (`app_geo`), or remotely (`remote`, always observed)."},"kioskId":{"type":"number","nullable":true},"branchId":{"type":"number","nullable":true},"deviceId":{"type":"number","nullable":true,"description":"Passkey device used."},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"accuracyM":{"type":"number","nullable":true,"description":"Reported GPS accuracy in meters."},"distanceM":{"type":"number","nullable":true,"description":"Meters from the site (for a remote check in geofence mode, from `remoteSiteId`), when both positions are known."},"remoteSiteId":{"type":"number","nullable":true,"description":"Remote check in geofence mode: the remote place measured (`/attendance/remote-sites`)."},"ip":{"type":"string","nullable":true,"example":"190.2.3.4"},"riskScore":{"type":"number","example":30},"riskFlags":{"example":["NO_GEO"],"description":"OUT_OF_RADIUS, LOW_ACCURACY, NO_GEO, NO_SITE_LOCATION, IP_NOT_ALLOWED, BURST_SAME_KIOSK, NEW_DEVICE_TODAY, SHORT_SEGMENT, ODD_HOURS, PIN_FALLBACK, SAME_DEVICE_FINGERPRINT, GEO_NO_QR (app location check-in without the kiosk QR; informative), MOCK_LOCATION (the phone reported a simulated location), REMOTE (remote check-in; always observed), OUTSIDE_REMOTE_SITE (remote check-in in geofence mode outside every remote place; informative).","type":"array","items":{"type":"string"}},"flagged":{"type":"boolean","description":"Risk score reached the review threshold (50)."},"review":{"nullable":true,"description":"Latest review, if any.","allOf":[{"$ref":"#/components/schemas/AttendanceEventReviewDto"}]},"hasPhoto":{"type":"boolean","description":"An evidence photo was stored (it may have been purged since)."}},"required":["id","employeeId","kind","occurredAt","source","kioskId","branchId","deviceId","latitude","longitude","accuracyM","distanceM","remoteSiteId","ip","riskScore","riskFlags","flagged","review","hasPhoto"]},"AttendanceTimelineResponseDto":{"type":"object","properties":{"employee":{"$ref":"#/components/schemas/AttendanceDayEmployeeDto"},"from":{"type":"string","example":"2026-09-01"},"to":{"type":"string","example":"2026-09-30"},"workDays":{"type":"array","items":{"$ref":"#/components/schemas/WorkDayResponseDto"}},"events":{"description":"Events of the range, oldest first.","type":"array","items":{"$ref":"#/components/schemas/AttendanceEventResponseDto"}},"leaves":{"description":"F2.4: pending and approved leaves overlapping the range, by start date.","type":"array","items":{"$ref":"#/components/schemas/LeaveSummaryDto"}}},"required":["employee","from","to","workDays","events","leaves"]},"AttendanceEventDetailResponseDto":{"type":"object","properties":{"event":{"$ref":"#/components/schemas/AttendanceEventResponseDto"},"employee":{"$ref":"#/components/schemas/AttendanceDayEmployeeDto"},"kioskName":{"type":"string","nullable":true,"description":"Name of the kiosk the QR came from."},"photoUrl":{"type":"string","nullable":true,"description":"Signed URL of the evidence photo, valid 5 minutes. Null when there is none, it was purged, or storage is unavailable."},"photoPurged":{"type":"boolean","description":"The photo existed but was deleted by the retention policy."},"reviews":{"description":"Every review, newest first.","type":"array","items":{"$ref":"#/components/schemas/AttendanceEventReviewDto"}}},"required":["event","employee","kioskName","photoUrl","photoPurged","reviews"]},"ReviewAttendanceEventDto":{"type":"object","properties":{"decision":{"type":"string","enum":["ok","invalid"],"description":"`ok` accepts the event (clears its flag); `invalid` removes it from the worked hours."},"note":{"type":"string","example":"Llegó con el celular sin GPS; lo vi en la sucursal.","maxLength":500}},"required":["decision"]},"ReviewAttendanceEventResponseDto":{"type":"object","properties":{"review":{"$ref":"#/components/schemas/AttendanceEventReviewDto"},"workDay":{"nullable":true,"description":"The recomputed work day of the event (null if it has none left).","allOf":[{"$ref":"#/components/schemas/WorkDayResponseDto"}]}},"required":["review","workDay"]},"CorrectionEmployeeDto":{"type":"object","properties":{"id":{"type":"number","example":12},"firstName":{"type":"string","example":"Ana"},"lastName":{"type":"string","example":"Gómez"}},"required":["id","firstName","lastName"]},"CorrectionResponseDto":{"type":"object","properties":{"id":{"type":"number","example":31},"employeeId":{"type":"number","example":12},"employee":{"$ref":"#/components/schemas/CorrectionEmployeeDto"},"date":{"type":"string","example":"2026-09-25","description":"Buenos Aires work date."},"kind":{"type":"string","enum":["in","out"]},"at":{"type":"string","format":"date-time","description":"Proposed time of the punch."},"reason":{"type":"string","example":"Me olvidé de fichar la salida."},"status":{"type":"string","enum":["pending","approved","rejected","cancelled"]},"requestedBy":{"type":"string","enum":["employee","admin"],"description":"`admin` = loaded directly from the backoffice."},"requestedByUserId":{"type":"number","nullable":true,"description":"User who loaded an admin correction."},"reviewedByUserId":{"type":"number","nullable":true,"description":"Backoffice user who approved/rejected it."},"reviewedByEmployeeId":{"type":"number","nullable":true,"description":"Supervisor (employee) who approved/rejected it."},"reviewerName":{"type":"string","nullable":true,"example":"María López","description":"Name of whoever reviewed it."},"reviewedAt":{"type":"string","format":"date-time","nullable":true},"reviewNote":{"type":"string","nullable":true},"resultingEventId":{"type":"number","nullable":true,"description":"Event created when it was approved."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","employee","date","kind","at","reason","status","requestedBy","requestedByUserId","reviewedByUserId","reviewedByEmployeeId","reviewerName","reviewedAt","reviewNote","resultingEventId","createdAt"]},"CorrectionPageResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CorrectionResponseDto"}},"nextCursor":{"type":"string","nullable":true,"example":"118"},"hasMore":{"type":"boolean","example":false}},"required":["data","nextCursor","hasMore"]},"CreateAdminCorrectionDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-09-25","description":"Buenos Aires work date the missing punch belongs to (YYYY-MM-DD)."},"kind":{"type":"string","enum":["in","out"],"description":"`in` = missing entry, `out` = missing exit."},"at":{"type":"string","example":"2026-09-25T18:05:00-03:00","description":"When it happened (ISO 8601 with offset). Must be in the past, at most 31 days old, and fall on `date` or — for a night-shift exit — the next day (Buenos Aires)."},"reason":{"type":"string","example":"Me olvidé de fichar la salida.","maxLength":500},"employeeId":{"type":"number","example":12,"description":"Employee the punch is loaded for."}},"required":["date","kind","at","reason","employeeId"]},"CorrectionDecisionResponseDto":{"type":"object","properties":{"correction":{"$ref":"#/components/schemas/CorrectionResponseDto"},"workDay":{"nullable":true,"description":"The recomputed work day that now holds the new event (null when rejected).","allOf":[{"$ref":"#/components/schemas/WorkDayResponseDto"}]}},"required":["correction","workDay"]},"ReviewCorrectionDto":{"type":"object","properties":{"note":{"type":"string","example":"Confirmado con el encargado del turno.","maxLength":500}}},"AttendanceSettingsResponseDto":{"type":"object","properties":{"missedCheckoutReminderEnabled":{"type":"boolean","example":true,"description":"Email employees who checked in today and have no check-out yet."},"missedCheckoutReminderHour":{"type":"integer","example":22,"minimum":17,"maximum":23,"description":"Hour of the day (Buenos Aires, 17–23) at which that reminder goes out."},"observeNonWorkingDays":{"type":"boolean","example":false,"description":"Count the national días no laborables (and the ones con fines turísticos) as holidays: no-show alerts skip them and `holidayOnly` pay bands apply. Optional for private employers; default false."},"unpaidBreakMode":{"type":"string","enum":["none","scheduled"],"example":"none","description":"`none` (default): worked minutes are the punched segments. `scheduled`: a day whose slots plan an unpaid break loses max(0, planned break − break punched between segments); expected minutes exclude the planned break."},"pendingReminderHours":{"type":"integer","nullable":true,"example":null,"minimum":1,"maximum":336,"description":"A3: approvers (the supervisor, or else the admins) get one email a day (09:00) listing the leaves, corrections and overtime pending for more than this many hours. null (default) = off; 48 is a good start."}},"required":["missedCheckoutReminderEnabled","missedCheckoutReminderHour","observeNonWorkingDays","unpaidBreakMode","pendingReminderHours"]},"UpdateAttendanceSettingsDto":{"type":"object","properties":{"missedCheckoutReminderEnabled":{"type":"boolean","example":true},"missedCheckoutReminderHour":{"type":"integer","example":21,"minimum":17,"maximum":23},"observeNonWorkingDays":{"type":"boolean","example":true},"unpaidBreakMode":{"type":"string","enum":["none","scheduled"],"example":"scheduled"},"pendingReminderHours":{"type":"integer","nullable":true,"minimum":1,"maximum":336,"example":48,"description":"null turns the reminder off."}}},"ScheduleSlotDto":{"type":"object","properties":{"weekday":{"type":"number","example":1,"minimum":1,"maximum":7,"description":"ISO weekday: 1 = Monday … 7 = Sunday. The day the slot starts on."},"startTime":{"type":"string","example":"09:00","description":"Start, HH:MM Buenos Aires (00:00–23:59)."},"endTime":{"type":"string","example":"18:00","description":"End, HH:MM (00:00–24:00). Not after `startTime` = crosses midnight (22:00–06:00); equal = 24 h."},"breakMinutes":{"type":"integer","example":60,"minimum":0,"maximum":240,"default":0,"description":"Unpaid break planned inside the slot, in minutes (0–240, shorter than the slot). Deducted from the day only when the organization's `unpaidBreakMode` is `scheduled`."}},"required":["weekday","startTime","endTime"]},"WorkScheduleResponseDto":{"type":"object","properties":{"id":{"type":"number","example":4},"name":{"type":"string","example":"Lunes a viernes 9 a 18"},"toleranceMinutes":{"type":"number","example":15},"slots":{"description":"Slots by weekday and start.","type":"array","items":{"$ref":"#/components/schemas/ScheduleSlotDto"}},"assignedEmployees":{"type":"number","example":12,"description":"Employees following it today or from a later date."},"archivedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","toleranceMinutes","slots","assignedEmployees","archivedAt","createdAt","updatedAt"]},"WorkScheduleListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}}},"required":["data"]},"CreateWorkScheduleDto":{"type":"object","properties":{"name":{"type":"string","example":"Lunes a viernes 9 a 18","maxLength":80},"toleranceMinutes":{"type":"number","example":15,"minimum":0,"maximum":240,"description":"Minutes after a slot's start before a missing entry raises a no-show alert. Default 15."},"slots":{"description":"Weekly slots (max 28); several per day allowed, none may overlap.","type":"array","items":{"$ref":"#/components/schemas/ScheduleSlotDto"}}},"required":["name","slots"]},"UpdateWorkScheduleDto":{"type":"object","properties":{"name":{"type":"string","example":"Turno mañana","maxLength":80},"toleranceMinutes":{"type":"number","example":10,"minimum":0,"maximum":240},"slots":{"description":"Replaces every slot of the schedule.","type":"array","items":{"$ref":"#/components/schemas/ScheduleSlotDto"}}}},"CurrentEmployeeScheduleDto":{"type":"object","properties":{"id":{"type":"number","example":31},"scheduleId":{"type":"number","example":4},"scheduleName":{"type":"string","example":"Lunes a viernes 9 a 18"},"validFrom":{"type":"string","example":"2026-10-05"},"validTo":{"type":"string","nullable":true,"example":null,"description":"Last day, inclusive; null = open-ended."},"createdAt":{"type":"string","format":"date-time"},"schedule":{"$ref":"#/components/schemas/WorkScheduleResponseDto"}},"required":["id","scheduleId","scheduleName","validFrom","validTo","createdAt","schedule"]},"EmployeeScheduleAssignmentDto":{"type":"object","properties":{"id":{"type":"number","example":31},"scheduleId":{"type":"number","example":4},"scheduleName":{"type":"string","example":"Lunes a viernes 9 a 18"},"validFrom":{"type":"string","example":"2026-10-05"},"validTo":{"type":"string","nullable":true,"example":null,"description":"Last day, inclusive; null = open-ended."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","scheduleId","scheduleName","validFrom","validTo","createdAt"]},"EmployeeScheduleResponseDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"current":{"nullable":true,"description":"Assignment in force today (Buenos Aires), with its schedule.","allOf":[{"$ref":"#/components/schemas/CurrentEmployeeScheduleDto"}]},"history":{"description":"Every assignment, newest first (including future ones).","type":"array","items":{"$ref":"#/components/schemas/EmployeeScheduleAssignmentDto"}}},"required":["employeeId","current","history"]},"AssignEmployeeScheduleDto":{"type":"object","properties":{"scheduleId":{"type":"number","nullable":true,"example":4,"description":"Schedule to follow from `validFrom`; null ends the current assignment the day before `validFrom`."},"validFrom":{"type":"string","example":"2026-10-05","description":"First day (YYYY-MM-DD, Buenos Aires). Must be after the start of the latest assignment; the previous one closes the day before."}},"required":["scheduleId","validFrom"]},"AttendanceAlertResponseDto":{"type":"object","properties":{"id":{"type":"number","example":120},"kind":{"type":"string","enum":["no_show"],"example":"no_show","description":"`no_show`: a slot's tolerance passed without an entry."},"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"documentNumber":{"type":"string","example":"30111222"},"branchId":{"type":"number","nullable":true,"example":3,"description":"The employee's branch."},"date":{"type":"string","example":"2026-10-01","description":"Buenos Aires date the slot starts on."},"expectedStart":{"type":"string","format":"date-time","description":"When the slot started (the employee was expected from then)."},"notifiedAt":{"type":"string","format":"date-time","nullable":true,"description":"When the email went out; null if it is still pending or failed."},"resolvedAt":{"type":"string","format":"date-time","nullable":true,"description":"Time of the entry that came after the alert; null while open."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","kind","employeeId","employeeName","documentNumber","branchId","date","expectedStart","notifiedAt","resolvedAt","createdAt"]},"AttendanceAlertListResponseDto":{"type":"object","properties":{"from":{"type":"string","example":"2026-10-01"},"to":{"type":"string","example":"2026-10-01"},"data":{"description":"Alerts by expected start, newest first (at most 500).","type":"array","items":{"$ref":"#/components/schemas/AttendanceAlertResponseDto"}}},"required":["from","to","data"]},"PayBandSiteRateResponseDto":{"type":"object","properties":{"siteId":{"type":"number","example":3,"description":"The site (branch)."},"payBandId":{"type":"number","example":7},"hourlyRate":{"type":"number","example":6000},"updatedAt":{"type":"string","format":"date-time"}},"required":["siteId","payBandId","hourlyRate","updatedAt"]},"PayBandSiteRateListResponseDto":{"type":"object","properties":{"data":{"description":"Rates of live bands, by site and band priority.","type":"array","items":{"$ref":"#/components/schemas/PayBandSiteRateResponseDto"}}},"required":["data"]},"SavePayBandSiteRateDto":{"type":"object","properties":{"hourlyRate":{"type":"number","example":6000,"minimum":0,"description":"The site's own value of one hour of the band (2 decimals)."}},"required":["hourlyRate"]},"PayBandResponseDto":{"type":"object","properties":{"id":{"type":"number","example":7},"name":{"type":"string","example":"Nocturna"},"weekdays":{"example":[1,2,3,4,5],"type":"array","items":{"type":"number"}},"startTime":{"type":"string","example":"20:00"},"endTime":{"type":"string","example":"08:00"},"hourlyRate":{"type":"number","example":2500.5},"currencyId":{"type":"number","nullable":true,"example":1},"priority":{"type":"number","example":20},"holidayOnly":{"type":"boolean","example":false,"description":"The band applies only on holidays of the employee."},"archivedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","weekdays","startTime","endTime","hourlyRate","currencyId","priority","holidayOnly","archivedAt","createdAt","updatedAt"]},"PayBandListResponseDto":{"type":"object","properties":{"data":{"description":"Bands by priority (highest first).","type":"array","items":{"$ref":"#/components/schemas/PayBandResponseDto"}}},"required":["data"]},"CreatePayBandDto":{"type":"object","properties":{"name":{"type":"string","example":"Nocturna","maxLength":60},"weekdays":{"example":[1,2,3,4,5],"description":"ISO weekdays the band applies to: 1 = Monday … 7 = Sunday.","type":"array","items":{"type":"number"}},"startTime":{"type":"string","example":"20:00","description":"Start of the window, HH:MM Buenos Aires (00:00–23:59)."},"endTime":{"type":"string","example":"08:00","description":"End, HH:MM (00:00–24:00). Not after `startTime` = the window wraps midnight on the same weekdays; equal = the whole day."},"hourlyRate":{"type":"number","example":2500.5,"minimum":0,"description":"Reference value of one hour (2 decimals). Default 0."},"priority":{"type":"number","example":20,"minimum":0,"maximum":1000,"description":"When bands overlap, a minute goes to the one with the highest priority (ties: the oldest). Default 0."},"currencyId":{"type":"number","example":1,"description":"Currency of the rate. Default: the currency of the organization's other bands, else its default currency. Every live band shares one currency."},"holidayOnly":{"type":"boolean","example":false,"description":"Only on holidays: the band covers a minute only when its Buenos Aires date is a holiday of the employee (national, provincial for their site, or the organization's own). Give it the highest priority to win over the regular bands. Default false."}},"required":["name","weekdays","startTime","endTime"]},"UpdatePayBandDto":{"type":"object","properties":{"name":{"type":"string","example":"Nocturna","maxLength":60},"weekdays":{"example":[1,2,3,4,5],"type":"array","items":{"type":"number"}},"startTime":{"type":"string","example":"20:00"},"endTime":{"type":"string","example":"08:00"},"hourlyRate":{"type":"number","example":2500.5,"minimum":0},"priority":{"type":"number","example":20,"minimum":0,"maximum":1000},"currencyId":{"type":"number","example":1},"holidayOnly":{"type":"boolean","example":true}}},"BandHoursBandDto":{"type":"object","properties":{"id":{"type":"number","example":7},"name":{"type":"string","example":"Nocturna"},"hourlyRate":{"type":"number","example":2500.5},"holidayOnly":{"type":"boolean","example":false,"description":"The band applies only on holidays of the employee."}},"required":["id","name","hourlyRate","holidayOnly"]},"BandHoursCellDto":{"type":"object","properties":{"minutes":{"type":"number","example":615},"amount":{"type":"number","example":25630.13,"description":"minutes / 60 × hourly rate, rounded to cents (0 for `none`). The rate is the site's own rate for the band when the minutes were worked at a site that has one, else the band's base rate."},"siteRate":{"type":"boolean","example":false,"description":"Some of these minutes were valued at a site's own rate instead of the band's base rate."}},"required":["minutes","amount","siteRate"]},"BandHoursRowDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"name":{"type":"string","example":"Pérez, Ana"},"documentNumber":{"type":"string","example":"30111222"},"bands":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/BandHoursCellDto"},"description":"Keyed by band id (as a string) plus `\"none\"` (minutes in no band). Every band of `bands` is present, zeros included.","example":{"7":{"minutes":615,"amount":25630.13,"siteRate":false},"none":{"minutes":30,"amount":0,"siteRate":false}}},"totalMinutes":{"type":"number","example":645},"totalAmount":{"type":"number","example":25630.13},"overtime50Minutes":{"type":"number","example":60,"description":"Overtime at 50 % that counts in the month (F2.3)."},"overtime100Minutes":{"type":"number","example":0,"description":"Overtime at 100 % that counts in the month (F2.3)."},"nightMinutes":{"type":"number","example":120,"description":"Minutes worked between 21:00 and 06:00 (F2.3)."},"overtimeBankMinutes":{"type":"number","example":0,"description":"Counted overtime sent to the hour bank (C5); to pay = 50 % + 100 % − this."}},"required":["employeeId","name","documentNumber","bands","totalMinutes","totalAmount","overtime50Minutes","overtime100Minutes","nightMinutes","overtimeBankMinutes"]},"BandHoursTotalsDto":{"type":"object","properties":{"bands":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/BandHoursCellDto"},"description":"Keyed by band id (as a string) plus `\"none\"` (minutes in no band). Every band of `bands` is present, zeros included.","example":{"7":{"minutes":615,"amount":25630.13,"siteRate":false},"none":{"minutes":30,"amount":0,"siteRate":false}}},"totalMinutes":{"type":"number","example":645},"totalAmount":{"type":"number","example":25630.13},"overtime50Minutes":{"type":"number","example":60,"description":"Overtime at 50 % that counts in the month (F2.3)."},"overtime100Minutes":{"type":"number","example":0,"description":"Overtime at 100 % that counts in the month (F2.3)."},"nightMinutes":{"type":"number","example":120,"description":"Minutes worked between 21:00 and 06:00 (F2.3)."},"overtimeBankMinutes":{"type":"number","example":0,"description":"Counted overtime sent to the hour bank (C5); to pay = 50 % + 100 % − this."}},"required":["bands","totalMinutes","totalAmount","overtime50Minutes","overtime100Minutes","nightMinutes","overtimeBankMinutes"]},"BandHoursResponseDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-10"},"currency":{"type":"string","nullable":true,"example":"ARS","description":"Currency code of the hourly rates (null when none is configured)."},"bands":{"description":"Live bands, highest priority first.","type":"array","items":{"$ref":"#/components/schemas/BandHoursBandDto"}},"rows":{"description":"One row per employee (active ones, plus anyone with hours in the month), by last name.","type":"array","items":{"$ref":"#/components/schemas/BandHoursRowDto"}},"totals":{"$ref":"#/components/schemas/BandHoursTotalsDto"}},"required":["month","currency","bands","rows","totals"]},"HolidayResponseDto":{"type":"object","properties":{"id":{"type":"number","nullable":true,"example":12,"description":"Organization holiday id (use it to delete); null for national and provincial holidays."},"date":{"type":"string","example":"2026-11-10"},"name":{"type":"string","example":"Visita de Su Santidad el Papa León XIV"},"source":{"type":"string","enum":["national","organization"],"description":"Official calendar or the organization's own day."},"kind":{"type":"string","enum":["inamovible","trasladable","puente","no_laborable"],"nullable":true,"description":"Official kind (null for organization holidays). `no_laborable` and `puente` (días no laborables con fines turísticos) count only when `observeNonWorkingDays` is on."},"scope":{"type":"string","enum":["national","province"],"nullable":true,"description":"national | province (null for organization holidays)."},"provinceCode":{"type":"number","nullable":true,"example":0,"description":"AFIP jurisdiction code of a provincial holiday (0 = CABA, 1 = Buenos Aires, 3 = Córdoba…)."},"provinceName":{"type":"string","nullable":true,"example":"Ciudad Autónoma de Buenos Aires"},"appliesToBranchIds":{"nullable":true,"example":[3],"description":"Sites it applies to: null = every site; for a provincial holiday, the organization's sites in that province (may be empty); for an organization holiday, the sites it was restricted to.","type":"array","items":{"type":"number"}},"observed":{"type":"boolean","description":"Whether it is a day off for the organization: false for a `no_laborable`/`puente` day while the toggle is off, or a provincial holiday with no site in that province."}},"required":["id","date","name","source","kind","scope","provinceCode","provinceName","appliesToBranchIds","observed"]},"HolidayListResponseDto":{"type":"object","properties":{"year":{"type":"number","example":2026},"observeNonWorkingDays":{"type":"boolean","description":"The organization counts `no_laborable` and `puente` days as holidays (attendance settings)."},"data":{"description":"By date; national before organization on the same date.","type":"array","items":{"$ref":"#/components/schemas/HolidayResponseDto"}}},"required":["year","observeNonWorkingDays","data"]},"CreateOrganizationHolidayDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-09-26","description":"Date, YYYY-MM-DD."},"name":{"type":"string","example":"Día del Empleado de Comercio","maxLength":120},"appliesToBranchIds":{"nullable":true,"example":[3],"description":"Sites (branch ids) it applies to. Omitted or null = every site of the organization.","type":"array","items":{"type":"number"}}},"required":["date","name"]},"ScheduleOverrideResponseDto":{"type":"object","properties":{"id":{"type":"number","example":41},"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"date":{"type":"string","example":"2026-10-09"},"kind":{"type":"string","enum":["shift","day_off"]},"startTime":{"type":"string","nullable":true,"example":"14:00"},"endTime":{"type":"string","nullable":true,"example":"22:00"},"reason":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","employeeName","date","kind","startTime","endTime","reason","createdAt"]},"ScheduleOverrideListResponseDto":{"type":"object","properties":{"from":{"type":"string","example":"2026-10-01"},"to":{"type":"string","example":"2026-10-31"},"data":{"description":"By date, then employee.","type":"array","items":{"$ref":"#/components/schemas/ScheduleOverrideResponseDto"}}},"required":["from","to","data"]},"CreateScheduleOverrideDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"date":{"type":"string","example":"2026-10-09","description":"The date (YYYY-MM-DD, Buenos Aires) the change applies to."},"kind":{"type":"string","enum":["shift","day_off"],"description":"`day_off`: no shift that day. `shift`: one shift from `startTime` to `endTime` instead of the schedule's slots."},"startTime":{"type":"string","example":"14:00","description":"Only for `shift`: HH:MM (00:00–23:59)."},"endTime":{"type":"string","example":"22:00","description":"Only for `shift`: HH:MM (00:00–24:00); not after `startTime` = crosses midnight."},"reason":{"type":"string","example":"Cambio de turno con Pérez","maxLength":200}},"required":["employeeId","date","kind"]},"AudienceDto":{"type":"object","properties":{"all":{"type":"boolean","example":false,"description":"true = every active employee of the organization."},"branchIds":{"example":[3,7],"description":"Sites (branch ids, the employee's `branchId`) when `all` is false; 1–200. Ignored (returned empty) when `all` is true. An employee without a site only sees items for everyone.","type":"array","items":{"type":"number"}}},"required":["all","branchIds"]},"IntranetStatsSummaryDto":{"type":"object","properties":{"audienceCount":{"type":"number","example":42,"description":"Active employees in the audience right now."},"readCount":{"type":"number","example":30,"description":"Of them, how many opened it (announcements) — for documents, same as `ackedCount`."},"ackedCount":{"type":"number","example":25,"description":"Of them, how many confirmed it (the current version, for documents). 0 when no confirmation is asked."}},"required":["audienceCount","readCount","ackedCount"]},"AnnouncementResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"title":{"type":"string","example":"Cambio de horario en feriados"},"bodyMd":{"type":"string","example":"El **lunes 12** abrimos de 10 a 18."},"audience":{"$ref":"#/components/schemas/AudienceDto"},"requiresAck":{"type":"boolean","example":true},"notifyByEmail":{"type":"boolean","example":true},"status":{"type":"string","enum":["draft","published","archived"],"example":"published","description":"draft (not visible to employees) → published → archived (hidden again)."},"publishedAt":{"type":"string","nullable":true,"example":"2026-10-02T12:00:00.000Z"},"archivedAt":{"type":"string","nullable":true,"example":null},"emailStatus":{"type":"string","enum":["none","pending","sent"],"example":"sent","description":"none = no email asked (or still a draft); pending = the email task is mailing the audience; sent = done."},"createdAt":{"type":"string","example":"2026-10-02T11:40:00.000Z"},"updatedAt":{"type":"string","example":"2026-10-02T11:55:00.000Z"},"stats":{"nullable":true,"description":"Read receipts; null for drafts.","allOf":[{"$ref":"#/components/schemas/IntranetStatsSummaryDto"}]}},"required":["id","title","bodyMd","audience","requiresAck","notifyByEmail","status","publishedAt","archivedAt","emailStatus","createdAt","updatedAt","stats"]},"AnnouncementListResponseDto":{"type":"object","properties":{"data":{"description":"Newest first (drafts by creation, the rest by publication), at most 200.","type":"array","items":{"$ref":"#/components/schemas/AnnouncementResponseDto"}}},"required":["data"]},"CreateAnnouncementDto":{"type":"object","properties":{"title":{"type":"string","example":"Cambio de horario en feriados","maxLength":200},"bodyMd":{"type":"string","example":"El **lunes 12** abrimos de 10 a 18.\n\n- Turno mañana: 10–14\n- Turno tarde: 14–18","maxLength":20000,"description":"Markdown. Rendered sanitized by the clients (no raw HTML)."},"audience":{"description":"Default: everyone.","allOf":[{"$ref":"#/components/schemas/AudienceDto"}]},"requiresAck":{"type":"boolean","example":true,"description":"Employees must confirm they read it. Default false."},"notifyByEmail":{"type":"boolean","example":true,"description":"Email the audience when it is published (batched, within minutes). Default false."}},"required":["title","bodyMd"]},"UpdateAnnouncementDto":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"bodyMd":{"type":"string","maxLength":20000,"description":"Markdown."},"audience":{"$ref":"#/components/schemas/AudienceDto"},"requiresAck":{"type":"boolean"},"notifyByEmail":{"type":"boolean"}}},"IntranetPendingEmployeeDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"firstName":{"type":"string","example":"Ana"},"lastName":{"type":"string","example":"García"},"branchId":{"type":"number","nullable":true,"example":3},"readAt":{"type":"string","nullable":true,"example":"2026-10-02T13:05:00.000Z","description":"When they opened it (announcements); null = never."},"ackedVersion":{"type":"number","nullable":true,"example":1,"description":"Documents: the last version they confirmed (null = none). Always null for announcements."}},"required":["employeeId","firstName","lastName","branchId","readAt","ackedVersion"]},"IntranetStatsResponseDto":{"type":"object","properties":{"requiresAck":{"type":"boolean","example":true},"version":{"type":"number","nullable":true,"example":2,"description":"Documents: the current version the confirmations count for. Null for announcements."},"audienceCount":{"type":"number","example":42},"readCount":{"type":"number","example":30},"ackedCount":{"type":"number","example":25},"pendingCount":{"type":"number","example":17,"description":"Employees still missing: not confirmed when a confirmation is asked, else not opened."},"pending":{"description":"The pending employees by last name (at most 500).","type":"array","items":{"$ref":"#/components/schemas/IntranetPendingEmployeeDto"}},"pendingTruncated":{"type":"boolean","example":false,"description":"True when there are more than 500 pending employees."}},"required":["requiresAck","version","audienceCount","readCount","ackedCount","pendingCount","pending","pendingTruncated"]},"DocumentVersionDto":{"type":"object","properties":{"version":{"type":"number","example":2},"fileName":{"type":"string","example":"reglamento-2026.pdf"},"contentType":{"type":"string","example":"application/pdf"},"sizeBytes":{"type":"number","example":182044},"uploadedAt":{"type":"string","example":"2026-10-02T12:00:00.000Z"}},"required":["version","fileName","contentType","sizeBytes","uploadedAt"]},"DocumentResponseDto":{"type":"object","properties":{"id":{"type":"number","example":4},"title":{"type":"string","example":"Reglamento interno"},"description":{"type":"string","nullable":true,"example":"Versión aprobada en septiembre."},"audience":{"$ref":"#/components/schemas/AudienceDto"},"requiresAck":{"type":"boolean","example":true},"version":{"type":"number","example":2,"description":"Current version (starts at 1, +1 per uploaded file)."},"fileName":{"type":"string","example":"reglamento-2026.pdf","description":"File of the current version."},"contentType":{"type":"string","example":"application/pdf"},"sizeBytes":{"type":"number","example":182044},"status":{"type":"string","enum":["active","archived"],"example":"active"},"archivedAt":{"type":"string","nullable":true,"example":null},"createdAt":{"type":"string","example":"2026-09-01T12:00:00.000Z"},"updatedAt":{"type":"string","example":"2026-10-02T12:00:00.000Z","description":"Last change (metadata or new version)."},"stats":{"description":"Confirmations of the current version.","allOf":[{"$ref":"#/components/schemas/IntranetStatsSummaryDto"}]},"versions":{"description":"Every version, newest first. Only in GET /intranet/documents/:id and the write responses.","type":"array","items":{"$ref":"#/components/schemas/DocumentVersionDto"}}},"required":["id","title","description","audience","requiresAck","version","fileName","contentType","sizeBytes","status","archivedAt","createdAt","updatedAt","stats"]},"DocumentListResponseDto":{"type":"object","properties":{"data":{"description":"Active first, then by title; at most 200.","type":"array","items":{"$ref":"#/components/schemas/DocumentResponseDto"}}},"required":["data"]},"UpdateDocumentDto":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"description":{"type":"string","nullable":true,"maxLength":2000},"audience":{"$ref":"#/components/schemas/AudienceDto"},"requiresAck":{"type":"boolean"}}},"DocumentDownloadResponseDto":{"type":"object","properties":{"url":{"type":"string","example":"https://storage.example/…signed…","description":"Signed URL, valid 5 minutes; it downloads the file as `fileName`."},"fileName":{"type":"string","example":"reglamento-2026.pdf"},"contentType":{"type":"string","example":"application/pdf"},"version":{"type":"number","example":2},"expiresAt":{"type":"string","example":"2026-10-02T12:05:00.000Z"}},"required":["url","fileName","contentType","version","expiresAt"]},"DirectoryFieldOptionDto":{"type":"object","properties":{"key":{"type":"string","example":"phone"},"label":{"type":"string","example":"Teléfono"},"contact":{"type":"boolean","example":true,"description":"Contact data: shown only for employees who opted in from the intranet."}},"required":["key","label","contact"]},"DirectorySettingsResponseDto":{"type":"object","properties":{"fields":{"example":["branch_id","phone"],"description":"Fields the directory shows besides the name, in this order.","type":"array","items":{"type":"string"}},"available":{"description":"Fields that can be shown: email, phone, site, supervisor, employee number, hire date and the organization's text/select custom fields. Fields hidden in the employee field settings are not offered.","type":"array","items":{"$ref":"#/components/schemas/DirectoryFieldOptionDto"}}},"required":["fields","available"]},"UpdateDirectorySettingsDto":{"type":"object","properties":{"fields":{"example":["branch_id","phone"],"description":"Full list (replaces the current one); empty = name only.","type":"array","items":{"type":"string"}}},"required":["fields"]},"OvertimePolicyResponseDto":{"type":"object","properties":{"basis":{"type":"string","enum":["schedule","threshold"],"example":"schedule","description":"`schedule`: an employee with a schedule on the day makes overtime past the day's expected minutes (a rest day, day off or holiday expects 0); without one, the thresholds apply. `threshold`: always the daily and weekly thresholds."},"dailyThresholdMinutes":{"type":"number","example":480,"description":"Daily threshold in minutes (Ley 11.544 art. 1: 8 h)."},"weeklyThresholdMinutes":{"type":"number","example":2880,"description":"Weekly threshold, Monday to Sunday (Ley 11.544 art. 1: 48 h)."},"saturdayCutoff":{"type":"string","example":"13:00","description":"Saturday time (HH:MM) from which overtime is 100 % (LCT art. 201)."},"roundingMinutes":{"type":"number","enum":[0,5,10,15,20,30,60],"example":0,"description":"The day's overtime rounds down to a multiple of this (0 = none)."},"requiresApproval":{"type":"boolean","example":false,"description":"Overtime counts only once a supervisor or admin approves it."},"nightReduction":{"type":"boolean","example":true,"description":"LCT art. 200 with the threshold: a wholly night day (21–6 h) has 7/8 of the daily threshold; a mixed day loses 8 minutes per whole night hour. Turn it off for rotating shifts."},"monthlyCapMinutes":{"type":"number","example":1800,"description":"Monthly cap in minutes (Dto. 484/2000: 30 h)."},"annualCapMinutes":{"type":"number","example":12000,"description":"Annual cap in minutes (Dto. 484/2000: 200 h), calendar year."},"dailyCapMinutes":{"type":"number","nullable":true,"example":null,"description":"Daily overtime cap in minutes (60–1440), or null for none. Warn only: a day above it is flagged `DAILY_CAP_EXCEEDED`, never truncated. The 3 h of Dto. 2882/79 is unverified."},"compensation":{"type":"string","enum":["pay","bank","choose"],"example":"pay","description":"`pay`: overtime is paid. `bank`: it goes to the hour bank (LCT 197 bis / 198). `choose`: the approver picks per day (needs `requiresApproval`; without it, it pays)."},"bankMultiplier":{"type":"number","example":1,"description":"Hour-bank minutes per overtime minute (0.5–4, 2 decimals)."},"isDefault":{"type":"boolean","example":false,"description":"True while the organization never saved a policy (these are the legal defaults)."},"updatedAt":{"type":"string","format":"date-time","nullable":true}},"required":["basis","dailyThresholdMinutes","weeklyThresholdMinutes","saturdayCutoff","roundingMinutes","requiresApproval","nightReduction","monthlyCapMinutes","annualCapMinutes","dailyCapMinutes","compensation","bankMultiplier","isDefault","updatedAt"]},"UpdateOvertimePolicyDto":{"type":"object","properties":{"basis":{"type":"string","enum":["schedule","threshold"]},"dailyThresholdMinutes":{"type":"integer","example":480,"minimum":60,"maximum":1440},"weeklyThresholdMinutes":{"type":"integer","example":2880,"minimum":60,"maximum":10080},"saturdayCutoff":{"type":"object","example":"13:00","description":"HH:MM"},"roundingMinutes":{"type":"number","enum":[0,5,10,15,20,30,60]},"requiresApproval":{"type":"boolean"},"nightReduction":{"type":"boolean"},"monthlyCapMinutes":{"type":"integer","example":1800,"minimum":0,"maximum":44640},"annualCapMinutes":{"type":"integer","example":12000,"minimum":0,"maximum":527040},"dailyCapMinutes":{"type":"integer","nullable":true,"example":180,"minimum":60,"maximum":1440,"description":"null removes the daily cap."},"compensation":{"type":"string","enum":["pay","bank","choose"]},"bankMultiplier":{"type":"number","example":1.5,"minimum":0.5,"maximum":4}}},"CapUsageDto":{"type":"object","properties":{"usedMinutes":{"type":"number","example":1440,"description":"Overtime that counts in the period (50 % + 100 %), never truncated at the cap."},"capMinutes":{"type":"number","example":1800},"ratio":{"type":"number","example":0.8,"description":"used / cap (may be above 1)."},"level":{"type":"string","enum":["ok","near","exceeded"],"description":"`near` from 80 % of the cap, `exceeded` past it."}},"required":["usedMinutes","capMinutes","ratio","level"]},"OvertimeApprovalStateDto":{"type":"object","properties":{"status":{"type":"string","enum":["pending","approved","rejected"]},"overtime50Minutes":{"type":"number","example":60},"overtime100Minutes":{"type":"number","example":0},"automatic":{"type":"boolean","example":false,"description":"Approved automatically: the day counted while the policy did not require approval."}},"required":["status","overtime50Minutes","overtime100Minutes","automatic"]},"OvertimeDayDto":{"type":"object","properties":{"date":{"type":"string","example":"2026-10-05"},"workedMinutes":{"type":"number","example":600},"expectedMinutes":{"type":"number","example":540},"overtime50Minutes":{"type":"number","example":60,"description":"Overtime at 50 % that counts."},"overtime100Minutes":{"type":"number","example":0,"description":"Overtime at 100 % that counts."},"nightMinutes":{"type":"number","example":0},"approval":{"nullable":true,"description":"The day's approval request, when the organization requires approval.","allOf":[{"$ref":"#/components/schemas/OvertimeApprovalStateDto"}]},"destination":{"type":"string","enum":["pay","bank"],"description":"Where the day's counted overtime went: paid or the hour bank."},"bankCreditMinutes":{"type":"number","example":0,"description":"Hour-bank minutes credited for the day (counted overtime × multiplier when it went to the bank)."},"flags":{"type":"array","example":[],"description":"`DAILY_CAP_EXCEEDED` when the day's overtime is above the daily cap; `DECISION_MINUTES_CHANGED` when the day was decided and its computed overtime changed since (the decision is kept).","items":{"type":"string","enum":["DAILY_CAP_EXCEEDED","DECISION_MINUTES_CHANGED"]}}},"required":["date","workedMinutes","expectedMinutes","overtime50Minutes","overtime100Minutes","nightMinutes","approval","destination","bankCreditMinutes","flags"]},"OvertimeSummaryRowDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"name":{"type":"string","example":"Pérez, Ana"},"documentNumber":{"type":"string","example":"30111222"},"workedMinutes":{"type":"number","example":10200},"overtime50Minutes":{"type":"number","example":600},"overtime100Minutes":{"type":"number","example":240},"nightMinutes":{"type":"number","example":1200},"pendingMinutes":{"type":"number","example":90,"description":"Overtime waiting for approval (does not count yet)."},"rejectedMinutes":{"type":"number","example":0,"description":"Overtime rejected (does not count)."},"bankedMinutes":{"type":"number","example":0,"description":"Counted overtime sent to the hour bank (before the multiplier). To pay = 50 % + 100 % − this."},"bankCreditMinutes":{"type":"number","example":0,"description":"Hour-bank minutes credited for the month's days."},"dailyCapExceededDays":{"type":"number","example":0,"description":"Days of the month above the daily cap."},"monthCap":{"description":"Monthly cap usage for `month`.","allOf":[{"$ref":"#/components/schemas/CapUsageDto"}]},"yearCap":{"description":"Annual cap usage, January 1 to the end of `month` (or today).","allOf":[{"$ref":"#/components/schemas/CapUsageDto"}]},"days":{"description":"Days of the month with overtime or an approval request.","type":"array","items":{"$ref":"#/components/schemas/OvertimeDayDto"}}},"required":["employeeId","name","documentNumber","workedMinutes","overtime50Minutes","overtime100Minutes","nightMinutes","pendingMinutes","rejectedMinutes","bankedMinutes","bankCreditMinutes","dailyCapExceededDays","monthCap","yearCap","days"]},"OvertimeTotalsDto":{"type":"object","properties":{"overtime50Minutes":{"type":"number","example":600},"overtime100Minutes":{"type":"number","example":240},"nightMinutes":{"type":"number","example":1200},"pendingMinutes":{"type":"number","example":90},"nearCap":{"type":"number","example":1,"description":"Employees at or past 80 % of the monthly or annual cap."},"exceededCap":{"type":"number","example":0,"description":"Employees past the monthly or annual cap."},"bankedMinutes":{"type":"number","example":0,"description":"Counted overtime sent to the hour bank (before the multiplier)."},"bankCreditMinutes":{"type":"number","example":0,"description":"Hour-bank minutes credited."},"dailyCapExceededDays":{"type":"number","example":0,"description":"Employee-days above the daily cap."}},"required":["overtime50Minutes","overtime100Minutes","nightMinutes","pendingMinutes","nearCap","exceededCap","bankedMinutes","bankCreditMinutes","dailyCapExceededDays"]},"OvertimeSummaryResponseDto":{"type":"object","properties":{"month":{"type":"string","example":"2026-10"},"policy":{"$ref":"#/components/schemas/OvertimePolicyResponseDto"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/OvertimeSummaryRowDto"}},"totals":{"$ref":"#/components/schemas/OvertimeTotalsDto"}},"required":["month","policy","rows","totals"]},"OvertimeApprovalResponseDto":{"type":"object","properties":{"id":{"type":"number","example":31},"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"date":{"type":"string","example":"2026-10-05"},"overtime50Minutes":{"type":"number","example":60},"overtime100Minutes":{"type":"number","example":30},"minutes":{"type":"number","example":90,"description":"overtime50Minutes + overtime100Minutes."},"workedMinutes":{"type":"number","example":630,"description":"Worked minutes of the day."},"expectedMinutes":{"type":"number","example":540,"description":"Expected minutes of the day (0 without a schedule)."},"status":{"type":"string","enum":["pending","approved","rejected"]},"destination":{"type":"string","enum":["pay","bank"],"nullable":true,"description":"Where the approved overtime went; null while pending or rejected."},"bankCreditMinutes":{"type":"number","example":0,"description":"Hour-bank minutes currently credited for the day."},"flags":{"type":"array","example":[],"description":"`DAILY_CAP_EXCEEDED` when the request's minutes are above the daily cap; `DECISION_MINUTES_CHANGED` when it was decided and the computed minutes changed since (the decision is kept; it can be decided again).","items":{"type":"string","enum":["DAILY_CAP_EXCEEDED","DECISION_MINUTES_CHANGED"]}},"automatic":{"type":"boolean","example":false,"description":"Approved automatically: the day counted while the policy did not require approval (no reviewer)."},"reviewerName":{"type":"string","nullable":true,"example":"López, Juan"},"reviewedAt":{"type":"string","format":"date-time","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","employeeName","date","overtime50Minutes","overtime100Minutes","minutes","workedMinutes","expectedMinutes","status","destination","bankCreditMinutes","flags","automatic","reviewerName","reviewedAt","note","createdAt"]},"OvertimeApprovalListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OvertimeApprovalResponseDto"}}},"required":["data"]},"ReviewOvertimeDto":{"type":"object","properties":{"note":{"type":"string","example":"Cierre de inventario.","maxLength":500},"destination":{"type":"string","enum":["pay","bank"],"description":"Approve only. Required when the policy's `compensation` is `choose`; ignored otherwise (the policy decides)."}}},"HourBankMovementDto":{"type":"object","properties":{"id":{"type":"number","example":7},"date":{"type":"string","example":"2026-10-05","description":"The day it refers to (an overtime day, a leave's first day, an adjustment's date)."},"minutes":{"type":"number","example":150,"description":"+ credit, − debit."},"source":{"type":"string","enum":["overtime","leave","adjustment"]},"sourceRef":{"type":"string","nullable":true,"example":"2026-10-05","description":"`overtime`: the day (YYYY-MM-DD); `leave`: the leave id; `adjustment`: null."},"note":{"type":"string","nullable":true,"example":null},"createdByName":{"type":"string","nullable":true,"example":"Sole Gómez","description":"Who caused it; null for automatic credits."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","date","minutes","source","sourceRef","note","createdByName","createdAt"]},"HourBankResponseDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"balanceMinutes":{"type":"number","example":330,"description":"Sum of every movement (may be negative only through adjustments or a credit taken back)."},"movements":{"description":"Newest date first, at most 500.","type":"array","items":{"$ref":"#/components/schemas/HourBankMovementDto"}},"truncated":{"type":"boolean","example":false,"description":"True when there are more than 500 movements."}},"required":["employeeId","employeeName","balanceMinutes","movements","truncated"]},"HourBankBalanceDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"balanceMinutes":{"type":"number","example":330}},"required":["employeeId","employeeName","balanceMinutes"]},"HourBankBalanceListDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/HourBankBalanceDto"}}},"required":["data"]},"CreateHourBankAdjustmentDto":{"type":"object","properties":{"employeeId":{"type":"integer","example":12},"minutes":{"type":"integer","example":660,"minimum":-60000,"maximum":60000,"description":"≠ 0: + credit, − debit."},"date":{"type":"object","example":"2026-10-01","description":"YYYY-MM-DD. Default: today."},"note":{"type":"object","example":"Saldo inicial acordado","maxLength":500}},"required":["employeeId","minutes","note"]},"LeaveTypeResponseDto":{"type":"object","properties":{"id":{"type":"number","example":3},"systemKey":{"type":"string","enum":["vacaciones","enfermedad","nacimiento","matrimonio","fallecimiento","examen","sin_goce","otra"],"nullable":true,"description":"Catalog key; null for a type the organization added."},"name":{"type":"string","example":"Vacaciones"},"paid":{"type":"boolean","example":true},"countsAs":{"type":"string","enum":["calendar_days","working_days"],"description":"`calendar_days` counts every date; `working_days` only the employee's working days."},"requiresCertificate":{"type":"boolean","example":false},"requiresApproval":{"type":"boolean","example":true,"description":"False: a request is approved as soon as it is made."},"employeeCanRequest":{"type":"boolean","example":true,"description":"Whether employees may request it from the intranet."},"consumesHourBank":{"type":"boolean","example":false,"description":"Approving a leave of this type debits its planned minutes from the employee's hour bank (franco compensatorio); 422 HOUR_BANK_INSUFFICIENT when the balance does not cover it."},"minDaysPerRequest":{"type":"number","nullable":true,"example":7},"maxDaysPerRequest":{"type":"number","nullable":true,"example":null},"maxDaysPerYear":{"type":"number","nullable":true,"example":null},"active":{"type":"boolean","example":true},"sortOrder":{"type":"number","example":10},"hasBalance":{"type":"boolean","example":true,"description":"Whether it has a balance (vacations)."}},"required":["id","systemKey","name","paid","countsAs","requiresCertificate","requiresApproval","employeeCanRequest","consumesHourBank","minDaysPerRequest","maxDaysPerRequest","maxDaysPerYear","active","sortOrder","hasBalance"]},"LeaveTypeListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LeaveTypeResponseDto"}}},"required":["data"]},"CreateLeaveTypeDto":{"type":"object","properties":{"name":{"type":"string","example":"Mudanza","maxLength":80},"paid":{"type":"boolean","default":true},"countsAs":{"type":"string","enum":["calendar_days","working_days"],"default":"calendar_days"},"requiresCertificate":{"type":"boolean","default":false},"requiresApproval":{"type":"boolean","default":true},"employeeCanRequest":{"type":"boolean","default":true},"consumesHourBank":{"type":"boolean","default":false,"description":"Approving it debits the hour bank (franco compensatorio)."},"minDaysPerRequest":{"type":"number","nullable":true,"minimum":1,"maximum":366},"maxDaysPerRequest":{"type":"number","nullable":true,"minimum":1,"maximum":366},"maxDaysPerYear":{"type":"number","nullable":true,"minimum":1,"maximum":366},"sortOrder":{"type":"number","minimum":0,"maximum":1000}},"required":["name"]},"UpdateLeaveTypeDto":{"type":"object","properties":{"name":{"type":"string","example":"Mudanza","maxLength":80},"paid":{"type":"boolean","default":true},"countsAs":{"type":"string","enum":["calendar_days","working_days"],"default":"calendar_days"},"requiresCertificate":{"type":"boolean","default":false},"requiresApproval":{"type":"boolean","default":true},"employeeCanRequest":{"type":"boolean","default":true},"consumesHourBank":{"type":"boolean","default":false,"description":"Approving it debits the hour bank (franco compensatorio)."},"minDaysPerRequest":{"type":"number","nullable":true,"minimum":1,"maximum":366},"maxDaysPerRequest":{"type":"number","nullable":true,"minimum":1,"maximum":366},"maxDaysPerYear":{"type":"number","nullable":true,"minimum":1,"maximum":366},"sortOrder":{"type":"number","minimum":0,"maximum":1000},"active":{"type":"boolean","description":"False hides it from new requests (existing ones stay)."}}},"LeaveTypeRefDto":{"type":"object","properties":{"id":{"type":"number","example":3},"systemKey":{"type":"string","enum":["vacaciones","enfermedad","nacimiento","matrimonio","fallecimiento","examen","sin_goce","otra"],"nullable":true},"name":{"type":"string","example":"Vacaciones"},"paid":{"type":"boolean","example":true},"countsAs":{"type":"string","enum":["calendar_days","working_days"]},"requiresCertificate":{"type":"boolean","example":false}},"required":["id","systemKey","name","paid","countsAs","requiresCertificate"]},"LeaveCertificateDto":{"type":"object","properties":{"fileName":{"type":"string","example":"certificado.pdf"},"contentType":{"type":"string","example":"application/pdf"},"sizeBytes":{"type":"number","example":182044},"uploadedAt":{"type":"string","format":"date-time"}},"required":["fileName","contentType","sizeBytes","uploadedAt"]},"LeaveResponseDto":{"type":"object","properties":{"id":{"type":"number","example":17},"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"leaveType":{"$ref":"#/components/schemas/LeaveTypeRefDto"},"fromDate":{"type":"string","example":"2026-12-07"},"toDate":{"type":"string","example":"2026-12-20"},"days":{"type":"number","example":14,"description":"Days it counts (calendar or working days by its type), fixed when requested."},"periodYear":{"type":"number","nullable":true,"example":2026,"description":"Vacation period it draws from (vacations only)."},"status":{"type":"string","enum":["pending","approved","rejected","cancelled"]},"reason":{"type":"string","nullable":true},"requestedBy":{"type":"string","enum":["employee","admin"]},"reviewerName":{"type":"string","nullable":true,"example":"Gabriel Pan","description":"User's full name or the supervisor's name."},"reviewedAt":{"type":"string","format":"date-time","nullable":true},"reviewNote":{"type":"string","nullable":true},"cancelledAt":{"type":"string","format":"date-time","nullable":true},"certificate":{"nullable":true,"allOf":[{"$ref":"#/components/schemas/LeaveCertificateDto"}]},"warnings":{"type":"array","description":"Non-blocking legal reminders (see the contract).","items":{"type":"string","enum":["short_notice","not_monday","outside_period","no_working_day","sick_leave_over_allowance"]}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","employeeName","leaveType","fromDate","toDate","days","periodYear","status","reason","requestedBy","reviewerName","reviewedAt","reviewNote","cancelledAt","certificate","warnings","createdAt"]},"LeaveListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LeaveResponseDto"}},"truncated":{"type":"boolean","example":false,"description":"More than 500 matched: narrow the filters."}},"required":["data","truncated"]},"VacationEntitlementDto":{"type":"object","properties":{"days":{"type":"number","nullable":true,"example":14,"description":"null without a hire date."},"rule":{"type":"string","enum":["seniority","proportional","not_employed","no_hire_date"],"description":"`seniority` (art. 150), `proportional` (art. 153: 1 per 20 days), `not_employed`, `no_hire_date`."},"seniorityYears":{"type":"number","nullable":true,"example":4,"description":"Whole years at December 31 of the year."},"workedDays":{"type":"number","nullable":true,"example":313,"description":"Monday–Saturday days within employment in the year (art. 151)."},"minimumDays":{"type":"number","example":157,"description":"Half of the year's Monday–Saturday days (art. 151 minimum)."}},"required":["days","rule","seniorityYears","workedDays","minimumDays"]},"SickLeaveAllowanceDto":{"type":"object","properties":{"year":{"type":"number","example":2026},"months":{"type":"number","example":3,"description":"3 (< 5 years) or 6 (≥ 5 years); doubled with family dependants."},"allowanceDays":{"type":"number","example":90,"description":"months × 30."},"seniorityYears":{"type":"number","nullable":true,"example":2,"description":"Full years of seniority; null without a hire date (lower bracket)."},"hasFamilyDependants":{"type":"boolean","example":false},"usedDays":{"type":"number","example":12,"description":"Approved sick days starting in the year."},"pendingDays":{"type":"number","example":3,"description":"Pending sick days starting in the year."},"remainingDays":{"type":"number","example":75,"description":"allowance − used − pending; may be negative."}},"required":["year","months","allowanceDays","seniorityYears","hasFamilyDependants","usedDays","pendingDays","remainingDays"]},"LeaveBalanceResponseDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"hireDate":{"type":"string","nullable":true,"example":"2022-03-01"},"year":{"type":"number","example":2026,"description":"Vacation period (calendar year whose December 31 fixes the seniority)."},"entitlement":{"$ref":"#/components/schemas/VacationEntitlementDto"},"entitledDays":{"type":"number","nullable":true,"example":14},"adjustmentDays":{"type":"number","example":2,"description":"Sum of manual adjustments of the period."},"usedDays":{"type":"number","example":7,"description":"Approved vacation days drawn from the period."},"pendingDays":{"type":"number","example":0,"description":"Pending vacation days drawn from the period."},"availableDays":{"type":"number","example":9,"description":"entitled + adjustments − used."},"requestableDays":{"type":"number","example":9,"description":"available − pending: what a new request may take."},"sickLeave":{"description":"Paid sick-leave allowance of the row's year (LCT art. 208, ATTENDANCE-WAVE-3.md B3).","allOf":[{"$ref":"#/components/schemas/SickLeaveAllowanceDto"}]}},"required":["employeeId","employeeName","hireDate","year","entitlement","entitledDays","adjustmentDays","usedDays","pendingDays","availableDays","requestableDays"]},"LeaveViolationDto":{"type":"object","properties":{"code":{"type":"string","enum":["empty","below_minimum","above_maximum","year_limit","insufficient_balance"]},"message":{"type":"string","example":"No alcanza el saldo: quedan 9 días para pedir."}},"required":["code","message"]},"LeavePreviewResponseDto":{"type":"object","properties":{"days":{"type":"number","example":14},"countsAs":{"type":"string","enum":["calendar_days","working_days"]},"periodYear":{"type":"number","nullable":true,"example":2026},"warnings":{"type":"array","items":{"type":"string","enum":["short_notice","not_monday","outside_period","no_working_day","sick_leave_over_allowance"]}},"balance":{"nullable":true,"description":"Vacations: the period's balance before this request.","allOf":[{"$ref":"#/components/schemas/LeaveBalanceResponseDto"}]},"violation":{"nullable":true,"description":"Why it would be refused (null = it can be requested; overlaps are checked on submit).","allOf":[{"$ref":"#/components/schemas/LeaveViolationDto"}]},"sickLeave":{"nullable":true,"description":"Sickness type only: the year's paid sick-leave allowance before this request (LCT art. 208). Exceeding it adds the warning `sick_leave_over_allowance`; it never blocks.","allOf":[{"$ref":"#/components/schemas/SickLeaveAllowanceDto"}]}},"required":["days","countsAs","periodYear","warnings","balance","violation","sickLeave"]},"CreateLeaveDto":{"type":"object","properties":{"leaveTypeId":{"type":"number","example":3},"fromDate":{"type":"string","example":"2026-12-07"},"toDate":{"type":"string","example":"2026-12-20"},"reason":{"type":"string","maxLength":500},"periodYear":{"type":"number","example":2026,"description":"Vacations only: the period it draws from. Default: the year of `fromDate`, or the previous one for January–April."},"employeeId":{"type":"number","example":12},"status":{"type":"string","enum":["approved","pending"],"default":"approved","description":"An admin's leave is approved at once unless `pending`."}},"required":["leaveTypeId","fromDate","toDate","employeeId"]},"LeaveDecisionDto":{"type":"object","properties":{"note":{"type":"string","maxLength":500}}},"LeaveCertificateDownloadDto":{"type":"object","properties":{"url":{"type":"string","example":"https://…signed…"},"fileName":{"type":"string","example":"certificado.pdf"},"contentType":{"type":"string","example":"application/pdf"},"expiresAt":{"type":"string","format":"date-time"}},"required":["url","fileName","contentType","expiresAt"]},"LeaveImportSummaryDto":{"type":"object","properties":{"total":{"type":"number","example":3},"valid":{"type":"number","example":1,"description":"Valid rows (imported ones included)."},"invalid":{"type":"number","example":1},"skipped":{"type":"number","example":1,"description":"Rows without days."},"imported":{"type":"number","example":0,"description":"Adjustments written (0 in a dry run)."}},"required":["total","valid","invalid","skipped","imported"]},"LeaveImportIssueDto":{"type":"object","properties":{"code":{"type":"string","example":"employee_not_found"},"message":{"type":"string","example":"No hay una persona con legajo 0099."}},"required":["code","message"]},"LeaveImportRowDto":{"type":"object","properties":{"row":{"type":"number","example":2,"description":"Spreadsheet row number (the header is row 1)."},"status":{"type":"string","enum":["valid","invalid","skipped","imported"]},"employeeId":{"type":"number","nullable":true,"example":12},"employeeName":{"type":"string","nullable":true,"example":"Pérez, Ana"},"leaveTypeId":{"type":"number","nullable":true,"example":3},"leaveTypeName":{"type":"string","nullable":true,"example":"Vacaciones"},"year":{"type":"number","nullable":true,"example":2026},"days":{"type":"number","nullable":true,"example":14},"note":{"type":"string","nullable":true,"example":"Saldo inicial importado"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/LeaveImportIssueDto"}},"warnings":{"description":"`already_imported`: the same balance was imported before (never blocks).","type":"array","items":{"$ref":"#/components/schemas/LeaveImportIssueDto"}}},"required":["row","status","employeeId","employeeName","leaveTypeId","leaveTypeName","year","days","note","errors","warnings"]},"LeaveImportResponseDto":{"type":"object","properties":{"dryRun":{"type":"boolean","example":true},"summary":{"$ref":"#/components/schemas/LeaveImportSummaryDto"},"rows":{"type":"array","items":{"$ref":"#/components/schemas/LeaveImportRowDto"}}},"required":["dryRun","summary","rows"]},"LeaveBalanceListResponseDto":{"type":"object","properties":{"year":{"type":"number","example":2026},"leaveTypeId":{"type":"number","nullable":true,"example":3,"description":"The vacation type (adjustments go to it)."},"data":{"type":"array","items":{"$ref":"#/components/schemas/LeaveBalanceResponseDto"}}},"required":["year","leaveTypeId","data"]},"LeaveAdjustmentResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"employeeId":{"type":"number","example":12},"year":{"type":"number","example":2026},"days":{"type":"number","example":-2,"description":"Days added (positive) or taken (negative)."},"reason":{"type":"string","example":"Saldo inicial al activar el módulo"},"createdByName":{"type":"string","nullable":true,"example":"Gabriel Pan"},"source":{"type":"string","enum":["manual","import"],"example":"manual","description":"`import`: loaded by the balances import (A2)."},"createdAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","year","days","reason","createdByName","source","createdAt"]},"LeaveAdjustmentListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LeaveAdjustmentResponseDto"}}},"required":["data"]},"CreateLeaveAdjustmentDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"year":{"type":"number","example":2026},"days":{"type":"number","example":3,"description":"Non-zero, −366 … 366."},"reason":{"type":"string","example":"Saldo inicial al activar el módulo","maxLength":300}},"required":["employeeId","year","days","reason"]},"PayrollConceptDto":{"type":"object","properties":{"source":{"type":"string","example":"overtime_50","description":"One of worked_hours, overtime_50, overtime_100, night_hours, absence_days, late_minutes, hour_bank_credit, hour_bank_debit, or `leave:<leaveTypeId>`."},"label":{"type":"string","example":"Horas extra 50 %","description":"Column name when there is no code: the saved label or the default one."},"defaultLabel":{"type":"string","example":"Horas extra 50 %"},"conceptCode":{"type":"string","nullable":true,"example":"1050","description":"Payroll concept code (≤ 20). The column header when set."},"unit":{"type":"string","enum":["hours","days"],"description":"Fixed by the source."},"enabled":{"type":"boolean","example":true,"description":"Exported as a column."},"configured":{"type":"boolean","example":false,"description":"False = never saved (the defaults)."},"leaveTypeId":{"type":"number","example":3,"description":"Only on `leave:<id>` sources."}},"required":["source","label","defaultLabel","conceptCode","unit","enabled","configured"]},"PayrollConceptListDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PayrollConceptDto"}}},"required":["data"]},"UpdatePayrollConceptsDto":{"type":"object","properties":{"concepts":{"type":"array","description":"Sources to change (the others keep their value). Each item: `source` and any of `conceptCode` (≤ 20, null = none), `label` (≤ 80, null = default), `enabled`.","example":[{"source":"overtime_50","conceptCode":"1050","enabled":true}],"items":{"type":"object"}}},"required":["concepts"]},"PayrollColumnDto":{"type":"object","properties":{"source":{"type":"string","example":"overtime_50"},"header":{"type":"string","example":"1050","description":"The concept code, or the label when there is none."},"conceptCode":{"type":"string","nullable":true,"example":"1050"},"unit":{"type":"string","enum":["hours","days"]}},"required":["source","header","conceptCode","unit"]},"PayrollRowDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"fileNumber":{"type":"string","nullable":true,"example":"0042","description":"Legajo."},"name":{"type":"string","example":"Pérez, Ana"},"cuil":{"type":"string","nullable":true,"example":"27301112223"},"siteName":{"type":"string","nullable":true,"example":"Casa central"},"values":{"type":"object","additionalProperties":{"type":"number"},"example":{"worked_hours":162.5,"overtime_50":4,"leave:3":5},"description":"One key per column `source`: hours (2 decimals) or days."}},"required":["employeeId","fileNumber","name","cuil","siteName","values"]},"PayrollWarningItemDto":{"type":"object","properties":{"employeeId":{"type":"number","example":12},"employeeName":{"type":"string","example":"Pérez, Ana"},"date":{"type":"string","nullable":true,"example":"2026-10-30"}},"required":["employeeId","employeeName","date"]},"PayrollWarningDto":{"type":"object","properties":{"code":{"type":"string","enum":["period_in_progress","open_days","incomplete_days","flagged_days","pending_overtime","pending_leaves","missing_cuil","missing_file_number"]},"message":{"type":"string","example":"2 jornadas siguen abiertas (sin salida)."},"count":{"type":"number","example":2},"items":{"description":"At most 50.","type":"array","items":{"$ref":"#/components/schemas/PayrollWarningItemDto"}}},"required":["code","message","count","items"]},"PayrollPreviewDto":{"type":"object","properties":{"period":{"type":"string","example":"2026-10"},"from":{"type":"string","example":"2026-10-01"},"to":{"type":"string","example":"2026-10-31"},"siteId":{"type":"number","nullable":true,"example":null},"columns":{"type":"array","items":{"$ref":"#/components/schemas/PayrollColumnDto"}},"rows":{"type":"array","items":{"$ref":"#/components/schemas/PayrollRowDto"}},"warnings":{"description":"Never block the export.","type":"array","items":{"$ref":"#/components/schemas/PayrollWarningDto"}}},"required":["period","from","to","siteId","columns","rows","warnings"]},"PayrollExportHistoryItemDto":{"type":"object","properties":{"id":{"type":"number","example":7},"period":{"type":"string","example":"2026-10"},"siteId":{"type":"number","nullable":true,"example":null},"format":{"type":"string","enum":["xlsx","csv"]},"rowCount":{"type":"number","example":23},"warningCount":{"type":"number","example":2},"checksum":{"type":"string","example":"9f2c…","description":"sha256 of the exported values: the same data gives the same checksum."},"generatedByName":{"type":"string","nullable":true,"example":"Sole Gómez"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","period","siteId","format","rowCount","warningCount","checksum","generatedByName","createdAt"]},"PayrollExportHistoryDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PayrollExportHistoryItemDto"}}},"required":["data"]},"CreateRecomputeDto":{"type":"object","properties":{"from":{"type":"object","example":"2026-09-01","description":"First date to recompute (YYYY-MM-DD)."},"to":{"type":"object","example":"2026-10-02","description":"Last date (default today). At most 93 days from `from`, not after today."},"employeeIds":{"example":[12,15],"description":"Only these employees (≤ 500). Default: active employees plus anyone with work days in the range.","type":"array","items":{"type":"number"}}},"required":["from"]},"RecomputeJobDto":{"type":"object","properties":{"id":{"type":"number","example":4},"status":{"type":"string","enum":["queued","running","done","failed"]},"from":{"type":"string","example":"2026-09-01"},"to":{"type":"string","example":"2026-10-02"},"employeeIds":{"nullable":true,"example":null,"description":"null = everyone.","type":"array","items":{"type":"number"}},"totalEmployees":{"type":"number","nullable":true,"example":23,"description":"null while queued."},"processedEmployees":{"type":"number","example":9},"failedEmployees":{"type":"number","example":0,"description":"Employees whose recompute failed (they keep their previous days)."},"error":{"type":"string","nullable":true,"example":null},"requestedByName":{"type":"string","nullable":true,"example":"Sole Gómez"},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":"string","format":"date-time","nullable":true},"finishedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","status","from","to","employeeIds","totalEmployees","processedEmployees","failedEmployees","error","requestedByName","createdAt","startedAt","finishedAt"]},"RecomputePreviewDto":{"type":"object","properties":{"from":{"type":"string","example":"2026-09-01"},"to":{"type":"string","example":"2026-10-02"},"employeeIds":{"nullable":true,"example":null,"description":"null = everyone.","type":"array","items":{"type":"number"}},"totalEmployees":{"type":"number","example":23},"checkedEmployees":{"type":"number","example":23,"description":"Employees simulated (fewer than the total when the 20 s budget ran out)."},"complete":{"type":"boolean","example":true,"description":"false when the time budget ran out: the counts are a lower bound."},"days":{"type":"number","example":12,"description":"Work days that would change (worked minutes, status, counted overtime or its destination)."},"workedMinutesChanged":{"type":"number","example":4},"statusChanged":{"type":"number","example":1,"description":"Days created, removed or whose status changes."},"overtimeChanged":{"type":"number","example":9,"description":"Days whose counted overtime (or its destination) changes."},"decidedOvertimeKept":{"type":"number","example":3,"description":"Changed days whose overtime decision (approved, rejected or automatic) is kept."},"decisionMinutesChanged":{"type":"number","example":1,"description":"Decided days newly flagged DECISION_MINUTES_CHANGED."},"newPendingRequests":{"type":"number","example":0,"description":"Days that would get a new pending overtime request."}},"required":["from","to","employeeIds","totalEmployees","checkedEmployees","complete","days","workedMinutesChanged","statusChanged","overtimeChanged","decidedOvertimeKept","decisionMinutesChanged","newPendingRequests"]},"RemoteSiteResponseDto":{"type":"object","properties":{"id":{"type":"number","example":5},"employeeId":{"type":"integer","nullable":true,"example":12,"description":"null = every employee of the organization."},"label":{"type":"string","example":"Casa"},"latitude":{"type":"number","example":-34.603722},"longitude":{"type":"number","example":-58.381592},"radiusM":{"type":"number","example":150},"archivedAt":{"type":"string","format":"date-time","nullable":true,"example":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","employeeId","label","latitude","longitude","radiusM","archivedAt","createdAt","updatedAt"]},"RemoteSiteListResponseDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RemoteSiteResponseDto"}}},"required":["data"]},"CreateRemoteSiteDto":{"type":"object","properties":{"employeeId":{"type":"integer","nullable":true,"example":12,"description":"The employee this place is for; null or omitted = every employee of the organization."},"label":{"type":"string","example":"Casa","maxLength":80},"latitude":{"type":"number","example":-34.603722,"minimum":-90,"maximum":90},"longitude":{"type":"number","example":-58.381592,"minimum":-180,"maximum":180},"radiusM":{"type":"number","example":150,"minimum":20,"maximum":5000,"description":"Meters. Default 150."}},"required":["label","latitude","longitude"]},"UpdateRemoteSiteDto":{"type":"object","properties":{"employeeId":{"type":"integer","nullable":true,"example":12,"description":"The employee this place is for; null or omitted = every employee of the organization."},"label":{"type":"string","example":"Casa","maxLength":80},"latitude":{"type":"number","example":-34.603722,"minimum":-90,"maximum":90},"longitude":{"type":"number","example":-58.381592,"minimum":-180,"maximum":180},"radiusM":{"type":"number","example":150,"minimum":20,"maximum":5000,"description":"Meters. Default 150."}}},"RosterSyncSiteDto":{"type":"object","properties":{"externalId":{"type":"string","example":"srv_k57abc","description":"Id of the site in the external system. Unique within `sites`."},"name":{"type":"string","example":"Domicilio Pérez – Palermo","description":"Branch name; unique per organization (case-insensitive)."},"address":{"type":"string","example":"Av. Santa Fe 3200 5° B"},"city":{"type":"string","example":"Ciudad Autónoma de Buenos Aires"},"postalCode":{"type":"string","nullable":true,"example":"C1425","description":"Missing or null stores an empty postal code."},"province":{"type":"string","example":"CABA","description":"Province, resolved against the locations catalog: \"CABA\", \"Capital Federal\" and \"Ciudad Autónoma de Buenos Aires\" are the city; \"Buenos Aires\" is the province. An unknown province skips the site."},"latitude":{"type":"number","nullable":true,"example":-34.588,"description":"Send both coordinates or neither."},"longitude":{"type":"number","nullable":true,"example":-58.411}},"required":["externalId","name","address","city","province"]},"RosterSyncEmployeeDto":{"type":"object","properties":{"externalId":{"type":"string","example":"cuidadora_j97xyz","description":"Id of the employee in the external system. Unique within `employees`."},"firstName":{"type":"string","example":"María"},"lastName":{"type":"string","example":"González"},"documentNumber":{"type":"string","example":"30123456","description":"DNI (7–8 digits; dots allowed)."},"email":{"type":"string","example":"maria@example.com"},"phone":{"type":"string","nullable":true,"example":"+54 9 11 5555-0000"},"hireDate":{"type":"string","nullable":true,"example":"2026-11-01","description":"YYYY-MM-DD."},"siteExternalIds":{"example":["srv_k57abc"],"description":"`externalId`s of sites of this same payload where the employee works. Exactly one resolvable site assigns that branch; none or several leave the employee without a branch (they may clock in at the nearest site).","type":"array","items":{"type":"string"}}},"required":["externalId","firstName","lastName","documentNumber","email","siteExternalIds"]},"RosterSyncRequestDto":{"type":"object","properties":{"source":{"type":"string","example":"cuidarnos","description":"Name of the calling system (1–40 of a-z, 0-9, _ and -). Written to the audit trail."},"dryRun":{"type":"boolean","default":false,"description":"Compute and return the plan without writing anything."},"inviteNewEmployees":{"type":"boolean","default":false,"description":"After the run commits, email an invitation to the Peakly app to each employee CREATED by this run (never to linked or updated ones)."},"allowMassDeactivation":{"type":"boolean","default":false,"description":"Allow a run that deactivates more than half of the linked active employees and more than 5 of them; without it such a run is refused (400 ROSTER_SYNC_MASS_DEACTIVATION)."},"sites":{"description":"Every site that should exist (max 500). Must not be empty.","type":"array","items":{"$ref":"#/components/schemas/RosterSyncSiteDto"}},"employees":{"description":"Every employee that should be active (max 2000). Must not be empty.","type":"array","items":{"$ref":"#/components/schemas/RosterSyncEmployeeDto"}}},"required":["source","sites","employees"]},"RosterSyncCreatedSiteDto":{"type":"object","properties":{"id":{"type":"integer","nullable":true,"example":41,"description":"Peakly branch id; null on a dry run."},"externalId":{"type":"string","example":"srv_k57abc"},"geoCheckinEnabled":{"type":"boolean","example":true,"description":"App check-in with location on (the site came with coordinates)."}},"required":["id","externalId","geoCheckinEnabled"]},"RosterSyncRefDto":{"type":"object","properties":{"id":{"type":"number","example":41,"description":"Peakly id."},"externalId":{"type":"string","example":"srv_k57abc"}},"required":["id","externalId"]},"RosterSyncDriftDto":{"type":"object","properties":{"id":{"type":"number","example":41,"description":"Peakly id of the branch or employee."},"externalId":{"type":"string","example":"srv_k57abc"},"field":{"type":"string","example":"name","description":"Sites: name, address, geoCheckinEnabled. Employees: firstName, lastName, documentNumber, email."},"peakly":{"type":"object","description":"Value in Peakly (kept).","example":"Domicilio Perez"},"incoming":{"type":"object","description":"Value in the payload (not applied).","example":"Domicilio Pérez"}},"required":["id","externalId","field","peakly","incoming"]},"RosterSyncSitesResultDto":{"type":"object","properties":{"created":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncCreatedSiteDto"}},"linked":{"description":"Existing branches (same name, no external id yet) now linked to the external id.","type":"array","items":{"$ref":"#/components/schemas/RosterSyncRefDto"}},"unchanged":{"type":"number","example":12,"description":"Sites already linked; nothing changed (drift is reported apart)."},"disabled":{"description":"Linked branches absent from the payload: app check-in turned off (the branch is kept).","type":"array","items":{"$ref":"#/components/schemas/RosterSyncRefDto"}},"drift":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncDriftDto"}}},"required":["created","linked","unchanged","disabled","drift"]},"RosterSyncCreatedEmployeeDto":{"type":"object","properties":{"id":{"type":"integer","nullable":true,"example":310,"description":"Peakly employee id; null on a dry run."},"externalId":{"type":"string","example":"cuidadora_j97xyz"},"branchId":{"type":"integer","nullable":true,"example":41,"description":"Assigned branch; null without one (or a site created on a dry run)."},"siteExternalId":{"type":"string","nullable":true,"example":"srv_k57abc","description":"externalId of the assigned site."}},"required":["id","externalId","branchId","siteExternalId"]},"RosterSyncReassignedDto":{"type":"object","properties":{"id":{"type":"number","example":310},"externalId":{"type":"string","example":"cuidadora_j97xyz"},"fromBranchId":{"type":"integer","nullable":true,"example":40},"toBranchId":{"type":"integer","nullable":true,"example":41,"description":"Null: no branch (or a site created on a dry run)."},"toSiteExternalId":{"type":"string","nullable":true,"example":"srv_k57abc"}},"required":["id","externalId","fromBranchId","toBranchId","toSiteExternalId"]},"RosterSyncUpdatedDto":{"type":"object","properties":{"id":{"type":"number","example":310},"externalId":{"type":"string","example":"cuidadora_j97xyz"},"fields":{"example":["phone"],"description":"Fields filled because they were empty in Peakly: phone, hireDate.","type":"array","items":{"type":"string"}}},"required":["id","externalId","fields"]},"RosterSyncInvitedDto":{"type":"object","properties":{"id":{"type":"number","example":310},"externalId":{"type":"string","example":"cuidadora_j97xyz"},"emailSent":{"type":"boolean","example":true,"description":"False when the invitation could not be issued or its email failed."}},"required":["id","externalId","emailSent"]},"RosterSyncEmployeesResultDto":{"type":"object","properties":{"created":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncCreatedEmployeeDto"}},"linked":{"description":"Existing employees (same DNI, else same email, no external id yet) now linked.","type":"array","items":{"$ref":"#/components/schemas/RosterSyncRefDto"}},"reassigned":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncReassignedDto"}},"reactivated":{"description":"Inactive employees present in the payload, reactivated.","type":"array","items":{"$ref":"#/components/schemas/RosterSyncRefDto"}},"deactivated":{"description":"Linked active employees absent from the payload, deactivated with today's date (devices and pending invitations revoked).","type":"array","items":{"$ref":"#/components/schemas/RosterSyncRefDto"}},"updated":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncUpdatedDto"}},"invited":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncInvitedDto"}},"unchanged":{"type":"number","example":87,"description":"Employees already linked with nothing to change (drift is reported apart)."},"drift":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncDriftDto"}}},"required":["created","linked","reassigned","reactivated","deactivated","updated","invited","unchanged","drift"]},"RosterSyncSkippedDto":{"type":"object","properties":{"kind":{"type":"string","enum":["site","employee"]},"externalId":{"type":"string","example":"srv_k57abc"},"code":{"type":"string","example":"unknown_province","description":"unknown_province, invalid_coordinates, site_name_conflict, site_deleted_in_peakly, invalid_document, invalid_email, invalid_employee, document_conflict, email_conflict, duplicate_in_payload, hire_date_in_future."},"reason":{"type":"string","example":"La provincia \"Narnia\" no está en el catálogo de Peakly."}},"required":["kind","externalId","code","reason"]},"RosterSyncResponseDto":{"type":"object","properties":{"dryRun":{"type":"boolean","example":false},"sites":{"$ref":"#/components/schemas/RosterSyncSitesResultDto"},"employees":{"$ref":"#/components/schemas/RosterSyncEmployeesResultDto"},"skipped":{"type":"array","items":{"$ref":"#/components/schemas/RosterSyncSkippedDto"}}},"required":["dryRun","sites","employees","skipped"]}}},"security":[{"apiKey":[]}]}