Validate and durably create a comprobante de retención (CRE, 20)
A comprobante de retención declares the documents an agente de retención is settling, the payment made against each one, the amount withheld and the net handed over. Every monetary figure in the response is DERIVED from the payments and the declared rate; none may be supplied. Creation is capability-gated per tenant (retention_issuance_enabled, off by default) and does not contact SUNAT.
A comprobante de retención declares the documents an agente de retención is settling, the payment made against each one, the amount withheld and the net handed over. Every monetary figure in the response is DERIVED from the payments and the declared rate; none may be supplied. Creation is capability-gated per tenant (retention_issuance_enabled, off by default) and does not contact SUNAT.
Authorization
bearerAuth Tenant-bound, scoped and expiring Apifact credential. Migrated legacy credentials are accepted only on deprecated v1 writes and tenant-scoped v2 read, poll and download routes. Each operation names the single scope it requires in x-required-scope; the scope array of the security requirement itself is empty because OpenAPI 3.0 requires it to be for a non-oauth2 scheme.
In: header
Header Parameters
1 <= length <= 200Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v2/retentions" \ -H "Idempotency-Key: b6a2f0e4-1c3d-4a5b-8e7f-9d0c1b2a3e4f" \ -H "Authorization: Bearer apf_v2_tu_credencial" \ -H "Content-Type: application/json" \ -d '{ "schemaVersion": "1.0", "documentType": "20", "series": "R001", "number": "56", "issueDate": "2026-08-12", "currency": "PEN", "regimeCode": "01", "regimePercent": "3", "note": "Retencion del regimen general aplicada al pago de la factura del proveedor", "agent": { "documentType": "6", "documentNumber": "20601030405", "legalName": "MI EMPRESA EMISORA S.A.C.", "address": "AV. JAVIER PRADO ESTE 1234", "ubigeo": "150131", "district": "SAN ISIDRO", "province": "LIMA", "department": "LIMA" }, "receiver": { "documentType": "6", "documentNumber": "20512345678", "legalName": "COMERCIAL LOS ANDES S.A.C.", "address": "AV. AREQUIPA 4321", "ubigeo": "150122", "district": "MIRAFLORES", "province": "LIMA", "department": "LIMA" }, "documents": [ { "documentType": "01", "series": "F500", "number": "128", "issueDate": "2026-08-12", "totalAmount": "1180.00", "currency": "PEN", "payment": { "id": "1", "amount": "1180.00", "date": "2026-08-12" }, "regimeDate": "2026-08-12" } ] }'{ "schemaVersion": "2.0", "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6", "operationId": "3051932a-fdd2-48fa-b330-7e7d41535969", "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6", "documentType": "20", "documentName": "string", "state": "VALIDATED", "replay": true}Durably request void communication (RA) dispatch POST POST
Builds the VoidedDocuments UBL from the stored canonical payload, signs it, packages it and dispatches it with sendSummary inside the same private durable Workflow as the daily summary, with the same ticket cycle and the same non-resendable ambiguity fence.
Get a tenant-owned comprobante de retención (CRE, 20) and its references GET GET
Returns the stored header and every reference in the order the signed XML declares them, with the PEN base, the amount withheld and the net for each. netAmount = baseAmount - regimeAmount.