Get a tenant-owned comprobante de retención (CRE, 20) and its references
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.
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.
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
Path Parameters
uuidResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/api/v2/retentions/497f6eca-6276-4993-bfeb-53cbbbba6f08" \ -H "Authorization: Bearer apf_v2_tu_credencial"{ "schemaVersion": "2.0", "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6", "paymentRegimeId": "aec72d33-cb63-4eea-9e74-0de13136fa96", "operationId": "3051932a-fdd2-48fa-b330-7e7d41535969", "documentType": "20", "environment": "BETA", "series": "string", "number": "string", "issueDate": "2019-08-24", "documentName": "string", "regimeCode": "string", "regimePercent": "string", "agentRuc": "string", "receiverRuc": "string", "totalRegimeAmount": "string", "totalNetAmount": "string", "submissionProfileVersion": "sunat-retention-cre-v1", "state": "VALIDATED", "stateVersion": 1, "responseCode": "string", "responseMessage": "string", "errorCode": "string", "references": [ { "referenceIndex": 1, "referenceDocumentType": "01", "referenceSeries": "string", "referenceNumber": "string", "referenceIssueDate": "2019-08-24", "referenceCurrency": "string", "referenceTotalAmount": "string", "paymentId": "string", "paidAmount": "string", "paymentDate": "2019-08-24", "regimeDate": "2019-08-24", "exchangeRate": "string", "exchangeDate": "2019-08-24", "baseAmount": "string", "regimeAmount": "string", "netAmount": "string" } ], "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z"}Validate and durably create a comprobante de retención (CRE, 20) POST POST
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.
Durably request comprobante de retención (CRE, 20) dispatch POST POST
Durably requests dispatch through SUNAT's 'otros CPE' service, which is a different deployment from the one that carries facturas and boletas. Answers 202 with the operation id allocated at creation. Dispatch is gated by submission_publication_enabled AND retention_issuance_enabled, both re-read under a row lock immediately before the outbound call. Exactly one envelope can ever leave for a given document: the attempt is fenced in the database before the call, and a run that finds a fenced attempt with no CDR settles AMBIGUOUS for reconciliation rather than resending.