Skip to content

Webhooks and Events

This guide covers handling async document flows, retrying failed documents, and understanding SUNAT error responses.

Most SUIT document types use SUNAT’s synchronous sendBill method — you send the request and receive the result immediately. However, Comunicaciones de Baja (voided documents) use the asynchronous sendSummary method.

SUNAT MethodDocumentsFlow
sendBill (sync)Facturas, Boletas, NC, ND, Guias, Retenciones, PercepcionesRequest -> immediate response
sendSummary (async)Comunicacion de BajaRequest -> ticket -> poll for result

When emitting a voided document, the response includes a ticket number:

{
"id": "cm3vwx234",
"ticket": "1708123456789",
"status": "SENT"
}

Poll for the result using the check-ticket endpoint:

Terminal window
curl -X POST https://api.suit.pe/api/documents/cm3vwx234/check-ticket \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"

See the Voided Documents reference for the complete polling implementation.

If a document fails with status SUNAT_ERROR (SUNAT server was down or returned a temporary error), you can retry the submission:

Terminal window
curl -X POST https://api.suit.pe/api/documents/:id/retry \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"

The retry endpoint re-sends the already-signed XML to SUNAT. It does not re-generate or re-sign the document.

StatusRetryableAction
SUNAT_ERRORYesPOST /api/documents/:id/retry
SIGN_ERRORNoFix certificate configuration, re-emit
REJECTEDNoFix data issues, emit a new document
ERRORNoContact support
CodeMeaning
200Success
201Created (document emitted successfully)
204No Content (delete successful)
400Bad Request (validation error)
401Unauthorized (invalid/missing auth)
404Not Found
409Conflict (duplicate document)
429Rate Limited
500Server Error
{
"statusCode": 400,
"error": "Bad Request",
"message": "Validation error: series must match pattern F\\d{3}"
}

When SUNAT rejects a document, the response includes the CDR response code and description:

{
"id": "cm3abc123",
"status": "REJECTED",
"cdrResponseCode": "2329",
"cdrDescription": "El tipo de documento de identidad del receptor no es valido"
}

Common rejection codes:

CodeDescriptionHow to fix
2017RUC del receptor no existeVerify the customer RUC number
2329Tipo de doc. identidad no validoUse the correct identityType code
2370Serie no validaUse F prefix for facturas, B for boletas
3105Monto total no coincideCheck IGV calculations (SUIT calculates automatically)
ScopeLimitWindow
/api/* (API Key/JWT)60 requests1 minute
/admin/* (Master Key)20 requests1 minute
General100 requests1 minute

When rate limited, the API returns HTTP 429 with a Retry-After header indicating how many seconds to wait.

{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded. Retry after 30 seconds."
}