{"openapi": "3.1.0", "info": {"title": "N1 API", "version": "1", "description": "## Introducci\u00f3n\n\nLa API de N1 permite integrar tu sistema con la plataforma: consultar documentos electr\u00f3nicos, administrar contactos, cargar documentos, causar en tu software contable, enviar eventos DIAN y recibir webhooks. Todas las rutas viven bajo `https://api.n1.app/v1`. Los cuerpos de solicitud y respuesta son JSON en UTF-8; las fechas van en ISO 8601 UTC (`2026-01-31T15:04:05Z`) y los montos como cadenas decimales con dos cifras (`\"1250000.00\"`).\n\n## Autenticaci\u00f3n\n\nCada solicitud lleva una clave de API en el encabezado `Authorization`:\n\n```\nAuthorization: Bearer n1_live_<id>_<secreto>\n```\n\nLas claves se crean en **Configuraci\u00f3n \u2192 API** del panel de N1 y se muestran completas una sola vez. Cada clave pertenece a un usuario, tiene una lista de scopes y puede tener fecha de vencimiento. En cuanto a empresas, hay dos tipos de clave: con acceso a **todas las empresas del usuario** (`all_companies: true`), que incluye autom\u00e1ticamente las empresas a las que el usuario se una despu\u00e9s de crearla, o restringida a una **lista de empresas** elegida al crearla. Una clave revocada o vencida responde `401` con `code` `api_key_revoked` o `api_key_expired`. Si la cuenta no tiene habilitada la API, la respuesta es `403 feature_not_enabled`.\n\n`GET /v1/me` devuelve la clave actual, sus scopes, si tiene acceso a todas las empresas y las empresas a las que hoy tiene acceso.\n\n## Habilitaci\u00f3n DIAN\n\nAntes de enviar eventos DIAN, cada empresa debe estar habilitada ante la DIAN, y la habilitaci\u00f3n se hace una sola vez por empresa. El flujo es:\n\n1. `GET /v1/companies/{id}/dian-habilitation` devuelve `government_status` (`NOT_STARTED`, `PENDING`, `IN_PROCESS`, `AUTHORIZED` o `UNAUTHORIZED`), `is_authorized`, `last_error`, la ejecuci\u00f3n en curso (`active_run`) y la m\u00e1s reciente (`last_run`). Si ya es `AUTHORIZED`, no hay nada m\u00e1s que hacer.\n2. Elige una de las dos modalidades:\n   - **Autom\u00e1tica:** `POST .../dian-habilitation/start` con `auth_url` (el enlace de autorizaci\u00f3n de la DIAN, que empieza por `https://catalogo-vpfe-hab.dian.gov.co/`) y `authorization_confirmed: true`, que confirma que el usuario autoriz\u00f3 a Alegra como proveedor tecnol\u00f3gico. Responde `202` con la ejecuci\u00f3n encolada; si ya hay una activa, devuelve esa misma.\n   - **Manual:** `POST .../dian-habilitation/register` con `test_set_id` (identificador del Test-Set de la DIAN, m\u00e1ximo 64 caracteres) y `dv` (d\u00edgito de verificaci\u00f3n del NIT, de 0 a 9, enviado como cadena JSON: `\"dv\": \"7\"`). Responde `202` con el estado actual.\n3. Consulta `GET .../dian-habilitation` peri\u00f3dicamente (no hay webhook para este flujo) hasta que `government_status` sea `AUTHORIZED`. Si queda en `UNAUTHORIZED`, revisa `last_error` y reintenta. Si el run autom\u00e1tico falla, revisa `last_run.error_code` (y `last_run.error_message`) antes de reintentar.\n4. `POST .../dian-habilitation/cancel` cancela la ejecuci\u00f3n autom\u00e1tica mientras no haya pasado a registro; sin ejecuci\u00f3n activa responde `200` con el estado actual.\n\nUna vez `AUTHORIZED`, ya puedes enviar eventos y usar las importaciones de documentos DIAN (`dian-imports`). El enlace de habilitaci\u00f3n (`catalogo-vpfe-hab.dian.gov.co`) es distinto del enlace de importaci\u00f3n (`catalogo-vpfe.dian.gov.co`): no los intercambies.\n\nLas consultas requieren el scope `dian_events:read` y rol de preparador; las acciones requieren `dian_events:write` y rol de administrador. Los errores propios de este flujo:\n\n| Estado | `code` | Cu\u00e1ndo ocurre |\n|---|---|---|\n| 409 | `already_authorized` | La empresa ya est\u00e1 habilitada. |\n| 409 | `run_active` | Hay una habilitaci\u00f3n en curso; espera a que termine o canc\u00e9lala. |\n| 422 | `validation_error` | `auth_url`, `test_set_id` o `dv` inv\u00e1lidos, o falta confirmar la autorizaci\u00f3n. El detalle va en `errors`. |\n| 503 | `dispatch_failed` | No se pudo encolar la habilitaci\u00f3n (`start`) o el registro (`register`); reintenta m\u00e1s tarde. |\n\nValores de `errors[].code` en los `422`:\n\n| Campo | `code` | Cu\u00e1ndo ocurre |\n|---|---|---|\n| `auth_url` | `invalid_url` | El enlace no es una URL v\u00e1lida, no es del portal de habilitaci\u00f3n o es demasiado largo. |\n| `auth_url` | `prod_url_not_hab` | Es el enlace de producci\u00f3n (`catalogo-vpfe`) y no el de habilitaci\u00f3n. |\n| `auth_url` | `not_auth_token_url` | No es un enlace de autorizaci\u00f3n (`/User/AuthToken`). |\n| `auth_url` | `missing_params` | Al enlace le faltan par\u00e1metros. |\n| `auth_url` | `nit_mismatch` | El enlace es de otro NIT. |\n| `authorization_confirmed` | `authorization_required` | No se confirm\u00f3 la autorizaci\u00f3n a Alegra. |\n| `test_set_id` | `test_set_id_invalid` | Vac\u00edo o de m\u00e1s de 64 caracteres. |\n| `dv` | `dv_invalid` | No es un solo d\u00edgito entre 0 y 9. |\n\n## Gu\u00edas\n\nInicio r\u00e1pido, permisos por empresa, estado de causaci\u00f3n, archivos, paginaci\u00f3n, errores, idempotencia, l\u00edmites de tasa, webhooks (firma y reintentos), versionado y soporte est\u00e1n en [n1.app/docs/api](https://n1.app/docs/api). Esta referencia describe cada endpoint con sus par\u00e1metros, cuerpos y respuestas.\n\n## Agentes de escritorio (trabajos externos)\n\nCon estas rutas tu sistema escribe documentos (compras, ventas, notas contables) en el software contable del cliente a trav\u00e9s del **N1 Agente** instalado en su equipo Windows: t\u00fa env\u00edas el documento, N1 lo valida y lo encola, el equipo lo escribe y t\u00fa consultas el resultado o lo recibes por webhook.\n\n**Doble consentimiento.** Hacen falta dos permisos independientes: la clave debe tener el scope `desktop_agents:read` o `desktop_agents:write`, y un administrador de la empresa debe activar en N1 el permiso de causaciones externas del equipo. Sin el interruptor, la creaci\u00f3n responde `403 desktop_agent_external_jobs_disabled`; validar y consultar siguen disponibles. Si el administrador lo apaga, N1 cancela los trabajos que ning\u00fan equipo ha tomado y libera sus cr\u00e9ditos; los que el equipo ya tom\u00f3 alguna vez terminan normalmente. Reactivar un equipo que ya estaba activo no cambia qui\u00e9n dio el consentimiento.\n\n**Qui\u00e9n puede usarlo.** El equipo debe pertenecer al usuario due\u00f1o de la clave y estar vinculado a la empresa; la clave debe tener acceso a esa empresa y rol de administrador para crear o cancelar (preparador para validar y consultar). Cuando no se cumple, la respuesta es `403 desktop_agent_device_not_eligible`.\n\n**Rutas.**\n\n- `GET /v1/desktop-agents/devices`: equipos, presencia, capacidades, interruptor y empresas listas.\n- `GET /v1/desktop-agents/companies/{company_id}/references`: cat\u00e1logos sincronizados desde el software contable.\n- `GET /v1/desktop-agents/companies/{company_id}/settings`: configuraci\u00f3n de la integraci\u00f3n (solo lectura).\n- `GET /v1/desktop-agents/job-types`: tipos de trabajo y su esquema JSON.\n- `POST /v1/desktop-agents/companies/{company_id}/jobs/validate`: valida sin escribir ni cobrar.\n- `POST /v1/desktop-agents/companies/{company_id}/jobs`: crea uno o varios trabajos.\n- `GET /v1/desktop-agents/jobs/{job_id}` y `GET /v1/desktop-agents/jobs`: consulta y listado (filtros `business_key` y `status`).\n- `POST /v1/desktop-agents/jobs/{job_id}/cancel`: cancela mientras el trabajo est\u00e1 `pending` y ning\u00fan equipo lo ha tomado nunca.\n\n**Idempotencia.** Cada documento lleva una `idempotency_key` propia (\u00fanica por clave de API). Repetir la misma `idempotency_key` con el mismo contenido devuelve el trabajo original con `200` y el encabezado `Idempotent-Replayed: true`, sin crear otro ni cobrar de nuevo; con contenido distinto responde `409 idempotency_conflict` e indica `existing_job_id`.\n\n**Identidad de negocio.** Te recomendamos enviar una `business_key` con la forma `<autoridad>:<tipo>:<id>#post` (por ejemplo `erp:compra:FC-1001#post`). Mientras exista un trabajo vivo o escrito con esa `business_key`, no se crea otro para la misma empresa: queda consumida por los estados `pending`, `claimed`, `running`, `reconciling`, `conflict` y `succeeded`, y se libera al terminar en `failed`, `expired`, `cancelled` o `refused` (`refused` est\u00e1 reservado para uso futuro y hoy ning\u00fan trabajo queda en ese estado). Si el equipo no pudo confirmar si escribi\u00f3 el documento, la `business_key` queda bloqueada y la creaci\u00f3n responde `423 write_uncertain` (o `423 write_blocked` tras fallos repetidos): no reintentes; un operador de N1 revisa el software contable y libera el trabajo como escrito o no escrito.\n\n**L\u00edmites.** Por empresa y por hora: 60 documentos al crear, 600 al validar y 20 documentos por lote. Se cuentan documentos, no llamadas, y un lote rechazado tambi\u00e9n consume su cupo, salvo si supera el tama\u00f1o m\u00e1ximo. En crear y validar, los encabezados `RateLimit-*` reflejan la cuota por hora de la empresa y no la de la clave. Las repeticiones idempotentes devuelven `Idempotent-Replayed: true` y no se cobran. Cada trabajo reserva un cr\u00e9dito, que se consume al escribirse y se libera si falla, vence o se cancela. El cuerpo admite hasta 1 MB y cada documento hasta 256 KB.\n\n**Vencimiento y reversos.** Un trabajo que ning\u00fan equipo toma vence a las 24 horas (`expired`). No existe borrado: para revertir un documento ya escrito, env\u00eda un documento contrario (por ejemplo una nota contable) con una `business_key` nueva.\n\n**Resultado.** `result.verification` trae lo que el equipo ley\u00f3 del software contable despu\u00e9s de escribir, para que compares el documento registrado con el que enviaste. Si fall\u00f3, `result.error_code` y `result.user_message` explican el motivo en lenguaje del usuario. `GET /v1/desktop-agents/jobs/{job_id}` incluye adem\u00e1s los cr\u00e9ditos y la l\u00ednea de tiempo.\n\n**Webhooks.** Se emiten cuatro eventos: `desktop_agent.job.succeeded`, `desktop_agent.job.failed`, `desktop_agent.job.expired` y `desktop_agent.job.cancelled`. Su `data` es el trabajo tal como lo devuelve `GET /v1/desktop-agents/jobs/{job_id}`, sin el campo `payload` (tu documento) ni `replayed`.\n\n## Integraciones de escritorio\n\nCon estas rutas tu sistema deja lista una integraci\u00f3n de escritorio (World Office o Siigo Pyme) sin abrir el panel de N1; solo hace falta que el usuario abra el enlace de vinculaci\u00f3n y asigne la empresa en N1 Agente, en su PC. En las rutas, `{name}` es `world_office_desktop` o `siigo_pyme_desktop` (el alias `siigo_pyme` equivale a `siigo_pyme_desktop`). El orden es:\n\n1. **Cr\u00e9ditos.** `GET /v1/me/credits` confirma que la billetera tiene saldo.\n2. **DIAN.** Deja la configuraci\u00f3n DIAN de la empresa completa en N1 antes de activar la integraci\u00f3n.\n3. **Activar.** `POST /v1/companies/{company_id}/integrations/{name}/activate`.\n4. **Vincular el equipo.** `POST /v1/desktop-agents/enrollments` entrega una `credential` (y, con `kind: link`, el enlace `n1-agente://`) que se muestra una sola vez: N1 no la guarda ni la vuelve a mostrar, as\u00ed que p\u00e1sala de inmediato al usuario. Cuando el equipo aparezca en `GET /v1/desktop-agents/devices` con `confirmation_required: true`, conf\u00edrmalo con `POST /v1/desktop-agents/devices/{device_id}/confirm`.\n5. **Asignar la empresa en el PC.** El usuario abre N1 Agente en su PC, asigna la empresa de N1 a la empresa del software contable y confirma la copia de seguridad. Eso crea la vinculaci\u00f3n del equipo con la empresa; la API no puede hacer este paso. Cuando termina, la empresa aparece en `companies` del equipo en `GET /v1/desktop-agents/devices`.\n6. **Seleccionar el equipo.** `PUT /v1/companies/{company_id}/integrations/{name}/device`. Antes del paso 5 responde `409 conflict` con `existing_device_unavailable`. Al seleccionarlo, N1 le pide sincronizar los cat\u00e1logos.\n7. **Cat\u00e1logos.** La sincronizaci\u00f3n termina cuando cambia `last_reference_sync_at` en `GET /v1/companies/{company_id}/integrations/{name}`; `reference_scopes_synced` lista los cat\u00e1logos recibidos. `POST .../references/refresh` la pide de nuevo.\n8. **Preferencias y homologaciones, o historial.** Configura las preferencias por proveedor, la agrupaci\u00f3n de \u00edtems (World Office), la configuraci\u00f3n de documentos (Siigo Pyme) y la homologaci\u00f3n de productos, o deja que N1 las proponga leyendo el historial del software contable (`history-scans` y `history-suggestions`; cada propuesta se acepta o se rechaza con `decide`). Los valores se validan contra los cat\u00e1logos sincronizados, as\u00ed que espera al paso 7.\n9. **Preparaci\u00f3n por documento.** `GET /v1/companies/{company_id}/exports/readiness?document_id=&integration=` eval\u00faa en el momento un documento y devuelve `status` (`READY`, `MISSING`, `ALREADY_SYNCED` o `UNKNOWN`) con los faltantes en `issues`. La preparaci\u00f3n es de cada documento, no de la integraci\u00f3n: `GET /v1/companies/{company_id}/integrations/{name}` no la incluye.\n10. **Exportar.** Con el documento en `READY`, `POST /v1/companies/{company_id}/exports` lo encola.\n\n**Rec\u00e1lculo de la preparaci\u00f3n guardada.** N1 guarda la preparaci\u00f3n de cada documento para la exportaci\u00f3n autom\u00e1tica y los filtros del panel. Las escrituras de preferencias, agrupaci\u00f3n, homologaciones y configuraci\u00f3n de documentos, y la aceptaci\u00f3n de una propuesta del historial, la recalculan antes de responder para los documentos afectados, hasta `SYNC_RECOMPUTE_LIMIT` (300) documentos por tipo de documento; el resto se recalcula en segundo plano. Rechazar una propuesta, decidir una plantilla contable (`accounting_template`), activar, seleccionar el equipo y refrescar los cat\u00e1logos no la recalculan. `GET .../exports/readiness` siempre eval\u00faa en el momento, as\u00ed que \u00fasalo para confirmar un documento.\n\n**Propuestas de productos.** Una homologaci\u00f3n aceptada desde el historial queda guardada con el concepto normalizado de la l\u00ednea (min\u00fasculas, sin fechas ni n\u00fameros largos). La preparaci\u00f3n y la exportaci\u00f3n usan primero la homologaci\u00f3n con el nombre exacto del producto y, si no existe, la del concepto normalizado del nombre.\n\n**Homologaci\u00f3n de productos.** En World Office, `PUT .../item-mappings` combina con lo guardado: la cuenta y el centro de costos que no se env\u00edan conservan su valor. En Siigo Pyme reemplaza la homologaci\u00f3n del producto: un campo que no se env\u00eda queda vac\u00edo.\n\n**Desactivar.** `DELETE /v1/companies/{company_id}/integrations/{name}` es irreversible y no se puede deshacer desde la API; si la integraci\u00f3n ya no existe responde `204`.\n\n## Soporte\n\nEscr\u00edbenos por el chat de soporte del panel de N1. Cada respuesta incluye el encabezado `X-Request-ID` (eco del que env\u00edes o generado por N1) y los errores lo repiten en el campo `request_id`: incl\u00fayelo siempre junto con la ruta, el m\u00e9todo y la hora aproximada para que podamos rastrear la solicitud.\n"}, "paths": {"/v1/me": {"get": {"operationId": "get_me", "summary": "Informaci\u00f3n de la clave actual", "parameters": [], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MeOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la clave de API con la que te autenticaste, el usuario due\u00f1o y las empresas a las que la clave tiene acceso hoy. Si `all_companies` es `true`, son todas las empresas en las que el usuario es miembro, incluidas las que se unan despu\u00e9s de crear la clave; si es `false`, solo las empresas seleccionadas al crearla en las que el usuario sigue siendo miembro.", "tags": ["Cuenta"], "security": [{"ApiKeyAuth": []}]}}, "/v1/me/credits": {"get": {"operationId": "get_me_credits", "summary": "Cr\u00e9ditos disponibles", "parameters": [{"in": "query", "name": "company_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Empresa para la que se resuelve qui\u00e9n paga. Sin ella se devuelve la billetera del usuario de la clave.", "title": "Company Id"}, "required": false, "description": "Empresa para la que se resuelve qui\u00e9n paga. Sin ella se devuelve la billetera del usuario de la clave."}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CreditsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve los cr\u00e9ditos de la billetera que paga las acciones del usuario de la clave. Con `company_id`, resuelve si esa empresa la paga la organizaci\u00f3n (`payer: organization`) o el propio usuario (`payer: self`).", "tags": ["Cuenta"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies": {"get": {"operationId": "list_companies", "summary": "Listar empresas accesibles", "parameters": [], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"items": {"$ref": "#/components/schemas/CompanyOut"}, "title": "Response", "type": "array"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las empresas a las que la clave tiene acceso hoy: todas las empresas del usuario si la clave no tiene restricci\u00f3n de empresas, o las empresas seleccionadas al crearla. En ambos casos solo aparecen empresas en las que el usuario sigue siendo miembro. Requiere el scope `companies:read`.", "tags": ["Empresas"], "security": [{"ApiKeyAuth": []}]}, "post": {"operationId": "create_company", "summary": "Crear una empresa", "parameters": [], "responses": {"201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CompanyOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Crea una empresa nueva. El usuario due\u00f1o de la clave queda como administrador y la empresa queda accesible para la clave (si la clave est\u00e1 restringida a empresas, se agrega a su lista). El NIT se env\u00eda sin d\u00edgito de verificaci\u00f3n. Requiere el scope `companies:write`.", "tags": ["Empresas"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/CompanyCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}": {"get": {"operationId": "get_company", "summary": "Consultar una empresa", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CompanyOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve los datos b\u00e1sicos de una empresa autorizada para la clave.", "tags": ["Empresas"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/invitations": {"post": {"operationId": "create_company_invitation", "summary": "Invitar un usuario a la empresa", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/InvitationOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Env\u00eda una invitaci\u00f3n por correo para unirse a la empresa con el rol indicado (`admin`, `preparer` o `viewer`) y devuelve el enlace de aceptaci\u00f3n. Requiere el scope `companies:write` y rol de administrador.", "tags": ["Empresas"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/InvitationIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/invoices": {"get": {"operationId": "list_invoices", "summary": "Listar facturas electr\u00f3nicas", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "issued_from", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "issued_to", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "required": false, "description": "Solo documentos actualizados desde esta fecha y hora."}, {"in": "query", "name": "synced", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "required": false, "description": "Solo documentos causados (o no) en la integraci\u00f3n."}, {"in": "query", "name": "contact_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "required": false, "description": "Identificador del contacto (tercero)."}, {"in": "query", "name": "imported_file_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "required": false, "description": "Solo documentos del archivo cargado indicado."}, {"in": "query", "name": "search", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "required": false, "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero."}, {"in": "query", "name": "cufe", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "CUFE/CUDE exacto.", "title": "Cufe"}, "required": false, "description": "CUFE/CUDE exacto."}, {"in": "query", "name": "kind", "schema": {"anyOf": [{"enum": ["purchase", "sales"], "type": "string"}, {"type": "null"}], "description": "`purchase` (facturas recibidas) o `sales` (emitidas por la empresa).", "title": "Kind"}, "required": false, "description": "`purchase` (facturas recibidas) o `sales` (emitidas por la empresa)."}, {"in": "query", "name": "dian_event_state", "schema": {"anyOf": [{"enum": ["none", "in_progress", "accepted", "claimed"], "type": "string"}, {"type": "null"}], "description": "Estado de los eventos RADIAN de facturas a cr\u00e9dito: `none`, `in_progress`, `accepted` o `claimed`.", "title": "Dian Event State"}, "required": false, "description": "Estado de los eventos RADIAN de facturas a cr\u00e9dito: `none`, `in_progress`, `accepted` o `claimed`."}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedInvoiceOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las facturas electr\u00f3nicas (recibidas y emitidas) de la empresa, de la m\u00e1s reciente a la m\u00e1s antigua seg\u00fan su fecha de importaci\u00f3n. Requiere el scope `documents:read`.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/invoices/{invoice_id}": {"get": {"operationId": "get_invoice", "summary": "Consultar una factura electr\u00f3nica", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "invoice_id", "schema": {"title": "Invoice Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/InvoiceDetailOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la factura con sus l\u00edneas, impuestos, retenciones, \u00faltimo intento de exportaci\u00f3n por integraci\u00f3n y estado de eventos RADIAN.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/invoices/{invoice_id}/pdf": {"get": {"operationId": "download_invoice_pdf", "summary": "Descargar el PDF de una factura", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "invoice_id", "schema": {"title": "Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con la representaci\u00f3n en PDF del documento. Revisa `files.pdf.status` en el documento antes de llamar; responde 404 `file_not_available` si no existe o no se pudo generar.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/invoices/{invoice_id}/original": {"get": {"operationId": "download_invoice_original", "summary": "Descargar el archivo original de una factura", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "invoice_id", "schema": {"title": "Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con el archivo tal como lleg\u00f3 a N1 (XML, ZIP o PDF). Revisa `files.original` en el documento antes de llamar; responde 404 `file_not_available` si no existe.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/credit-notes": {"get": {"operationId": "list_credit_notes", "summary": "Listar notas cr\u00e9dito", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "issued_from", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "issued_to", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "required": false, "description": "Solo documentos actualizados desde esta fecha y hora."}, {"in": "query", "name": "synced", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "required": false, "description": "Solo documentos causados (o no) en la integraci\u00f3n."}, {"in": "query", "name": "contact_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "required": false, "description": "Identificador del contacto (tercero)."}, {"in": "query", "name": "imported_file_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "required": false, "description": "Solo documentos del archivo cargado indicado."}, {"in": "query", "name": "search", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "required": false, "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero."}, {"in": "query", "name": "cufe", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "CUFE/CUDE exacto.", "title": "Cufe"}, "required": false, "description": "CUFE/CUDE exacto."}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedCreditNoteOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las notas cr\u00e9dito electr\u00f3nicas de la empresa. Requiere `documents:read`.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/credit-notes/{credit_note_id}": {"get": {"operationId": "get_credit_note", "summary": "Consultar una nota cr\u00e9dito", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "credit_note_id", "schema": {"title": "Credit Note Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CreditNoteDetailOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la nota cr\u00e9dito con sus l\u00edneas, impuestos y exportaciones.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/credit-notes/{credit_note_id}/pdf": {"get": {"operationId": "download_credit_note_pdf", "summary": "Descargar el PDF de una nota cr\u00e9dito", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "credit_note_id", "schema": {"title": "Credit Note Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con la representaci\u00f3n en PDF del documento. Revisa `files.pdf.status` en el documento antes de llamar; responde 404 `file_not_available` si no existe o no se pudo generar.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/credit-notes/{credit_note_id}/original": {"get": {"operationId": "download_credit_note_original", "summary": "Descargar el archivo original de una nota cr\u00e9dito", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "credit_note_id", "schema": {"title": "Credit Note Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con el archivo tal como lleg\u00f3 a N1 (XML, ZIP o PDF). Revisa `files.original` en el documento antes de llamar; responde 404 `file_not_available` si no existe.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contractor-invoices": {"get": {"operationId": "list_contractor_invoices", "summary": "Listar cuentas de cobro", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "issued_from", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "issued_to", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "required": false, "description": "Solo documentos actualizados desde esta fecha y hora."}, {"in": "query", "name": "synced", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "required": false, "description": "Solo documentos causados (o no) en la integraci\u00f3n."}, {"in": "query", "name": "contact_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "required": false, "description": "Identificador del contacto (tercero)."}, {"in": "query", "name": "imported_file_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "required": false, "description": "Solo documentos del archivo cargado indicado."}, {"in": "query", "name": "search", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "required": false, "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero."}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedContractorInvoiceOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las cuentas de cobro de la empresa. Requiere `documents:read`.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contractor-invoices/{contractor_invoice_id}": {"get": {"operationId": "get_contractor_invoice", "summary": "Consultar una cuenta de cobro", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contractor_invoice_id", "schema": {"title": "Contractor Invoice Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContractorInvoiceDetailOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la cuenta de cobro con sus l\u00edneas y exportaciones.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contractor-invoices/{contractor_invoice_id}/pdf": {"get": {"operationId": "download_contractor_invoice_pdf", "summary": "Descargar el PDF de una cuenta de cobro", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contractor_invoice_id", "schema": {"title": "Contractor Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con la representaci\u00f3n en PDF del documento. Revisa `files.pdf.status` en el documento antes de llamar; responde 404 `file_not_available` si no existe o no se pudo generar.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contractor-invoices/{contractor_invoice_id}/original": {"get": {"operationId": "download_contractor_invoice_original", "summary": "Descargar el archivo original de una cuenta de cobro", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contractor_invoice_id", "schema": {"title": "Contractor Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con el archivo tal como lleg\u00f3 a N1 (XML, ZIP o PDF). Revisa `files.original` en el documento antes de llamar; responde 404 `file_not_available` si no existe.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/international-invoices": {"get": {"operationId": "list_international_invoices", "summary": "Listar facturas del exterior", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "issued_from", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "issued_to", "schema": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "required": false, "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia)."}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "required": false, "description": "Solo documentos actualizados desde esta fecha y hora."}, {"in": "query", "name": "synced", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "required": false, "description": "Solo documentos causados (o no) en la integraci\u00f3n."}, {"in": "query", "name": "contact_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "required": false, "description": "Identificador del contacto (tercero)."}, {"in": "query", "name": "imported_file_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "required": false, "description": "Solo documentos del archivo cargado indicado."}, {"in": "query", "name": "search", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "required": false, "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero."}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedInternationalInvoiceOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las facturas de proveedores del exterior. Requiere `documents:read`.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/international-invoices/{international_invoice_id}": {"get": {"operationId": "get_international_invoice", "summary": "Consultar una factura del exterior", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "international_invoice_id", "schema": {"title": "International Invoice Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/InternationalInvoiceDetailOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la factura del exterior con sus l\u00edneas y exportaciones.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/international-invoices/{international_invoice_id}/pdf": {"get": {"operationId": "download_international_invoice_pdf", "summary": "Descargar el PDF de una factura del exterior", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "international_invoice_id", "schema": {"title": "International Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con la representaci\u00f3n en PDF del documento. Revisa `files.pdf.status` en el documento antes de llamar; responde 404 `file_not_available` si no existe o no se pudo generar.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/international-invoices/{international_invoice_id}/original": {"get": {"operationId": "download_international_invoice_original", "summary": "Descargar el archivo original de una factura del exterior", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "international_invoice_id", "schema": {"title": "International Invoice Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con el archivo tal como lleg\u00f3 a N1 (XML, ZIP o PDF). Revisa `files.original` en el documento antes de llamar; responde 404 `file_not_available` si no existe.", "tags": ["Documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contacts": {"get": {"operationId": "list_contacts", "summary": "Listar contactos", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "id_number", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "N\u00famero de identificaci\u00f3n exacto.", "title": "Id Number"}, "required": false, "description": "N\u00famero de identificaci\u00f3n exacto."}, {"in": "query", "name": "search", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por nombre, raz\u00f3n social o n\u00famero de identificaci\u00f3n.", "title": "Search"}, "required": false, "description": "B\u00fasqueda por nombre, raz\u00f3n social o n\u00famero de identificaci\u00f3n."}, {"in": "query", "name": "is_supplier", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Supplier"}, "required": false}, {"in": "query", "name": "is_client", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Client"}, "required": false}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo contactos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "required": false, "description": "Solo contactos actualizados desde esta fecha y hora."}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedContactOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los contactos (clientes y proveedores) de la empresa, ordenados del m\u00e1s reciente al m\u00e1s antiguo. Requiere el scope `contacts:read`.", "tags": ["Contactos"], "security": [{"ApiKeyAuth": []}]}, "post": {"operationId": "create_contact", "summary": "Crear un contacto", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Crea un contacto en la empresa. El n\u00famero de identificaci\u00f3n debe ser \u00fanico por empresa. Requiere el scope `contacts:write` y rol de administrador. Emite el evento `contact.created`.", "tags": ["Contactos"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/contacts/{contact_id}": {"get": {"operationId": "get_contact", "summary": "Consultar un contacto", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contact_id", "schema": {"title": "Contact Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve un contacto de la empresa por su identificador.", "tags": ["Contactos"], "security": [{"ApiKeyAuth": []}]}, "patch": {"operationId": "update_contact", "summary": "Actualizar un contacto", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contact_id", "schema": {"title": "Contact Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Actualiza solo los campos enviados. Requiere el scope `contacts:write` y rol de administrador. Emite el evento `contact.updated`.", "tags": ["Contactos"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactUpdateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/files": {"post": {"operationId": "upload_file", "summary": "Subir un documento para procesar", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ImportedFileOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Recibe un archivo (XML, ZIP o PDF de factura electr\u00f3nica, o documento soporte) de hasta 25 MB y lo encola para procesamiento; otros tipos, archivos cuyo contenido no coincide con su extensi\u00f3n, XML con DTD o ZIP cifrados, anidados o demasiado grandes al descomprimir responden 422. Las importaciones desde Excel solo est\u00e1n disponibles en la interfaz web. Consulta el estado con `GET /companies/{company_id}/files/{file_id}`. Requiere el scope `imports:write` y rol de preparador.", "tags": ["Carga de documentos"], "requestBody": {"content": {"multipart/form-data": {"schema": {"properties": {"file": {"format": "binary", "title": "File", "type": "string"}}, "required": ["file"], "title": "FileParams", "type": "object"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}, "get": {"operationId": "list_files", "summary": "Listar archivos cargados", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "status", "schema": {"anyOf": [{"$ref": "#/components/schemas/ImportedFileStatus"}, {"type": "null"}]}, "required": false}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedImportedFileOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los archivos cargados en la empresa (manuales, por correo o desde la DIAN), del m\u00e1s reciente al m\u00e1s antiguo. Requiere el scope `imports:read`.", "tags": ["Carga de documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/files/{file_id}": {"get": {"operationId": "get_file", "summary": "Consultar un archivo cargado", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "file_id", "schema": {"title": "File Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ImportedFileOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado de procesamiento de un archivo y los documentos generados a partir de \u00e9l.", "tags": ["Carga de documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/files/{file_id}/content": {"get": {"operationId": "download_file_content", "summary": "Descargar un archivo cargado", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "file_id", "schema": {"title": "File Id", "type": "integer"}, "required": true}], "responses": {"302": {"description": "Found"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Redirige (302) a una URL firmada, v\u00e1lida por una hora, con el archivo tal como se recibi\u00f3 (carga manual, correo o importaci\u00f3n DIAN). Responde 404 `file_not_available` si N1 ya no tiene el archivo. Requiere el scope `imports:read`.", "tags": ["Carga de documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-imports": {"post": {"operationId": "create_dian_import", "summary": "Iniciar una importaci\u00f3n desde la DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianImportationOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Inicia la importaci\u00f3n de documentos electr\u00f3nicos a partir del enlace recibido por correo desde la DIAN. El proceso corre en segundo plano; consulta su avance con `GET /companies/{company_id}/dian-imports/{id}`. Requiere el scope `imports:write` y rol de preparador.", "tags": ["Carga de documentos"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianImportationCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}, "get": {"operationId": "list_dian_imports", "summary": "Listar importaciones DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "status", "schema": {"anyOf": [{"$ref": "#/components/schemas/DianImportationStatusFilter"}, {"type": "null"}]}, "required": false}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedDianImportationOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las importaciones desde la DIAN de la empresa, de la m\u00e1s reciente a la m\u00e1s antigua. Requiere el scope `imports:read`.", "tags": ["Carga de documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-imports/{import_id}": {"get": {"operationId": "get_dian_import", "summary": "Consultar una importaci\u00f3n DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "import_id", "schema": {"title": "Import Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianImportationOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado, el avance del escaneo y los contadores de una importaci\u00f3n.", "tags": ["Carga de documentos"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/exports": {"get": {"operationId": "list_exports", "summary": "Listar exportaciones (causaciones)", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "status", "schema": {"anyOf": [{"$ref": "#/components/schemas/ExportStatus"}, {"type": "null"}]}, "required": false}, {"in": "query", "name": "integration", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`).", "title": "Integration"}, "required": false, "description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`)."}, {"in": "query", "name": "document_kind", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Tipo exportado (`export_kind`), p. ej. `electronic_invoice`.", "title": "Document Kind"}, "required": false, "description": "Tipo exportado (`export_kind`), p. ej. `electronic_invoice`."}, {"in": "query", "name": "document_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Document Id"}, "required": false}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedExportOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los intentos de exportaci\u00f3n hacia integraciones contables, del m\u00e1s reciente al m\u00e1s antiguo. Requiere el scope `exports:read`.", "tags": ["Causaci\u00f3n"], "security": [{"ApiKeyAuth": []}]}, "post": {"operationId": "create_export", "summary": "Causar un documento en una integraci\u00f3n", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExportQueuedOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Encola la exportaci\u00f3n de un documento a la integraci\u00f3n contable. Si el documento no est\u00e1 listo responde `409 export_not_ready` con los faltantes. El resultado se consulta en `GET /companies/{company_id}/exports` o llega por webhook. Requiere el scope `exports:write` y rol de administrador.", "tags": ["Causaci\u00f3n"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExportCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/exports/readiness": {"get": {"operationId": "get_export_readiness", "summary": "Verificar si un documento est\u00e1 listo para causar", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "document_id", "schema": {"title": "Document Id", "type": "integer"}, "required": true}, {"in": "query", "name": "integration", "schema": {"description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`).", "title": "Integration", "type": "string"}, "required": true, "description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`)."}, {"in": "query", "name": "document_kind", "schema": {"allOf": [{"enum": ["electronic_invoice", "contractor_invoice"], "title": "ExportDocumentKind", "type": "string"}], "default": "electronic_invoice"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ReadinessOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Eval\u00faa si el documento tiene toda la informaci\u00f3n necesaria (mapeos, contacto, retenciones) para exportarse a la integraci\u00f3n indicada y devuelve los faltantes. Requiere el scope `exports:read`.", "tags": ["Causaci\u00f3n"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/exports/{export_id}": {"get": {"operationId": "get_export", "summary": "Consultar una exportaci\u00f3n", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "export_id", "schema": {"title": "Export Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExportOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el detalle de un intento de exportaci\u00f3n, incluido el error si fall\u00f3.", "tags": ["Causaci\u00f3n"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-events": {"get": {"operationId": "list_dian_events", "summary": "Listar estados de eventos DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "cufe", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cufe"}, "required": false}, {"in": "query", "name": "is_paid", "schema": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Paid"}, "required": false}, {"in": "query", "name": "updated_since", "schema": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedDianEventStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista el estado de los eventos RADIAN (acuse, recibo del bien, aceptaci\u00f3n expresa, reclamo) por factura, ordenado por \u00faltima actualizaci\u00f3n. Requiere el scope `dian_events:read`.", "tags": ["Eventos DIAN"], "security": [{"ApiKeyAuth": []}]}, "post": {"operationId": "create_dian_event", "summary": "Enviar un evento DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianEventQueuedOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Encola el env\u00edo del evento RADIAN indicado para una factura a cr\u00e9dito. Los eventos previos faltantes se env\u00edan en cadena. Consume una aceptaci\u00f3n del saldo del usuario due\u00f1o de la clave si la factura no estaba pagada. Requiere el scope `dian_events:write` y rol de administrador.", "tags": ["Eventos DIAN"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianEventSendIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-events/{invoice_id}": {"get": {"operationId": "get_dian_events_for_invoice", "summary": "Consultar eventos DIAN de una factura", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "invoice_id", "schema": {"title": "Invoice Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DianEventStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado de eventos RADIAN de una factura por su identificador.", "tags": ["Eventos DIAN"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-habilitation": {"get": {"operationId": "get_dian_habilitation", "summary": "Consultar la habilitaci\u00f3n DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado de la habilitaci\u00f3n de la empresa para enviar eventos DIAN, la ejecuci\u00f3n en curso (`active_run`) y la m\u00e1s reciente (`last_run`). Si el run autom\u00e1tico falla, revisa `last_run.error_code`. Requiere el scope `dian_events:read` y rol de preparador.", "tags": ["Habilitaci\u00f3n DIAN"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-habilitation/start": {"post": {"operationId": "start_dian_habilitation", "summary": "Iniciar la habilitaci\u00f3n DIAN", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationStartOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "503": {"description": "Service Unavailable", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Encola la habilitaci\u00f3n autom\u00e1tica con la URL de autorizaci\u00f3n de la DIAN. Si ya hay una ejecuci\u00f3n activa, devuelve esa misma. Si no se puede encolar, responde 503 `dispatch_failed` y la ejecuci\u00f3n queda en `ERROR`. Requiere el scope `dian_events:write` y rol de administrador.", "tags": ["Habilitaci\u00f3n DIAN"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationStartIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-habilitation/register": {"post": {"operationId": "register_dian_habilitation", "summary": "Registrar la empresa con el set de pruebas", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "503": {"description": "Service Unavailable", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Registra la empresa en Alanube con el identificador del set de pruebas y el d\u00edgito de verificaci\u00f3n. Requiere el scope `dian_events:write` y rol de administrador.", "tags": ["Habilitaci\u00f3n DIAN"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationRegisterIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/dian-habilitation/cancel": {"post": {"operationId": "cancel_dian_habilitation", "summary": "Cancelar la habilitaci\u00f3n DIAN en curso", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HabilitationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Cancela la ejecuci\u00f3n de habilitaci\u00f3n si a\u00fan no ha pasado a registro. Sin ejecuci\u00f3n activa responde 200 con el estado actual. Requiere el scope `dian_events:write` y rol de administrador.", "tags": ["Habilitaci\u00f3n DIAN"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/webhooks": {"get": {"operationId": "list_webhooks", "summary": "Listar webhooks", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedWebhookEndpointOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los endpoints de webhook de la empresa. Requiere `webhooks:manage` y rol ADMIN.", "tags": ["Webhooks"], "security": [{"ApiKeyAuth": []}]}, "post": {"operationId": "create_webhook", "summary": "Crear un webhook", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookEndpointCreatedOut"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Crea un endpoint de webhook. La respuesta incluye el `secret` de firma una \u00fanica vez; gu\u00e1rdalo de forma segura. Lista de eventos vac\u00eda = todos.", "tags": ["Webhooks"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookEndpointIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/webhooks/{endpoint_id}": {"get": {"operationId": "get_webhook", "summary": "Consultar un webhook", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookEndpointOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "tags": ["Webhooks"], "security": [{"ApiKeyAuth": []}]}, "patch": {"operationId": "update_webhook", "summary": "Actualizar un webhook", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookEndpointOut"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Actualiza url, descripci\u00f3n, eventos o estado. Al habilitar de nuevo se reinicia el contador de fallos y se reanudan las entregas pendientes.", "tags": ["Webhooks"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookEndpointPatch"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}, "delete": {"operationId": "delete_webhook", "summary": "Eliminar un webhook", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}], "responses": {"204": {"description": "No Content"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Elimina el endpoint y su historial de entregas.", "tags": ["Webhooks"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/webhooks/{endpoint_id}/rotate-secret": {"post": {"operationId": "rotate_webhook_secret", "summary": "Rotar el secreto de firma", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookSecretOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Genera un nuevo secreto. El anterior deja de ser v\u00e1lido de inmediato.", "tags": ["Webhooks"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/webhooks/{endpoint_id}/test": {"post": {"operationId": "send_test_webhook", "summary": "Enviar un evento de prueba", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WebhookTestOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Encola un evento `webhook.test` hacia el endpoint y devuelve el id de la entrega.", "tags": ["Webhooks"], "requestBody": {"content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/WebhookTestIn"}, {"type": "null"}]}}}, "required": false}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/webhooks/{endpoint_id}/deliveries": {"get": {"operationId": "list_webhook_deliveries", "summary": "Listar entregas de un webhook", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "endpoint_id", "schema": {"title": "Endpoint Id", "type": "integer"}, "required": true}, {"in": "query", "name": "status", "schema": {"anyOf": [{"$ref": "#/components/schemas/WebhookDeliveryStatus"}, {"type": "null"}]}, "required": false}, {"in": "query", "name": "event_type", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Event Type"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedWebhookDeliveryOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Historial de entregas (\u00faltimos 30 d\u00edas). Filtros opcionales por `status` y `event_type`.", "tags": ["Webhooks"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/devices": {"get": {"operationId": "list_desktop_agent_devices", "summary": "Listar equipos con N1 Agente", "parameters": [], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DevicesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los equipos con N1 Agente del usuario due\u00f1o de la clave, con su presencia, versi\u00f3n, capacidades, si las causaciones externas est\u00e1n permitidas y las empresas vinculadas a las que la clave tiene acceso (`ready` indica si el equipo puede recibir trabajos de esa empresa). Requiere el scope `desktop_agents:read`.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/enrollments": {"post": {"operationId": "create_desktop_agent_enrollment", "summary": "Crear una credencial para vincular N1 Agente", "parameters": [], "responses": {"201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EnrollmentOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "413": {"description": "Request Entity Too Large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "423": {"description": "Locked", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Crea una credencial de un solo uso, v\u00e1lida por 30 minutos, para vincular un equipo con N1 Agente al usuario due\u00f1o de la clave: `link` devuelve tambi\u00e9n el enlace `n1-agente://` y `code` un c\u00f3digo corto. La credencial solo aparece en esta respuesta: no se guarda, no se registra y una repetici\u00f3n con el mismo `Idempotency-Key` crea otra. Despu\u00e9s de vincular, el equipo aparece en `GET /desktop-agents/devices` con `confirmation_required` hasta que se confirme. Errores: 403 `forbidden` si el usuario no tiene una licencia activa de N1 Agente para la integraci\u00f3n, 409 `conflict` si tiene varias licencias activas o la licencia est\u00e1 bloqueada. Requiere el scope `desktop_agents:write`.", "tags": ["Agentes de escritorio"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/EnrollmentIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/devices/{device_id}/confirm": {"post": {"operationId": "confirm_desktop_agent_device", "summary": "Confirmar la vinculaci\u00f3n de un equipo", "parameters": [{"in": "path", "name": "device_id", "schema": {"format": "uuid", "title": "Device Id", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeviceOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "413": {"description": "Request Entity Too Large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "423": {"description": "Locked", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Confirma la vinculaci\u00f3n pendiente de un equipo del usuario due\u00f1o de la clave; despu\u00e9s `confirmation_required` es false. Repetirla sobre un equipo ya confirmado responde 200. Confirmar el equipo no lo vincula todav\u00eda a la empresa: el usuario abre N1 Agente en su PC, asigna la empresa de N1 a la empresa del software contable y confirma la copia de seguridad; solo entonces el equipo aparece en `companies` con la vinculaci\u00f3n lista y `PUT /companies/{id}/integrations/{name}/device` lo acepta. Errores: 404 `not_found` si el equipo no existe o es de otro usuario, 409 `conflict` si no tiene una vinculaci\u00f3n pendiente. Requiere el scope `desktop_agents:write`.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/companies/{company_id}/references": {"get": {"operationId": "list_desktop_agent_references", "summary": "Consultar los cat\u00e1logos sincronizados", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "scope", "schema": {"description": "Cat\u00e1logo sincronizado, p. ej. `cuentas`.", "title": "Scope", "type": "string"}, "required": true, "description": "Cat\u00e1logo sincronizado, p. ej. `cuentas`."}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 100, "maximum": 500, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ReferencesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve, p\u00e1gina a p\u00e1gina, un cat\u00e1logo que N1 Agente sincroniz\u00f3 desde el software contable (cuentas, terceros, prefijos, centros de costo, bodegas, inventarios...), con la fecha de la \u00faltima sincronizaci\u00f3n (`synced_at`). Un `scope` que la integraci\u00f3n no sincroniza responde 422 con los valores v\u00e1lidos. Requiere el scope `desktop_agents:read` y rol de preparador.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/companies/{company_id}/settings": {"get": {"operationId": "get_desktop_agent_settings", "summary": "Consultar la configuraci\u00f3n de la integraci\u00f3n", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SettingsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la configuraci\u00f3n que N1 guarda para la integraci\u00f3n de escritorio de la empresa (variante por defecto, valores de ventas o de documentos, equipo seleccionado). Es de solo lectura y nunca incluye credenciales. Requiere el scope `desktop_agents:read` y rol de preparador.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/job-types": {"get": {"operationId": "list_desktop_agent_job_types", "summary": "Listar los tipos de trabajo y sus esquemas", "parameters": [{"in": "query", "name": "company_id", "schema": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Limita a los tipos de la integraci\u00f3n de la empresa.", "title": "Company Id"}, "required": false, "description": "Limita a los tipos de la integraci\u00f3n de la empresa."}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobTypesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los tipos de trabajo externos con el esquema JSON que N1 Agente aplica (versi\u00f3n 1). `causacionId` lo asigna N1 y no se env\u00eda. Con `company_id` devuelve solo los tipos de la integraci\u00f3n activa de esa empresa. Requiere el scope `desktop_agents:read`.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/companies/{company_id}/jobs/validate": {"post": {"operationId": "validate_desktop_agent_jobs", "summary": "Validar documentos sin escribirlos", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"anyOf": [{"$ref": "#/components/schemas/ValidateOut"}, {"$ref": "#/components/schemas/ValidateBatchOut"}], "title": "Response"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "413": {"description": "Request Entity Too Large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "423": {"description": "Locked", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Aplica al documento las mismas validaciones que la creaci\u00f3n (esquema, empresa contable del equipo, reglas contables y datos maestros contra los cat\u00e1logos sincronizados) sin efectos ni cobro. Responde `ok`, los errores, las advertencias y la fecha de sincronizaci\u00f3n de cada cat\u00e1logo consultado. No exige que el equipo tenga habilitadas las causaciones externas. Con `items` valida un lote de hasta 20 documentos. L\u00edmite: 600 documentos por hora por empresa, contados antes de validar y despu\u00e9s de revisar el tama\u00f1o. Requiere el scope `desktop_agents:read` y rol de preparador.", "tags": ["Agentes de escritorio"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ValidateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/companies/{company_id}/jobs": {"post": {"operationId": "create_desktop_agent_jobs", "summary": "Crear trabajos externos para N1 Agente", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobsOut"}}}}, "201": {"description": "Created", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "413": {"description": "Request Entity Too Large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "423": {"description": "Locked", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Valida y encola uno o varios documentos (lote de hasta 20, todo o nada) para que el equipo indicado los escriba en el software contable. N1 asigna `causacionId` (el id del trabajo), reserva un cr\u00e9dito por documento y devuelve el documento final. Responde 201 al crear y 200 cuando todo el lote es una repetici\u00f3n (misma `idempotency_key` y mismo contenido, o `business_key` ya consumida); cada elemento trae `replayed`. Errores: 400 `validation_failed` (el detalle trae la respuesta de validaci\u00f3n), 402 `insufficient_credits`, 403 `desktop_agent_external_jobs_disabled` o `desktop_agent_device_not_eligible`, 409 `idempotency_conflict`, 423 `write_uncertain` o `write_blocked`, 429 `rate_limited`. L\u00edmite: 60 documentos por hora por empresa, contados antes de crear y despu\u00e9s de revisar el tama\u00f1o (un lote rechazado tambi\u00e9n cuenta). El encabezado `Idempotency-Key` es opcional. Requiere el scope `desktop_agents:write` y rol de administrador.", "tags": ["Agentes de escritorio"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobsCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/jobs/{job_id}": {"get": {"operationId": "get_desktop_agent_job", "summary": "Consultar un trabajo externo", "parameters": [{"in": "path", "name": "job_id", "schema": {"format": "uuid", "title": "Job Id", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExternalJobOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado del trabajo, el resultado del equipo (c\u00f3digo de error y mensaje para el usuario, verificaci\u00f3n), los cr\u00e9ditos y la l\u00ednea de tiempo. Requiere el scope `desktop_agents:read` y rol de preparador.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/jobs": {"get": {"operationId": "list_desktop_agent_jobs", "summary": "Listar trabajos externos", "parameters": [{"in": "query", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "business_key", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Business Key"}, "required": false}, {"in": "query", "name": "status", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Status"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobsListOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista los trabajos externos de la empresa, del m\u00e1s reciente al m\u00e1s antiguo, con filtros por `business_key` y `status`. Sirve para buscar un documento por su identidad de negocio. Requiere el scope `desktop_agents:read` y rol de preparador.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/desktop-agents/jobs/{job_id}/cancel": {"post": {"operationId": "cancel_desktop_agent_job", "summary": "Cancelar un trabajo externo", "parameters": [{"in": "path", "name": "job_id", "schema": {"format": "uuid", "title": "Job Id", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExternalJobOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "413": {"description": "Request Entity Too Large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "423": {"description": "Locked", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Cancela el trabajo mientras ning\u00fan equipo lo haya tomado nunca (`pending` sin intentos); en otro caso responde 409 `job_not_cancellable`, tambi\u00e9n si el equipo lo tom\u00f3 y lo solt\u00f3. Libera el cr\u00e9dito reservado y la `business_key`. Solo la clave que lo cre\u00f3 o otra clave del mismo usuario puede cancelarlo. Requiere el scope `desktop_agents:write` y rol de administrador.", "tags": ["Agentes de escritorio"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}": {"get": {"operationId": "get_integration", "summary": "Consultar una integraci\u00f3n de escritorio", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/IntegrationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve el estado de la integraci\u00f3n de escritorio de la empresa (`world_office_desktop` o `siigo_pyme_desktop`; `siigo_pyme` es un alias): si est\u00e1 activa, si la activaci\u00f3n requiere pago y si ya se pag\u00f3, el equipo seleccionado, la \u00faltima sincronizaci\u00f3n completa de cat\u00e1logos y los cat\u00e1logos recibidos del equipo seleccionado, y la configuraci\u00f3n de documentos (Siigo Pyme) o de ventas (World Office). Requiere el scope `integrations:read` y rol de preparador.", "tags": ["Integraciones"], "security": [{"ApiKeyAuth": []}]}, "delete": {"operationId": "disable_integration", "summary": "Desactivar una integraci\u00f3n de escritorio", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"204": {"description": "No Content"}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Elimina la integraci\u00f3n de la empresa con su configuraci\u00f3n y revoca las vinculaciones de los equipos; los trabajos pendientes vencen. Es irreversible: para volver a usarla hay que activarla y configurarla de nuevo. Es idempotente: si la integraci\u00f3n no existe responde 204. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/activate": {"post": {"operationId": "activate_integration", "summary": "Activar una integraci\u00f3n de escritorio", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/IntegrationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Activa la integraci\u00f3n para la empresa y la licencia de N1 Agente del usuario de la clave. Con `existing_device_id` reutiliza un equipo ya vinculado a la empresa en N1 Agente. Errores: 402 `activation_purchase_required` (el detalle trae add-on, precio y moneda), 409 `accounting_integration_conflict` cuando la empresa ya tiene otra integraci\u00f3n contable, 409 `conflict` cuando el equipo no est\u00e1 disponible o la licencia no lo permite. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ActivateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/device": {"put": {"operationId": "select_integration_device", "summary": "Seleccionar el equipo de la integraci\u00f3n", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/IntegrationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Selecciona el equipo con N1 Agente con el que trabaja la integraci\u00f3n, entre los equipos del usuario de la clave con una vinculaci\u00f3n activa y confirmada para la empresa, y le pide sincronizar los cat\u00e1logos. La vinculaci\u00f3n se crea en el equipo: despu\u00e9s de confirmar el equipo (`POST /desktop-agents/devices/{id}/confirm`), el usuario abre N1 Agente en su PC, asigna la empresa de N1 a la empresa del software contable y confirma la copia de seguridad. Hasta entonces, o con un equipo sin esa vinculaci\u00f3n, responde 409 `conflict` con `existing_device_unavailable`. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SelectDeviceIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/references/refresh": {"post": {"operationId": "refresh_integration_references", "summary": "Sincronizar los cat\u00e1logos de la integraci\u00f3n", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ReferencesRefreshOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Pide a N1 Agente que vuelva a sincronizar los cat\u00e1logos del software contable (cuentas, terceros, centros de costo...). La sincronizaci\u00f3n termina cuando `last_reference_sync_at` de la integraci\u00f3n cambia. Sin un equipo disponible responde 409 `conflict`. Requiere el scope `desktop_agents:write` y rol de administrador.", "tags": ["Integraciones"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/world_office_desktop/contacts/{contact_id}/preferences": {"put": {"operationId": "set_world_office_desktop_contact_preferences", "summary": "Guardar las preferencias de un proveedor en World Office", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contact_id", "schema": {"title": "Contact Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactPreferencesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Guarda la forma de pago y, si se env\u00edan, el centro de costos, el plazo, la bodega y las cuentas de retenci\u00f3n (`{scheme_id}:{percentage}` \u2192 c\u00f3digo de cuenta) que World Office Desktop usa al causar las compras del contacto. Los valores se validan contra los cat\u00e1logos sincronizados: uno que no existe responde 422 `reference_outdated` con el campo en `errors[0].loc`. Los campos que no se env\u00edan conservan su valor. Recalcula la preparaci\u00f3n de los documentos del contacto antes de responder. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WoContactPreferencesIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/world_office_desktop/contacts/{contact_id}/item-grouping": {"put": {"operationId": "set_world_office_desktop_item_grouping", "summary": "Guardar la agrupaci\u00f3n de \u00edtems de un proveedor en World Office", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contact_id", "schema": {"title": "Contact Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactPreferencesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Activa o desactiva la agrupaci\u00f3n de los \u00edtems de las compras del contacto por tarifa de IVA, con una regla (inventario, bodega y cuenta opcional) por tarifa. Dos reglas con la misma tarifa responden 422 `validation_failed`. El inventario (por c\u00f3digo), la bodega (por nombre) y la cuenta (por c\u00f3digo) se validan contra los cat\u00e1logos sincronizados: uno que no existe, o un cat\u00e1logo que a\u00fan no se ha sincronizado, responde 422 `reference_outdated` con la regla en `errors[0].loc` (`[\"body\", \"rules\", i, campo]`). Solo cambia la agrupaci\u00f3n de compras; la de ventas se conserva. Recalcula la preparaci\u00f3n de los documentos del contacto antes de responder. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WoItemGroupingIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/world_office_desktop/item-mappings": {"put": {"operationId": "set_world_office_desktop_item_mappings", "summary": "Guardar la homologaci\u00f3n de productos en World Office", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ItemMappingsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Guarda, por nombre de producto, el inventario, la bodega y, si se env\u00edan, la cuenta y el centro de costos con los que World Office Desktop causa las compras. Con `contact_id` aplica a un proveedor; con `contact_id` nulo aplica a toda la empresa (sin centro de costos). Sobre una homologaci\u00f3n existente, la cuenta y el centro de costos que no se env\u00edan conservan su valor. Un mismo `product_name` y `contact_id` repetido en la solicitud responde 422 `validation_failed`. Los valores se validan contra los cat\u00e1logos sincronizados: uno que no existe responde 422 `reference_outdated` con el \u00edtem en `errors[0].loc` (`[\"body\", \"items\", i, campo]`). Recalcula la preparaci\u00f3n de los documentos afectados antes de responder. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WoItemMappingsIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/siigo_pyme_desktop/settings": {"patch": {"operationId": "update_siigo_pyme_desktop_settings", "summary": "Actualizar la configuraci\u00f3n de documentos en Siigo Pyme", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/IntegrationStatusOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Actualiza los comprobantes de compra, nota y venta, las cuentas por pagar, por cobrar, de IVA y de descuentos, el centro de costos, la bodega, el plazo y las cuentas de retenci\u00f3n (`{clave}` \u2192 c\u00f3digo de cuenta) que Siigo Pyme Desktop usa por defecto en la empresa. Los campos que no se env\u00edan conservan su valor. Los valores se validan contra los cat\u00e1logos sincronizados: uno que no existe, o un cat\u00e1logo que a\u00fan no se ha sincronizado, responde 422 `reference_outdated` con el campo en `errors[0].loc`. Recalcula la preparaci\u00f3n de los documentos de la empresa antes de responder y devuelve el estado de la integraci\u00f3n. `siigo_pyme` tambi\u00e9n se acepta como nombre de la integraci\u00f3n. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SiigoSettingsIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/siigo_pyme_desktop/contacts/{contact_id}/preferences": {"put": {"operationId": "set_siigo_pyme_desktop_contact_preferences", "summary": "Guardar las preferencias de un proveedor en Siigo Pyme", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "contact_id", "schema": {"title": "Contact Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ContactPreferencesOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Guarda, si se env\u00edan, el comprobante de compra, el centro de costos, el plazo y las cuentas de retenci\u00f3n (`{clave}` \u2192 c\u00f3digo de cuenta) que Siigo Pyme Desktop usa al causar las compras del contacto. Los valores se validan contra los cat\u00e1logos sincronizados: uno que no existe responde 422 `reference_outdated` con el campo en `errors[0].loc`. Los campos que no se env\u00edan conservan su valor. Recalcula la preparaci\u00f3n de los documentos del contacto antes de responder. `siigo_pyme` tambi\u00e9n se acepta como nombre de la integraci\u00f3n. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SiigoContactPreferencesIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/siigo_pyme_desktop/item-mappings": {"put": {"operationId": "set_siigo_pyme_desktop_item_mappings", "summary": "Guardar la homologaci\u00f3n de productos en Siigo Pyme", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ItemMappingsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Guarda, por nombre de producto, el producto o la cuenta contable de Siigo (al menos uno) y, si se env\u00edan, la bodega y el centro de costos con los que Siigo Pyme Desktop causa las compras. Con `contact_id` aplica a un proveedor; sin `contact_id` aplica a toda la empresa. Reemplaza la homologaci\u00f3n existente del producto: un campo que no se env\u00eda queda vac\u00edo. Un \u00edtem sin producto ni cuenta, o un mismo `product_name` y `contact_id` repetido en la solicitud, responde 422 `validation_failed`; un valor que no existe en los cat\u00e1logos sincronizados responde 422 `reference_outdated` con el \u00edtem en `errors[0].loc` cuando se puede identificar. Recalcula la preparaci\u00f3n de los documentos afectados antes de responder. `siigo_pyme` tambi\u00e9n se acepta como nombre de la integraci\u00f3n. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SiigoItemMappingsIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/history-scans": {"post": {"operationId": "start_integration_history_scan", "summary": "Leer el historial del software contable", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HistoryScanOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Pide a N1 Agente leer los documentos ya causados en el software contable para proponer preferencias de proveedores y homologaciones de productos. World Office acepta `document_types`, `date_from` y `date_to`; Siigo Pyme acepta `document_types` y `years`. Un campo que la integraci\u00f3n no acepta o un rango de fechas inv\u00e1lido responde 422; sin un equipo que pueda leer el historial responde 409 `conflict`. Una lectura en curso se cancela. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/HistoryScanIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/history-scans/latest": {"get": {"operationId": "get_integration_history_scan", "summary": "Consultar la \u00faltima lectura del historial", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HistoryScanOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Devuelve la \u00faltima lectura del historial de la integraci\u00f3n con su estado y estad\u00edsticas. Sin lecturas responde 404. Requiere el scope `integrations:read` y rol de preparador.", "tags": ["Integraciones"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/history-suggestions": {"get": {"operationId": "list_integration_history_suggestions", "summary": "Listar las sugerencias del historial", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}, {"in": "query", "name": "status", "schema": {"anyOf": [{"enum": ["pending", "confirmed", "rejected"], "type": "string"}, {"type": "null"}], "default": "pending", "title": "Status"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 200, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HistorySuggestionsOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Lista las propuestas que dej\u00f3 la lectura del historial, por tipo (`supplier_preference`, `item_mapping` y, en World Office, `accounting_template`) y de la m\u00e1s frecuente a la menos frecuente. `status` filtra por `pending` (por defecto), `confirmed` o `rejected`. `has_contact` dice si el proveedor de la propuesta ya existe como contacto en N1 (requisito para aceptarla). `data` trae los campos propios de cada tipo, sin repetir los del primer nivel (`id`, `kind`, `status`, `document_count`, `has_contact`). Pagina con `next_cursor`. Requiere el scope `integrations:read` y rol de preparador.", "tags": ["Integraciones"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/integrations/{name}/history-suggestions/{kind}/{suggestion_id}/decide": {"post": {"operationId": "decide_integration_history_suggestion", "summary": "Aceptar o rechazar una sugerencia del historial", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "name", "schema": {"title": "Name", "type": "string"}, "required": true}, {"in": "path", "name": "kind", "schema": {"title": "Kind", "type": "string"}, "required": true}, {"in": "path", "name": "suggestion_id", "schema": {"title": "Suggestion Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DecideOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Con `accept` verdadero aplica la propuesta a la configuraci\u00f3n (las preferencias del proveedor o la homologaci\u00f3n del producto, sin pisar valores ya configurados) y recalcula la preparaci\u00f3n de los documentos del proveedor antes de responder; con `accept` falso la descarta sin recalcular. Las plantillas contables (`accounting_template`) solo cambian de estado. Repetir la misma decisi\u00f3n responde 200 con el estado actual; una decisi\u00f3n distinta sobre una propuesta ya resuelta, o una propuesta cuyo proveedor no existe como contacto en N1, responde 409 `conflict`; un tipo desconocido responde 422. Requiere el scope `integrations:write` y rol de administrador.", "tags": ["Integraciones"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DecideIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/world-office-desktop/documents": {"post": {"operationId": "create_world_office_desktop_document", "summary": "Registrar un comprobante contable en World Office Desktop", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "header", "name": "Idempotency-Key", "required": true, "schema": {"type": "string", "maxLength": 255}, "description": "Obligatorio. Clave \u00fanica por comprobante: repetir la solicitud con la misma clave y el mismo contenido devuelve `200` con el estado actual del comprobante sin registrarlo de nuevo; con otro contenido responde `409 idempotency_conflict`. Un comprobante `failed` se env\u00eda de nuevo con una clave nueva."}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WorldOfficeDesktopDocumentOut"}}}}, "202": {"description": "Accepted", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WorldOfficeDesktopDocumentOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "400": {"description": "Bad Request", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "402": {"description": "Payment Required", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "409": {"description": "Conflict", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "422": {"description": "Unprocessable Entity", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "429": {"description": "Too Many Requests", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "\nRegistra un comprobante contable en World Office Desktop a trav\u00e9s de N1 Agente,\nsin factura en N1. Responde `202` con el comprobante en estado `queued` (`200`\ncon su estado actual si el `Idempotency-Key` ya lo registr\u00f3); el\nresultado se consulta en `GET .../documents/{document_id}` o llega por los\nwebhooks `world_office_desktop_document.succeeded` y\n`world_office_desktop_document.failed`. Requiere el scope `exports:write`, rol de\nadministrador y el encabezado `Idempotency-Key`.\n\nLicencia: se usa la licencia de World Office Desktop del usuario de la clave de\nAPI; si no la tiene, vale la del due\u00f1o del equipo con N1 Agente que registrar\u00e1\nel comprobante, porque el agente registra con esa licencia.\n\nTercero del encabezado: si no existe como contacto de la empresa en N1, env\u00eda\n`contact.name` (o `first_name` y `last_name`) y `contact.id_type`, salvo en NO y\nNOS, cuyo tercero debe existir en World Office.\n\nAntes de encolar, N1 valida: tipo habilitado, World Office Desktop activo,\nequipo con N1 Agente listo y compatible con el tipo, licencia, cr\u00e9ditos y la\nestructura del comprobante (d\u00e9bitos = cr\u00e9ditos, cada l\u00ednea con un solo lado\nmayor que cero y m\u00e1ximo dos decimales, textos en Windows-1252 y nunca solo\npuntos, longitudes, sentido de los cruces por tipo). N1 Agente verifica en World\nOffice cuentas, terceros, centros de costos, prefijo, n\u00famero, per\u00edodo y saldo de\nlos cruces antes de escribir.\n\nErrores inmediatos (`code`): `idempotency_key_required` (400),\n`insufficient_credits` (402), `document_type_not_enabled`, `license_required`\n(403), `integration_not_active`, `agent_grant_missing`, `agent_unavailable`,\n`agent_update_required`, `not_supported`, `agent_incompatible` (versi\u00f3n de World\nOffice no autorizada o base recuperada sin aprobar), `agent_ambiguous` (varios\nequipos listos con bases de World Office distintas y ninguno elegido),\n`idempotency_conflict` (409), `document_type_not_supported`,\n`validation_error` con `errors[].loc` (422, siempre `[\"body\", \"payload\", ...]`).\n\nErrores del agente (`error.code` del comprobante `failed`):\n`crossing_target_invalid` (`details.reason`: `missing`, `annulled`,\n`no_open_item`, `ambiguous`, `account_mismatch`, `contact_mismatch`,\n`cost_center_mismatch`, `wrong_direction`, `wrong_side`,\n`date_before_target`), `crossing_exceeds_balance`,\n`document_type_not_supported` (`details.reason`: `unknown`, `missing`,\n`inactive`, `template_not_ready`, `crossing_side`), `validation_failed`\n(`details.fields[]` con `field` y `reason`), `master_data_missing`,\n`master_data_ambiguous`, `document_number_taken`, `period_locked`,\n`verification_failed`, `already_imported_mismatch`, `commit_unknown`,\n`finalization_failed`, `agent_unavailable` y los `wo_*`. Un comprobante\n`failed` es definitivo: corrige la causa y env\u00edalo con un `Idempotency-Key`\nnuevo.\n\nCr\u00e9ditos: se cobra un cr\u00e9dito cuando el comprobante queda registrado, ninguno\nsi ya exist\u00eda (`posted.outcome` `already_imported`). Si el cobro falla, el\ncomprobante sigue `succeeded` con `credit_charge_failed: true`.\n", "tags": ["World Office Desktop"], "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DocumentCreateIn"}}}, "required": true}, "security": [{"ApiKeyAuth": []}]}, "get": {"operationId": "list_world_office_desktop_documents", "summary": "Listar comprobantes de World Office Desktop", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "query", "name": "type", "schema": {"anyOf": [{"$ref": "#/components/schemas/WorldOfficeDocumentType"}, {"type": "null"}], "description": "Tipo de comprobante."}, "required": false, "description": "Tipo de comprobante."}, {"in": "query", "name": "status", "schema": {"anyOf": [{"$ref": "#/components/schemas/WorldOfficeDocumentStatus"}, {"type": "null"}]}, "required": false}, {"in": "query", "name": "limit", "schema": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "required": false}, {"in": "query", "name": "cursor", "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "required": false}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PagedWorldOfficeDesktopDocumentOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Comprobantes enviados por API, del m\u00e1s reciente al m\u00e1s antiguo, con filtros por tipo (`type`) y estado (`status`). Requiere el scope `exports:read`.", "tags": ["World Office Desktop"], "security": [{"ApiKeyAuth": []}]}}, "/v1/companies/{company_id}/world-office-desktop/documents/{document_id}": {"get": {"operationId": "get_world_office_desktop_document", "summary": "Consultar un comprobante de World Office Desktop", "parameters": [{"in": "path", "name": "company_id", "schema": {"title": "Company Id", "type": "integer"}, "required": true}, {"in": "path", "name": "document_id", "schema": {"title": "Document Id", "type": "integer"}, "required": true}], "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WorldOfficeDesktopDocumentOut"}}}}, "401": {"description": "Unauthorized", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "403": {"description": "Forbidden", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}, "404": {"description": "Not Found", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}}}, "description": "Estado y resultado de un comprobante enviado por API: n\u00famero y asiento en World Office si qued\u00f3 registrado, o el error con `code`, mensaje y `details`. Requiere el scope `exports:read`.", "tags": ["World Office Desktop"], "security": [{"ApiKeyAuth": []}]}}}, "components": {"schemas": {"ApiKeyInfo": {"properties": {"id": {"title": "Id", "type": "integer"}, "name": {"title": "Name", "type": "string"}, "prefix": {"title": "Prefix", "type": "string"}, "last_four": {"title": "Last Four", "type": "string"}, "scopes": {"items": {"type": "string"}, "title": "Scopes", "type": "array"}, "all_companies": {"description": "Si es true, la clave accede a todas las empresas del usuario, incluidas las que se unan despu\u00e9s.", "title": "All Companies", "type": "boolean"}, "expires_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Expires At"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}}, "required": ["id", "name", "prefix", "last_four", "scopes", "all_companies", "expires_at", "created_at"], "title": "ApiKeyInfo", "type": "object"}, "CompanyOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "name": {"title": "Name", "type": "string"}, "nit": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "N\u00famero de identificaci\u00f3n sin d\u00edgito de verificaci\u00f3n.", "title": "Nit"}, "dv": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "D\u00edgito de verificaci\u00f3n (solo personas jur\u00eddicas).", "title": "Dv"}, "person_type": {"description": "LEGAL o NATURAL.", "title": "Person Type", "type": "string"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "dian_habilitation": {"anyOf": [{"$ref": "#/components/schemas/DianHabilitationOut"}, {"type": "null"}], "description": "Estado de la habilitaci\u00f3n DIAN con el proveedor tecnol\u00f3gico (Alegra v\u00eda Alanube); null si la empresa nunca inici\u00f3 el proceso."}}, "required": ["id", "name", "person_type", "created_at"], "title": "CompanyOut", "type": "object"}, "DianHabilitationOut": {"properties": {"status": {"description": "PENDING, IN_PROCESS, AUTHORIZED o UNAUTHORIZED.", "title": "Status", "type": "string"}, "source": {"description": "Origen de la autorizaci\u00f3n: ALANUBE, MANUAL o cadena vac\u00eda.", "title": "Source", "type": "string"}, "authorized_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Authorized At"}, "test_set_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Test Set Id"}, "alanube_company_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Alanube Company Id"}}, "required": ["status", "source"], "title": "DianHabilitationOut", "type": "object"}, "MeOut": {"properties": {"key": {"$ref": "#/components/schemas/ApiKeyInfo"}, "user": {"$ref": "#/components/schemas/MeUser"}, "companies": {"items": {"$ref": "#/components/schemas/CompanyOut"}, "title": "Companies", "type": "array"}}, "required": ["key", "user", "companies"], "title": "MeOut", "type": "object"}, "MeUser": {"properties": {"email": {"title": "Email", "type": "string"}, "first_name": {"title": "First Name", "type": "string"}, "last_name": {"title": "Last Name", "type": "string"}}, "required": ["email", "first_name", "last_name"], "title": "MeUser", "type": "object"}, "ProblemDetails": {"properties": {"type": {"description": "URL de la documentaci\u00f3n del c\u00f3digo de error.", "examples": ["https://n1.app/docs/api?error=validation_error"], "title": "Type", "type": "string"}, "title": {"description": "T\u00edtulo legible del error.", "examples": ["La solicitud no es v\u00e1lida"], "title": "Title", "type": "string"}, "status": {"description": "C\u00f3digo de estado HTTP.", "examples": [422], "title": "Status", "type": "integer"}, "detail": {"default": "", "description": "Explicaci\u00f3n espec\u00edfica de esta ocurrencia.", "examples": ["El campo id_number es obligatorio para personas jur\u00eddicas."], "title": "Detail", "type": "string"}, "instance": {"description": "Ruta de la solicitud que fall\u00f3.", "examples": ["/v1/companies/1842/contacts"], "title": "Instance", "type": "string"}, "code": {"description": "C\u00f3digo estable del error (ver cat\u00e1logo).", "examples": ["validation_error"], "title": "Code", "type": "string"}, "request_id": {"default": "", "description": "Identificador de la solicitud (X-Request-ID).", "examples": ["req_01HZX9R2K7Q4V8M3N6B5C1D0EF"], "title": "Request Id", "type": "string"}, "errors": {"anyOf": [{"items": {"type": "object"}, "type": "array"}, {"type": "null"}], "description": "Detalle por campo en errores de validaci\u00f3n.", "examples": [[{"loc": ["body", "id_number"], "msg": "Este campo es obligatorio."}]], "title": "Errors"}}, "required": ["type", "title", "status", "instance", "code"], "title": "ProblemDetails", "type": "object"}, "CreditsQuery": {"properties": {"company_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Empresa para la que se resuelve qui\u00e9n paga. Sin ella se devuelve la billetera del usuario de la clave.", "title": "Company Id"}}, "title": "CreditsQuery", "type": "object"}, "CreditsOut": {"properties": {"payer": {"description": "`self` si paga el usuario de la clave; `organization` si paga el due\u00f1o de la organizaci\u00f3n que cubre la empresa.", "enum": ["self", "organization"], "title": "Payer", "type": "string"}, "available": {"description": "Cr\u00e9ditos disponibles descontando las reservas activas.", "title": "Available", "type": "integer"}, "subscription": {"title": "Subscription", "type": "integer"}, "promotional": {"title": "Promotional", "type": "integer"}, "purchased": {"title": "Purchased", "type": "integer"}}, "required": ["payer", "available", "subscription", "promotional", "purchased"], "title": "CreditsOut", "type": "object"}, "CompanyCreateIn": {"examples": [{"address_line_1": "Carrera 13 # 93-40 Oficina 501", "city_id": 149, "email": "contabilidad@comercialandina.com.co", "name": "Comercial Andina S.A.S.", "nit": 900123456, "person_type": "LEGAL", "phone": "6015551234", "postal_code": "110221"}], "properties": {"name": {"maxLength": 120, "minLength": 1, "title": "Name", "type": "string"}, "person_type": {"$ref": "#/components/schemas/CompanyPersonType"}, "nit": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "NIT o c\u00e9dula sin d\u00edgito de verificaci\u00f3n.", "title": "Nit"}, "email": {"anyOf": [{"format": "email", "type": "string"}, {"type": "null"}], "title": "Email"}, "phone": {"anyOf": [{"maxLength": 10, "type": "string"}, {"type": "null"}], "title": "Phone"}, "address_line_1": {"anyOf": [{"maxLength": 120, "type": "string"}, {"type": "null"}], "title": "Address Line 1"}, "address_line_2": {"anyOf": [{"maxLength": 100, "type": "string"}, {"type": "null"}], "title": "Address Line 2"}, "postal_code": {"anyOf": [{"maxLength": 6, "pattern": "^\\d+$", "type": "string"}, {"type": "null"}], "title": "Postal Code"}, "city_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "City Id"}}, "required": ["name", "person_type"], "title": "CompanyCreateIn", "type": "object"}, "CompanyPersonType": {"enum": ["LEGAL", "NATURAL"], "title": "CompanyPersonType", "type": "string"}, "InvitationOut": {"properties": {"invitation_url": {"title": "Invitation Url", "type": "string"}}, "required": ["invitation_url"], "title": "InvitationOut", "type": "object"}, "InvitationIn": {"examples": [{"email": "laura.restrepo@comercialandina.com.co", "first_name": "Laura", "last_name": "Restrepo", "role": "preparer"}], "properties": {"email": {"format": "email", "title": "Email", "type": "string"}, "first_name": {"examples": ["Laura"], "maxLength": 150, "minLength": 1, "title": "First Name", "type": "string"}, "last_name": {"examples": ["Restrepo"], "maxLength": 150, "minLength": 1, "title": "Last Name", "type": "string"}, "role": {"$ref": "#/components/schemas/InvitationRole"}}, "required": ["email", "first_name", "last_name", "role"], "title": "InvitationIn", "type": "object"}, "InvitationRole": {"enum": ["admin", "preparer", "viewer"], "title": "InvitationRole", "type": "string"}, "Input": {"properties": {"limit": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}, "cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}}, "title": "Input", "type": "object"}, "InvoiceFilters": {"properties": {"issued_from": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "issued_to": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "synced": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "contact_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "search": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "cufe": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "CUFE/CUDE exacto.", "title": "Cufe"}, "kind": {"anyOf": [{"enum": ["purchase", "sales"], "type": "string"}, {"type": "null"}], "description": "`purchase` (facturas recibidas) o `sales` (emitidas por la empresa).", "title": "Kind"}, "dian_event_state": {"anyOf": [{"enum": ["none", "in_progress", "accepted", "claimed"], "type": "string"}, {"type": "null"}], "description": "Estado de los eventos RADIAN de facturas a cr\u00e9dito: `none`, `in_progress`, `accepted` o `claimed`.", "title": "Dian Event State"}}, "title": "InvoiceFilters", "type": "object"}, "ContactRef": {"properties": {"id": {"title": "Id", "type": "integer"}, "id_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Id Number"}, "name": {"title": "Name", "type": "string"}}, "required": ["id", "id_number", "name"], "title": "ContactRef", "type": "object"}, "DocumentExportOut": {"properties": {"integration": {"description": "Integraci\u00f3n contable en la que est\u00e1 causado (siigo, alegra, odoo\u2026).", "title": "Integration", "type": "string"}, "external_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Identificador del comprobante en el software contable.", "title": "External Id"}, "external_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "N\u00famero del comprobante en el software contable.", "title": "External Number"}, "external_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Nombre o descripci\u00f3n del comprobante.", "title": "External Name"}, "exported_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Momento en que qued\u00f3 causado.", "title": "Exported At"}, "marked_manually": {"description": "`true` si un usuario lo marc\u00f3 como causado sin enviarlo desde N1.", "title": "Marked Manually", "type": "boolean"}}, "required": ["integration", "marked_manually"], "title": "DocumentExportOut", "type": "object"}, "DocumentFilesOut": {"properties": {"original": {"$ref": "#/components/schemas/FileVariantOut"}, "pdf": {"$ref": "#/components/schemas/PdfVariantOut"}}, "required": ["original", "pdf"], "title": "DocumentFilesOut", "type": "object"}, "FileVariantOut": {"properties": {"available": {"description": "Si N1 tiene el archivo original del documento.", "title": "Available", "type": "boolean"}, "file_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "File Name"}, "extension": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "xml, zip o pdf.", "title": "Extension"}, "content_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Content Type"}, "size": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Tama\u00f1o en bytes.", "title": "Size"}}, "required": ["available"], "title": "FileVariantOut", "type": "object"}, "InvoiceOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"description": "Prefijo y consecutivo del documento.", "title": "Number", "type": "string"}, "cufe": {"title": "Cufe", "type": "string"}, "issued_at": {"format": "date-time", "title": "Issued At", "type": "string"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"anyOf": [{"$ref": "#/components/schemas/ContactRef"}, {"type": "null"}]}, "sub_total": {"title": "Sub Total", "type": "string"}, "total": {"title": "Total", "type": "string"}, "vat": {"title": "Vat", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "kind": {"description": "`sales` si la empresa emiti\u00f3 la factura, `purchase` si la recibi\u00f3.", "enum": ["purchase", "sales"], "title": "Kind", "type": "string"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "cufe", "issued_at", "due_date", "contact", "sub_total", "total", "vat", "kind"], "title": "InvoiceOut", "type": "object"}, "PagedInvoiceOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/InvoiceOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedInvoiceOut", "type": "object"}, "PdfVariantOut": {"properties": {"status": {"description": "`available`: el original es un PDF o, en el detalle, N1 ya tiene el PDF guardado. `on_demand`: N1 puede generarla o extraerla del archivo original al descargarla (puede fallar y responder 404 `file_not_available`); los listados no verifican si ya existe. `none`: no existe.", "enum": ["available", "on_demand", "none"], "title": "Status", "type": "string"}, "source": {"anyOf": [{"enum": ["original", "n1"], "type": "string"}, {"type": "null"}], "description": "`original` si es el archivo recibido, `n1` si la genera N1.", "title": "Source"}}, "required": ["status"], "title": "PdfVariantOut", "type": "object"}, "AdjustmentEntry": {"properties": {"id": {"default": "", "title": "Id", "type": "string"}, "reason": {"default": "", "title": "Reason", "type": "string"}, "reason_code": {"default": "", "title": "Reason Code", "type": "string"}, "amount": {"title": "Amount", "type": "string"}, "base_amount": {"title": "Base Amount", "type": "string"}, "multiplier": {"title": "Multiplier", "type": "number"}}, "required": ["amount", "base_amount", "multiplier"], "title": "AdjustmentEntry", "type": "object"}, "DianEventOut": {"properties": {"sent_at": {"format": "date-time", "title": "Sent At", "type": "string"}, "event_id": {"title": "Event Id", "type": "string"}}, "required": ["sent_at", "event_id"], "title": "DianEventOut", "type": "object"}, "DianEventStatusOut": {"properties": {"invoice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Invoice Id"}, "cufe": {"title": "Cufe", "type": "string"}, "current_state": {"description": "none, 030, 032, 033 o 031.", "title": "Current State", "type": "string"}, "events": {"$ref": "#/components/schemas/DianEventsOut"}, "is_paid": {"title": "Is Paid", "type": "boolean"}, "is_processing": {"title": "Is Processing", "type": "boolean"}, "integration": {"title": "Integration", "type": "string"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}}, "required": ["invoice_id", "cufe", "current_state", "events", "is_paid", "is_processing", "integration", "created_at", "updated_at"], "title": "DianEventStatusOut", "type": "object"}, "ElectronicLineOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "description": {"title": "Description", "type": "string"}, "sku": {"title": "Sku", "type": "string"}, "quantity": {"title": "Quantity", "type": "string"}, "unit_price": {"title": "Unit Price", "type": "string"}, "total": {"title": "Total", "type": "string"}, "taxes": {"items": {"$ref": "#/components/schemas/TaxEntry"}, "title": "Taxes", "type": "array"}, "discounts": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Discounts", "type": "array"}, "surcharges": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Surcharges", "type": "array"}, "withholding_taxes": {"items": {"$ref": "#/components/schemas/WithholdingTaxEntry"}, "title": "Withholding Taxes", "type": "array"}}, "required": ["id", "description", "sku", "quantity", "unit_price", "total", "taxes", "discounts", "surcharges", "withholding_taxes"], "title": "ElectronicLineOut", "type": "object"}, "ExportDocumentRef": {"properties": {"kind": {"title": "Kind", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "cufe": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cufe"}}, "required": ["kind", "id"], "title": "ExportDocumentRef", "type": "object"}, "ExportError": {"properties": {"code": {"default": "", "title": "Code", "type": "string"}, "message": {"default": "", "title": "Message", "type": "string"}}, "title": "ExportError", "type": "object"}, "ExportOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "integration": {"title": "Integration", "type": "string"}, "export_kind": {"title": "Export Kind", "type": "string"}, "status": {"title": "Status", "type": "string"}, "source": {"title": "Source", "type": "string"}, "document": {"$ref": "#/components/schemas/ExportDocumentRef"}, "external_id": {"default": "", "description": "Identificador del comprobante en el software contable.", "title": "External Id", "type": "string"}, "external_number": {"default": "", "description": "N\u00famero del comprobante en el software contable.", "title": "External Number", "type": "string"}, "external_name": {"default": "", "description": "Nombre o descripci\u00f3n del comprobante en el software contable.", "title": "External Name", "type": "string"}, "error": {"anyOf": [{"$ref": "#/components/schemas/ExportError"}, {"type": "null"}]}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "started_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Started At"}, "finished_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Finished At"}}, "required": ["id", "integration", "export_kind", "status", "source", "document", "created_at", "updated_at"], "title": "ExportOut", "type": "object"}, "InvoiceDetailOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"description": "Prefijo y consecutivo del documento.", "title": "Number", "type": "string"}, "cufe": {"title": "Cufe", "type": "string"}, "issued_at": {"format": "date-time", "title": "Issued At", "type": "string"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"anyOf": [{"$ref": "#/components/schemas/ContactRef"}, {"type": "null"}]}, "sub_total": {"title": "Sub Total", "type": "string"}, "total": {"title": "Total", "type": "string"}, "vat": {"title": "Vat", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "kind": {"description": "`sales` si la empresa emiti\u00f3 la factura, `purchase` si la recibi\u00f3.", "enum": ["purchase", "sales"], "title": "Kind", "type": "string"}, "lines": {"items": {"$ref": "#/components/schemas/ElectronicLineOut"}, "title": "Lines", "type": "array"}, "discounts": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Discounts", "type": "array"}, "surcharges": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Surcharges", "type": "array"}, "withholding_taxes": {"items": {"$ref": "#/components/schemas/WithholdingTaxEntry"}, "title": "Withholding Taxes", "type": "array"}, "payment_method": {"anyOf": [{"enum": ["cash", "credit"], "type": "string"}, {"type": "null"}], "title": "Payment Method"}, "concept": {"title": "Concept", "type": "string"}, "exports": {"description": "\u00daltimo intento de causaci\u00f3n por integraci\u00f3n, con estado (`queued`, `running`, `succeeded`, `failed`, `cancelled`), n\u00famero y nombre del comprobante en el software contable, fechas y error si fall\u00f3.", "items": {"$ref": "#/components/schemas/ExportOut"}, "title": "Exports", "type": "array"}, "other_taxes": {"description": "Impuestos solo a nivel de factura (IBUA, ICUI, ICL, otros).", "items": {"$ref": "#/components/schemas/TaxEntry"}, "title": "Other Taxes", "type": "array"}, "issuer_nit": {"title": "Issuer Nit", "type": "string"}, "receiver_nit": {"title": "Receiver Nit", "type": "string"}, "dian_event_status": {"anyOf": [{"$ref": "#/components/schemas/DianEventStatusOut"}, {"type": "null"}]}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "cufe", "issued_at", "due_date", "contact", "sub_total", "total", "vat", "kind", "lines", "discounts", "surcharges", "withholding_taxes", "payment_method", "concept", "exports", "other_taxes", "issuer_nit", "receiver_nit", "dian_event_status"], "title": "InvoiceDetailOut", "type": "object"}, "TaxEntry": {"properties": {"id": {"title": "Id", "type": "string"}, "name": {"title": "Name", "type": "string"}, "percentage": {"title": "Percentage", "type": "number"}, "amount": {"title": "Amount", "type": "string"}, "taxable_amount": {"title": "Taxable Amount", "type": "string"}}, "required": ["id", "name", "percentage", "amount", "taxable_amount"], "title": "TaxEntry", "type": "object"}, "WithholdingTaxEntry": {"properties": {"id": {"default": "", "title": "Id", "type": "string"}, "name": {"default": "", "title": "Name", "type": "string"}, "percentage": {"title": "Percentage", "type": "number"}, "amount": {"title": "Amount", "type": "string"}, "taxable_amount": {"title": "Taxable Amount", "type": "string"}}, "required": ["percentage", "amount", "taxable_amount"], "title": "WithholdingTaxEntry", "type": "object"}, "ElectronicDocumentFilters": {"properties": {"issued_from": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00ednima (inclusive, zona horaria de Colombia).", "title": "Issued From"}, "issued_to": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Fecha de emisi\u00f3n m\u00e1xima (inclusive, zona horaria de Colombia).", "title": "Issued To"}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo documentos actualizados desde esta fecha y hora.", "title": "Updated Since"}, "synced": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo documentos causados (o no) en la integraci\u00f3n.", "title": "Synced"}, "contact_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Identificador del contacto (tercero).", "title": "Contact Id"}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Solo documentos del archivo cargado indicado.", "title": "Imported File Id"}, "search": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por n\u00famero de documento, nombre o NIT del tercero.", "title": "Search"}, "cufe": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "CUFE/CUDE exacto.", "title": "Cufe"}}, "title": "ElectronicDocumentFilters", "type": "object"}, "CreditNoteOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"description": "Prefijo y consecutivo del documento.", "title": "Number", "type": "string"}, "cufe": {"title": "Cufe", "type": "string"}, "issued_at": {"format": "date-time", "title": "Issued At", "type": "string"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"anyOf": [{"$ref": "#/components/schemas/ContactRef"}, {"type": "null"}]}, "sub_total": {"title": "Sub Total", "type": "string"}, "total": {"title": "Total", "type": "string"}, "vat": {"title": "Vat", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "invoice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Factura electr\u00f3nica asociada.", "title": "Invoice Id"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "cufe", "issued_at", "due_date", "contact", "sub_total", "total", "vat"], "title": "CreditNoteOut", "type": "object"}, "PagedCreditNoteOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/CreditNoteOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedCreditNoteOut", "type": "object"}, "CreditNoteDetailOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"description": "Prefijo y consecutivo del documento.", "title": "Number", "type": "string"}, "cufe": {"title": "Cufe", "type": "string"}, "issued_at": {"format": "date-time", "title": "Issued At", "type": "string"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"anyOf": [{"$ref": "#/components/schemas/ContactRef"}, {"type": "null"}]}, "sub_total": {"title": "Sub Total", "type": "string"}, "total": {"title": "Total", "type": "string"}, "vat": {"title": "Vat", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "invoice_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Factura electr\u00f3nica asociada.", "title": "Invoice Id"}, "lines": {"items": {"$ref": "#/components/schemas/ElectronicLineOut"}, "title": "Lines", "type": "array"}, "discounts": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Discounts", "type": "array"}, "surcharges": {"items": {"$ref": "#/components/schemas/AdjustmentEntry"}, "title": "Surcharges", "type": "array"}, "withholding_taxes": {"items": {"$ref": "#/components/schemas/WithholdingTaxEntry"}, "title": "Withholding Taxes", "type": "array"}, "payment_method": {"anyOf": [{"enum": ["cash", "credit"], "type": "string"}, {"type": "null"}], "title": "Payment Method"}, "concept": {"title": "Concept", "type": "string"}, "exports": {"description": "\u00daltimo intento de causaci\u00f3n por integraci\u00f3n, con estado (`queued`, `running`, `succeeded`, `failed`, `cancelled`), n\u00famero y nombre del comprobante en el software contable, fechas y error si fall\u00f3.", "items": {"$ref": "#/components/schemas/ExportOut"}, "title": "Exports", "type": "array"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "cufe", "issued_at", "due_date", "contact", "sub_total", "total", "vat", "lines", "discounts", "surcharges", "withholding_taxes", "payment_method", "concept", "exports"], "title": "CreditNoteDetailOut", "type": "object"}, "DocumentFilters": {"properties": {"type": {"anyOf": [{"$ref": "#/components/schemas/WorldOfficeDocumentType"}, {"type": "null"}], "description": "Tipo de comprobante."}, "status": {"anyOf": [{"$ref": "#/components/schemas/WorldOfficeDocumentStatus"}, {"type": "null"}]}}, "title": "DocumentFilters", "type": "object"}, "ContractorInvoiceOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"title": "Number", "type": "string"}, "issued_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Issued Date"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"$ref": "#/components/schemas/ContactRef"}, "sub_total": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sub Total"}, "total": {"title": "Total", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "vat": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Vat"}, "rete_fuente_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Fuente Amount"}, "rete_fuente_percentage": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Fuente Percentage"}, "rete_ica_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Ica Amount"}, "rete_ica_percentage": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Ica Percentage"}, "cost_center": {"title": "Cost Center", "type": "string"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "issued_date", "due_date", "contact", "sub_total", "total", "vat", "rete_fuente_amount", "rete_fuente_percentage", "rete_ica_amount", "rete_ica_percentage", "cost_center"], "title": "ContractorInvoiceOut", "type": "object"}, "PagedContractorInvoiceOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/ContractorInvoiceOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedContractorInvoiceOut", "type": "object"}, "ContractorInvoiceDetailOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"title": "Number", "type": "string"}, "issued_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Issued Date"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"$ref": "#/components/schemas/ContactRef"}, "sub_total": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sub Total"}, "total": {"title": "Total", "type": "string"}, "currency": {"default": "COP", "title": "Currency", "type": "string"}, "vat": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Vat"}, "rete_fuente_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Fuente Amount"}, "rete_fuente_percentage": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Fuente Percentage"}, "rete_ica_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Ica Amount"}, "rete_ica_percentage": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rete Ica Percentage"}, "cost_center": {"title": "Cost Center", "type": "string"}, "lines": {"items": {"$ref": "#/components/schemas/InformalLineOut"}, "title": "Lines", "type": "array"}, "concept": {"title": "Concept", "type": "string"}, "payment_details": {"title": "Payment Details", "type": "string"}, "recipient_name": {"title": "Recipient Name", "type": "string"}, "recipient_nit": {"title": "Recipient Nit", "type": "string"}, "exports": {"description": "\u00daltimo intento de causaci\u00f3n por integraci\u00f3n, con estado (`queued`, `running`, `succeeded`, `failed`, `cancelled`), n\u00famero y nombre del comprobante en el software contable, fechas y error si fall\u00f3.", "items": {"$ref": "#/components/schemas/ExportOut"}, "title": "Exports", "type": "array"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "issued_date", "due_date", "contact", "sub_total", "total", "vat", "rete_fuente_amount", "rete_fuente_percentage", "rete_ica_amount", "rete_ica_percentage", "cost_center", "lines", "concept", "payment_details", "recipient_name", "recipient_nit", "exports"], "title": "ContractorInvoiceDetailOut", "type": "object"}, "InformalLineOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "position": {"title": "Position", "type": "integer"}, "description": {"title": "Description", "type": "string"}, "quantity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Quantity"}, "unit_price": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Unit Price"}, "total": {"title": "Total", "type": "string"}}, "required": ["id", "position", "description", "quantity", "unit_price", "total"], "title": "InformalLineOut", "type": "object"}, "InternationalInvoiceOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"title": "Number", "type": "string"}, "issued_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Issued Date"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"$ref": "#/components/schemas/ContactRef"}, "sub_total": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sub Total"}, "total": {"description": "Valor en COP.", "title": "Total", "type": "string"}, "currency": {"title": "Currency", "type": "string"}, "amount": {"description": "Valor en la moneda del documento.", "title": "Amount", "type": "string"}, "tax_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tax Amount"}, "supplier_country": {"title": "Supplier Country", "type": "string"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "issued_date", "due_date", "contact", "sub_total", "total", "currency", "amount", "tax_amount", "supplier_country"], "title": "InternationalInvoiceOut", "type": "object"}, "PagedInternationalInvoiceOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/InternationalInvoiceOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedInternationalInvoiceOut", "type": "object"}, "InternationalInvoiceDetailOut": {"properties": {"synced": {"description": "`true` si el documento ya est\u00e1 causado en el software contable.", "title": "Synced", "type": "boolean"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Synced At"}, "export": {"anyOf": [{"$ref": "#/components/schemas/DocumentExportOut"}, {"type": "null"}], "description": "Comprobante en el software contable cuando `synced` es `true`; `null` si no se ha causado. El detalle del documento trae en `exports` el \u00faltimo intento por integraci\u00f3n, incluidos los fallidos."}, "imported_file_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Archivo cargado del que proviene el documento.", "title": "Imported File Id"}, "files": {"$ref": "#/components/schemas/DocumentFilesOut", "description": "Variantes de archivo disponibles para descargar."}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "number": {"title": "Number", "type": "string"}, "issued_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Issued Date"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Due Date"}, "contact": {"$ref": "#/components/schemas/ContactRef"}, "sub_total": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sub Total"}, "total": {"description": "Valor en COP.", "title": "Total", "type": "string"}, "currency": {"title": "Currency", "type": "string"}, "amount": {"description": "Valor en la moneda del documento.", "title": "Amount", "type": "string"}, "tax_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tax Amount"}, "supplier_country": {"title": "Supplier Country", "type": "string"}, "lines": {"items": {"$ref": "#/components/schemas/InformalLineOut"}, "title": "Lines", "type": "array"}, "concept": {"title": "Concept", "type": "string"}, "payment_details": {"title": "Payment Details", "type": "string"}, "recipient_name": {"title": "Recipient Name", "type": "string"}, "recipient_nit": {"title": "Recipient Nit", "type": "string"}, "exports": {"description": "\u00daltimo intento de causaci\u00f3n por integraci\u00f3n, con estado (`queued`, `running`, `succeeded`, `failed`, `cancelled`), n\u00famero y nombre del comprobante en el software contable, fechas y error si fall\u00f3.", "items": {"$ref": "#/components/schemas/ExportOut"}, "title": "Exports", "type": "array"}}, "required": ["synced", "synced_at", "files", "created_at", "updated_at", "id", "number", "issued_date", "due_date", "contact", "sub_total", "total", "currency", "amount", "tax_amount", "supplier_country", "lines", "concept", "payment_details", "recipient_name", "recipient_nit", "exports"], "title": "InternationalInvoiceDetailOut", "type": "object"}, "ContactFilters": {"properties": {"id_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "N\u00famero de identificaci\u00f3n exacto.", "title": "Id Number"}, "search": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "B\u00fasqueda por nombre, raz\u00f3n social o n\u00famero de identificaci\u00f3n.", "title": "Search"}, "is_supplier": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Supplier"}, "is_client": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Client"}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "Solo contactos actualizados desde esta fecha y hora.", "title": "Updated Since"}}, "title": "ContactFilters", "type": "object"}, "ContactOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "id_type": {"title": "Id Type", "type": "string"}, "id_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Id Number"}, "person_type": {"title": "Person Type", "type": "string"}, "first_name": {"title": "First Name", "type": "string"}, "last_name": {"title": "Last Name", "type": "string"}, "legal_name": {"title": "Legal Name", "type": "string"}, "name": {"description": "Raz\u00f3n social o nombre completo.", "title": "Name", "type": "string"}, "address_line_1": {"title": "Address Line 1", "type": "string"}, "address_line_2": {"title": "Address Line 2", "type": "string"}, "postal_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Postal Code"}, "email": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Email"}, "phone": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Phone"}, "is_client": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Client"}, "is_supplier": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Supplier"}, "whitelisted_supplier": {"title": "Whitelisted Supplier", "type": "boolean"}, "city_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "City Id"}, "tax_schema_id": {"title": "Tax Schema Id", "type": "string"}, "tax_level_codes": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Tax Level Codes"}, "is_declarante_renta": {"title": "Is Declarante Renta", "type": "boolean"}, "is_autoretenedor_renta": {"title": "Is Autoretenedor Renta", "type": "boolean"}, "regimen": {"title": "Regimen", "type": "string"}, "foreign_retention_regime": {"title": "Foreign Retention Regime", "type": "string"}, "foreign_service_is_iva_taxable": {"title": "Foreign Service Is Iva Taxable", "type": "boolean"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}}, "required": ["id", "id_type", "id_number", "person_type", "first_name", "last_name", "legal_name", "name", "address_line_1", "address_line_2", "postal_code", "email", "phone", "is_client", "is_supplier", "whitelisted_supplier", "city_id", "tax_schema_id", "tax_level_codes", "is_declarante_renta", "is_autoretenedor_renta", "regimen", "foreign_retention_regime", "foreign_service_is_iva_taxable", "created_at", "updated_at"], "title": "ContactOut", "type": "object"}, "PagedContactOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/ContactOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedContactOut", "type": "object"}, "ContactCreateIn": {"examples": [{"address_line_1": "Carrera 13 # 93-40 Oficina 501", "city_id": 149, "email": "facturacion@comercialandina.com.co", "foreign_retention_regime": "none", "id_number": "900123456", "id_type": "31", "is_autoretenedor_renta": false, "is_client": false, "is_declarante_renta": true, "is_supplier": true, "legal_name": "Comercial Andina S.A.S.", "person_type": "LEGAL", "phone": "6015551234", "postal_code": "110221", "regimen": "comun", "tax_level_codes": ["O_13"], "tax_schema_id": "IVA_01"}], "properties": {"person_type": {"enum": ["NATURAL", "LEGAL"], "title": "Person Type", "type": "string"}, "id_type": {"anyOf": [{"enum": ["11", "12", "13", "21", "22", "31", "41", "42", "43", "47", "48", "50", "91", "CC", "NIT"], "type": "string"}, {"type": "null"}], "description": "C\u00f3digo DIAN del tipo de documento (\"31\" NIT, \"13\" c\u00e9dula, \"41\" pasaporte, ...). \"NIT\" y \"CC\" se aceptan como alias.", "title": "Id Type"}, "id_number": {"anyOf": [{"type": "integer"}, {"type": "string"}, {"type": "null"}], "description": "N\u00famero de identificaci\u00f3n sin d\u00edgito de verificaci\u00f3n; alfanum\u00e9rico para pasaportes y documentos extranjeros.", "title": "Id Number"}, "first_name": {"maxLength": 100, "title": "First Name", "type": "string"}, "last_name": {"maxLength": 100, "title": "Last Name", "type": "string"}, "legal_name": {"maxLength": 200, "title": "Legal Name", "type": "string"}, "address_line_1": {"maxLength": 120, "title": "Address Line 1", "type": "string"}, "address_line_2": {"maxLength": 100, "title": "Address Line 2", "type": "string"}, "postal_code": {"anyOf": [{"maxLength": 6, "pattern": "^\\d+$", "type": "string"}, {"type": "null"}], "title": "Postal Code"}, "email": {"anyOf": [{"format": "email", "type": "string"}, {"type": "null"}], "title": "Email"}, "phone": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "7 o 10 d\u00edgitos.", "title": "Phone"}, "is_client": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Client"}, "is_supplier": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Supplier"}, "whitelisted_supplier": {"title": "Whitelisted Supplier", "type": "boolean"}, "city_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "City Id"}, "tax_schema_id": {"anyOf": [{"enum": ["IVA_01", "IC_02", "ICA_03", "INC_04", "RETEIVA_05", "RETEFUENTE_06", "RETEICA_07", "FTOHORTICULTURA_20", "TIMBRE_21", "BOLSAS_22", "INCARBONO_23", "INCOMBUSTIBLES_24", "SOBRETASACOMBUSTIBLES_25", "SORDICOM_26", "ZZ"], "type": "string"}, {"type": "null"}], "title": "Tax Schema Id"}, "tax_level_codes": {"anyOf": [{"items": {"enum": ["O_13", "O_15", "O_23", "O_47", "R_99_PN"], "type": "string"}, "type": "array"}, {"type": "null"}], "title": "Tax Level Codes"}, "is_declarante_renta": {"title": "Is Declarante Renta", "type": "boolean"}, "is_autoretenedor_renta": {"title": "Is Autoretenedor Renta", "type": "boolean"}, "regimen": {"anyOf": [{"enum": ["comun", "simple", "especial"], "type": "string"}, {"type": "null"}], "title": "Regimen"}, "foreign_retention_regime": {"enum": ["none", "pes", "pes_exempt", "technical_service", "treaty_exempt"], "title": "Foreign Retention Regime", "type": "string"}, "foreign_service_is_iva_taxable": {"title": "Foreign Service Is Iva Taxable", "type": "boolean"}}, "required": ["person_type"], "title": "ContactCreateIn", "type": "object"}, "ContactUpdateIn": {"examples": [{"address_line_1": "Carrera 13 # 93-40 Oficina 501", "email": "pagos@comercialandina.com.co", "is_client": true, "legal_name": "Comercial Andina S.A.S.", "phone": "6015551234"}], "properties": {"person_type": {"enum": ["NATURAL", "LEGAL"], "title": "Person Type", "type": "string"}, "id_type": {"anyOf": [{"enum": ["11", "12", "13", "21", "22", "31", "41", "42", "43", "47", "48", "50", "91", "CC", "NIT"], "type": "string"}, {"type": "null"}], "description": "C\u00f3digo DIAN del tipo de documento (\"31\" NIT, \"13\" c\u00e9dula, \"41\" pasaporte, ...). \"NIT\" y \"CC\" se aceptan como alias.", "title": "Id Type"}, "id_number": {"anyOf": [{"type": "integer"}, {"type": "string"}, {"type": "null"}], "description": "N\u00famero de identificaci\u00f3n sin d\u00edgito de verificaci\u00f3n; alfanum\u00e9rico para pasaportes y documentos extranjeros.", "title": "Id Number"}, "first_name": {"maxLength": 100, "title": "First Name", "type": "string"}, "last_name": {"maxLength": 100, "title": "Last Name", "type": "string"}, "legal_name": {"maxLength": 200, "title": "Legal Name", "type": "string"}, "address_line_1": {"maxLength": 120, "title": "Address Line 1", "type": "string"}, "address_line_2": {"maxLength": 100, "title": "Address Line 2", "type": "string"}, "postal_code": {"anyOf": [{"maxLength": 6, "pattern": "^\\d+$", "type": "string"}, {"type": "null"}], "title": "Postal Code"}, "email": {"anyOf": [{"format": "email", "type": "string"}, {"type": "null"}], "title": "Email"}, "phone": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "7 o 10 d\u00edgitos.", "title": "Phone"}, "is_client": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Client"}, "is_supplier": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Supplier"}, "whitelisted_supplier": {"title": "Whitelisted Supplier", "type": "boolean"}, "city_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "City Id"}, "tax_schema_id": {"anyOf": [{"enum": ["IVA_01", "IC_02", "ICA_03", "INC_04", "RETEIVA_05", "RETEFUENTE_06", "RETEICA_07", "FTOHORTICULTURA_20", "TIMBRE_21", "BOLSAS_22", "INCARBONO_23", "INCOMBUSTIBLES_24", "SOBRETASACOMBUSTIBLES_25", "SORDICOM_26", "ZZ"], "type": "string"}, {"type": "null"}], "title": "Tax Schema Id"}, "tax_level_codes": {"anyOf": [{"items": {"enum": ["O_13", "O_15", "O_23", "O_47", "R_99_PN"], "type": "string"}, "type": "array"}, {"type": "null"}], "title": "Tax Level Codes"}, "is_declarante_renta": {"title": "Is Declarante Renta", "type": "boolean"}, "is_autoretenedor_renta": {"title": "Is Autoretenedor Renta", "type": "boolean"}, "regimen": {"anyOf": [{"enum": ["comun", "simple", "especial"], "type": "string"}, {"type": "null"}], "title": "Regimen"}, "foreign_retention_regime": {"enum": ["none", "pes", "pes_exempt", "technical_service", "treaty_exempt"], "title": "Foreign Retention Regime", "type": "string"}, "foreign_service_is_iva_taxable": {"title": "Foreign Service Is Iva Taxable", "type": "boolean"}}, "title": "ContactUpdateIn", "type": "object"}, "ImportedDocumentRef": {"properties": {"kind": {"description": "electronic_invoice, credit_note, contractor_invoice o international_invoice.", "title": "Kind", "type": "string"}, "id": {"title": "Id", "type": "integer"}, "cufe": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cufe"}}, "required": ["kind", "id"], "title": "ImportedDocumentRef", "type": "object"}, "ImportedFileOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "status": {"title": "Status", "type": "string"}, "type": {"default": "", "description": "Tipo detectado por el procesador; vac\u00edo mientras se procesa.", "title": "Type", "type": "string"}, "file_name": {"title": "File Name", "type": "string"}, "extension": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "xml, zip o pdf.", "title": "Extension"}, "content_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Content Type"}, "file_size": {"title": "File Size", "type": "integer"}, "hash": {"title": "Hash", "type": "string"}, "session_uuid": {"anyOf": [{"format": "uuid", "type": "string"}, {"type": "null"}], "title": "Session Uuid"}, "dian_importation_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Dian Importation Id"}, "last_log_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Nivel del \u00faltimo registro de procesamiento.", "title": "Last Log Level"}, "last_log_message": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "\u00daltimo mensaje de procesamiento (errores incluidos).", "title": "Last Log Message"}, "documents": {"items": {"$ref": "#/components/schemas/ImportedDocumentRef"}, "title": "Documents", "type": "array"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}}, "required": ["id", "status", "file_name", "file_size", "hash", "documents", "created_at", "updated_at"], "title": "ImportedFileOut", "type": "object"}, "ImportedFileFilters": {"properties": {"status": {"anyOf": [{"$ref": "#/components/schemas/ImportedFileStatus"}, {"type": "null"}]}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}}, "title": "ImportedFileFilters", "type": "object"}, "ImportedFileStatus": {"enum": ["NEW", "PENDING_REVIEW", "REJECTED", "SUCCESS", "DUPLICATE", "ERROR", "UNSUPPORTED"], "title": "ImportedFileStatus", "type": "string"}, "PagedImportedFileOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/ImportedFileOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedImportedFileOut", "type": "object"}, "DianImportationOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "status": {"title": "Status", "type": "string"}, "source": {"title": "Source", "type": "string"}, "document_type": {"title": "Document Type", "type": "string"}, "begin_date": {"format": "date-time", "title": "Begin Date", "type": "string"}, "end_date": {"format": "date-time", "title": "End Date", "type": "string"}, "found_cufes_count": {"title": "Found Cufes Count", "type": "integer"}, "founded_electronic_invoices_count": {"title": "Founded Electronic Invoices Count", "type": "integer"}, "founded_credit_notes_count": {"title": "Founded Credit Notes Count", "type": "integer"}, "founded_skipped_count": {"title": "Founded Skipped Count", "type": "integer"}, "scan_progress": {"title": "Scan Progress", "type": "object"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}}, "required": ["id", "status", "source", "document_type", "begin_date", "end_date", "found_cufes_count", "founded_electronic_invoices_count", "founded_credit_notes_count", "founded_skipped_count", "scan_progress", "created_at", "updated_at"], "title": "DianImportationOut", "type": "object"}, "DianImportDocumentType": {"enum": ["PURCHASE", "SALE"], "title": "DianImportDocumentType", "type": "string"}, "DianImportationCreateIn": {"examples": [{"begin_date": "2026-01-01", "document_type": "PURCHASE", "url": "https://catalogo-vpfe.dian.gov.co/User/AuthToken?pk=8f2c1b4a9d3e&rk=900123456&token=6c1f0b7a2e5d4c3b"}], "properties": {"url": {"description": "Enlace del correo de la DIAN (con token).", "examples": ["https://catalogo-vpfe.dian.gov.co/User/AuthToken?pk=8f2c1b4a9d3e&rk=900123456&token=6c1f0b7a2e5d4c3b"], "title": "Url", "type": "string"}, "begin_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Inicio del rango a importar. Obligatorio en la primera importaci\u00f3n; luego se contin\u00faa desde el fin de la anterior.", "title": "Begin Date"}, "document_type": {"allOf": [{"$ref": "#/components/schemas/DianImportDocumentType"}], "default": "PURCHASE"}}, "required": ["url"], "title": "DianImportationCreateIn", "type": "object"}, "DianImportationFilters": {"properties": {"status": {"anyOf": [{"$ref": "#/components/schemas/DianImportationStatusFilter"}, {"type": "null"}]}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}}, "title": "DianImportationFilters", "type": "object"}, "DianImportationStatusFilter": {"enum": ["NEW", "IN_PROGRESS", "SUCCESS", "ERROR"], "title": "DianImportationStatusFilter", "type": "string"}, "PagedDianImportationOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/DianImportationOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedDianImportationOut", "type": "object"}, "ExportFilters": {"properties": {"status": {"anyOf": [{"$ref": "#/components/schemas/ExportStatus"}, {"type": "null"}]}, "integration": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`).", "title": "Integration"}, "document_kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Tipo exportado (`export_kind`), p. ej. `electronic_invoice`.", "title": "Document Kind"}, "document_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Document Id"}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}}, "title": "ExportFilters", "type": "object"}, "ExportStatus": {"enum": ["queued", "running", "succeeded", "failed", "cancelled"], "title": "ExportStatus", "type": "string"}, "PagedExportOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/ExportOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedExportOut", "type": "object"}, "ExportQueuedOut": {"properties": {"run_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Run Id"}, "document_id": {"title": "Document Id", "type": "integer"}, "integration": {"title": "Integration", "type": "string"}, "document_kind": {"title": "Document Kind", "type": "string"}, "queued": {"title": "Queued", "type": "integer"}, "total": {"title": "Total", "type": "integer"}, "ready": {"title": "Ready", "type": "integer"}, "missing": {"title": "Missing", "type": "integer"}, "already_synced": {"title": "Already Synced", "type": "integer"}, "not_found": {"title": "Not Found", "type": "integer"}}, "required": ["run_id", "document_id", "integration", "document_kind", "queued", "total", "ready", "missing", "already_synced", "not_found"], "title": "ExportQueuedOut", "type": "object"}, "ExportCreateIn": {"examples": [{"document_id": 482913, "document_kind": "electronic_invoice", "integration": "siigo"}], "properties": {"document_id": {"examples": [482913], "title": "Document Id", "type": "integer"}, "integration": {"description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`).", "examples": ["siigo"], "title": "Integration", "type": "string"}, "document_kind": {"allOf": [{"$ref": "#/components/schemas/ExportDocumentKind"}], "default": "electronic_invoice"}}, "required": ["document_id", "integration"], "title": "ExportCreateIn", "type": "object"}, "ExportDocumentKind": {"enum": ["electronic_invoice", "contractor_invoice"], "title": "ExportDocumentKind", "type": "string"}, "ReadinessQuery": {"properties": {"document_id": {"title": "Document Id", "type": "integer"}, "integration": {"description": "Nombre de la integraci\u00f3n, p. ej. `siigo`, `world_office_desktop` o `siigo_pyme_desktop` (alias `siigo_pyme`).", "title": "Integration", "type": "string"}, "document_kind": {"allOf": [{"enum": ["electronic_invoice", "contractor_invoice"], "title": "ExportDocumentKind", "type": "string"}], "default": "electronic_invoice"}}, "required": ["document_id", "integration"], "title": "ReadinessQuery", "type": "object"}, "ReadinessIssueOut": {"properties": {"code": {"title": "Code", "type": "string"}, "message": {"title": "Message", "type": "string"}}, "required": ["code", "message"], "title": "ReadinessIssueOut", "type": "object"}, "ReadinessOut": {"properties": {"ready": {"title": "Ready", "type": "boolean"}, "status": {"description": "READY, MISSING, ALREADY_SYNCED o UNKNOWN.", "title": "Status", "type": "string"}, "issues": {"items": {"$ref": "#/components/schemas/ReadinessIssueOut"}, "title": "Issues", "type": "array"}, "total_to_pay": {"title": "Total To Pay"}}, "required": ["ready", "status", "issues"], "title": "ReadinessOut", "type": "object"}, "DianEventFilters": {"properties": {"cufe": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cufe"}, "is_paid": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Paid"}, "updated_since": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated Since"}}, "title": "DianEventFilters", "type": "object"}, "DianEventsOut": {"properties": {"acuse_recibo": {"anyOf": [{"$ref": "#/components/schemas/DianEventOut"}, {"type": "null"}], "description": "Evento 030."}, "recibo_bien": {"anyOf": [{"$ref": "#/components/schemas/DianEventOut"}, {"type": "null"}], "description": "Evento 032."}, "aceptacion_expresa": {"anyOf": [{"$ref": "#/components/schemas/DianEventOut"}, {"type": "null"}], "description": "Evento 033."}, "reclamo": {"anyOf": [{"$ref": "#/components/schemas/DianEventOut"}, {"type": "null"}], "description": "Evento 031."}}, "title": "DianEventsOut", "type": "object"}, "PagedDianEventStatusOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/DianEventStatusOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedDianEventStatusOut", "type": "object"}, "DianEventQueuedOut": {"properties": {"invoice_id": {"title": "Invoice Id", "type": "integer"}, "target_event": {"title": "Target Event", "type": "string"}, "queued": {"title": "Queued", "type": "boolean"}}, "required": ["invoice_id", "target_event", "queued"], "title": "DianEventQueuedOut", "type": "object"}, "DianEventSendIn": {"examples": [{"invoice_id": 482913, "target_event": "033"}], "properties": {"invoice_id": {"examples": [482913], "title": "Invoice Id", "type": "integer"}, "target_event": {"$ref": "#/components/schemas/DianTargetEvent", "description": "Evento objetivo: 030 acuse de recibo, 032 recibo del bien, 033 aceptaci\u00f3n expresa, 031 reclamo. Los eventos previos faltantes se env\u00edan en cadena.", "examples": ["033"]}}, "required": ["invoice_id", "target_event"], "title": "DianEventSendIn", "type": "object"}, "DianTargetEvent": {"enum": ["030", "032", "033", "031"], "title": "DianTargetEvent", "type": "string"}, "HabilitationRunOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "status": {"title": "Status", "type": "string"}, "started_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Started At"}, "finished_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Finished At"}, "error_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error Code"}, "error_message": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error Message"}}, "required": ["id", "status"], "title": "HabilitationRunOut", "type": "object"}, "HabilitationStatusOut": {"properties": {"government_status": {"enum": ["NOT_STARTED", "PENDING", "IN_PROCESS", "AUTHORIZED", "UNAUTHORIZED"], "title": "Government Status", "type": "string"}, "is_authorized": {"title": "Is Authorized", "type": "boolean"}, "test_set_id_present": {"title": "Test Set Id Present", "type": "boolean"}, "last_error": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Error"}, "active_run": {"anyOf": [{"$ref": "#/components/schemas/HabilitationRunOut"}, {"type": "null"}]}, "last_run": {"anyOf": [{"$ref": "#/components/schemas/HabilitationRunOut"}, {"type": "null"}]}, "updated_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Updated At"}}, "required": ["government_status", "is_authorized", "test_set_id_present"], "title": "HabilitationStatusOut", "type": "object"}, "HabilitationStartOut": {"properties": {"run": {"$ref": "#/components/schemas/HabilitationRunOut"}}, "required": ["run"], "title": "HabilitationStartOut", "type": "object"}, "HabilitationStartIn": {"properties": {"auth_url": {"description": "URL de autorizaci\u00f3n de la DIAN (se enmascara al guardarla).", "title": "Auth Url", "type": "string"}, "authorization_confirmed": {"description": "Confirma que el usuario autoriz\u00f3 a Alegra como proveedor.", "title": "Authorization Confirmed", "type": "boolean"}}, "required": ["auth_url", "authorization_confirmed"], "title": "HabilitationStartIn", "type": "object"}, "HabilitationRegisterIn": {"properties": {"test_set_id": {"title": "Test Set Id", "type": "string"}, "dv": {"description": "D\u00edgito de verificaci\u00f3n del NIT (0 a 9), enviado como cadena JSON, por ejemplo \"7\".", "title": "Dv", "type": "string"}}, "required": ["test_set_id", "dv"], "title": "HabilitationRegisterIn", "type": "object"}, "PagedWebhookEndpointOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/WebhookEndpointOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedWebhookEndpointOut", "type": "object"}, "WebhookEndpointOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "url": {"title": "Url", "type": "string"}, "description": {"title": "Description", "type": "string"}, "events": {"description": "Lista vac\u00eda = todos los eventos.", "items": {"type": "string"}, "title": "Events", "type": "array"}, "enabled": {"title": "Enabled", "type": "boolean"}, "consecutive_failures": {"title": "Consecutive Failures", "type": "integer"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}}, "required": ["id", "url", "description", "events", "enabled", "consecutive_failures", "created_at", "updated_at"], "title": "WebhookEndpointOut", "type": "object"}, "WebhookEndpointCreatedOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "url": {"title": "Url", "type": "string"}, "description": {"title": "Description", "type": "string"}, "events": {"description": "Lista vac\u00eda = todos los eventos.", "items": {"type": "string"}, "title": "Events", "type": "array"}, "enabled": {"title": "Enabled", "type": "boolean"}, "consecutive_failures": {"title": "Consecutive Failures", "type": "integer"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "secret": {"description": "Secreto de firma. Solo se muestra en esta respuesta.", "title": "Secret", "type": "string"}}, "required": ["id", "url", "description", "events", "enabled", "consecutive_failures", "created_at", "updated_at", "secret"], "title": "WebhookEndpointCreatedOut", "type": "object"}, "WebhookEndpointIn": {"examples": [{"description": "Producci\u00f3n Comercial Andina S.A.S.", "events": ["document.imported", "export.succeeded"], "url": "https://erp.comercialandina.com.co/webhooks/n1"}], "properties": {"url": {"description": "URL https a la que se enviar\u00e1n los eventos.", "format": "uri", "maxLength": 2083, "minLength": 1, "title": "Url", "type": "string"}, "description": {"default": "", "maxLength": 200, "title": "Description", "type": "string"}, "events": {"description": "Eventos suscritos. Lista vac\u00eda = todos los eventos.", "items": {"$ref": "#/components/schemas/WebhookEvent"}, "title": "Events", "type": "array"}}, "required": ["url"], "title": "WebhookEndpointIn", "type": "object"}, "WebhookEvent": {"enum": ["document.imported", "document.import_failed", "dian_import.completed", "dian_import.failed", "export.succeeded", "export.failed", "dian_event.completed", "dian_event.failed", "contact.created", "contact.updated", "desktop_agent.job.succeeded", "desktop_agent.job.failed", "desktop_agent.job.expired", "desktop_agent.job.cancelled", "world_office_desktop_document.succeeded", "world_office_desktop_document.failed", "webhook.test"], "title": "WebhookEvent", "type": "string"}, "WebhookEndpointPatch": {"examples": [{"description": "Producci\u00f3n Comercial Andina S.A.S.", "enabled": true, "events": ["document.imported", "export.failed"], "url": "https://erp.comercialandina.com.co/webhooks/n1"}], "properties": {"url": {"anyOf": [{"format": "uri", "maxLength": 2083, "minLength": 1, "type": "string"}, {"type": "null"}], "title": "Url"}, "description": {"anyOf": [{"maxLength": 200, "type": "string"}, {"type": "null"}], "title": "Description"}, "events": {"anyOf": [{"items": {"$ref": "#/components/schemas/WebhookEvent"}, "type": "array"}, {"type": "null"}], "title": "Events"}, "enabled": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Enabled"}}, "title": "WebhookEndpointPatch", "type": "object"}, "WebhookSecretOut": {"properties": {"secret": {"title": "Secret", "type": "string"}}, "required": ["secret"], "title": "WebhookSecretOut", "type": "object"}, "WebhookTestOut": {"properties": {"delivery_id": {"title": "Delivery Id", "type": "integer"}}, "required": ["delivery_id"], "title": "WebhookTestOut", "type": "object"}, "WebhookTestIn": {"properties": {"message": {"default": "Hola desde N1", "examples": ["Prueba de integraci\u00f3n de Comercial Andina S.A.S."], "maxLength": 200, "title": "Message", "type": "string"}}, "title": "WebhookTestIn", "type": "object"}, "WebhookDeliveryStatus": {"enum": ["pending", "delivered", "failed"], "title": "WebhookDeliveryStatus", "type": "string"}, "PagedWebhookDeliveryOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/WebhookDeliveryOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedWebhookDeliveryOut", "type": "object"}, "WebhookDeliveryOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "event_id": {"title": "Event Id", "type": "string"}, "event_type": {"title": "Event Type", "type": "string"}, "status": {"$ref": "#/components/schemas/WebhookDeliveryStatus"}, "attempts": {"title": "Attempts", "type": "integer"}, "next_attempt_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Next Attempt At"}, "last_status_code": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Last Status Code"}, "last_error": {"title": "Last Error", "type": "string"}, "delivered_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Delivered At"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}}, "required": ["id", "event_id", "event_type", "status", "attempts", "next_attempt_at", "last_status_code", "last_error", "delivered_at", "created_at"], "title": "WebhookDeliveryOut", "type": "object"}, "DeviceCompanyOut": {"properties": {"company_id": {"title": "Company Id", "type": "integer"}, "integration_name": {"title": "Integration Name", "type": "string"}, "grant_status": {"title": "Grant Status", "type": "string"}, "external_company_id": {"title": "External Company Id", "type": "string"}, "external_company_name": {"title": "External Company Name", "type": "string"}, "source_id": {"title": "Source Id", "type": "string"}, "ready": {"description": "El equipo est\u00e1 listo para recibir trabajos de esta empresa con el usuario de la clave (vinculaci\u00f3n confirmada y copia de seguridad).", "title": "Ready", "type": "boolean"}}, "required": ["company_id", "integration_name", "grant_status", "external_company_id", "external_company_name", "source_id", "ready"], "title": "DeviceCompanyOut", "type": "object"}, "DeviceOut": {"properties": {"id": {"description": "`device_id` p\u00fablico del equipo.", "format": "uuid", "title": "Id", "type": "string"}, "hostname": {"title": "Hostname", "type": "string"}, "app_version": {"title": "App Version", "type": "string"}, "presence": {"description": "online, degraded u offline.", "title": "Presence", "type": "string"}, "external_jobs_enabled": {"description": "Un administrador permiti\u00f3 causaciones externas en el equipo.", "title": "External Jobs Enabled", "type": "boolean"}, "external_jobs_enabled_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "External Jobs Enabled At"}, "capabilities": {"items": {"type": "string"}, "title": "Capabilities", "type": "array"}, "confirmation_required": {"description": "El equipo se vincul\u00f3 y espera que el usuario confirme la vinculaci\u00f3n (`POST /desktop-agents/devices/{device_id}/confirm`).", "title": "Confirmation Required", "type": "boolean"}, "companies": {"items": {"$ref": "#/components/schemas/DeviceCompanyOut"}, "title": "Companies", "type": "array"}}, "required": ["id", "hostname", "app_version", "presence", "external_jobs_enabled", "capabilities", "confirmation_required", "companies"], "title": "DeviceOut", "type": "object"}, "DevicesOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/DeviceOut"}, "title": "Items", "type": "array"}}, "required": ["items"], "title": "DevicesOut", "type": "object"}, "EnrollmentOut": {"properties": {"credential": {"description": "Credencial de un solo uso para vincular N1 Agente. Solo aparece en esta respuesta; N1 no la guarda ni la vuelve a mostrar.", "title": "Credential", "type": "string"}, "deep_link": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Enlace `n1-agente://`; null para `code`.", "title": "Deep Link"}, "expires_at": {"format": "date-time", "title": "Expires At", "type": "string"}, "kind": {"enum": ["link", "code"], "title": "Kind", "type": "string"}}, "required": ["credential", "expires_at", "kind"], "title": "EnrollmentOut", "type": "object"}, "EnrollmentIn": {"properties": {"kind": {"description": "`link` devuelve un enlace `n1-agente://`; `code` un c\u00f3digo corto.", "enum": ["link", "code"], "title": "Kind", "type": "string"}, "integration_name": {"description": "Integraci\u00f3n de escritorio, p. ej. `world_office_desktop` o `siigo_pyme`.", "title": "Integration Name", "type": "string"}}, "required": ["kind", "integration_name"], "title": "EnrollmentIn", "type": "object"}, "ReferencesQuery": {"properties": {"scope": {"description": "Cat\u00e1logo sincronizado, p. ej. `cuentas`.", "title": "Scope", "type": "string"}, "cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "limit": {"default": 100, "maximum": 500, "minimum": 1, "title": "Limit", "type": "integer"}}, "required": ["scope"], "title": "ReferencesQuery", "type": "object"}, "ReferenceItemOut": {"properties": {"id": {"title": "Id", "type": "string"}, "name": {"title": "Name", "type": "string"}, "data": {"title": "Data", "type": "object"}}, "required": ["id", "name", "data"], "title": "ReferenceItemOut", "type": "object"}, "ReferencesOut": {"properties": {"scope": {"title": "Scope", "type": "string"}, "synced_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "description": "\u00daltima sincronizaci\u00f3n del cat\u00e1logo; null si nunca.", "title": "Synced At"}, "items": {"items": {"$ref": "#/components/schemas/ReferenceItemOut"}, "title": "Items", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}}, "required": ["scope", "items", "next_cursor"], "title": "ReferencesOut", "type": "object"}, "SettingsOut": {"properties": {"integration_name": {"title": "Integration Name", "type": "string"}, "settings": {"title": "Settings", "type": "object"}}, "required": ["integration_name", "settings"], "title": "SettingsOut", "type": "object"}, "JobTypesQuery": {"properties": {"company_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "Limita a los tipos de la integraci\u00f3n de la empresa.", "title": "Company Id"}}, "title": "JobTypesQuery", "type": "object"}, "JobTypeOut": {"properties": {"job_type": {"title": "Job Type", "type": "string"}, "integration_name": {"title": "Integration Name", "type": "string"}, "schema_version": {"title": "Schema Version", "type": "integer"}, "schema": {"title": "Schema", "type": "object"}, "server_assigned_fields": {"items": {"type": "string"}, "title": "Server Assigned Fields", "type": "array"}}, "required": ["job_type", "integration_name", "schema_version", "schema", "server_assigned_fields"], "title": "JobTypeOut", "type": "object"}, "JobTypesOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/JobTypeOut"}, "title": "Items", "type": "array"}}, "required": ["items"], "title": "JobTypesOut", "type": "object"}, "ValidateBatchOut": {"properties": {"ok": {"description": "Todos los documentos son v\u00e1lidos.", "title": "Ok", "type": "boolean"}, "items": {"items": {"$ref": "#/components/schemas/ValidateOut"}, "title": "Items", "type": "array"}}, "required": ["ok", "items"], "title": "ValidateBatchOut", "type": "object"}, "ValidateOut": {"properties": {"ok": {"title": "Ok", "type": "boolean"}, "errors": {"items": {"$ref": "#/components/schemas/ValidationIssueOut"}, "title": "Errors", "type": "array"}, "warnings": {"items": {"$ref": "#/components/schemas/ValidationIssueOut"}, "title": "Warnings", "type": "array"}, "references_synced_at": {"additionalProperties": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}]}, "title": "References Synced At", "type": "object"}}, "required": ["ok", "errors", "warnings", "references_synced_at"], "title": "ValidateOut", "type": "object"}, "ValidationIssueOut": {"properties": {"code": {"title": "Code", "type": "string"}, "path": {"title": "Path", "type": "string"}, "message": {"title": "Message", "type": "string"}, "candidates": {"items": {}, "title": "Candidates", "type": "array"}, "scope": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Scope"}}, "required": ["code", "path", "message", "candidates"], "title": "ValidationIssueOut", "type": "object"}, "ValidateIn": {"properties": {"job_type": {"examples": ["wo_desktop.compra"], "title": "Job Type", "type": "string"}, "device_id": {"format": "uuid", "title": "Device Id", "type": "string"}, "payload": {"anyOf": [{"type": "object"}, {"type": "null"}], "description": "Documento completo seg\u00fan el esquema del tipo de trabajo (`GET /desktop-agents/job-types`). N1 asigna `causacionId`.", "title": "Payload"}, "items": {"anyOf": [{"items": {"$ref": "#/components/schemas/ValidateItem"}, "type": "array"}, {"type": "null"}], "description": "Lote de hasta 20 documentos, en lugar de `payload`.", "title": "Items"}}, "required": ["job_type", "device_id"], "title": "ValidateIn", "type": "object"}, "ValidateItem": {"properties": {"payload": {"description": "Documento completo seg\u00fan el esquema del tipo de trabajo (`GET /desktop-agents/job-types`). N1 asigna `causacionId`.", "title": "Payload", "type": "object"}}, "required": ["payload"], "title": "ValidateItem", "type": "object"}, "ExternalJobCreditsOut": {"properties": {"reserved": {"title": "Reserved", "type": "integer"}, "charged": {"title": "Charged", "type": "integer"}}, "required": ["reserved", "charged"], "title": "ExternalJobCreditsOut", "type": "object"}, "ExternalJobOut": {"properties": {"id": {"format": "uuid", "title": "Id", "type": "string"}, "company_id": {"title": "Company Id", "type": "integer"}, "device_id": {"format": "uuid", "title": "Device Id", "type": "string"}, "job_type": {"title": "Job Type", "type": "string"}, "status": {"description": "pending, claimed, running, reconciling, conflict, succeeded, failed, expired, cancelled o refused. Mientras el trabajo no termina refleja el estado actual del equipo. refused est\u00e1 reservado y hoy no se asigna.", "title": "Status", "type": "string"}, "origin": {"title": "Origin", "type": "string"}, "business_key": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Business Key"}, "external_actor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "External Actor"}, "idempotency_key": {"title": "Idempotency Key", "type": "string"}, "payload_digest": {"title": "Payload Digest", "type": "string"}, "payload": {"description": "Documento final, con `causacionId`, tal como lo recibe el equipo.", "title": "Payload", "type": "object"}, "result": {"anyOf": [{"$ref": "#/components/schemas/ExternalJobResultOut"}, {"type": "null"}]}, "uncertain": {"title": "Uncertain", "type": "boolean"}, "blocked_reason": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Blocked Reason"}, "credits": {"$ref": "#/components/schemas/ExternalJobCreditsOut"}, "created_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Created At"}, "claimed_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Claimed At"}, "finished_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Finished At"}, "timeline": {"items": {"$ref": "#/components/schemas/TimelineEntryOut"}, "title": "Timeline", "type": "array"}, "replayed": {"default": false, "description": "true cuando esta creaci\u00f3n devolvi\u00f3 un trabajo existente (misma `idempotency_key` o `business_key` ya consumida).", "title": "Replayed", "type": "boolean"}}, "required": ["id", "company_id", "device_id", "job_type", "status", "origin", "idempotency_key", "payload_digest", "payload", "uncertain", "credits", "timeline"], "title": "ExternalJobOut", "type": "object"}, "ExternalJobResultOut": {"properties": {"status": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Status"}, "error_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error Code"}, "user_message": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "User Message"}, "verification": {"title": "Verification", "type": "object"}}, "title": "ExternalJobResultOut", "type": "object"}, "JobsOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/ExternalJobOut"}, "title": "Items", "type": "array"}}, "required": ["items"], "title": "JobsOut", "type": "object"}, "TimelineEntryOut": {"properties": {"at": {"title": "At", "type": "string"}, "status": {"title": "Status", "type": "string"}, "detail": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Detail"}}, "required": ["at", "status"], "title": "TimelineEntryOut", "type": "object"}, "JobsCreateIn": {"examples": [{"business_key": "FC-11975", "device_id": "3f1c2a9e-5b7d-4e8a-9c0f-1a2b3c4d5e6f", "external_actor": "adlass:actor-7", "idempotency_key": "adlass-fc-11975", "job_type": "wo_desktop.compra", "payload": {"schemaVersion": 1, "type": "compra"}}], "properties": {"job_type": {"examples": ["wo_desktop.compra"], "title": "Job Type", "type": "string"}, "device_id": {"format": "uuid", "title": "Device Id", "type": "string"}, "idempotency_key": {"anyOf": [{"maxLength": 128, "minLength": 1, "type": "string"}, {"type": "null"}], "description": "Obligatoria con `payload`; en un lote va solo en cada elemento.", "title": "Idempotency Key"}, "business_key": {"anyOf": [{"maxLength": 200, "minLength": 1, "type": "string"}, {"type": "null"}], "description": "Identidad de negocio del documento (muy recomendada): una sola escritura por empresa y business_key. En un lote va en cada elemento.", "title": "Business Key"}, "external_actor": {"default": "", "maxLength": 200, "title": "External Actor", "type": "string"}, "payload": {"anyOf": [{"type": "object"}, {"type": "null"}], "description": "Documento completo seg\u00fan el esquema del tipo de trabajo (`GET /desktop-agents/job-types`). N1 asigna `causacionId`.", "title": "Payload"}, "items": {"anyOf": [{"items": {"$ref": "#/components/schemas/JobsCreateItem"}, "type": "array"}, {"type": "null"}], "description": "Lote de hasta 20 documentos, en lugar de `payload`.", "title": "Items"}}, "required": ["job_type", "device_id"], "title": "JobsCreateIn", "type": "object"}, "JobsCreateItem": {"properties": {"idempotency_key": {"maxLength": 128, "minLength": 1, "title": "Idempotency Key", "type": "string"}, "business_key": {"anyOf": [{"maxLength": 200, "minLength": 1, "type": "string"}, {"type": "null"}], "title": "Business Key"}, "external_actor": {"anyOf": [{"maxLength": 200, "type": "string"}, {"type": "null"}], "title": "External Actor"}, "payload": {"description": "Documento completo seg\u00fan el esquema del tipo de trabajo (`GET /desktop-agents/job-types`). N1 asigna `causacionId`.", "title": "Payload", "type": "object"}}, "required": ["idempotency_key", "payload"], "title": "JobsCreateItem", "type": "object"}, "JobsListQuery": {"properties": {"company_id": {"title": "Company Id", "type": "integer"}, "business_key": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Business Key"}, "status": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Status"}, "cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "limit": {"default": 50, "maximum": 100, "minimum": 1, "title": "Limit", "type": "integer"}}, "required": ["company_id"], "title": "JobsListQuery", "type": "object"}, "JobsListOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/ExternalJobOut"}, "title": "Items", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}}, "required": ["items", "next_cursor"], "title": "JobsListOut", "type": "object"}, "ActivationOut": {"properties": {"required": {"title": "Required", "type": "boolean"}, "purchased": {"title": "Purchased", "type": "boolean"}, "price": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Price"}, "currency": {"title": "Currency", "type": "string"}}, "required": ["required", "purchased", "price", "currency"], "title": "ActivationOut", "type": "object"}, "IntegrationStatusOut": {"properties": {"name": {"title": "Name", "type": "string"}, "active": {"title": "Active", "type": "boolean"}, "activation": {"$ref": "#/components/schemas/ActivationOut"}, "selected_device_id": {"anyOf": [{"format": "uuid", "type": "string"}, {"type": "null"}], "title": "Selected Device Id"}, "last_reference_sync_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Last Reference Sync At"}, "reference_scopes_synced": {"items": {"type": "string"}, "title": "Reference Scopes Synced", "type": "array"}, "document_settings": {"anyOf": [{"type": "object"}, {"type": "null"}], "title": "Document Settings"}, "sales_settings": {"anyOf": [{"type": "object"}, {"type": "null"}], "title": "Sales Settings"}}, "required": ["name", "active", "activation", "selected_device_id", "last_reference_sync_at", "reference_scopes_synced", "document_settings", "sales_settings"], "title": "IntegrationStatusOut", "type": "object"}, "ActivateIn": {"properties": {"existing_device_id": {"anyOf": [{"format": "uuid", "type": "string"}, {"type": "null"}], "title": "Existing Device Id"}}, "title": "ActivateIn", "type": "object"}, "SelectDeviceIn": {"properties": {"device_id": {"format": "uuid", "title": "Device Id", "type": "string"}}, "required": ["device_id"], "title": "SelectDeviceIn", "type": "object"}, "ReferencesRefreshOut": {"properties": {"requested_at": {"format": "date-time", "title": "Requested At", "type": "string"}}, "required": ["requested_at"], "title": "ReferencesRefreshOut", "type": "object"}, "ContactPreferencesOut": {"properties": {"contact_id": {"title": "Contact Id", "type": "integer"}, "preferences": {"title": "Preferences", "type": "object"}}, "required": ["contact_id", "preferences"], "title": "ContactPreferencesOut", "type": "object"}, "WoContactPreferencesIn": {"properties": {"payment_method": {"title": "Payment Method", "type": "string"}, "cost_center": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cost Center"}, "cost_center_per_item": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Cost Center Per Item"}, "payment_term_days": {"anyOf": [{"minimum": 0, "type": "integer"}, {"type": "null"}], "title": "Payment Term Days"}, "warehouse": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Warehouse"}, "withholding_accounts": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Withholding Accounts"}}, "required": ["payment_method"], "title": "WoContactPreferencesIn", "type": "object"}, "GroupRuleIn": {"properties": {"vat_rate": {"title": "Vat Rate", "type": "string"}, "inventory_code": {"title": "Inventory Code", "type": "string"}, "warehouse": {"title": "Warehouse", "type": "string"}, "account_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Account Code"}}, "required": ["vat_rate", "inventory_code", "warehouse"], "title": "GroupRuleIn", "type": "object"}, "WoItemGroupingIn": {"properties": {"enabled": {"title": "Enabled", "type": "boolean"}, "rules": {"items": {"$ref": "#/components/schemas/GroupRuleIn"}, "maxItems": 50, "title": "Rules", "type": "array"}}, "required": ["enabled", "rules"], "title": "WoItemGroupingIn", "type": "object"}, "ItemMappingOut": {"properties": {"product_name": {"title": "Product Name", "type": "string"}, "contact_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Contact Id"}, "mapping": {"title": "Mapping", "type": "object"}}, "required": ["product_name", "contact_id", "mapping"], "title": "ItemMappingOut", "type": "object"}, "ItemMappingsOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/ItemMappingOut"}, "title": "Items", "type": "array"}}, "required": ["items"], "title": "ItemMappingsOut", "type": "object"}, "WoItemMappingIn": {"properties": {"product_name": {"maxLength": 255, "minLength": 1, "title": "Product Name", "type": "string"}, "contact_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Contact Id"}, "inventory_code": {"title": "Inventory Code", "type": "string"}, "warehouse": {"title": "Warehouse", "type": "string"}, "account_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Account Code"}, "cost_center": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cost Center"}}, "required": ["product_name", "contact_id", "inventory_code", "warehouse"], "title": "WoItemMappingIn", "type": "object"}, "WoItemMappingsIn": {"properties": {"items": {"items": {"$ref": "#/components/schemas/WoItemMappingIn"}, "maxItems": 200, "minItems": 1, "title": "Items", "type": "array"}}, "required": ["items"], "title": "WoItemMappingsIn", "type": "object"}, "SiigoSettingsIn": {"properties": {"compra_document_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Compra Document Code"}, "nota_document_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Nota Document Code"}, "venta_document_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Venta Document Code"}, "payable_account": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Payable Account"}, "receivable_account": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Receivable Account"}, "purchase_iva_account": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Purchase Iva Account"}, "sales_iva_account": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sales Iva Account"}, "sales_discount_account": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Sales Discount Account"}, "cost_center": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cost Center"}, "warehouse": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Warehouse"}, "payment_term_days": {"anyOf": [{"minimum": 0, "type": "integer"}, {"type": "null"}], "title": "Payment Term Days"}, "retention_accounts": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Retention Accounts"}}, "title": "SiigoSettingsIn", "type": "object"}, "SiigoContactPreferencesIn": {"properties": {"document_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Document Code"}, "cost_center": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cost Center"}, "payment_term_days": {"anyOf": [{"minimum": 0, "type": "integer"}, {"type": "null"}], "title": "Payment Term Days"}, "retention": {"anyOf": [{"additionalProperties": {"type": "string"}, "type": "object"}, {"type": "null"}], "title": "Retention"}}, "title": "SiigoContactPreferencesIn", "type": "object"}, "SiigoItemMappingIn": {"properties": {"product_name": {"maxLength": 255, "minLength": 1, "title": "Product Name", "type": "string"}, "contact_id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Contact Id"}, "product_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Product Id"}, "account_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Account Code"}, "warehouse": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Warehouse"}, "cost_center": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cost Center"}}, "required": ["product_name"], "title": "SiigoItemMappingIn", "type": "object"}, "SiigoItemMappingsIn": {"properties": {"items": {"items": {"$ref": "#/components/schemas/SiigoItemMappingIn"}, "maxItems": 200, "minItems": 1, "title": "Items", "type": "array"}}, "required": ["items"], "title": "SiigoItemMappingsIn", "type": "object"}, "HistoryScanOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "status": {"title": "Status", "type": "string"}, "document_types": {"items": {"type": "string"}, "title": "Document Types", "type": "array"}, "statistics": {"anyOf": [{"type": "object"}, {"type": "null"}], "title": "Statistics"}, "error_code": {"title": "Error Code", "type": "string"}, "error_message": {"title": "Error Message", "type": "string"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "started_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Started At"}, "finished_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Finished At"}}, "required": ["id", "status", "document_types", "statistics", "error_code", "error_message", "created_at", "started_at", "finished_at"], "title": "HistoryScanOut", "type": "object"}, "HistoryScanIn": {"properties": {"document_types": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Document Types"}, "date_from": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Date From"}, "date_to": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "title": "Date To"}, "years": {"anyOf": [{"items": {"type": "integer"}, "type": "array"}, {"type": "null"}], "title": "Years"}}, "title": "HistoryScanIn", "type": "object"}, "HistorySuggestionsQuery": {"properties": {"status": {"anyOf": [{"enum": ["pending", "confirmed", "rejected"], "type": "string"}, {"type": "null"}], "default": "pending", "title": "Status"}, "cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Cursor"}, "limit": {"default": 50, "maximum": 200, "minimum": 1, "title": "Limit", "type": "integer"}}, "title": "HistorySuggestionsQuery", "type": "object"}, "HistorySuggestionOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "kind": {"title": "Kind", "type": "string"}, "status": {"title": "Status", "type": "string"}, "document_count": {"title": "Document Count", "type": "integer"}, "has_contact": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Has Contact"}, "data": {"title": "Data", "type": "object"}}, "required": ["id", "kind", "status", "document_count", "has_contact", "data"], "title": "HistorySuggestionOut", "type": "object"}, "HistorySuggestionsOut": {"properties": {"items": {"items": {"$ref": "#/components/schemas/HistorySuggestionOut"}, "title": "Items", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}}, "required": ["items", "next_cursor"], "title": "HistorySuggestionsOut", "type": "object"}, "DecideOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "kind": {"title": "Kind", "type": "string"}, "status": {"title": "Status", "type": "string"}}, "required": ["id", "kind", "status"], "title": "DecideOut", "type": "object"}, "DecideIn": {"properties": {"accept": {"title": "Accept", "type": "boolean"}}, "required": ["accept"], "title": "DecideIn", "type": "object"}, "DocumentErrorOut": {"properties": {"code": {"title": "Code", "type": "string"}, "message": {"title": "Message", "type": "string"}, "details": {"description": "Detalle del worker (p. ej. `reason`, `fields[]`, `missing[]`).", "title": "Details", "type": "object"}}, "required": ["code", "message"], "title": "DocumentErrorOut", "type": "object"}, "DocumentPostedOut": {"properties": {"id_asiento_contable": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Identificador del asiento en World Office.", "title": "Id Asiento Contable"}, "prefix": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefix"}, "document_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Document Number"}, "outcome": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "`imported` o `already_imported` (ya exist\u00eda con el mismo contenido).", "title": "Outcome"}, "crossings": {"description": "Cruces aplicados con el saldo del documento antes y despu\u00e9s (`balanceBefore`/`balanceAfter` pueden faltar en `already_imported`).", "items": {"type": "object"}, "title": "Crossings", "type": "array"}}, "title": "DocumentPostedOut", "type": "object"}, "WorldOfficeDesktopDocumentOut": {"properties": {"id": {"title": "Id", "type": "integer"}, "document_type": {"title": "Document Type", "type": "string"}, "external_number": {"title": "External Number", "type": "string"}, "status": {"$ref": "#/components/schemas/WorldOfficeDocumentStatus", "description": "`queued`, `running`, `succeeded` o `failed`."}, "posted": {"anyOf": [{"$ref": "#/components/schemas/DocumentPostedOut"}, {"type": "null"}], "description": "Comprobante registrado en World Office (solo `succeeded`)."}, "error": {"anyOf": [{"$ref": "#/components/schemas/DocumentErrorOut"}, {"type": "null"}]}, "credit_charged": {"title": "Credit Charged", "type": "boolean"}, "credit_charge_failed": {"default": false, "description": "`true` si el comprobante qued\u00f3 registrado pero N1 no pudo cobrar su cr\u00e9dito (c\u00f3digo `credit_charge_failed`).", "title": "Credit Charge Failed", "type": "boolean"}, "created_at": {"format": "date-time", "title": "Created At", "type": "string"}, "updated_at": {"format": "date-time", "title": "Updated At", "type": "string"}, "finished_at": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "title": "Finished At"}}, "required": ["id", "document_type", "external_number", "status", "credit_charged", "created_at", "updated_at"], "title": "WorldOfficeDesktopDocumentOut", "type": "object"}, "WorldOfficeDocumentStatus": {"enum": ["queued", "running", "succeeded", "failed"], "title": "WorldOfficeDocumentStatus", "type": "string"}, "DocumentContactIn": {"properties": {"tax_id": {"description": "Identificaci\u00f3n del tercero del encabezado, sin d\u00edgito de verificaci\u00f3n (solo letras y n\u00fameros). Si existe como contacto de la empresa en N1, se usan sus datos; si no, `name` (o `first_name` y `last_name`) e `id_type` son obligatorios (salvo NO y NOS).", "examples": ["900000801"], "title": "Tax Id", "type": "string"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Raz\u00f3n social o nombre completo.", "title": "Name"}, "first_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "First Name"}, "last_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Name"}, "id_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Tipo de identificaci\u00f3n DIAN.", "title": "Id Type"}, "person_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "`LEGAL` o `NATURAL`.", "title": "Person Type"}, "email": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Email"}, "phone": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Phone"}, "address": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Address"}, "city": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "City"}}, "required": ["tax_id"], "title": "DocumentContactIn", "type": "object"}, "DocumentCreateIn": {"examples": [{"concept": "Pago factura FV 936001", "contact": {"tax_id": "900000801"}, "date": "2026-10-28", "document_type": "RC", "external_number": "RC-2026-0001", "lines": [{"account_code": "11100501", "credit": "0", "debit": "1190000.00"}, {"account_code": "13050501", "credit": "1190000.00", "crossing": {"document_number": 936001, "document_type": "FV"}, "debit": "0"}]}], "properties": {"document_type": {"description": "Tipo de comprobante de World Office: `NC` Nota de contabilidad, `RC` Recibo de caja, `CE` Comprobante de egreso, `NO` N\u00f3mina de empleados, `NOS` N\u00f3mina de independientes, `NCPR` Nota cr\u00e9dito proveedores, `NDPR` Nota d\u00e9bito proveedores, `SI` Saldos iniciales. Un tipo desconocido responde `422 document_type_not_supported`; uno no habilitado, `403 document_type_not_enabled` (NCCL y NDCL est\u00e1n deshabilitados por defecto).", "examples": ["RC"], "title": "Document Type", "type": "string"}, "external_number": {"description": "Referencia del comprobante en tu sistema (m\u00e1ximo 20 caracteres: letras, n\u00fameros, `.`, `_`, `/`, `-`). World Office no registra dos comprobantes del mismo tipo con la misma referencia.", "examples": ["RC-2026-0001"], "title": "External Number", "type": "string"}, "date": {"format": "date", "title": "Date", "type": "string"}, "concept": {"description": "Nota del encabezado (1 a 500).", "title": "Concept", "type": "string"}, "contact": {"$ref": "#/components/schemas/DocumentContactIn"}, "prefix": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Prefijo registrado en World Office para el tipo (5).", "title": "Prefix"}, "document_number": {"anyOf": [{"type": "integer"}, {"type": "null"}], "description": "N\u00famero del comprobante; si falta, el siguiente libre del tipo.", "title": "Document Number"}, "lines": {"description": "De 1 a 347 l\u00edneas.", "items": {"$ref": "#/components/schemas/DocumentLineIn"}, "title": "Lines", "type": "array"}}, "required": ["document_type", "external_number", "date", "concept", "contact", "lines"], "title": "DocumentCreateIn", "type": "object"}, "DocumentCrossingIn": {"properties": {"document_type": {"description": "Tipo del documento a cruzar en World Office (1 a 4 letras), p. ej. `FV` o `FC`.", "examples": ["FV"], "title": "Document Type", "type": "string"}, "prefix": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Prefijo del documento a cruzar.", "title": "Prefix"}, "document_number": {"examples": [936001], "title": "Document Number", "type": "integer"}}, "required": ["document_type", "document_number"], "title": "DocumentCrossingIn", "type": "object"}, "DocumentLineIn": {"properties": {"account_code": {"description": "Cuenta auxiliar.", "examples": ["13050501"], "title": "Account Code", "type": "string"}, "debit": {"anyOf": [{"type": "number"}, {"type": "string"}], "default": "0", "description": "D\u00e9bito, m\u00e1ximo dos decimales.", "title": "Debit"}, "credit": {"anyOf": [{"type": "number"}, {"type": "string"}], "default": "0", "description": "Cr\u00e9dito, m\u00e1ximo dos decimales.", "title": "Credit"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Nota de la l\u00ednea (255).", "title": "Description"}, "contact_tax_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Tercero de la l\u00ednea; por defecto el del encabezado.", "title": "Contact Tax Id"}, "cost_center_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "C\u00f3digo del centro de costos.", "title": "Cost Center Code"}, "due_date": {"anyOf": [{"format": "date", "type": "string"}, {"type": "null"}], "description": "Vencimiento de la l\u00ednea.", "title": "Due Date"}, "retention_base": {"anyOf": [{"type": "number"}, {"type": "string"}, {"type": "null"}], "description": "Base de retenci\u00f3n; solo junto con `retention_percentage`.", "title": "Retention Base"}, "retention_percentage": {"anyOf": [{"type": "number"}, {"type": "string"}, {"type": "null"}], "description": "Porcentaje de retenci\u00f3n mayor que 0 y hasta 100 (p. ej. `2.5`).", "title": "Retention Percentage"}, "check": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "N\u00famero de cheque (20).", "title": "Check"}, "petty_cash": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "description": "Solo CE: l\u00ednea de caja menor.", "title": "Petty Cash"}, "crossing": {"anyOf": [{"$ref": "#/components/schemas/DocumentCrossingIn"}, {"type": "null"}], "description": "Cruce contra el saldo pendiente de otro documento de la empresa. RC, NCCL y la NC sobre un documento de cliente cruzan al cr\u00e9dito; CE, NCPR y la NC sobre un documento de proveedor al d\u00e9bito; NDCL al d\u00e9bito y NDPR al cr\u00e9dito. SI, NO y NOS no admiten cruces."}}, "required": ["account_code"], "title": "DocumentLineIn", "type": "object"}, "WorldOfficeDocumentType": {"enum": ["NC", "RC", "CE", "NO", "NOS", "NCPR", "NDPR", "NCCL", "NDCL", "SI"], "title": "WorldOfficeDocumentType", "type": "string"}, "PagedWorldOfficeDesktopDocumentOut": {"properties": {"data": {"items": {"$ref": "#/components/schemas/WorldOfficeDesktopDocumentOut"}, "title": "Data", "type": "array"}, "next_cursor": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Cursor"}, "has_more": {"title": "Has More", "type": "boolean"}}, "required": ["data", "next_cursor", "has_more"], "title": "PagedWorldOfficeDesktopDocumentOut", "type": "object"}}, "securitySchemes": {"ApiKeyAuth": {"type": "http", "bearerFormat": "n1_live_<id>_<secret>", "description": "Clave de API de N1. Env\u00edala en el encabezado `Authorization: Bearer n1_live_\u2026`. Se crea desde Configuraci\u00f3n \u2192 API.", "scheme": "bearer"}}}, "servers": [{"url": "https://api.n1.app", "description": "Producci\u00f3n"}], "externalDocs": {"description": "Gu\u00edas y ejemplos", "url": "https://n1.app/docs/api"}}