{"openapi":"3.1.0","info":{"description":"Emisión de documentos electrónicos del SIFEN (Paraguay). Autenticación con `Authorization: Bearer dpyf_test_…` (pruebas) o `dpyf_live_…` (producción). Toda emisión lleva `Idempotency-Key`. Los errores son `application/problem+json` con `code`, `mensaje`, `campo` y `como_resolver`. Ambiente actual del SIFEN: PRUEBAS.\n\n## Errores frecuentes\n\nTodos los errores son `application/problem+json` (RFC 9457) con `code` estable, `mensaje` en castellano, y cuando aplican `campo` (el dato del pedido o el id del Manual Técnico), `como_resolver` y `errores` (`[{campo, mensaje}]`).\n\n| HTTP | `code` | Qué pasó |\n|---|---|---|\n| 400 | `idempotency_key_requerida` | Falta `Idempotency-Key` en una emisión. |\n| 401 | `api_key_invalida` | La API key no existe, venció o fue revocada. |\n| 403 | `acceso_denegado` | La API key no tiene el scope (por ejemplo `documentos:emitir`). |\n| 409 | `perfil_inexistente` / `empresa_incompleta` | Falta configurar la empresa o su perfil de emisión. |\n| 409 | `xml_no_disponible` | El documento todavía no está firmado. |\n| 422 | `documento_invalido` | Un dato no cumple el Manual Técnico; la lista completa va en `errores`. |\n| 422 | `datos_invalidos` | Un dato del pedido no es válido; `campo` trae la ruta del JSON (`items[0].unidad`). |\n| 422 | `idempotency_key_reutilizada` | La misma `Idempotency-Key` con otro cuerpo. |\n| 429 | `limite_de_uso` | Demasiados pedidos por minuto: esperá lo que dice `Retry-After`. |\n\nUn rechazo del SIFEN no es un error HTTP: el documento queda `rechazado` con `sifen.codigo` y `sifen.mensaje`.","title":"FacturacionDPY","version":"v1"},"servers":[{"url":"https://facturacion.desarrollospy.de","description":"Este despliegue"}],"security":[{"claveApi":[]}],"paths":{"/api/v1/clave":{"get":{"tags":["controlador-clave"],"summary":"La clave de este pedido","description":"Prefijo, nombre, permisos, empresa y ambiente de la clave con la que se autenticó el pedido. Sirve con cualquier clave.","operationId":"clave","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaveInfo"}}}}},"x-scopes":["documentos:emitir","documentos:leer","eventos:enviar","catalogos:escribir"]}},"/api/v1/clientes":{"get":{"tags":["controlador-catalogos"],"operationId":"clientes","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limite","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosPaginaClientes"}}}}},"x-scopes":["documentos:emitir","catalogos:escribir"]},"post":{"tags":["controlador-catalogos"],"operationId":"crearCliente","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosDatosCliente"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosCliente"}}}}},"x-scopes":["catalogos:escribir"]}},"/api/v1/clientes/{id}":{"get":{"tags":["controlador-catalogos"],"operationId":"cliente","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosCliente"}}}}},"x-scopes":["documentos:emitir","catalogos:escribir"]},"put":{"tags":["controlador-catalogos"],"operationId":"editarCliente","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosDatosCliente"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosCliente"}}}}},"x-scopes":["catalogos:escribir"]},"delete":{"tags":["controlador-catalogos"],"operationId":"borrarCliente","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"}},"x-scopes":["catalogos:escribir"]}},"/api/v1/documentos":{"get":{"tags":["controlador-documentos"],"operationId":"listar_1","parameters":[{"name":"estado","in":"query","required":false,"schema":{"type":"string"}},{"name":"tipo","in":"query","description":"factura, autofactura, nota_credito, nota_debito o nota_remision (también 1, 4, 5, 6 o 7)","required":false,"schema":{"type":"string"}},{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"desde","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"hasta","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limite","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pagina"}}}}},"x-scopes":["documentos:leer"]},"post":{"tags":["controlador-documentos"],"summary":"Emitir un documento electrónico","description":"Requiere Idempotency-Key. Con esperar (hasta 10 s) espera el resultado del SIFEN. DPYF-Simular (rechazo, demora, caida_sifen) solo en el ambiente de pruebas o en una empresa de demostración.","operationId":"emitir","parameters":[{"name":"Idempotency-Key","in":"header","description":"Un valor único por documento (por ejemplo, un UUID), de hasta 100 caracteres.","required":true,"schema":{"type":"string"}},{"name":"DPYF-Simular","in":"header","required":false,"schema":{"type":"string"}},{"name":"esperar","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pedido"},"examples":{"factura":{"summary":"Factura a un contribuyente, pagada por transferencia","value":{"tipo":"factura","external_id":"PED-1001","cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A.","email":"compras@cliente.com.py"},"items":[{"codigo":"SOP-1","descripcion":"Servicio de soporte mensual","cantidad":1,"precio":150000,"iva":10}],"pagos":[{"tipo":"transferencia","monto":150000}],"metadata":{"pedido":"PED-1001","sucursal":"Centro"}}},"nota_credito":{"summary":"Nota de crédito por devolución de una factura electrónica","value":{"tipo":"nota_credito","external_id":"DEV-0042","motivo":2,"documentos_asociados":[{"cdc":"01800000056001001000500212026102415091204280"}],"cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A."},"items":[{"descripcion":"Devolución de 2 bolsas de cemento","cantidad":2,"precio":62000,"iva":10}]}},"nota_remision":{"summary":"Nota de remisión: traslado de mercadería, sin precios","value":{"tipo":"nota_remision","external_id":"REM-0007","cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A.","direccion":"Avda. España 456","numero_casa":"456","departamento":1,"ciudad":1},"remision":{"motivo":1,"kilometros":25,"fecha_factura":"2026-10-26"},"transporte":{"inicio":"2026-10-24","fin":"2026-10-25","salida":{"direccion":"Depósito central","numero_casa":"1234","departamento":1,"ciudad":1},"entregas":[{"direccion":"Obra, Avda. España 456","departamento":1,"ciudad":1}],"vehiculos":[{"tipo":"Camión","marca":"Volvo","matricula":"ABC123"}],"transportista":{"nombre":"Transportes del Sur S.A.","ruc":"80025298-5","documento_chofer":"1234567","nombre_chofer":"Pedro Gómez","domicilio_fiscal":"Ruta 1 km 10, Capiatá","direccion_chofer":"Calle 1 nº 2, Asunción"}},"items":[{"codigo":"C50","descripcion":"Bolsa de cemento 50 kg","cantidad":10}]}}}}},"required":true},"responses":{"200":{"description":"Con `esperar`, si el SIFEN respondió a tiempo: el documento completo. También es la respuesta a un reintento con la misma `Idempotency-Key` y el mismo cuerpo (con `Idempotent-Replayed: true`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Documento"}}}},"202":{"description":"Recibido y en proceso, con `Location`: el resultado llega por webhook o por consulta. El `estado` es el de ese momento (con `esperar`, puede haber avanzado a `firmado` o `enviado`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Aceptado"},"examples":{"aceptado":{"summary":"Recibido: la firma y el envío siguen en segundo plano","value":{"id":"2009c98a-cf31-42fa-a4fd-d599d243428e","estado":"en_proceso","cdc":"01800000056001001000000122026102415091204280","numero":"001-001-0000001","links":{"self":"/api/v1/documentos/01800000056001001000000122026102415091204280","xml":"/api/v1/documentos/01800000056001001000000122026102415091204280/xml","kude":"/api/v1/documentos/01800000056001001000000122026102415091204280/kude.pdf"}}}}}}},"400":{"description":"Pedido incompleto","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"idempotency_key_requerida":{"summary":"Falta el encabezado Idempotency-Key","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#idempotency_key_requerida","title":"Bad Request","status":400,"detail":"Toda emisión necesita el encabezado Idempotency-Key (hasta 100 caracteres).","code":"idempotency_key_requerida","mensaje":"Toda emisión necesita el encabezado Idempotency-Key (hasta 100 caracteres).","campo":"Idempotency-Key","como_resolver":"Generá un UUID por documento y reusalo solo si reintentás ese mismo documento."}}}}}},"409":{"description":"Falta configuración de la empresa","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"perfil_inexistente":{"summary":"La empresa no tiene configurado cómo emitir","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#perfil_inexistente","title":"Conflict","status":409,"detail":"La empresa no tiene un perfil de emisión predeterminado.","code":"perfil_inexistente","mensaje":"La empresa no tiene un perfil de emisión predeterminado.","campo":"perfil_id","como_resolver":"Configurá establecimiento, punto de expedición y timbrado en el perfil de emisión."}}}}}},"422":{"description":"Datos que no cumplen el Manual Técnico o la API","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"datos_invalidos":{"summary":"Datos del pedido que no son válidos: campo con la ruta del JSON y todos los problemas en 'errores'","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#datos_invalidos","title":"Unprocessable Content","status":422,"detail":"Hay 2 datos para corregir. El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","code":"datos_invalidos","mensaje":"Hay 2 datos para corregir. El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","campo":"cliente.ruc","como_resolver":"Corregí todos los datos de 'errores' y volvé a enviar el pedido.","errores":[{"campo":"cliente.ruc","mensaje":"El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","como_resolver":"Verificá el número y el dígito verificador con tu cliente."},{"campo":"items[0].unidad","mensaje":"La unidad de medida 99999 no existe en la Tabla 5 del SIFEN.","como_resolver":"Usá por ejemplo 77 (unidad)."}]}},"documento_invalido":{"summary":"Un dato no cumple el Manual Técnico: campo con el id del MT y todos los errores en 'errores'","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#documento_invalido","title":"Unprocessable Content","status":422,"detail":"Número de casa del receptor debe ser numérico y es '12B'","code":"documento_invalido","mensaje":"Número de casa del receptor debe ser numérico y es '12B'","campo":"D218","como_resolver":"Corregí el dato indicado; la lista completa está en 'errores'.","errores":[{"mensaje":"Número de casa del receptor debe ser numérico y es '12B'","campo":"D218"}]}},"idempotency_key_reutilizada":{"summary":"La misma Idempotency-Key con otro cuerpo","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#idempotency_key_reutilizada","title":"Unprocessable Content","status":422,"detail":"Esa Idempotency-Key ya se usó para otro documento con datos distintos.","code":"idempotency_key_reutilizada","mensaje":"Esa Idempotency-Key ya se usó para otro documento con datos distintos.","campo":"Idempotency-Key","como_resolver":"Usá una clave nueva para cada documento; repetila solo al reintentar el mismo pedido."}}}}}},"429":{"description":"Límite de uso superado (con Retry-After)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"limite_de_uso":{"summary":"Se superó el límite de pedidos por minuto (viene con Retry-After)","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#limite_de_uso","title":"Too Many Requests","status":429,"detail":"La empresa superó el límite de 600 pedidos por minuto.","code":"limite_de_uso","mensaje":"La empresa superó el límite de 600 pedidos por minuto.","como_resolver":"Esperá los segundos que indica Retry-After; para emitir en volumen, agrupá pedidos o pedí un límite mayor."}}}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/acciones":{"post":{"tags":["controlador-acciones"],"operationId":"ejecutar","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccionesPedido"}}},"required":true},"responses":{"200":{"description":"Las demás acciones: qué documento se aceptó y cuál se omitió, y por qué.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccionesResultado"}}}},"202":{"description":"Al descargar: el ZIP en preparación, con `Location` para seguirlo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccionesResultado"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/acciones/descargas/{id}":{"get":{"tags":["controlador-acciones"],"operationId":"descarga","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportacionExportacion"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/acciones/descargas/{id}/archivo":{"get":{"tags":["controlador-acciones"],"operationId":"archivo","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string","format":"byte"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/crudo":{"post":{"tags":["controlador-mapeos"],"operationId":"crudo","parameters":[{"name":"mapeo_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"validar","in":"query","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string","format":"byte"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoResultado"}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/crudo/csv":{"post":{"tags":["controlador-mapeos"],"operationId":"crudoCsv","parameters":[{"name":"mapeo_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"validar","in":"query","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"archivo":{"type":"string","format":"binary"}},"required":["archivo"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoResultado"}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/importar":{"post":{"tags":["controlador-documentos"],"operationId":"importar","parameters":[{"name":"validar","in":"query","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"archivo":{"type":"string","format":"binary"}},"required":["archivo"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportacionResultado"}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/validar":{"post":{"tags":["controlador-documentos"],"operationId":"validar","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pedido"},"examples":{"factura":{"summary":"Factura a un contribuyente, pagada por transferencia","value":{"tipo":"factura","external_id":"PED-1001","cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A.","email":"compras@cliente.com.py"},"items":[{"codigo":"SOP-1","descripcion":"Servicio de soporte mensual","cantidad":1,"precio":150000,"iva":10}],"pagos":[{"tipo":"transferencia","monto":150000}],"metadata":{"pedido":"PED-1001","sucursal":"Centro"}}},"nota_credito":{"summary":"Nota de crédito por devolución de una factura electrónica","value":{"tipo":"nota_credito","external_id":"DEV-0042","motivo":2,"documentos_asociados":[{"cdc":"01800000056001001000500212026102415091204280"}],"cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A."},"items":[{"descripcion":"Devolución de 2 bolsas de cemento","cantidad":2,"precio":62000,"iva":10}]}},"nota_remision":{"summary":"Nota de remisión: traslado de mercadería, sin precios","value":{"tipo":"nota_remision","external_id":"REM-0007","cliente":{"ruc":"80025298-5","nombre":"Cliente de Prueba S.A.","direccion":"Avda. España 456","numero_casa":"456","departamento":1,"ciudad":1},"remision":{"motivo":1,"kilometros":25,"fecha_factura":"2026-10-26"},"transporte":{"inicio":"2026-10-24","fin":"2026-10-25","salida":{"direccion":"Depósito central","numero_casa":"1234","departamento":1,"ciudad":1},"entregas":[{"direccion":"Obra, Avda. España 456","departamento":1,"ciudad":1}],"vehiculos":[{"tipo":"Camión","marca":"Volvo","matricula":"ABC123"}],"transportista":{"nombre":"Transportes del Sur S.A.","ruc":"80025298-5","documento_chofer":"1234567","nombre_chofer":"Pedro Gómez","domicilio_fiscal":"Ruta 1 km 10, Capiatá","direccion_chofer":"Calle 1 nº 2, Asunción"}},"items":[{"codigo":"C50","descripcion":"Bolsa de cemento 50 kg","cantidad":10}]}}}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Validacion"}}}},"409":{"description":"Falta configuración de la empresa","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"perfil_inexistente":{"summary":"La empresa no tiene configurado cómo emitir","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#perfil_inexistente","title":"Conflict","status":409,"detail":"La empresa no tiene un perfil de emisión predeterminado.","code":"perfil_inexistente","mensaje":"La empresa no tiene un perfil de emisión predeterminado.","campo":"perfil_id","como_resolver":"Configurá establecimiento, punto de expedición y timbrado en el perfil de emisión."}}}}}},"422":{"description":"Datos que no cumplen el Manual Técnico o la API","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"datos_invalidos":{"summary":"Datos del pedido que no son válidos: campo con la ruta del JSON y todos los problemas en 'errores'","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#datos_invalidos","title":"Unprocessable Content","status":422,"detail":"Hay 2 datos para corregir. El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","code":"datos_invalidos","mensaje":"Hay 2 datos para corregir. El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","campo":"cliente.ruc","como_resolver":"Corregí todos los datos de 'errores' y volvé a enviar el pedido.","errores":[{"campo":"cliente.ruc","mensaje":"El RUC 80956784-0 no es válido: El dígito verificador 0 no corresponde al RUC 80956784.","como_resolver":"Verificá el número y el dígito verificador con tu cliente."},{"campo":"items[0].unidad","mensaje":"La unidad de medida 99999 no existe en la Tabla 5 del SIFEN.","como_resolver":"Usá por ejemplo 77 (unidad)."}]}},"documento_invalido":{"summary":"Un dato no cumple el Manual Técnico: campo con el id del MT y todos los errores en 'errores'","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#documento_invalido","title":"Unprocessable Content","status":422,"detail":"Número de casa del receptor debe ser numérico y es '12B'","code":"documento_invalido","mensaje":"Número de casa del receptor debe ser numérico y es '12B'","campo":"D218","como_resolver":"Corregí el dato indicado; la lista completa está en 'errores'.","errores":[{"mensaje":"Número de casa del receptor debe ser numérico y es '12B'","campo":"D218"}]}}}}}},"429":{"description":"Límite de uso superado (con Retry-After)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problema"},"examples":{"limite_de_uso":{"summary":"Se superó el límite de pedidos por minuto (viene con Retry-After)","value":{"type":"https://facturacion.desarrollospy.de/api/docs/errores#limite_de_uso","title":"Too Many Requests","status":429,"detail":"La empresa superó el límite de 600 pedidos por minuto.","code":"limite_de_uso","mensaje":"La empresa superó el límite de 600 pedidos por minuto.","como_resolver":"Esperá los segundos que indica Retry-After; para emitir en volumen, agrupá pedidos o pedí un límite mayor."}}}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/xml":{"post":{"tags":["controlador-mapeos"],"operationId":"traerXml","parameters":[{"name":"Idempotency-Key","in":"header","description":"Un valor único por documento, de hasta 100 caracteres.","required":true,"schema":{"type":"string"}},{"name":"external_id","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/xml":{"schema":{"type":"string","format":"byte"}},"text/xml":{"schema":{"type":"string","format":"byte"}}},"required":true},"responses":{"200":{"description":"Un reintento con la misma `Idempotency-Key` y el mismo XML (`Idempotent-Replayed: true`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AceptadoXml"}}}},"202":{"description":"Recibido y en proceso, con `advertencias` (por ejemplo, huecos de numeración).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AceptadoXml"}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/{referencia}":{"get":{"tags":["controlador-documentos"],"operationId":"documento","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Documento"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/{referencia}/cancelar":{"post":{"tags":["controlador-eventos"],"operationId":"cancelar","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}},{"name":"esperar","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosCancelacion"}}},"required":true},"responses":{"200":{"description":"Con `esperar`, si el SIFEN respondió a tiempo: el evento resuelto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosEvento"}}}},"202":{"description":"Evento en curso, con `Location`: el resultado llega por webhook o por consulta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosEvento"}}}}},"x-scopes":["eventos:enviar"]}},"/api/v1/documentos/{referencia}/correos":{"get":{"tags":["controlador-documentos"],"operationId":"envios","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EnvioCorreo"}}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/{referencia}/enviar-correo":{"post":{"tags":["controlador-documentos"],"operationId":"enviarCorreo","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PedidoCorreo"}}}},"responses":{"202":{"description":"El envío quedó programado (`pendiente`); se sigue en `GET /documentos/{referencia}/correos`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CorreoProgramado"}}}}},"x-scopes":["documentos:emitir"]}},"/api/v1/documentos/{referencia}/eventos":{"get":{"tags":["controlador-eventos"],"operationId":"delDocumento","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EventosEvento"}}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/{referencia}/kude.pdf":{"get":{"tags":["controlador-documentos"],"summary":"KuDE en PDF","description":"formato=a4 (por defecto) o ticket (cinta de 80 mm).","operationId":"kude","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}},{"name":"formato","in":"query","required":false,"schema":{"type":"string","default":"a4"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string","format":"byte"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/documentos/{referencia}/xml":{"get":{"tags":["controlador-documentos"],"operationId":"xml","parameters":[{"name":"referencia","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/eventos":{"get":{"tags":["controlador-eventos"],"operationId":"listar_2","parameters":[{"name":"tipo","in":"query","required":false,"schema":{"type":"string"}},{"name":"estado","in":"query","required":false,"schema":{"type":"string"}},{"name":"desde","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"hasta","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limite","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosPagina"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/eventos-vivo":{"get":{"tags":["controlador-vivo"],"operationId":"vivo","responses":{"200":{"description":"OK","content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/SseEmitter"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/eventos/{id}":{"get":{"tags":["controlador-eventos"],"operationId":"evento","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosEvento"}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/inutilizaciones":{"post":{"tags":["controlador-eventos"],"operationId":"inutilizar","parameters":[{"name":"esperar","in":"query","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosInutilizacion"}}},"required":true},"responses":{"200":{"description":"Con `esperar`, si el SIFEN respondió a tiempo: el evento resuelto.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosEvento"}}}},"202":{"description":"Evento en curso, con `Location`: el resultado llega por webhook o por consulta.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventosEvento"}}}}},"x-scopes":["eventos:enviar"]}},"/api/v1/inutilizaciones/pendientes":{"get":{"tags":["controlador-eventos"],"operationId":"pendientes","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EventosRangoPendiente"}}}}}},"x-scopes":["documentos:leer"]}},"/api/v1/mapeos":{"get":{"tags":["controlador-mapeos"],"operationId":"listar","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MapeoMapeo"}}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]},"post":{"tags":["controlador-mapeos"],"operationId":"crear","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoPedidoMapeo"}}},"required":true},"responses":{"201":{"description":"El mapeo creado, con `Location`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoMapeo"}}}}},"x-scopes":["catalogos:escribir"]}},"/api/v1/mapeos/probar":{"post":{"tags":["controlador-mapeos"],"summary":"Probar una definición sin guardarla contra un ejemplo (no emite ni numera)","operationId":"probarDefinicion","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoPruebaDefinicion"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoResultado"}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]}},"/api/v1/mapeos/{id}":{"get":{"tags":["controlador-mapeos"],"operationId":"detalle","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoMapeo"}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]},"put":{"tags":["controlador-mapeos"],"operationId":"actualizar","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoPedidoMapeo"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoMapeo"}}}}},"x-scopes":["catalogos:escribir"]},"delete":{"tags":["controlador-mapeos"],"operationId":"eliminar","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"}},"x-scopes":["catalogos:escribir"]}},"/api/v1/mapeos/{id}/probar":{"post":{"tags":["controlador-mapeos"],"operationId":"probarArchivo","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string","format":"byte"}},"multipart/form-data":{"schema":{"type":"object","properties":{"archivo":{"type":"string","format":"binary"}},"required":["archivo"]}},"text/csv":{"schema":{"type":"string","format":"byte"}},"text/plain":{"schema":{"type":"string","format":"byte"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoResultado"}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]}},"/api/v1/mapeos/{id}/versiones/{version}":{"get":{"tags":["controlador-mapeos"],"operationId":"version","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoVersion"}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]}},"/api/v1/productos":{"get":{"tags":["controlador-catalogos"],"operationId":"productos","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limite","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosPaginaProductos"}}}}},"x-scopes":["documentos:emitir","catalogos:escribir"]},"post":{"tags":["controlador-catalogos"],"operationId":"crearProducto","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosDatosProducto"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosProducto"}}}}},"x-scopes":["catalogos:escribir"]}},"/api/v1/productos/{id}":{"get":{"tags":["controlador-catalogos"],"operationId":"producto","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosProducto"}}}}},"x-scopes":["documentos:emitir","catalogos:escribir"]},"put":{"tags":["controlador-catalogos"],"operationId":"editarProducto","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosDatosProducto"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogosProducto"}}}}},"x-scopes":["catalogos:escribir"]},"delete":{"tags":["controlador-catalogos"],"operationId":"borrarProducto","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"}},"x-scopes":["catalogos:escribir"]}},"/api/v1/recetas":{"get":{"tags":["controlador-mapeos"],"operationId":"recetas","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MapeoReceta"}}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]}},"/api/v1/recetas/{codigo}/ejemplo":{"get":{"tags":["controlador-mapeos"],"operationId":"ejemplo","parameters":[{"name":"codigo","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string","format":"byte"}}}}},"x-scopes":["catalogos:escribir","documentos:emitir"]}},"/api/v1/recetas/{codigo}/instalar":{"post":{"tags":["controlador-mapeos"],"operationId":"instalar","parameters":[{"name":"codigo","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoInstalarReceta"}}}},"responses":{"201":{"description":"El mapeo creado desde la receta, con `Location`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MapeoMapeo"}}}}},"x-scopes":["catalogos:escribir"]}},"/api/v1/ruc/{ruc}":{"get":{"tags":["controlador-ruc"],"operationId":"consultar","parameters":[{"name":"ruc","in":"path","required":true,"schema":{"type":"string"}},{"name":"esperar","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"`ruc`, `dv`, `ruc_completo`, `razon_social`, `estado` (`codigo` y `descripcion`), `activo`, `facturador_electronico`, `consultado_en` y `fuente`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RucRucConsultado"}}}},"202":{"description":"Con `esperar=0s` y sin datos en el caché: la consulta sigue; volvé a pedirlo en unos segundos (`Retry-After`).","content":{"application/json":{"schema":{"type":"object"}}}}},"x-scopes":["documentos:emitir","documentos:leer"]}}},"components":{"schemas":{"AccionesFiltro":{"type":"object","properties":{"desde":{"type":"string","format":"date"},"estado":{"type":"string"},"hasta":{"type":"string","format":"date"},"q":{"type":"string"},"tipo":{"type":"integer","format":"int32"}}},"AccionesPedido":{"type":"object","properties":{"accion":{"type":"string","minLength":1},"documentos":{"type":"array","items":{"type":"string"},"maxItems":500,"minItems":0},"filtro":{"$ref":"#/components/schemas/AccionesFiltro"},"incluir_kude":{"type":"boolean"}},"required":["accion"]},"AccionesResultado":{"type":"object","properties":{"accion":{"type":"string"},"aceptados":{"type":"integer","format":"int32"},"descarga":{"$ref":"#/components/schemas/ExportacionExportacion"},"documentos":{"type":"array","items":{"$ref":"#/components/schemas/AccionesResultadoDocumento"}},"omitidos":{"type":"integer","format":"int32"},"total":{"type":"integer","format":"int32"}}},"AccionesResultadoDocumento":{"type":"object","properties":{"cdc":{"type":"string"},"estado":{"type":"string"},"id":{"type":"string","format":"uuid"},"motivo":{"type":"string"},"numero":{"type":"string"},"referencia":{"type":"string"},"resultado":{"type":"string"}}},"Aceptado":{"type":"object","properties":{"advertencias":{"type":"array","items":{"type":"string"}},"cdc":{"type":"string"},"estado":{"type":"string"},"id":{"type":"string","format":"uuid"},"links":{"type":"object","additionalProperties":{"type":"string"}},"numero":{"type":"string"}}},"AceptadoXml":{"type":"object","properties":{"advertencias":{"type":"array","items":{"type":"string"}},"cdc":{"type":"string"},"estado":{"type":"string"},"id":{"type":"string","format":"uuid"},"links":{"type":"object","additionalProperties":{"type":"string"}},"numero":{"type":"string"}}},"Agente":{"type":"object","properties":{"direccion":{"type":"string","maxLength":255,"minLength":0},"nombre":{"type":"string","maxLength":60,"minLength":4},"ruc":{"type":"string","maxLength":12,"minLength":0}}},"AsociadoDocumento":{"type":"object","properties":{"cdc":{"type":"string"},"establecimiento":{"type":"string"},"fecha_emision":{"type":"string","format":"date"},"numero":{"type":"string"},"numero_constancia":{"type":"string"},"punto_expedicion":{"type":"string"},"timbrado":{"type":"string"},"tipo":{"type":"string"},"tipo_constancia":{"type":"string"},"tipo_documento":{"type":"string"}}},"CatalogosCliente":{"type":"object","properties":{"actualizado_en":{"type":"string","format":"date-time"},"celular":{"type":"string"},"ciudad":{"type":"integer","format":"int32"},"codigo":{"type":"string"},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string"},"distrito":{"type":"integer","format":"int32"},"documento":{"type":"string"},"email":{"type":"string"},"id":{"type":"string","format":"uuid"},"nombre":{"type":"string"},"numero_casa":{"type":"string"},"pais":{"type":"string"},"ruc":{"type":"string"},"telefono":{"type":"string"},"tipo_documento":{"type":"integer","format":"int32"},"tipo_operacion":{"type":"string"}}},"CatalogosDatosCliente":{"type":"object","properties":{"celular":{"type":"string","maxLength":20,"minLength":0},"ciudad":{"type":"integer","format":"int32"},"codigo":{"type":"string","maxLength":15,"minLength":0},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string","maxLength":255,"minLength":0},"distrito":{"type":"integer","format":"int32"},"documento":{"type":"string","maxLength":20,"minLength":0},"email":{"type":"string","format":"email","maxLength":80,"minLength":0},"nombre":{"type":"string","maxLength":255,"minLength":4},"numero_casa":{"type":"string","maxLength":6,"minLength":0},"pais":{"type":"string","maxLength":3,"minLength":3},"ruc":{"type":"string","maxLength":12,"minLength":0},"telefono":{"type":"string","maxLength":15,"minLength":0},"tipo_documento":{"type":"integer","format":"int32"},"tipo_operacion":{"type":"string"}},"required":["nombre"]},"CatalogosDatosProducto":{"type":"object","properties":{"afectacion":{"type":"string"},"codigo":{"type":"string","maxLength":50,"minLength":0},"descripcion":{"type":"string","maxLength":2000,"minLength":0},"iva":{"type":"integer","format":"int32"},"precio":{"type":"number","minimum":0},"proporcion_gravada":{"type":"number"},"unidad":{"type":"integer","format":"int32"}},"required":["codigo","descripcion"]},"CatalogosPaginaClientes":{"type":"object","properties":{"datos":{"type":"array","items":{"$ref":"#/components/schemas/CatalogosCliente"}},"siguiente":{"type":"string"}}},"CatalogosPaginaProductos":{"type":"object","properties":{"datos":{"type":"array","items":{"$ref":"#/components/schemas/CatalogosProducto"}},"siguiente":{"type":"string"}}},"CatalogosProducto":{"type":"object","properties":{"actualizado_en":{"type":"string","format":"date-time"},"afectacion":{"type":"string"},"codigo":{"type":"string"},"descripcion":{"type":"string"},"id":{"type":"string","format":"uuid"},"iva":{"type":"integer","format":"int32"},"precio":{"type":"number"},"proporcion_gravada":{"type":"number"},"unidad":{"type":"integer","format":"int32"}}},"Cheque":{"type":"object","properties":{"banco":{"type":"string","maxLength":20,"minLength":4},"numero":{"type":"string","minLength":1,"pattern":"\\d{1,8}"}},"required":["banco","numero"]},"ClaveEmpresa":{"type":"object","properties":{"demostracion":{"type":"boolean"},"razon_social":{"type":"string"},"ruc":{"type":"string"}}},"ClaveInfo":{"type":"object","properties":{"ambiente":{"type":"string","enum":["pruebas","produccion"]},"empresa":{"$ref":"#/components/schemas/ClaveEmpresa"},"expira_en":{"type":"string","format":"date-time"},"nombre":{"type":"string"},"prefijo":{"type":"string"},"scopes":{"type":"array","enum":["documentos:emitir","documentos:leer","eventos:enviar","catalogos:escribir"],"items":{"type":"string"}}}},"Cliente":{"type":"object","properties":{"celular":{"type":"string","maxLength":20,"minLength":0},"ciudad":{"type":"integer","format":"int32"},"codigo":{"type":"string","maxLength":15,"minLength":0},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string","maxLength":255,"minLength":0},"distrito":{"type":"integer","format":"int32"},"documento":{"type":"string","maxLength":20,"minLength":0},"email":{"type":"string","maxLength":80,"minLength":0},"nombre":{"type":"string","maxLength":255,"minLength":4},"numero_casa":{"type":"string","maxLength":6,"minLength":0},"pais":{"type":"string","maxLength":3,"minLength":3},"ruc":{"type":"string","maxLength":12,"minLength":0},"telefono":{"type":"string","maxLength":15,"minLength":0},"tipo_documento":{"type":"integer","format":"int32"},"tipo_operacion":{"type":"string"}}},"CorreoProgramado":{"type":"object","properties":{"destinatario":{"type":"string"},"estado":{"type":"string","enum":["pendiente","enviado","fallido"]},"id":{"type":"string","format":"uuid"}}},"Credito":{"type":"object","properties":{"cuotas":{"type":"integer","format":"int32"},"plazo":{"type":"string","maxLength":15,"minLength":0}}},"Documento":{"type":"object","properties":{"cancelable_hasta":{"type":"string","format":"date-time"},"cdc":{"type":"string"},"creado_en":{"type":"string","format":"date-time"},"documentos_asociados":{"type":"array","items":{"$ref":"#/components/schemas/AsociadoDocumento"}},"estado":{"type":"string"},"external_id":{"type":"string"},"fecha_emision":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"items":{"type":"array","items":{"$ref":"#/components/schemas/ItemDocumento"}},"links":{"type":"object","additionalProperties":{"type":"string"}},"metadata":{},"moneda":{"type":"string"},"numero":{"type":"string"},"receptor":{"$ref":"#/components/schemas/Receptor"},"sifen":{"$ref":"#/components/schemas/Sifen"},"tipo":{"type":"string"},"total":{"type":"number"},"total_iva":{"type":"number"}}},"DocumentoAsociado":{"type":"object","properties":{"cdc":{"type":"string","pattern":"[0-9]{44}"},"establecimiento":{"type":"string","pattern":"[0-9]{3}"},"fecha_emision":{"type":"string","format":"date"},"numero":{"type":"string","pattern":"[0-9]{1,7}"},"numero_constancia":{"type":"string","pattern":"[0-9]{11}"},"numero_control":{"type":"string","maxLength":8,"minLength":8},"punto_expedicion":{"type":"string","pattern":"[0-9]{3}"},"timbrado":{"type":"string","pattern":"[0-9]{8}"},"tipo_constancia":{"type":"string"},"tipo_documento":{"type":"string"}}},"EnvioCorreo":{"type":"object","properties":{"creado_en":{"type":"string","format":"date-time"},"destinatario":{"type":"string"},"enviado_en":{"type":"string","format":"date-time"},"estado":{"type":"string","enum":["pendiente","enviado","fallido"]},"id":{"type":"string","format":"uuid"},"intentos":{"type":"integer","format":"int32"},"origen":{"type":"string","enum":["automatico","manual"]},"ultimo_error":{"type":"string"}}},"EventosCancelacion":{"type":"object","properties":{"motivo":{"type":"string","maxLength":500,"minLength":5}},"required":["motivo"]},"EventosEvento":{"type":"object","properties":{"advertencias":{"type":"array","items":{"type":"string"}},"cdc":{"type":"string"},"creado_en":{"type":"string","format":"date-time"},"desde":{"type":"integer","format":"int32"},"documento_id":{"type":"string","format":"uuid"},"establecimiento":{"type":"string"},"estado":{"type":"string"},"hasta":{"type":"integer","format":"int32"},"id":{"type":"string","format":"uuid"},"links":{"type":"object","additionalProperties":{"type":"string"}},"motivo":{"type":"string"},"numero":{"type":"integer","format":"int64"},"punto_expedicion":{"type":"string"},"resuelto_en":{"type":"string","format":"date-time"},"serie":{"type":"string"},"sifen":{"$ref":"#/components/schemas/Sifen"},"timbrado":{"type":"string"},"tipo":{"type":"string"},"tipo_documento":{"type":"string"}}},"EventosInutilizacion":{"type":"object","properties":{"desde":{"type":"integer","format":"int32","maximum":9999999,"minimum":1},"establecimiento":{"type":"string","pattern":"[0-9]{3}"},"hasta":{"type":"integer","format":"int32","maximum":9999999,"minimum":1},"motivo":{"type":"string","maxLength":500,"minLength":5},"punto_expedicion":{"type":"string","pattern":"[0-9]{3}"},"serie":{"type":"string","pattern":"[A-Z]{2}"},"timbrado":{"type":"string","pattern":"[0-9]{8}"},"tipo_documento":{"type":"string","minLength":1}},"required":["desde","establecimiento","hasta","motivo","punto_expedicion","timbrado","tipo_documento"]},"EventosPagina":{"type":"object","properties":{"datos":{"type":"array","items":{"$ref":"#/components/schemas/EventosEvento"}},"siguiente":{"type":"string"}}},"EventosRangoPendiente":{"type":"object","properties":{"cantidad":{"type":"integer","format":"int32"},"desde":{"type":"integer","format":"int32"},"establecimiento":{"type":"string"},"hasta":{"type":"integer","format":"int32"},"motivo_sugerido":{"type":"string"},"punto_expedicion":{"type":"string"},"serie":{"type":"string"},"timbrado":{"type":"string"},"tipo_documento":{"type":"string"}}},"ExportacionExportacion":{"type":"object","properties":{"creada_en":{"type":"string","format":"date-time"},"documentos":{"type":"integer","format":"int32"},"error":{"type":"string"},"estado":{"type":"string"},"id":{"type":"string","format":"uuid"},"incluir_kude":{"type":"boolean"},"links":{"type":"object","additionalProperties":{"type":"string"}},"lista_en":{"type":"string","format":"date-time"},"mes":{"type":"string"},"nombre":{"type":"string"},"seleccionados":{"type":"integer","format":"int32"},"solicitada_por":{"type":"string"},"tamano":{"type":"integer","format":"int64"},"vence_en":{"type":"string","format":"date-time"}}},"ImportacionErrorFila":{"type":"object","properties":{"campo":{"type":"string"},"fila":{"type":"integer","format":"int32"},"mensaje":{"type":"string"}}},"ImportacionResultado":{"type":"object","properties":{"con_errores":{"type":"integer","format":"int32"},"documentos":{"type":"integer","format":"int32"},"emitidos":{"type":"integer","format":"int32"},"repetidos":{"type":"integer","format":"int32"},"resultados":{"type":"array","items":{"$ref":"#/components/schemas/ImportacionResultadoDocumento"}},"solo_validar":{"type":"boolean"},"validos":{"type":"integer","format":"int32"}}},"ImportacionResultadoDocumento":{"type":"object","properties":{"cdc":{"type":"string"},"errores":{"type":"array","items":{"$ref":"#/components/schemas/ImportacionErrorFila"}},"estado":{"type":"string"},"filas":{"type":"array","items":{"type":"integer","format":"int32"}},"numero":{"type":"string"},"referencia":{"type":"string"}}},"Item":{"type":"object","properties":{"afectacion":{"type":"string"},"cantidad":{"type":"number","exclusiveMinimum":0},"codigo":{"type":"string","maxLength":50,"minLength":0},"descripcion":{"type":"string","maxLength":2000,"minLength":0},"descuento":{"type":"number","minimum":0},"informacion":{"type":"string","maxLength":500,"minLength":0},"iva":{"type":"integer","format":"int32"},"precio":{"type":"number","minimum":0},"proporcion_gravada":{"type":"number"},"unidad":{"type":"integer","format":"int32"}},"required":["cantidad"]},"ItemDocumento":{"type":"object","properties":{"afectacion":{"type":"string"},"cantidad":{"type":"number"},"codigo":{"type":"string"},"descripcion":{"type":"string"},"descuento":{"type":"number"},"iva":{"type":"integer","format":"int32"},"precio":{"type":"number"},"total":{"type":"number"},"unidad":{"type":"integer","format":"int32"},"unidad_descripcion":{"type":"string"}}},"JsonNode":{"type":"object","properties":{"array":{"type":"boolean"},"big_decimal":{"type":"boolean"},"big_integer":{"type":"boolean"},"binary":{"type":"boolean"},"boolean":{"type":"boolean"},"container":{"type":"boolean"},"double":{"type":"boolean"},"embedded_value":{"type":"boolean"},"empty":{"type":"boolean"},"float":{"type":"boolean"},"floating_point_number":{"type":"boolean"},"int":{"type":"boolean"},"integral_number":{"type":"boolean"},"long":{"type":"boolean"},"missing_node":{"type":"boolean"},"node_type":{"type":"string","enum":["ARRAY","BINARY","BOOLEAN","MISSING","NULL","NUMBER","OBJECT","POJO","STRING"]},"null":{"type":"boolean"},"number":{"type":"boolean"},"object":{"type":"boolean"},"pojo":{"type":"boolean"},"short":{"type":"boolean"},"string":{"type":"boolean"},"textual":{"type":"boolean","deprecated":true},"value_node":{"type":"boolean"}}},"Lugar":{"type":"object","properties":{"ciudad":{"type":"integer","format":"int32"},"complemento1":{"type":"string","maxLength":255,"minLength":0},"complemento2":{"type":"string","maxLength":255,"minLength":0},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string","maxLength":255,"minLength":0},"distrito":{"type":"integer","format":"int32"},"numero_casa":{"type":"string","maxLength":6,"minLength":0},"telefono":{"type":"string","maxLength":15,"minLength":6}},"required":["ciudad","direccion"]},"MapeoErrorFila":{"type":"object","properties":{"campo":{"type":"string"},"documento":{"type":"integer","format":"int32"},"fila":{"type":"integer","format":"int32"},"mensaje":{"type":"string"}}},"MapeoInstalarReceta":{"type":"object","properties":{"nombre":{"type":"string","maxLength":80,"minLength":3},"predeterminado":{"type":"boolean"}}},"MapeoMapeo":{"type":"object","properties":{"actualizado_en":{"type":"string","format":"date-time"},"creado_en":{"type":"string","format":"date-time"},"creado_por":{"type":"string"},"definicion":{},"descripcion":{"type":"string"},"documentos":{"type":"integer","format":"int64"},"formato":{"type":"string"},"id":{"type":"string","format":"uuid"},"links":{"type":"object","additionalProperties":{"type":"string"}},"nombre":{"type":"string"},"predeterminado":{"type":"boolean"},"receta":{"type":"string"},"version":{"type":"integer","format":"int32"},"versiones":{"type":"array","items":{"$ref":"#/components/schemas/MapeoVersion"}}}},"MapeoPedidoMapeo":{"type":"object","properties":{"definicion":{"$ref":"#/components/schemas/JsonNode"},"descripcion":{"type":"string","maxLength":500,"minLength":0},"nombre":{"type":"string","maxLength":80,"minLength":3},"predeterminado":{"type":"boolean"}},"required":["definicion","nombre"]},"MapeoPruebaDefinicion":{"type":"object","properties":{"definicion":{"$ref":"#/components/schemas/JsonNode"},"ejemplo":{"type":"string","maxLength":2000000,"minLength":0}},"required":["definicion","ejemplo"]},"MapeoReceta":{"type":"object","properties":{"codigo":{"type":"string"},"definicion":{},"descripcion":{"type":"string"},"formato":{"type":"string"},"links":{"type":"object","additionalProperties":{"type":"string"}},"nombre":{"type":"string"}}},"MapeoResultado":{"type":"object","properties":{"con_errores":{"type":"integer","format":"int32"},"documentos":{"type":"integer","format":"int32"},"emitidos":{"type":"integer","format":"int32"},"mapeo_id":{"type":"string","format":"uuid"},"repetidos":{"type":"integer","format":"int32"},"resultados":{"type":"array","items":{"$ref":"#/components/schemas/MapeoResultadoDocumento"}},"solo_validar":{"type":"boolean"},"validos":{"type":"integer","format":"int32"},"version":{"type":"integer","format":"int32"}}},"MapeoResultadoDocumento":{"type":"object","properties":{"cdc":{"type":"string"},"documento":{"type":"integer","format":"int32"},"errores":{"type":"array","items":{"$ref":"#/components/schemas/MapeoErrorFila"}},"estado":{"type":"string"},"filas":{"type":"array","items":{"type":"integer","format":"int32"}},"numero":{"type":"string"},"pedido":{},"referencia":{"type":"string"}}},"MapeoVersion":{"type":"object","properties":{"creado_en":{"type":"string","format":"date-time"},"creado_por":{"type":"string"},"definicion":{},"version":{"type":"integer","format":"int32"}}},"Pagina":{"type":"object","properties":{"datos":{"type":"array","items":{"$ref":"#/components/schemas/Documento"}},"siguiente":{"type":"string"}}},"Pago":{"type":"object","properties":{"cheque":{"$ref":"#/components/schemas/Cheque"},"monto":{"type":"number","minimum":0},"tarjeta":{"$ref":"#/components/schemas/Tarjeta"},"tipo":{"type":"string","minLength":1}},"required":["monto","tipo"]},"Pedido":{"type":"object","properties":{"cliente":{"$ref":"#/components/schemas/Cliente"},"condicion":{"type":"string"},"credito":{"$ref":"#/components/schemas/Credito"},"documentos_asociados":{"type":"array","items":{"$ref":"#/components/schemas/DocumentoAsociado"},"maxItems":99,"minItems":0},"external_id":{"type":"string","maxLength":100,"minLength":0},"informacion_adicional":{"type":"string","maxLength":3000,"minLength":0},"informacion_fisco":{"type":"string","maxLength":3000,"minLength":0},"items":{"type":"array","items":{"$ref":"#/components/schemas/Item"},"maxItems":999,"minItems":0},"metadata":{"type":"object","additionalProperties":{}},"moneda":{"type":"string","maxLength":3,"minLength":3},"motivo":{"type":"integer","format":"int32"},"pagos":{"type":"array","items":{"$ref":"#/components/schemas/Pago"}},"perfil_id":{"type":"string","format":"uuid"},"remision":{"$ref":"#/components/schemas/Remision"},"tipo":{"type":"string","minLength":1},"tipo_cambio":{"type":"number","exclusiveMinimum":0},"tipo_transaccion":{"type":"integer","format":"int32"},"transporte":{"$ref":"#/components/schemas/Transporte"},"vendedor":{"$ref":"#/components/schemas/Vendedor"}},"required":["items","tipo"]},"PedidoCorreo":{"type":"object","properties":{"email":{"type":"string","maxLength":80,"minLength":0}}},"Problema":{"type":"object","description":"Error en application/problem+json (RFC 9457)","properties":{"campo":{"type":"string","description":"El dato del pedido (ruta del JSON) o el id del Manual Técnico"},"code":{"type":"string","description":"Código estable del error, para tu código"},"como_resolver":{"type":"string","description":"Qué hacer para resolverlo"},"detail":{"type":"string","description":"Igual a mensaje"},"errores":{"type":"array","description":"Todos los errores por dato","items":{"type":"object","properties":{"campo":{"type":"string","description":"El dato"},"mensaje":{"type":"string","description":"Qué está mal"}}}},"mensaje":{"type":"string","description":"Qué pasó, en castellano, para mostrarle a la persona"},"referencia":{"type":"string","description":"En un 500: el número para pedir ayuda a soporte"},"status":{"type":"integer","description":"Estado HTTP"},"title":{"type":"string","description":"Nombre del estado HTTP"},"type":{"type":"string","description":"URL que describe el error"}},"required":["code","mensaje","status","title","type"]},"Procesadora":{"type":"object","properties":{"nombre":{"type":"string","maxLength":60,"minLength":4},"ruc":{"type":"string","maxLength":12,"minLength":0}},"required":["nombre"]},"Receptor":{"type":"object","properties":{"celular":{"type":"string"},"ciudad":{"type":"integer","format":"int32"},"codigo":{"type":"string"},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string"},"distrito":{"type":"integer","format":"int32"},"documento":{"type":"string"},"email":{"type":"string"},"naturaleza":{"type":"string","enum":["contribuyente","no_contribuyente"]},"nombre":{"type":"string"},"numero_casa":{"type":"string"},"pais":{"type":"string"},"ruc":{"type":"string"},"telefono":{"type":"string"},"tipo_contribuyente":{"type":"integer","format":"int32"},"tipo_documento":{"type":"integer","format":"int32"},"tipo_operacion":{"type":"string","enum":["b2b","b2c","b2g","b2f"]}}},"Remision":{"type":"object","properties":{"costo_flete":{"type":"number","minimum":0},"descripcion_motivo":{"type":"string","maxLength":60,"minLength":5},"fecha_factura":{"type":"string","format":"date"},"kilometros":{"type":"integer","format":"int32","maximum":99999,"minimum":1},"motivo":{"type":"integer","format":"int32"},"responsable":{"type":"integer","format":"int32"}},"required":["kilometros","motivo"]},"RucRucConsultado":{"type":"object","properties":{"activo":{"type":"boolean"},"consultado_en":{"type":"string","format":"date-time"},"dv":{"type":"integer","format":"int32"},"estado":{"type":"object","additionalProperties":{"type":"string"}},"facturador_electronico":{"type":"boolean"},"fuente":{"type":"string"},"razon_social":{"type":"string"},"ruc":{"type":"string"},"ruc_completo":{"type":"string"}}},"Sifen":{"type":"object","properties":{"codigo":{"type":"string"},"como_resolver":{"type":"string"},"fecha_aprobacion":{"type":"string","format":"date-time"},"mensaje":{"type":"string"},"mensaje_claro":{"type":"string"}}},"SseEmitter":{"type":"object","properties":{"timeout":{"type":"integer","format":"int64"}}},"Tarjeta":{"type":"object","properties":{"autorizacion":{"type":"string","pattern":"\\d{6,10}"},"denominacion":{"type":"string","minLength":1},"descripcion":{"type":"string","maxLength":20,"minLength":4},"procesadora":{"$ref":"#/components/schemas/Procesadora"},"procesamiento":{"type":"string"},"titular":{"type":"string","maxLength":30,"minLength":4},"ultimos_digitos":{"type":"string","pattern":"\\d{4}"}},"required":["denominacion"]},"Transporte":{"type":"object","properties":{"condicion_negociacion":{"type":"string","maxLength":3,"minLength":3},"entregas":{"type":"array","items":{"$ref":"#/components/schemas/Lugar"},"maxItems":99,"minItems":0},"fin":{"type":"string","format":"date"},"inicio":{"type":"string","format":"date"},"modalidad":{"type":"integer","format":"int32"},"numero_despacho":{"type":"string","maxLength":16,"minLength":16},"numero_manifiesto":{"type":"string","maxLength":15,"minLength":0},"pais_destino":{"type":"string","maxLength":3,"minLength":3},"responsable_flete":{"type":"integer","format":"int32"},"salida":{"$ref":"#/components/schemas/Lugar"},"tipo":{"type":"string"},"transportista":{"$ref":"#/components/schemas/Transportista"},"vehiculos":{"type":"array","items":{"$ref":"#/components/schemas/Vehiculo"},"maxItems":4,"minItems":0}},"required":["entregas","fin","inicio","salida","transportista","vehiculos"]},"Transportista":{"type":"object","properties":{"agente":{"$ref":"#/components/schemas/Agente"},"direccion_chofer":{"type":"string","maxLength":255,"minLength":0},"documento":{"type":"string","maxLength":20,"minLength":0},"documento_chofer":{"type":"string","maxLength":20,"minLength":0},"domicilio_fiscal":{"type":"string","maxLength":150,"minLength":0},"nacionalidad":{"type":"string","maxLength":3,"minLength":3},"nombre":{"type":"string","maxLength":60,"minLength":4},"nombre_chofer":{"type":"string","maxLength":60,"minLength":4},"ruc":{"type":"string","maxLength":12,"minLength":0},"tipo_documento":{"type":"integer","format":"int32"}},"required":["direccion_chofer","documento_chofer","domicilio_fiscal","nombre","nombre_chofer"]},"Validacion":{"type":"object","properties":{"advertencias":{"type":"array","items":{"type":"string"}},"cdc":{"type":"string"},"total":{"type":"number"},"total_iva":{"type":"number"},"valido":{"type":"boolean"}}},"Vehiculo":{"type":"object","properties":{"adicional":{"type":"string","maxLength":20,"minLength":0},"marca":{"type":"string","maxLength":10,"minLength":0},"matricula":{"type":"string","maxLength":7,"minLength":0},"numero_identificacion":{"type":"string","maxLength":20,"minLength":0},"numero_vuelo":{"type":"string","maxLength":6,"minLength":6},"tipo":{"type":"string","maxLength":10,"minLength":4}},"required":["marca","tipo"]},"Vendedor":{"type":"object","properties":{"ciudad":{"type":"integer","format":"int32"},"departamento":{"type":"integer","format":"int32"},"direccion":{"type":"string","maxLength":255,"minLength":0},"distrito":{"type":"integer","format":"int32"},"documento":{"type":"string","maxLength":20,"minLength":0},"lugar_operacion":{"$ref":"#/components/schemas/Lugar"},"naturaleza":{"type":"string"},"nombre":{"type":"string","maxLength":60,"minLength":4},"numero_casa":{"type":"string","maxLength":6,"minLength":0},"tipo_documento":{"type":"integer","format":"int32"}},"required":["ciudad","direccion","documento","nombre"]}},"securitySchemes":{"claveApi":{"description":"API key de la empresa, creada en el panel (Configuración → API keys).","scheme":"bearer","type":"http"}}}}