{"openapi":"3.0.0","paths":{"/v1/companies/{companyId}/logo":{"get":{"description":"Requires companies:read. Returns {logo, data_url}; data_url can be used directly as an image source.","operationId":"CompanyLogoController_get[1]","parameters":[{"name":"companyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["logo","data_url"],"properties":{"logo":{"type":"object","nullable":true,"required":["content_type","size_bytes","width","height","sha256","updated_at"],"properties":{"content_type":{"type":"string","enum":["image/png"]},"size_bytes":{"type":"integer"},"width":{"type":"integer"},"height":{"type":"integer"},"sha256":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"data_url":{"type":"string","nullable":true,"example":"data:image/png;base64,..."}}}}}},"401":{"description":"Missing or invalid Bearer credentials","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_UNAUTHORIZED","message":"Missing or invalid Bearer credentials","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"403":{"description":"Missing company scope or permission","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_FORBIDDEN","message":"Missing company scope or permission","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"404":{"description":"Company not found in the authenticated organization","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_NOT_FOUND","message":"Company not found in the authenticated organization","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Get company logo metadata and embedded PNG (or null)","tags":["Empresas"]},"put":{"description":"Requires companies:write. Static PNG/JPG/WebP, maximum 2 MB and 16 megapixels. Normalized to PNG, maximum 1200×1200. Used automatically when generating invoice, receipt and note PDFs. Existing stored PDFs are preserved.","operationId":"CompanyLogoController_put[1]","parameters":[{"name":"companyId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","required":["logo","data_url"],"properties":{"logo":{"type":"object","nullable":true,"required":["content_type","size_bytes","width","height","sha256","updated_at"],"properties":{"content_type":{"type":"string","enum":["image/png"]},"size_bytes":{"type":"integer"},"width":{"type":"integer"},"height":{"type":"integer"},"sha256":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"data_url":{"type":"string","nullable":true,"example":"data:image/png;base64,..."}}}}}},"400":{"description":"Missing, unsupported, animated or invalid image","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_VALIDATION","message":"Missing, unsupported, animated or invalid image","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"401":{"description":"Missing or invalid Bearer credentials","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_UNAUTHORIZED","message":"Missing or invalid Bearer credentials","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"403":{"description":"Missing company scope or permission","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_FORBIDDEN","message":"Missing company scope or permission","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"404":{"description":"Company not found in the authenticated organization","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_NOT_FOUND","message":"Company not found in the authenticated organization","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"413":{"description":"File exceeds 2 MB"}},"security":[{"bearer":[]}],"summary":"Upload or replace company logo","tags":["Empresas"]},"delete":{"operationId":"CompanyLogoController_remove[1]","parameters":[{"name":"companyId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"Logo removed from the company configuration"},"401":{"description":"Missing or invalid Bearer credentials","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_UNAUTHORIZED","message":"Missing or invalid Bearer credentials","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"403":{"description":"Missing company scope or permission","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_FORBIDDEN","message":"Missing company scope or permission","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"404":{"description":"Company not found in the authenticated organization","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_NOT_FOUND","message":"Company not found in the authenticated organization","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Remove company logo from future PDF generation","tags":["Empresas"]}},"/v1/companies":{"get":{"operationId":"IntegratorCompaniesController_list","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Listar empresas propias sin secretos","tags":["Onboarding de integradores"]},"post":{"description":"RUC inmutable por empresa. Varias empresas por organización según plan. No elimina historial fiscal.","operationId":"IntegratorCompaniesController_create","parameters":[],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Crear empresa e inicializar series","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Onboarding por API, scope companies:write. RUC inmutable; series iniciales opcionales.","content":{"application/json":{"schema":{"type":"object","properties":{"ruc":{"type":"string","pattern":"^\\d{11}$"},"legal_name":{"type":"string","minLength":1},"trade_name":{"type":["string","null"]},"environment":{"type":"string","enum":["sandbox","production"]},"address":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"timezone":{"type":"string","minLength":1},"tax_agent_settings":{"type":"object","properties":{"retention":{"default":false,"type":"boolean"},"perception_regimes":{"default":[],"maxItems":3,"type":"array","items":{"type":"string","enum":["01","02","03"]}}},"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"seed_default_series":{"default":true,"type":"boolean"},"integration_defaults":{"type":"object","properties":{"currency":{"default":"PEN","type":"string","enum":["PEN","USD","EUR"]},"operation_type":{"default":"0101","type":"string","enum":["1001","1002","1003","1004","0101","0200"]},"issue_date":{"default":"today","type":"string","enum":["today","required"]},"series":{"default":{},"type":"object","properties":{"01":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"03":{"type":"string","pattern":"^B[A-Z0-9]{3}$"},"07":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"08":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"07:B":{"type":"string","pattern":"^B[A-Z0-9]{3}$"},"08:B":{"type":"string","pattern":"^B[A-Z0-9]{3}$"}},"additionalProperties":false}},"additionalProperties":false}},"required":["ruc","legal_name","environment"],"additionalProperties":false}}}}}},"/v1/companies/{id}":{"get":{"operationId":"IntegratorCompaniesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Consultar configuración y estado de credenciales","tags":["Onboarding de integradores"]},"patch":{"operationId":"IntegratorCompaniesController_patch","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Actualizar configuración o desactivar empresa conservando historial","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Configuración/desactivación de empresa sin borrar historial fiscal.","content":{"application/json":{"schema":{"type":"object","properties":{"environment":{"type":"string","enum":["sandbox","production"]},"legal_name":{"type":"string","minLength":1},"trade_name":{"type":["string","null"]},"address":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"timezone":{"type":"string","minLength":1},"tax_agent_settings":{"type":"object","properties":{"retention":{"default":false,"type":"boolean"},"perception_regimes":{"default":[],"maxItems":3,"type":"array","items":{"type":"string","enum":["01","02","03"]}}},"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"status":{"type":"string","enum":["active","disabled"]},"integration_defaults":{"type":"object","properties":{"currency":{"default":"PEN","type":"string","enum":["PEN","USD","EUR"]},"operation_type":{"default":"0101","type":"string","enum":["1001","1002","1003","1004","0101","0200"]},"issue_date":{"default":"today","type":"string","enum":["today","required"]},"series":{"default":{},"type":"object","properties":{"01":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"03":{"type":"string","pattern":"^B[A-Z0-9]{3}$"},"07":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"08":{"type":"string","pattern":"^F[A-Z0-9]{3}$"},"07:B":{"type":"string","pattern":"^B[A-Z0-9]{3}$"},"08:B":{"type":"string","pattern":"^B[A-Z0-9]{3}$"}},"additionalProperties":false}},"additionalProperties":false}},"additionalProperties":false}}}}},"delete":{"operationId":"IntegratorCompaniesController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"permanent","required":false,"in":"query","schema":{"enum":["true","false"],"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Eliminar empresa lógicamente; permanent=true solo sin historial fiscal ni webhooks","tags":["Onboarding de integradores"]}},"/v1/companies/{id}/series":{"get":{"operationId":"IntegratorCompaniesController_listSeries","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Listar series y próximo correlativo","tags":["Onboarding de integradores"]},"post":{"operationId":"IntegratorCompaniesController_addSeries","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Crear serie sin consumir correlativos","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Crear serie. Scope series:write. No reserva correlativo.","content":{"application/json":{"schema":{"type":"object","properties":{"document_type":{"type":"string","enum":["20","31","40","01","03","07","08","09","RR","RA","RC"]},"serie":{"type":"string","minLength":1,"maxLength":8},"next_number":{"type":"integer","exclusiveMinimum":0,"maximum":99999999},"padding":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"is_active":{"type":"boolean"},"numbering_confirmed":{"type":"boolean"},"origin":{"type":"string","enum":["new","migration"]}},"required":["document_type","serie"],"additionalProperties":false}}}}}},"/v1/companies/{id}/series/{seriesId}":{"patch":{"operationId":"IntegratorCompaniesController_patchSeries","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"seriesId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Activar serie con confirmación o avanzar correlativo con control de concurrencia; nunca reiniciar","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Cambiar padding/estado, sin reiniciar contador.","content":{"application/json":{"schema":{"type":"object","properties":{"is_active":{"type":"boolean"},"padding":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"next_number":{"type":"integer","exclusiveMinimum":0,"maximum":99999999},"expected_next_number":{"type":"integer","exclusiveMinimum":0,"maximum":100000000},"numbering_confirmed":{"type":"boolean"},"reason":{"type":"string","minLength":10,"maxLength":500}},"additionalProperties":false}}}}}},"/v1/companies/{id}/series/{seriesId}/history":{"get":{"operationId":"IntegratorCompaniesController_seriesHistory","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"seriesId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"tags":["Onboarding de integradores"]}},"/v1/companies/{id}/sol-credentials":{"put":{"description":"username = RUC + usuario SOL. Rotación invalida cache OAuth GRE.","operationId":"IntegratorCompaniesController_sol","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Rotar SOL cifrado; nunca devuelve contraseña","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Credenciales SOL cifradas. username=RUC+usuario. Scope credentials:manage.","content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","minLength":12,"maxLength":128},"password":{"type":"string","minLength":1,"maxLength":512}},"required":["username","password"],"additionalProperties":false}}}}}},"/v1/companies/{id}/gre-credentials":{"put":{"operationId":"IntegratorCompaniesController_gre","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Rotar credenciales OAuth GRE cifradas","tags":["Onboarding de integradores"],"requestBody":{"required":true,"description":"Rotación cifrada de OAuth GRE. Invalida token cacheado.","content":{"application/json":{"schema":{"type":"object","properties":{"client_id":{"type":"string","minLength":1,"maxLength":128},"client_secret":{"type":"string","minLength":1,"maxLength":512}},"required":["client_id","client_secret"],"additionalProperties":false}}}}}},"/v1/companies/{id}/cpe-credentials":{"put":{"operationId":"IntegratorCompaniesController_cpe","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"client_id":{"type":"string","minLength":1,"maxLength":128},"client_secret":{"type":"string","minLength":1,"maxLength":512}},"required":["client_id","client_secret"],"additionalProperties":false}}}},"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Rotar credenciales cifradas de Consulta Integrada SUNAT","tags":["Onboarding de integradores"]}},"/v1/companies/{id}/certificate":{"put":{"operationId":"IntegratorCompaniesController_certificate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","password"],"properties":{"file":{"type":"string","format":"binary"},"password":{"type":"string"}}}}}},"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Validar y rotar PFX cifrado, máximo 5 MB","tags":["Onboarding de integradores"]}},"/v1/companies/{id}/credentials/{kind}":{"delete":{"operationId":"IntegratorCompaniesController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"kind","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Revocar credencial preservando documentos emitidos","tags":["Onboarding de integradores"]}},"/v1/company-tools/certificate":{"post":{"operationId":"CompanyToolsController_convert","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"cert":{"type":"string","minLength":4,"maxLength":180000},"cert_pass":{"type":"string","maxLength":512},"base64":{"default":true,"type":"boolean"}},"required":["cert","cert_pass"],"additionalProperties":false}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Convertir P12/PFX enviado a PEM y CER, sin persistir material privado","tags":["Utilidades de archivos y certificados"]}},"/v1/company-tools/certificate/free":{"post":{"operationId":"CompanyToolsController_testCertificate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"password":{"type":"string","minLength":8,"maxLength":128}},"required":["password"],"additionalProperties":false}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Generar PFX autofirmado de prueba; no acredita identidad ni aceptación SUNAT","tags":["Utilidades de archivos y certificados"]}},"/v1/company-tools/file/base64":{"post":{"operationId":"CompanyToolsController_encode","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Codificar archivo de hasta 128 KiB en Base64","tags":["Utilidades de archivos y certificados"]}},"/v1/company-tools/base64/file":{"post":{"operationId":"CompanyToolsController_decode","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"base64":{"type":"string","minLength":4,"maxLength":180000},"filename":{"default":"file.bin","type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$"}},"required":["base64"],"additionalProperties":false}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Descargar bytes de Base64 sin persistir el archivo","tags":["Utilidades de archivos y certificados"]}},"/v1/sale/qr":{"post":{"operationId":"SaleQrController_qr","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"tipo":{"type":"string","enum":["01","03","07","08"]},"serie":{"type":"string","pattern":"^[FB][A-Z0-9]{3}$"},"numero":{"type":"string","pattern":"^\\d{1,8}$"},"emision":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"igv":{"type":"number","minimum":0,"multipleOf":0.01},"total":{"type":"number","minimum":0,"multipleOf":0.01},"clienteTipo":{"type":"string","pattern":"^[0-9A-D]$"},"clienteNumero":{"type":"string","pattern":"^[A-Za-z0-9-]{1,20}$"}},"required":["company_id","tipo","serie","numero","emision","igv","total","clienteTipo","clienteNumero"],"additionalProperties":false}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Generar PNG QR desde datos suministrados; no verifica emisión ni aceptación","tags":["Utilidades de venta"]}},"/v1/document-status":{"get":{"description":"Consulta documentos registrados; no emite ni consulta SUNAT automáticamente. Recuperar CDR por UUID o reconciliar ticket cuando corresponda.","operationId":"DocumentStatusController_status","parameters":[{"name":"numero","required":true,"in":"query","schema":{"type":"number"}},{"name":"serie","required":true,"in":"query","schema":{"type":"string"}},{"name":"tipo","required":true,"in":"query","schema":{"enum":["20","31","40","01","03","07","08","09","RC","RA","RR"],"type":"string"}},{"name":"company_id","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Consultar estado y enlaces CDR por empresa, tipo, serie y número","tags":["Documentos"]}},"/v1/document-status/ticket":{"get":{"operationId":"DocumentStatusController_ticket","parameters":[{"name":"ticket","required":true,"in":"query","schema":{"type":"string"}},{"name":"company_id","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Consultar estado local y enlaces CDR por ticket registrado","tags":["Documentos"]}},"/v1/document-status/recover-cdr":{"post":{"description":"Factura/notas F en producción; RC/RA mediante ticket existente. Boletas se recuperan por RC. GRE y RR usan sus endpoints reconcile-ticket. No emite ni consume numeración.","operationId":"DocumentStatusController_recover","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"tipo":{"type":"string","enum":["20","31","40","01","03","07","08","09","RC","RA","RR"]},"serie":{"type":"string","pattern":"^(?:[FBTVRP][A-Z0-9]{3}|\\d{8})$"},"numero":{"type":"integer","exclusiveMinimum":0,"maximum":99999999}},"required":["company_id","tipo","serie","numero"],"additionalProperties":false}}}},"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Recuperar CDR de documento registrado por identificadores","tags":["Documentos"]}},"/v1/previews/validate":{"post":{"operationId":"PreviewsController_validate","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Prevalidar 01/03/07/08/09/31/20/40/RC/RA/RR sin firma ni reserva de numeración","tags":["Vistas previas"],"requestBody":{"required":true,"description":"Vista previa local 01/03/07/08/09/31/20/40/RC/RA/RR sin certificado, envío ni reserva de correlativos; número 1 referencial. Scope documents:write; 500 líneas / 200 KB máximo. PDF marcado sin QR fiscal.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"document_type":{"type":"string","const":"01"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[Ff][A-Za-z0-9]{3}$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"03"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"serie":{"type":"string","pattern":"^[Bb][A-Za-z0-9]{3}$"},"include_in_daily_summary":{"default":true,"type":"boolean"},"send_individually":{"default":false,"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"07"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"08"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"09"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"31"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RC"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lines":{"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["03","07","08"]},"serie_number":{"type":"string"},"status":{"type":"string","enum":["1","2","3"]},"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"totals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"affected_document":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"perception":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}},"required":["company_id","reference_date"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RA"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"documents":{"minItems":1,"type":"array","items":{"type":"object","properties":{"line_id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_type":{"type":"string","minLength":1},"serie_number":{"type":"string"},"serie":{"type":"string"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reason":{"type":"string","minLength":1}},"required":["document_type","reason"],"additionalProperties":false}}},"required":["company_id","reference_date","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"20"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"default":"01","type":"string","const":"01"},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^R[A-Z0-9]{3}$"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"40"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"type":"string","enum":["01","02","03"]},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^P[A-Z0-9]{3}$"},"customer_is_perception_agent":{"type":"boolean"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","regime","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RR"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["20","40"]},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"reference_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"communicated_on":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":100}},"required":["document_id","reason"],"additionalProperties":false}}},"required":["company_id","document_type","issue_date","reference_date","communicated_on","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false}]}}}}}},"/v1/previews/xml":{"post":{"operationId":"PreviewsController_xml","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"XML sin firmar de vista previa; número 1 referencial, sin reservar","tags":["Vistas previas"],"requestBody":{"required":true,"description":"Vista previa local 01/03/07/08/09/31/20/40/RC/RA/RR sin certificado, envío ni reserva de correlativos; número 1 referencial. Scope documents:write; 500 líneas / 200 KB máximo. PDF marcado sin QR fiscal.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"document_type":{"type":"string","const":"01"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[Ff][A-Za-z0-9]{3}$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"03"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"serie":{"type":"string","pattern":"^[Bb][A-Za-z0-9]{3}$"},"include_in_daily_summary":{"default":true,"type":"boolean"},"send_individually":{"default":false,"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"07"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"08"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"09"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"31"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RC"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lines":{"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["03","07","08"]},"serie_number":{"type":"string"},"status":{"type":"string","enum":["1","2","3"]},"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"totals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"affected_document":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"perception":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}},"required":["company_id","reference_date"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RA"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"documents":{"minItems":1,"type":"array","items":{"type":"object","properties":{"line_id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_type":{"type":"string","minLength":1},"serie_number":{"type":"string"},"serie":{"type":"string"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reason":{"type":"string","minLength":1}},"required":["document_type","reason"],"additionalProperties":false}}},"required":["company_id","reference_date","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"20"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"default":"01","type":"string","const":"01"},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^R[A-Z0-9]{3}$"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"40"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"type":"string","enum":["01","02","03"]},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^P[A-Z0-9]{3}$"},"customer_is_perception_agent":{"type":"boolean"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","regime","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RR"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["20","40"]},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"reference_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"communicated_on":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":100}},"required":["document_id","reason"],"additionalProperties":false}}},"required":["company_id","document_type","issue_date","reference_date","communicated_on","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false}]}}}}}},"/v1/previews/pdf":{"post":{"operationId":"PreviewsController_pdf","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"PDF con marca VISTA PREVIA; hasta 500 líneas y 200 KB","tags":["Vistas previas"],"requestBody":{"required":true,"description":"Vista previa local 01/03/07/08/09/31/20/40/RC/RA/RR sin certificado, envío ni reserva de correlativos; número 1 referencial. Scope documents:write; 500 líneas / 200 KB máximo. PDF marcado sin QR fiscal.","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"document_type":{"type":"string","const":"01"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[Ff][A-Za-z0-9]{3}$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"03"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"serie":{"type":"string","pattern":"^[Bb][A-Za-z0-9]{3}$"},"include_in_daily_summary":{"default":true,"type":"boolean"},"send_individually":{"default":false,"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["customer","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"07"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"08"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"09"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"31"},"document":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RC"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lines":{"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["03","07","08"]},"serie_number":{"type":"string"},"status":{"type":"string","enum":["1","2","3"]},"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"totals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"affected_document":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"perception":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}},"required":["company_id","reference_date"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RA"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"documents":{"minItems":1,"type":"array","items":{"type":"object","properties":{"line_id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_type":{"type":"string","minLength":1},"serie_number":{"type":"string"},"serie":{"type":"string"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reason":{"type":"string","minLength":1}},"required":["document_type","reason"],"additionalProperties":false}}},"required":["company_id","reference_date","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"20"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"default":"01","type":"string","const":"01"},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^R[A-Z0-9]{3}$"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"40"},"document":{"type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"type":"string","enum":["01","02","03"]},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^P[A-Z0-9]{3}$"},"customer_is_perception_agent":{"type":"boolean"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","regime","documents","serie","company_id"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false},{"type":"object","properties":{"document_type":{"type":"string","const":"RR"},"document":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["20","40"]},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"reference_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"communicated_on":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":100}},"required":["document_id","reason"],"additionalProperties":false}}},"required":["company_id","document_type","issue_date","reference_date","communicated_on","documents"],"additionalProperties":false}},"required":["document_type","document"],"additionalProperties":false}]}}}}}},"/v1/documents/{id}/recover-cdr":{"post":{"description":"Factura/notas F por identificadores en producción; RC/RA por ticket existente. Máximo tres ciclos. GRE usa reconcile-ticket. No equivale a consultar validez.","operationId":"DocumentIntegrationController_recover","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Recuperar CDR sin emitir ni reservar correlativo","tags":["Integración y entrega"]}},"/v1/documents/{id}/deliveries":{"post":{"description":"Espera aceptación CPE/RC o aceptación GRE con PDF definitivo. Observados aceptados se entregan; pendientes esperan hasta siete días. Error de correo no altera resultado fiscal.","operationId":"DocumentIntegrationController_send","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Solicitar entrega por correo a hasta diez destinatarios","tags":["Integración y entrega"],"requestBody":{"required":true,"description":"Entrega solo tras aceptación. Idempotency-Key obligatorio; hasta diez correos. Estado propio por destinatario.","content":{"application/json":{"schema":{"type":"object","properties":{"recipients":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}}},"required":["recipients"],"additionalProperties":false}}}}},"get":{"operationId":"DocumentIntegrationController_list","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Consultar estado propio de entrega por destinatario","tags":["Integración y entrega"]}},"/v1/documents/{id}/deliveries/{deliveryId}/retry":{"post":{"description":"Requiere motivo. SMTP no garantiza exactamente una entrega; revisar estado unknown antes de autorizar reenvío.","operationId":"DocumentIntegrationController_retry","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"deliveryId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Reintento explícito de entrega fallida o incierta","tags":["Integración y entrega"],"requestBody":{"required":true,"description":"Autoriza reintento explícito de entrega fallida, desconocida o vencida; requiere motivo.","content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":5,"maxLength":500}},"required":["reason"],"additionalProperties":false}}}}}},"/v1/documents/{id}/shares":{"post":{"description":"Token opaco de 256 bits, almacenado como hash, máximo siete días. URL relativa al host API; token devuelto una vez. Revocable. MinIO permanece privado.","operationId":"DocumentIntegrationController_share","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Crear acceso temporal a archivos de un documento","tags":["Integración y entrega"],"requestBody":{"required":true,"description":"Token limitado a un documento, máximo siete días; URL relativa, revocable. Archivos requieren aceptación.","content":{"application/json":{"schema":{"type":"object","properties":{"allowed_artifacts":{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","enum":["pdf","xml","cdr","qr"]}},"ttl_seconds":{"default":86400,"type":"integer","minimum":60,"maximum":604800}},"required":["allowed_artifacts"],"additionalProperties":false}}}}},"get":{"operationId":"DocumentIntegrationController_shares","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Listar accesos temporales sin revelar tokens","tags":["Integración y entrega"]}},"/v1/documents/{id}/shares/{shareId}":{"delete":{"operationId":"DocumentIntegrationController_revoke","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"shareId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"bearer":[]}],"summary":"Revocar acceso compartido","tags":["Integración y entrega"]}},"/v1/shared-documents/{token}":{"get":{"description":"Solo identificador fiscal, estado y archivos permitidos del documento. No expone cliente, organización, listados ni credenciales.","operationId":"SharedDocumentsController_get","parameters":[{"name":"token","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Consultar documento compartido mediante token temporal","tags":["Acceso para destinatarios"]}},"/v1/shared-documents/{token}/{kind}":{"get":{"operationId":"SharedDocumentsController_file","parameters":[{"name":"token","required":true,"in":"path","schema":{"type":"string"}},{"name":"kind","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"summary":"Descargar archivo autorizado del documento compartido","tags":["Acceso para destinatarios"]}},"/v1/capabilities":{"get":{"description":"Fake/log prueban flujo, no aceptación oficial ni entrega SMTP real. No revela credenciales.","operationId":"CapabilitiesController_get","parameters":[],"responses":{"200":{"description":""}},"summary":"Matriz de capacidades reales y modos de transporte","tags":["Integración"]}},"/v1/retentions":{"post":{"description":"Requiere empresa habilitada como agente. Pagos brutos sin retención; el motor calcula 3% y neto pagado. Resultado asíncrono en /v1/documents/{id}.","operationId":"TaxAgentsController_retention","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"default":"01","type":"string","const":"01"},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^R[A-Z0-9]{3}$"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","documents","serie","company_id"],"additionalProperties":false}}}},"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"20","serie_number":"R001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Emitir comprobante de retención electrónica (20)","tags":["Retenciones, percepciones y reversiones"]}},"/v1/perceptions":{"post":{"description":"Regímenes 01=2%, 02=1%, 03=0.5%. Importe base del cobro sin percepción. Consulta, XML, CDR, PDF y QR en /v1/documents/{id}.","operationId":"TaxAgentsController_perception","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"issue_time":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"currency":{"default":"PEN","type":"string","const":"PEN"},"customer":{"type":"object","properties":{"identity_type":{"type":"string","const":"6"},"identity_number":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"trade_name":{"type":"string","maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"regime":{"type":"string","enum":["01","02","03"]},"observations":{"type":"string","maxLength":250},"totals_mode":{"default":"auto","type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["tax_amount","settlement_amount"],"additionalProperties":false},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03","08"]},"serie_number":{"type":"string","pattern":"^[A-Z0-9]{1,20}-[0-9]{1,12}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","enum":["PEN","USD","EUR"]},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"credit_notes":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"serie_number":{"type":"string","pattern":"^[A-Z0-9]{4}-[0-9]{1,8}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"total_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99}},"required":["serie_number","issue_date","total_amount"],"additionalProperties":false}},"payments":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":99999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"tax_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"tax_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"settlement_amount":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.99},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","enum":["USD","EUR"]},"target_currency":{"default":"PEN","type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0,"maximum":9999.999999},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["source_currency","rate","date"],"additionalProperties":false}},"required":["number","date","amount"],"additionalProperties":false}}},"required":["document_type","serie_number","issue_date","currency","total_amount","payments"],"additionalProperties":false}},"serie":{"type":"string","pattern":"^P[A-Z0-9]{3}$"},"customer_is_perception_agent":{"type":"boolean"},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["issue_date","customer","regime","documents","serie","company_id"],"additionalProperties":false}}}},"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"40","serie_number":"P001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Emitir comprobante de percepción electrónica (40)","tags":["Retenciones, percepciones y reversiones"]}},"/v1/reversions":{"post":{"description":"Documentos aceptados del mismo tipo, emisor, ambiente y fecha de referencia. Indicar communicated_on de la comunicación electrónica al receptor (máximo siete días). Incluye las reversiones previas aceptadas del mismo día y tipo; conserva originales y numeración.","operationId":"TaxAgentsController_reversion","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["20","40"]},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"reference_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"communicated_on":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"documents":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","minLength":1,"maxLength":100}},"required":["document_id","reason"],"additionalProperties":false}}},"required":["company_id","document_type","issue_date","reference_date","communicated_on","documents"],"additionalProperties":false}}}},"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"RR","serie_number":"20261013-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Enviar resumen de reversión (RR) de 20/40","tags":["Retenciones, percepciones y reversiones"]}},"/v1/reversions/{id}/reconcile-ticket":{"post":{"operationId":"TaxAgentsController_reconcile","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Reconciliar el ticket existente de un RR sin reenviar","tags":["Retenciones, percepciones y reversiones"]}},"/v1/invoices":{"post":{"description":"Crea y encola una factura electrónica (tipo 01).\n\n**Scope:** `documents:write`\n**Header obligatorio:** `Idempotency-Key`\n\nFlujo: validación → UBL → firma → envío SUNAT (o Fake) → estados hasta CDR.\nConsulta el resultado con `GET /v1/documents/{id}` o un webhook.","operationId":"InvoicesController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"01","serie_number":"F001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}},"401":{"description":"API key ausente o inválida.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_UNAUTHORIZED","message":"API key ausente o inválida.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"422":{"description":"Validación fallida o falta Idempotency-Key.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_VALIDATION","message":"Validación fallida o falta Idempotency-Key.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Emitir factura electrónica (01)","tags":["Facturas"],"requestBody":{"required":true,"description":"Factura (01) con múltiples líneas y totales por categoría/tributo/tasa. `auto` calcula los importes; `strict` requiere `totals` y compara exactamente a dos decimales. Se admiten direcciones tipadas, códigos de producto, leyendas, hora, vencimiento y orden de compra. Correlativo automático: omitir `number`. Crédito y cuotas, medios de pago, descuentos/cargos, anticipos, detracción 1001-1004, ISC (01/02/03), ICBPER, IVAP y tipo de cambio tipados. Ver docs/phase1-commercial-cpe.md.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[Ff][A-Za-z0-9]{3}$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false}},"required":["customer","lines"],"additionalProperties":false},"examples":{"simple":{"summary":"Integración mínima: una empresa asignada y una serie predeterminada/única activa","value":{"customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":100,"unit_price":118,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}]}},"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","serie":"F001","operation_type":"0101","issue_date":"2026-09-27","currency":"PEN","totals_mode":"auto","customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"id":1,"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":100,"unit_price":118,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}]}}}},"text/plain":{"example":"FACTOSYS|1|01\nFIELD|customer|{\"identity_type\":\"6\",\"identity_number\":\"20123456789\",\"name\":\"ACME SAC\"}\nLINE|{\"quantity\":1,\"unit_code\":\"NIU\",\"description\":\"Servicio de consultoría\",\"unit_value\":100,\"unit_price\":118,\"tax_affectation\":\"10\",\"igv_percent\":18,\"tax_scheme_id\":\"1000\"}\n","schema":{"type":"string","maxLength":204800,"description":"Factosys TXT v1: UTF-8, 200 KiB, header FACTOSYS|1|document-type, FIELD|field|JSON-value and LINE|JSON-object. See docs/phase6-compatibility.md and examples/phase6/invoice.txt."}}}}}},"/v1/receipts":{"post":{"description":"Crea y encola una boleta electrónica (tipo 03).\n\n**Scope:** `documents:write` · **Header:** `Idempotency-Key`\n\nTras la emisión puedes agrupar boletas en un resumen diario (RC) según reglas del plan.","operationId":"ReceiptsController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"03","serie_number":"B001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}},"401":{"description":"API key ausente o inválida.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_UNAUTHORIZED","message":"API key ausente o inválida.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}},"422":{"description":"Validación fallida o falta Idempotency-Key.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_VALIDATION","message":"Validación fallida o falta Idempotency-Key.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Emitir boleta electrónica (03)","tags":["Boletas"],"requestBody":{"required":true,"description":"Boleta (03), serie B###, mismo contrato y totales auto/strict que factura. RC conserva gravadas/exoneradas/inafectas/gratuitas. RC en moneda distinta de PEN o exportación aún no soportado: usar envío individual.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"operation_type":{"type":"string","minLength":4,"maxLength":4},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"totals_mode":{"type":"string","enum":["auto","strict"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"serie":{"type":"string","pattern":"^[Bb][A-Za-z0-9]{3}$"},"include_in_daily_summary":{"default":true,"type":"boolean"},"send_individually":{"default":false,"type":"boolean"}},"required":["customer","lines"],"additionalProperties":false},"examples":{"simple":{"summary":"Integración mínima: una empresa asignada y una serie predeterminada/única activa","value":{"customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":100,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}],"send_individually":true,"include_in_daily_summary":false}},"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","serie":"B001","operation_type":"0101","issue_date":"2026-10-08","currency":"PEN","totals_mode":"auto","customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"id":1,"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":100,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}],"send_individually":true,"include_in_daily_summary":false}}}},"text/plain":{"example":"FACTOSYS|1|03\nFIELD|customer|{\"identity_type\":\"6\",\"identity_number\":\"20123456789\",\"name\":\"ACME SAC\"}\nLINE|{\"quantity\":1,\"unit_code\":\"NIU\",\"description\":\"Servicio de consultoría\",\"unit_value\":100,\"tax_affectation\":\"10\",\"igv_percent\":18,\"tax_scheme_id\":\"1000\"}\nFIELD|send_individually|true\nFIELD|include_in_daily_summary|false\n","schema":{"type":"string","maxLength":204800,"description":"Factosys TXT v1: UTF-8, 200 KiB, header FACTOSYS|1|document-type, FIELD|field|JSON-value and LINE|JSON-object. See docs/phase6-compatibility.md and examples/phase6/invoice.txt."}}}}}},"/v1/credit-notes":{"post":{"description":"Emite una nota de crédito electrónica. Scope `documents:write`. Requiere `Idempotency-Key` y referencia al CPE afectado.","operationId":"CreditNotesController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"07","serie_number":"FC01-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}},"422":{"description":"Validación fallida.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_VALIDATION","message":"Validación fallida.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Emitir nota de crédito (07)","tags":["Notas de crédito"],"requestBody":{"required":true,"description":"Nota de crédito (07) con todas sus líneas, totales auto/strict y referencia al comprobante aceptado. Admite direcciones, códigos, hora, leyendas y orden de compra. Crédito tipo 13 ajusta cuotas de una factura a crédito aceptada con importes fiscales cero. Códigos 11/12 para exportación/IVAP. Descuentos y cargos tipados; misma moneda y adquirente del documento afectado.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","serie":"FC01","issue_date":"2026-10-08","currency":"PEN","totals_mode":"auto","customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"id":1,"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":10,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}],"note_type":"06","reason":"Ajuste comercial","affected_document":{"document_type":"01","serie_number":"F001-1"}}}}},"text/plain":{"example":"FACTOSYS|1|07\nFIELD|company_id|\"00000000-0000-4000-8000-000000000001\"\nFIELD|serie|\"FC01\"\nFIELD|issue_date|\"2026-10-08\"\nFIELD|currency|\"PEN\"\nFIELD|totals_mode|\"auto\"\nFIELD|customer|{\"identity_type\":\"6\",\"identity_number\":\"20123456789\",\"name\":\"ACME SAC\"}\nLINE|{\"id\":1,\"quantity\":1,\"unit_code\":\"NIU\",\"description\":\"Servicio de consultoría\",\"unit_value\":10,\"tax_affectation\":\"10\",\"igv_percent\":18,\"tax_scheme_id\":\"1000\"}\nFIELD|note_type|\"06\"\nFIELD|reason|\"Ajuste comercial\"\nFIELD|affected_document|{\"document_type\":\"01\",\"serie_number\":\"F001-1\"}\n","schema":{"type":"string","maxLength":204800,"description":"Factosys TXT v1: UTF-8, 200 KiB, header FACTOSYS|1|document-type, FIELD|field|JSON-value and LINE|JSON-object. See docs/phase6-compatibility.md and examples/phase6/invoice.txt."}}}}}},"/v1/debit-notes":{"post":{"description":"Emite una nota de débito electrónica. Scope `documents:write`. Requiere `Idempotency-Key` y referencia al CPE afectado.","operationId":"DebitNotesController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"08","serie_number":"FD01-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}},"422":{"description":"Validación fallida.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_VALIDATION","message":"Validación fallida.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Emitir nota de débito (08)","tags":["Notas de débito"],"requestBody":{"required":true,"description":"Nota de débito (08) con todas sus líneas y totales auto/strict, referenciando el comprobante aceptado. Admite direcciones, códigos, hora, leyendas y orden de compra. Vencimiento aún no soportado.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serie":{"type":"string","pattern":"^[FfBb][A-Za-z0-9]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"pdf_format":{"type":"string","enum":["A4","A5","TICKET80","TICKET58"]},"observations":{"type":"string","maxLength":2000},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"purchase_order":{"type":"string","minLength":1},"legends":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"text":{"type":"string","minLength":1}},"required":["code","text"],"additionalProperties":false}},"seller":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false},"embedded_despatch":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":100},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":100},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"transport_mode":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"multipleOf":0.001},"weight_unit":{"type":"string","enum":["KGM","TNE"]},"vehicle_plate":{"type":"string","pattern":"^[A-Z0-9-]{3,8}$"},"vehicle_brand":{"type":"string","minLength":1,"maxLength":40},"authorization":{"type":"string","minLength":1,"maxLength":40},"driver_license":{"type":"string","minLength":1,"maxLength":20}},"required":["origin","destination","transport_mode","gross_weight","weight_unit","vehicle_plate"],"additionalProperties":false},"sale_perception":{"type":"object","properties":{"regime":{"type":"string","enum":["01","02","03"]},"base_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"total_amount":{"type":"number","exclusiveMinimum":0,"multipleOf":0.01},"customer_is_perception_agent":{"type":"boolean"}},"required":["regime","base_amount","amount","total_amount"],"additionalProperties":false},"rounding_amount":{"type":"number","minimum":-1,"maximum":1,"multipleOf":0.01},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":100}},"required":["document_type","number"],"additionalProperties":false}},"payment_terms":{"oneOf":[{"type":"object","properties":{"condition":{"type":"string","const":"cash"}},"required":["condition"],"additionalProperties":false},{"type":"object","properties":{"condition":{"type":"string","const":"credit"},"currency":{"type":"string","minLength":3,"maxLength":3},"outstanding_amount":{"type":"number","exclusiveMinimum":0},"installments":{"minItems":1,"type":"array","items":{"type":"object","properties":{"number":{"type":"integer","minimum":1,"maximum":999},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["number","due_date","amount"],"additionalProperties":false}}},"required":["condition","currency","outstanding_amount","installments"],"additionalProperties":false}]},"payment_means":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{3}$"},"account":{"type":"string","minLength":1},"bank":{"type":"string","minLength":1},"reference":{"type":"string","minLength":1},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["code"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"prepayments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1,"maximum":99},"document_type":{"type":"string","enum":["01","03"]},"serie_number":{"type":"string","pattern":"^[FB][A-Z0-9]{3}-\\d{1,8}$"},"issuer_ruc":{"type":"string","pattern":"^\\d{11}$"},"paid_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"amount":{"type":"number","exclusiveMinimum":0},"base_amount":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","enum":["10","17","20","30"]},"percent":{"type":"number","minimum":0,"maximum":100},"isc_amount":{"type":"number","minimum":0},"isc_percent":{"type":"number","exclusiveMinimum":0},"isc_system":{"type":"string","enum":["01","02","03"]}},"required":["id","document_type","serie_number","issuer_ruc","paid_date","amount","base_amount","tax_affectation"],"additionalProperties":false}},"detraction":{"type":"object","properties":{"goods_code":{"type":"string","pattern":"^\\d{3}$"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100},"amount":{"type":"number","exclusiveMinimum":0},"account":{"type":"string","pattern":"^\\d{11}$"},"payment_means_code":{"type":"string","pattern":"^\\d{3}$"},"currency":{"default":"PEN","type":"string","const":"PEN"}},"required":["goods_code","percent","amount","account","payment_means_code"],"additionalProperties":false},"exchange_rate":{"type":"object","properties":{"source_currency":{"type":"string","minLength":3,"maxLength":3},"target_currency":{"type":"string","const":"PEN"},"rate":{"type":"number","exclusiveMinimum":0},"date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"source":{"type":"string","minLength":1}},"required":["source_currency","target_currency","rate","date","source"],"additionalProperties":false},"despatch_references":{"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie_number":{"type":"string","minLength":1}},"required":["document_type","serie_number"],"additionalProperties":false}},"currency":{"type":"string","minLength":3,"maxLength":3},"note_type":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"affected_document":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","01","03"]},"serie_number":{"type":"string","minLength":3}},"required":["document_type","serie_number"]},"customer":{"type":"object","properties":{"identity_type":{"type":"string","minLength":1},"identity_number":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"non_resident":{"type":"boolean"},"address":{"type":"object","properties":{"line":{"type":"string","minLength":1},"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"department":{"type":"string","minLength":1},"province":{"type":"string","minLength":1},"district":{"type":"string","minLength":1},"urbanization":{"type":"string","minLength":1},"country_code":{"type":"string","pattern":"^[A-Z]{2}$"},"establishment_code":{"type":"string","pattern":"^\\d{4}$"}},"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"gs1_product_code":{"type":"string","pattern":"^(?:\\d{8}|\\d{12}|\\d{13}|\\d{14})$"},"attributes":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{4}$"},"name":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":500},"start_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"end_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"duration_days":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name","value"],"additionalProperties":false}},"adjustments":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["20","46","47","48","49","50","51","52","53","00","01","02","03","04","05","06"]},"reason":{"type":"string","minLength":1},"base_amount":{"type":"number","exclusiveMinimum":0},"amount":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0},"tax_affectation":{"type":"string","pattern":"^\\d{2}$"},"tax_scheme_id":{"type":"string","pattern":"^\\d{4}$"},"percent":{"type":"number","minimum":0,"maximum":100},"tier_range":{"type":"string"},"related_percent":{"type":"number"}},"required":["code","base_amount","amount"],"additionalProperties":false}},"isc":{"oneOf":[{"type":"object","properties":{"system":{"type":"string","const":"01"},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","percent"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"02"},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["system","per_unit_amount"],"additionalProperties":false},{"type":"object","properties":{"system":{"type":"string","const":"03"},"retail_unit_price":{"type":"number","exclusiveMinimum":0},"factor":{"type":"number","exclusiveMinimum":0,"maximum":1},"percent":{"type":"number","exclusiveMinimum":0,"maximum":100}},"required":["system","retail_unit_price","factor","percent"],"additionalProperties":false}]},"icbper":{"type":"object","properties":{"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"per_unit_amount":{"type":"number","exclusiveMinimum":0}},"required":["quantity","per_unit_amount"],"additionalProperties":false},"cargo_transport":{"type":"object","properties":{"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1}},"required":["ubigeo","address"],"additionalProperties":false},"trip_description":{"type":"string","minLength":1},"reference_amount":{"type":"number","exclusiveMinimum":0},"reference_load_amount":{"type":"number","exclusiveMinimum":0},"reference_vehicle_amount":{"type":"number","exclusiveMinimum":0},"trips":{"minItems":1,"type":"array","items":{"type":"object","properties":{"configuration":{"type":"string","minLength":1},"tons":{"type":"number","exclusiveMinimum":0},"effective_tons":{"type":"number","exclusiveMinimum":0},"reference_amount":{"type":"number","exclusiveMinimum":0}},"required":["configuration","tons","effective_tons","reference_amount"],"additionalProperties":false}}},"required":["origin","destination","trip_description","reference_amount","reference_load_amount","reference_vehicle_amount","trips"],"additionalProperties":false},"hydrobiology":{"type":"object","properties":{"vessel_registration":{"type":"string","minLength":1},"vessel_name":{"type":"string","minLength":1},"species":{"type":"string","minLength":1},"quantity":{"type":"number","exclusiveMinimum":0},"unloading_place":{"type":"string","minLength":1},"unloading_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"required":["vessel_registration","vessel_name","species","quantity","unloading_place","unloading_date"],"additionalProperties":false},"passenger_transport":{"type":"object","properties":{"vehicle_plate":{"type":"string","minLength":1},"service_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"origin":{"type":"string","minLength":1},"destination":{"type":"string","minLength":1}},"required":["vehicle_plate","service_date","origin","destination"],"additionalProperties":false},"id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"quantity":{"type":"number","exclusiveMinimum":0},"unit_code":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"unit_value":{"type":"number","minimum":0},"unit_price":{"type":"number","minimum":0},"tax_affectation":{"type":"string","minLength":1},"igv_percent":{"type":"number","minimum":0,"maximum":100},"tax_scheme_id":{"type":"string"},"product_code":{"type":"string","minLength":1},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"}},"required":["quantity","unit_code","description","unit_value","tax_affectation"],"additionalProperties":false}},"totals_mode":{"type":"string","enum":["auto","strict"]},"totals":{"type":"object","properties":{"rounding_amount":{"type":"number"},"perception_amount":{"type":"number","minimum":0},"line_extension_amount":{"type":"number","minimum":0},"tax_amount":{"type":"number","minimum":0},"tax_inclusive_amount":{"type":"number","minimum":0},"payable_amount":{"type":"number","minimum":0},"taxed_amount":{"type":"number","minimum":0},"exempt_amount":{"type":"number","minimum":0},"unaffected_amount":{"type":"number","minimum":0},"export_amount":{"type":"number","minimum":0},"free_amount":{"type":"number","minimum":0},"free_tax_amount":{"type":"number","minimum":0},"prepaid_amount":{"type":"number","minimum":0},"allowance_total_amount":{"type":"number","minimum":0},"charge_total_amount":{"type":"number","minimum":0},"igv_amount":{"type":"number","minimum":0},"ivap_amount":{"type":"number","minimum":0},"isc_amount":{"type":"number","minimum":0},"icbper_amount":{"type":"number","minimum":0}},"required":["line_extension_amount","tax_amount","tax_inclusive_amount","payable_amount"],"additionalProperties":false},"include_in_daily_summary":{"type":"boolean"}},"required":["note_type","reason","affected_document","lines"],"additionalProperties":false},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","serie":"FD01","issue_date":"2026-10-08","currency":"PEN","totals_mode":"auto","customer":{"identity_type":"6","identity_number":"20123456789","name":"ACME SAC"},"lines":[{"id":1,"quantity":1,"unit_code":"NIU","description":"Servicio de consultoría","unit_value":10,"tax_affectation":"10","igv_percent":18,"tax_scheme_id":"1000"}],"note_type":"02","reason":"Aumento del valor","affected_document":{"document_type":"01","serie_number":"F001-1"}}}}},"text/plain":{"example":"FACTOSYS|1|08\nFIELD|company_id|\"00000000-0000-4000-8000-000000000001\"\nFIELD|serie|\"FD01\"\nFIELD|issue_date|\"2026-10-08\"\nFIELD|currency|\"PEN\"\nFIELD|totals_mode|\"auto\"\nFIELD|customer|{\"identity_type\":\"6\",\"identity_number\":\"20123456789\",\"name\":\"ACME SAC\"}\nLINE|{\"id\":1,\"quantity\":1,\"unit_code\":\"NIU\",\"description\":\"Servicio de consultoría\",\"unit_value\":10,\"tax_affectation\":\"10\",\"igv_percent\":18,\"tax_scheme_id\":\"1000\"}\nFIELD|note_type|\"02\"\nFIELD|reason|\"Aumento del valor\"\nFIELD|affected_document|{\"document_type\":\"01\",\"serie_number\":\"F001-1\"}\n","schema":{"type":"string","maxLength":204800,"description":"Factosys TXT v1: UTF-8, 200 KiB, header FACTOSYS|1|document-type, FIELD|field|JSON-value and LINE|JSON-object. See docs/phase6-compatibility.md and examples/phase6/invoice.txt."}}}}}},"/v1/voided-documents":{"post":{"description":"Registra una comunicación de baja. Scope `documents:write`. Requiere `Idempotency-Key`. El envío a SUNAT sigue el flujo SendSummary + consulta de ticket.","operationId":"VoidedDocumentsController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"RA","serie_number":"20261013-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Comunicación de baja RA (SendSummary + poll)","tags":["Comunicaciones de baja"],"requestBody":{"required":true,"description":"Comunicación de baja (RA). Incluye los documentos a dar de baja y el motivo.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"documents":{"minItems":1,"type":"array","items":{"type":"object","properties":{"line_id":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_type":{"type":"string","minLength":1},"serie_number":{"type":"string"},"serie":{"type":"string"},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"reason":{"type":"string","minLength":1}},"required":["document_type","reason"],"additionalProperties":false}}},"required":["company_id","reference_date","documents"],"additionalProperties":false},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","reference_date":"2026-10-08","documents":[{"document_type":"01","serie_number":"F001-1","reason":"Error de emisión"}]}}}}}}}},"/v1/daily-summaries":{"post":{"description":"Emite un resumen diario de boletas. Scope `documents:write`. Requiere `Idempotency-Key`.","operationId":"DailySummariesController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"RC","serie_number":"20261013-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Resumen diario RC (auto-pool + SendSummary + poll)","tags":["Resúmenes diarios"],"requestBody":{"required":true,"description":"Resumen diario (RC). Puede agrupar boletas del día según reglas de pool.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"correlative":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"document_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"lines":{"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_type":{"type":"string","enum":["03","07","08"]},"serie_number":{"type":"string"},"status":{"type":"string","enum":["1","2","3"]},"customer":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"totals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"affected_document":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"perception":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}},"required":["company_id","reference_date"],"additionalProperties":false},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"00000000-0000-4000-8000-000000000001","reference_date":"2026-10-08","document_ids":["00000000-0000-4000-8000-000000000001"]}}}}}}}},"/v1/despatch-advices/{id}/reconcile-ticket":{"post":{"description":"Máximo tres reconciliaciones manuales, ocho consultas por ciclo. El ticket debe corresponder a la guía; se verifica identidad del CDR antes de aceptar. Si se perdió el ticket, consultar SUNAT; esta operación no recupera tickets por serie/número.","operationId":"DespatchAdvicesController_reconcile","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Retomar consulta GRE con ticket existente, sin reenviar","tags":["Guías de remisión"],"requestBody":{"required":true,"description":"Reanuda consultarTicket de una GRE pendiente de reconciliación. Sin reenvío ni correlativo nuevo; máximo tres ciclos manuales. Se verifica identidad del CDR.","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["ticket"],"additionalProperties":false}}}}}},"/v1/despatch-advices":{"post":{"description":"Emite una guía de remisión electrónica. Scope `documents:write`. Requiere `Idempotency-Key`. Flujo GRE: OAuth SUNAT → sendDespatch → poll.","operationId":"DespatchAdvicesController_create","parameters":[{"name":"Idempotency-Key","in":"header","description":"Clave única de idempotencia por solicitud de emisión","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"Documento registrado y encolado. Ejemplo ilustrativo: 201 no significa aceptación SUNAT. Consulta status y los enlaces devueltos.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"09","serie_number":"T001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}}},"security":[{"bearer":[]}],"summary":"Emitir GRE 09/31 (OAuth + sendDespatch + poll)","tags":["Guías de remisión"],"requestBody":{"required":true,"description":"GRE 09/31 con roles de transporte, entrega e inicio del traslado, indicadores y referencias aduaneras. Numeración automática; 201 indica registro local. PDF/QR requieren aceptación y URL oficial del CDR. Consultar gre para disponibilidad y reconciliación.","content":{"application/json":{"schema":{"type":"object","properties":{"document_type":{"type":"string","enum":["31","09"]},"serie":{"type":"string","pattern":"^[TV][A-Z0-9]{3}$"},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"issue_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"notes":{"type":"string","minLength":1,"maxLength":250},"shipper":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"delivery_customer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"buyer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"shipment":{"type":"object","properties":{"transfer_reason_code":{"type":"string","enum":["13","14","17","18","19","01","02","03","04","05","06","07","08","09"]},"transfer_reason_text":{"type":"string","minLength":1,"maxLength":100},"transport_mode_code":{"type":"string","enum":["01","02"]},"gross_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"gross_weight_unit":{"type":"string","enum":["KGM","TNE"]},"selected_items_weight":{"type":"number","exclusiveMinimum":0,"maximum":999999999999.999},"weight_difference_reason":{"type":"string","minLength":1,"maxLength":250},"total_packages":{"type":"integer","exclusiveMinimum":0,"maximum":9999999999999},"start_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"start_time":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$"},"handover_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"carrier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"mtc_registration":{"type":"string","pattern":"^[A-Z0-9]{1,20}$"},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"vehicles":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"plate":{"type":"string","pattern":"^[A-Z0-9-]{6,8}$"},"authority_code":{"type":"string","minLength":1,"maxLength":50},"authority_entity_code":{"type":"string","pattern":"^\\d{2}$"},"tuc":{"type":"string","pattern":"^[A-Z0-9]{1,15}$"}},"required":["plate"],"additionalProperties":false}},"drivers":{"maxItems":3,"type":"array","items":{"type":"object","properties":{"job_title":{"type":"string","enum":["Principal","Secundario"]},"identity_type":{"type":"string","enum":["1","4","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250},"last_name":{"type":"string","minLength":1,"maxLength":250},"license":{"type":"string","pattern":"^[A-Z0-9]{9,10}$"}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"origin":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"destination":{"type":"object","properties":{"ubigeo":{"type":"string","pattern":"^\\d{6}$"},"address":{"type":"string","minLength":1,"maxLength":500},"establishment_code":{"type":"string","pattern":"^\\d{4}$"},"establishment_ruc":{"type":"string","pattern":"^\\d{11}$"}},"required":["ubigeo","address"],"additionalProperties":false},"container_id":{"type":"string","minLength":1,"maxLength":17},"container_seal":{"type":"string","minLength":1,"maxLength":100},"containers":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":17},"seal":{"type":"string","minLength":1,"maxLength":100}},"required":["id"],"additionalProperties":false}},"port_code":{"type":"string","pattern":"^[A-Z0-9]{3}$"},"scheduled_transshipment":{"type":"boolean"},"vehicle_m1_l":{"type":"boolean"},"return_empty_vehicle":{"type":"boolean"},"return_empty_packaging":{"type":"boolean"},"register_carrier_transport":{"type":"boolean"},"total_customs_transfer":{"type":"boolean"},"total_goods_transfer":{"type":"boolean"},"manifest_container_transfer":{"type":"boolean"},"subcontracted":{"type":"boolean"},"subcontractor":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"freight_payer":{"type":"string","enum":["shipper","subcontractor","third_party"]},"freight_payer_party":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false},"mtc_registration":{"type":"string","minLength":1,"maxLength":20},"authorization":{"type":"object","properties":{"entity_code":{"type":"string","pattern":"^\\d{2}$"},"number":{"type":"string","minLength":1,"maxLength":50}},"required":["entity_code","number"],"additionalProperties":false}},"required":["gross_weight","gross_weight_unit","start_date","origin","destination"],"additionalProperties":false},"related_documents":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"document_type":{"type":"string","enum":["12","31","48","49","50","52","65","66","67","68","69","71","72","73","74","75","76","77","78","80","81","82","91","92","93","94","95","01","03","04","09"]},"serie_number":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":120},"issuer":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie_number"],"additionalProperties":false}},"lines":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":0,"maximum":9999},"quantity":{"type":"number","exclusiveMinimum":0,"maximum":999999999999},"unit_code":{"type":"string","pattern":"^[A-Z0-9]{2,3}$"},"description":{"type":"string","minLength":1,"maxLength":500},"product_code":{"type":"string","minLength":1,"maxLength":30},"sunat_product_code":{"type":"string","pattern":"^\\d{8}$"},"tariff_heading":{"type":"string","pattern":"^\\d{10}$"},"normalized_good":{"type":"boolean"},"customs_document_number":{"type":"string","pattern":"^\\d{3}-\\d{4}-\\d{2}-[1-9]\\d{0,5}$"},"customs_item_number":{"type":"string","pattern":"^\\d{1,4}$"}},"required":["id","quantity","unit_code","description"],"additionalProperties":false}},"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier":{"type":"object","properties":{"identity_type":{"type":"string","enum":["0","1","4","6","7","A","B","C","D","E","F","G"]},"identity_number":{"type":"string","minLength":1,"maxLength":15},"name":{"type":"string","minLength":1,"maxLength":250}},"required":["identity_type","identity_number","name"],"additionalProperties":false}},"required":["document_type","serie","issue_date","delivery_customer","shipment","lines","company_id"],"additionalProperties":false},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"document_type":"09","serie":"T001","issue_date":"2026-10-08","issue_time":"10:00:00","notes":"Mercadería frágil: evitar golpes.","delivery_customer":{"identity_type":"6","identity_number":"20123456789","name":"DESTINATARIO SAC"},"shipment":{"transfer_reason_code":"01","transport_mode_code":"01","gross_weight":125.125,"gross_weight_unit":"KGM","total_packages":20,"start_date":"2026-10-10","start_time":"08:00:00","handover_date":"2026-10-09","carrier":{"identity_type":"6","identity_number":"20600000000","name":"DESTINATARIO SAC","mtc_registration":"MTC123","authorization":{"entity_code":"01","number":"AUT123"}},"origin":{"ubigeo":"150101","address":"Av. Origen 123","establishment_code":"0001","establishment_ruc":"20601234567"},"destination":{"ubigeo":"040101","address":"Almacén destino 456"}},"related_documents":[{"document_type":"01","serie_number":"F001-15","issuer":{"identity_type":"6","identity_number":"20123456789","name":"DESTINATARIO SAC"}}],"lines":[{"id":1,"quantity":12.123456789,"unit_code":"NIU","description":"Bienes a trasladar","product_code":"PROD1"}],"company_id":"00000000-0000-4000-8000-000000000001"}}}}}}}},"/v1/documents":{"get":{"description":"Lista documentos de la organización. Filtros: `company_id`, `document_type` (uno o CSV), `status`, fechas, `serie_number`, paginación por `cursor`. Scope `documents:read`.","operationId":"DocumentsController_list","parameters":[],"responses":{"200":{"description":"Listado paginado.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}},"next_cursor":{"type":"string","nullable":true}}},"example":{"items":[{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"01","serie_number":"F001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}],"next_cursor":null}}}}},"security":[{"bearer":[]}],"summary":"Listar documentos (filtros + cursor)","tags":["Documentos"]}},"/v1/documents/{id}":{"get":{"description":"Detalle del documento por id (estado SUNAT, serie-número, enlaces). Scope `documents:read`.","operationId":"DocumentsController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Estado actual del documento; ejemplo ilustrativo en cola.","content":{"application/json":{"schema":{"type":"object","required":["id","company_id","document_type","status","environment","links"],"properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"document_type":{"type":"string"},"serie_number":{"type":"string","nullable":true},"status":{"type":"string"},"environment":{"type":"string","enum":["sandbox","production"]},"issue_date":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"customer":{"type":"object","properties":{"identity_type":{"type":"string","nullable":true},"identity_number":{"type":"string","nullable":true},"name":{"type":"string","nullable":true}}},"totals":{"type":"object","nullable":true,"additionalProperties":true},"sunat_ticket":{"type":"string","nullable":true},"sunat_code":{"type":"string","nullable":true},"sunat_message":{"type":"string","nullable":true},"summary_status":{"type":"string","nullable":true},"error":{"type":"object","nullable":true,"additionalProperties":true},"links":{"type":"object","properties":{"self":{"type":"string"},"xml":{"type":"string"},"cdr":{"type":"string"},"pdf":{"type":"string"},"trace":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"example":{"id":"11111111-1111-4111-8111-111111111111","company_id":"00000000-0000-4000-8000-000000000001","document_type":"01","serie_number":"F001-00000001","status":"queued","environment":"sandbox","issue_date":"2026-10-13","currency":"PEN","customer":{"identity_type":"6","identity_number":"20123456789","name":"Cliente de ejemplo"},"totals":null,"sunat_ticket":null,"sunat_code":null,"sunat_message":null,"summary_status":null,"error":null,"links":{"self":"/v1/documents/11111111-1111-4111-8111-111111111111","xml":"/v1/documents/11111111-1111-4111-8111-111111111111/xml","cdr":"/v1/documents/11111111-1111-4111-8111-111111111111/cdr","pdf":"/v1/documents/11111111-1111-4111-8111-111111111111/pdf","trace":"/v1/documents/11111111-1111-4111-8111-111111111111/trace"},"created_at":"2026-10-13T15:00:00.000Z","updated_at":"2026-10-13T15:00:00.000Z"}}}},"404":{"description":"No existe o no pertenece al tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"example":{"code":"FACTOSYS_NOT_FOUND","message":"No existe o no pertenece al tenant.","request_id":"request-id-de-ejemplo","retryable":false,"details":[]}}}}},"security":[{"bearer":[]}],"summary":"Obtener documento","tags":["Documentos"]}},"/v1/documents/{id}/trace":{"get":{"description":"Eventos de auditoría del ciclo de vida (emisión, envío, CDR, errores).","operationId":"DocumentsController_trace","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Línea de tiempo / eventos del documento","tags":["Documentos"]}},"/v1/documents/{id}/xml":{"get":{"description":"Descarga el XML firmado cuando está disponible en almacenamiento.","operationId":"DocumentsController_xml","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Descargar XML firmado","tags":["Documentos"]}},"/v1/documents/{id}/cdr":{"get":{"description":"Descarga el CDR de SUNAT (ZIP) cuando el documento fue aceptado/rechazado.","operationId":"DocumentsController_cdr","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Descargar CDR (ZIP)","tags":["Documentos"]}},"/v1/documents/{id}/qr":{"get":{"operationId":"DocumentsController_qr","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Datos y PNG del QR CPE basado en XML firmado","tags":["Documentos"]}},"/v1/documents/{id}/qr.png":{"get":{"operationId":"DocumentsController_qrImage","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Descargar QR CPE en PNG","tags":["Documentos"]}},"/v1/documents/{id}/pdf":{"get":{"description":"Obtiene el PDF RI. Si aún no existe, puede disparar render asíncrono y requerir reintento.","operationId":"DocumentsController_pdfDownload","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Descargar PDF de representación impresa (render diferido)","tags":["Documentos"]}},"/v1/webhook-endpoints":{"get":{"operationId":"WebhookEndpointsController_list","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Listar endpoints de webhook","tags":["Webhooks"]},"post":{"operationId":"WebhookEndpointsController_create","parameters":[],"responses":{"201":{"description":""}},"security":[{"bearer":[]}],"summary":"Crear endpoint de webhook — el secreto se devuelve una sola vez","tags":["Webhooks"],"requestBody":{"required":true,"description":"Registra una URL HTTPS que recibirá eventos. El `secret` se devuelve una sola vez.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","minLength":1}},"company_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["url"]},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"url":"https://example.com/webhooks/factosys","events":["document.status_changed"]}}}}}}}},"/v1/webhook-endpoints/companies":{"get":{"operationId":"WebhookEndpointsController_availableCompanies","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Empresas disponibles para suscribir webhooks","tags":["Webhooks"]}},"/v1/webhook-endpoints/{id}":{"get":{"operationId":"WebhookEndpointsController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Obtener endpoint de webhook","tags":["Webhooks"]},"patch":{"operationId":"WebhookEndpointsController_patch","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Actualizar endpoint de webhook (eventos / estado / url)","tags":["Webhooks"],"requestBody":{"required":false,"description":"Actualiza URL, eventos o estado (`active` / `disabled`).","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","minLength":1}},"status":{"type":"string","enum":["active","disabled"]}}}}}}}},"/v1/webhook-endpoints/{id}/rotate-secret":{"post":{"operationId":"WebhookEndpointsController_rotate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Rotar secreto del webhook — se devuelve una sola vez","tags":["Webhooks"]}},"/v1/webhook-endpoints/{id}/deliveries":{"get":{"operationId":"WebhookEndpointsController_deliveries","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Listar entregas recientes del endpoint","tags":["Webhooks"]}},"/v1/validations/cpe":{"post":{"description":"Scope validations:cpe. mode=real consulta SUNAT con credenciales de Consulta Integrada; permite EB01/E001 sin documento local. No recupera CDR ni emite. Producción bloquea simuladores. La respuesta identifica source y simulated.","operationId":"ValidationsController_validate","parameters":[],"responses":{"200":{"description":""}},"security":[{"bearer":[]}],"summary":"Consultar validez de CPE en SUNAT o simulador explícito","tags":["Validaciones"],"requestBody":{"required":true,"description":"mode=real consulta validez en SUNAT con credenciales de Consulta Integrada. Incluye RUC, tipo, serie, número, fecha y monto. No emite ni recupera CDR; source/simulated identifican simuladores.","content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"ruc":{"type":"string","minLength":11,"maxLength":11},"document_type":{"type":"string","minLength":2,"maxLength":2},"serie":{"type":"string","minLength":1},"number":{"anyOf":[{"type":"string","minLength":1},{"type":"integer","minimum":0,"maximum":9007199254740991}]},"issue_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"total_amount":{"type":"number"},"mode":{"type":"string","enum":["real","fake"]}},"required":["company_id","ruc","document_type","serie","number","issue_date","total_amount"]},"examples":{"explicit":{"summary":"Valores explícitos para múltiples empresas/series o casos avanzados","value":{"company_id":"01a128f9-1abb-70c6-98c7-55a62e97e29e","ruc":"10197010741","document_type":"03","serie":"EB01","number":12752,"issue_date":"2026-09-30","total_amount":670,"mode":"real"}}}}}}}},"/meta/integration-options":{"get":{"operationId":"MetaController_integrationOptions","parameters":[],"responses":{"200":{"description":""}},"summary":"Opciones disponibles para valores de integración: catálogo ampliable de monedas","tags":["Meta / Reglas"]}},"/meta/ruleset":{"get":{"description":"Endpoint público (sin auth) con el ruleset de validación y pines de catálogo usados por la plataforma. Útil para clientes y el SDK (`getRuleset`).","operationId":"MetaController_getRuleset","parameters":[],"responses":{"200":{"description":""}},"summary":"Ruleset / catálogos SUNAT de la plataforma (valores por defecto, ADR-005)","tags":["Meta / Reglas"]}}},"info":{"title":"FactoAPIs — API v1 · Facturación electrónica","description":"FactoAPIs: API de facturación electrónica SUNAT para integradores.\n## Integrar desde tu sistema: disponible hoy\nLa API funciona con HTTP REST desde el **backend** de tu ERP, POS, ecommerce o aplicación. Usa Node.js con fetch, PHP con cURL, Python, Java, .NET o cualquier cliente HTTP. No necesitas un SDK para comenzar. No pongas tu API key en JavaScript del navegador ni en un repositorio.\n\n1. Crea tu cuenta y empresa, elige el ambiente y configura las credenciales del servicio: SOL + certificado para comprobantes; keys GRE + SOL + certificado para guías; keys de Consulta Integrada para validez.\n2. Revisa las series: si migras, registra el siguiente correlativo después de revisar emitidos y pendientes del proveedor anterior. En producción debes confirmar la numeración para activar las series nuevas. No compartas una serie con otro proveedor que siga emitiendo.\n3. Crea una API key, asígnale la empresa y los scopes necesarios. `documents:write` para emitir; `documents:read` para estados y archivos; `validations:cpe` para validez; `companies:read/write` y `series:read/write` para onboarding; `webhooks:manage` para notificaciones.\n4. Consulta `GET /v1/capabilities`. Pruebas, simulación y conexión real son distintas; las keys por sí solas no activan el transporte de producción.\n5. Envía JSON con `Content-Type: application/json`. En cada emisión persiste una `Idempotency-Key` por operación **antes** del POST. Guarda el `id` devuelto y el payload exacto.\n6. Sigue el documento por `GET /v1/documents/{id}` o `document.status_changed`. Un 201 significa registro local, no aceptación SUNAT. Descarga XML/CDR/PDF usando los enlaces devueltos y sus estados de disponibilidad.\n\n### Solicitud mínima: solo los datos de la venta\nPara facturas (01) y boletas (03), puedes omitir company_id si la API key tiene una sola empresa autorizada. La serie se obtiene de la configuración de esa empresa o de su única serie activa para el tipo. Con varias series, configura una predeterminada o envía serie; nunca se elige arbitrariamente.\nMoneda seleccionable en el panel (PEN, USD, EUR; catálogo ampliable mediante GET /meta/integration-options). Fecha automática del día de Lima, con opción de exigir fecha explícita. Tipo de operación según la configuración. Los datos que envíes explícitamente tienen prioridad; el correlativo siempre lo asigna la API. Los identificadores de líneas pueden omitirse.\n```json\n{ \"customer\": { \"identity_type\": \"1\", \"identity_number\": \"12345678\", \"name\": \"Cliente de ejemplo\" },\n  \"lines\": [{ \"description\": \"Producto\", \"quantity\": 1, \"unit_code\": \"NIU\", \"unit_value\": 100, \"tax_affectation\": \"10\" }] }\n```\nEjemplo ilustrativo de boleta: sustituye los datos del cliente y de la venta. unit_value es el valor unitario sin impuestos; la unidad y afectación tributaria deben corresponder a lo vendido. La API calcula totales, pero no adivina precios ni impuestos aplicables.\nLas notas (07/08) pueden heredar cliente y moneda de su comprobante afectado aceptado en la plataforma. Debes enviar referencia, motivo y tipo de nota. Las vistas previas CPE aceptan los mismos campos simplificados dentro de document y no reservan números. GRE, agentes, bajas y resúmenes conservan los datos propios de su operación; no se deduce información de transporte ni se selecciona automáticamente qué documentos anular.\nUn reintento con la misma clave y datos reutiliza el documento antes de volver a resolver los valores automáticos. Cambiar fecha, moneda o serie predeterminada no modifica una respuesta ya guardada.\n\n### Ejemplo Node.js sin paquete\n```javascript\n// Código del servidor. payload es el JSON de factura/boleta de esta referencia.\n// Guarda payload e idempotencyKey en tu BD antes de llamar a la API.\nconst response = await fetch(process.env.FACTOSYS_URL + '/v1/receipts', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer ' + process.env.FACTOSYS_API_KEY,\n    'Content-Type': 'application/json', 'Idempotency-Key': idempotencyKey },\n  body: JSON.stringify(payload)\n});\nconst result = await response.json();\nif (!response.ok) throw new Error(result.code + ': ' + result.message);\n// Persiste result.id y consulta su estado; no marques la venta como aceptada todavía.\n```\n\n### PHP, Laravel y WordPress hoy\n```php\n// PHP del servidor con extensión cURL. $payload contiene el JSON de esta referencia.\n// $idempotencyKey se guarda en tu BD antes del POST y se conserva al reintentar.\n$ch = curl_init(rtrim(getenv('FACTOSYS_URL'), '/') . '/v1/receipts');\ncurl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => [\n    'Authorization: Bearer ' . getenv('FACTOSYS_API_KEY'),\n    'Content-Type: application/json', 'Idempotency-Key: ' . $idempotencyKey],\n  CURLOPT_POSTFIELDS => json_encode($payload, JSON_THROW_ON_ERROR)]);\n$raw = curl_exec($ch);\nif ($raw === false) { curl_close($ch); throw new RuntimeException('Resultado incierto: conserva la clave y reconcilia'); }\n$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\ncurl_close($ch);\n$result = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);\nif ($status >= 400) throw new RuntimeException($result['code'] . ': ' . $result['message']);\n// Guarda $result['id']; consulta GET /v1/documents/{id} antes de confirmar aceptación.\n```\n\nPHP puede consumir la API con cURL; Laravel puede utilizar su cliente HTTP. En WordPress la integración propia debe ejecutarse en PHP del servidor (wp_remote_request), guardar la relación pedido/documento y una clave de idempotencia estable por pedido. Un reintento de pago o de webhook no debe crear otro comprobante. Aún no hay plugin oficial instalable.\n\n### Reintentos y notificaciones\nAnte timeout conserva el mismo payload y clave; no generes una nueva emisión. Un 409 requiere revisar el conflicto; un 422, corregir la validación. Respeta Retry-After en 429. Guarda request_id para soporte sin registrar secretos.\nPara webhooks valida HMAC-SHA256 de `timestamp.rawBody` con el secreto del webhook: cabeceras `X-Factosys-Timestamp` y `X-Factosys-Signature` (`v1=<hex>`). Verifica antigüedad, compara en tiempo constante y deduplica `X-Factosys-Delivery-Id`. Conserva el cuerpo HTTP sin reserializar. Responde rápido y procesa en una cola.\n\n### Paquetes y plugins previstos\n| Herramienta | Estado |\n| --- | --- |\n| REST + JSON y ejemplos HTTP por lenguaje | Disponible hoy |\n| SDK JavaScript/TypeScript para npm y pnpm | Próximamente; el SDK del repositorio aún es interno |\n| Paquete PHP para Composer | Próximamente |\n| Plugin WordPress / integración WooCommerce | Próximamente |\n\nnpm y pnpm son gestores para JavaScript/TypeScript; PHP utiliza Composer. No hay fechas ni comandos oficiales de instalación anunciados. Los ejemplos que genera esta referencia (fetch, Guzzle, etc.) son clientes HTTP genéricos y no implican que exista un paquete oficial publicado.\n\n## Qué incluye\n- CPE: facturas (01), boletas (03), notas de crédito/débito (07/08)\n- GRE (09/31), resumen diario (RC) y comunicaciones de baja (RA)\n- Consulta de documentos, XML firmado, CDR y PDF de representación impresa\n- Logo por empresa para personalizar los PDF (`/v1/companies/{companyId}/logo`)\n- Webhooks firmados (HMAC) y validación de CPE\n- Meta ruleset / catálogos (`GET /meta/ruleset`)\n\n## Autenticación\nUsa una **API key** de la organización:\n`Authorization: Bearer <api_key>`\n\nScope típico de emisión: `documents:write`. Lectura: `documents:read`.\nLogo de empresa: `companies:read` para consultar y `companies:write` para subir o eliminar.\n\n## Idempotencia\nEn `POST` de emisión envía siempre `Idempotency-Key` (única por empresa).\nReintentos con la misma clave reutilizan la respuesta guardada.\n\n## Flujo típico\n1. Emitir (`POST /v1/invoices`, etc.) → documento en cola / estados SUNAT\n2. Consultar `GET /v1/documents/{id}` o webhook `document.status_changed`\n3. Descargar XML, CDR o PDF cuando el estado lo permita\n\n## Errores frecuentes\n- **401** — API key ausente o inválida\n- **403** — sin scope / permiso\n- **422** — validación de cuerpo o `Idempotency-Key` faltante\n- **429** — rate limit (revisa `Retry-After`)\n\nIntegración: **REST + JSON**; 01/03/07/08 también aceptan **Factosys TXT v1** con `text/plain; charset=utf-8` por las mismas rutas e idempotencia (ver contrato Fase 6).\nNo hace falta instalar un paquete npm: `@factosys/sdk` es interno del monorepo y aún no está publicado.\n\n**Fuera de alcance:** endpoints SaaS, plataforma y panel administrativo.","version":"1.0.0","contact":{}},"tags":[{"name":"Facturas","description":"Emisión de facturas electrónicas (tipo 01)."},{"name":"Boletas","description":"Emisión de boletas electrónicas (tipo 03)."},{"name":"Notas de crédito","description":"Notas de crédito electrónicas (tipo 07)."},{"name":"Notas de débito","description":"Notas de débito electrónicas (tipo 08)."},{"name":"Comunicaciones de baja","description":"Comunicación de baja RA (SendSummary + consulta)."},{"name":"Resúmenes diarios","description":"Resumen diario RC (pool automático + envío SUNAT)."},{"name":"Guías de remisión","description":"GRE 09/31 (OAuth + sendDespatch + poll)."},{"name":"Documentos","description":"Listado, detalle, traza, XML, CDR y PDF de documentos emitidos."},{"name":"Webhooks","description":"Endpoints de notificación y entregas firmadas HMAC."},{"name":"Validaciones","description":"Consulta de validez de CPE."},{"name":"Vistas previas","description":"Prevalidación local y XML/PDF sin firma ni consumo de correlativo."},{"name":"Empresas","description":"Configuración del logo de los comprobantes por empresa."},{"name":"Meta / Reglas","description":"Ruleset y pines de catálogo SUNAT (ADR-005)."}],"servers":[],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"API Key","type":"http","description":"API key de la organización. Enviar como `Authorization: Bearer <api_key>`."}},"schemas":{}}}