First Invoice in 5 Minutes
This guide walks you through emitting your first factura (invoice) using the SUIT API. Make sure you have completed the registration steps first.
Prerequisites
Section titled “Prerequisites”- An active SUIT API Key (
sk_live_xxx...) - SUNAT certificate uploaded
- SOL credentials configured
Emit a Factura (Invoice)
Section titled “Emit a Factura (Invoice)”Send a POST request to /api/invoices with your invoice data:
curl -X POST https://api.suit.pe/api/invoices \ -H "Authorization: Bearer sk_live_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "series": "F001", "correlative": 1, "issueDate": "2026-02-20", "dueDate": "2026-03-20", "currencyCode": "PEN", "customer": { "identityType": "6", "identityNumber": "20100047218", "name": "Empresa Cliente SAC", "address": "Av. Javier Prado 1234, San Isidro" }, "items": [ { "code": "SRV-001", "description": "Servicio de consultoria", "quantity": 1, "unitCode": "ZZ", "unitPrice": 1000.00, "igvType": "10" } ] }'Response
Section titled “Response”A successful response returns HTTP 201 Created:
{ "id": "cm3abc123", "documentId": "20123456789-01-F001-00000001", "status": "ACCEPTED", "cdrResponseCode": "0", "cdrDescription": "La Factura numero F001-00000001, ha sido aceptada", "ticket": null}Understanding the response
Section titled “Understanding the response”| Field | Description |
|---|---|
id | Internal SUIT document ID |
documentId | SUNAT document identifier (RUC-TYPE-SERIES-CORRELATIVE) |
status | Document status (see below) |
cdrResponseCode | SUNAT CDR response code (0 = accepted) |
cdrDescription | Human-readable description from SUNAT |
ticket | Only present for async documents (voided documents) |
Document statuses
Section titled “Document statuses”| Status | Description |
|---|---|
SIGNED | XML signed, ready to send |
SENT | Sent to SUNAT |
ACCEPTED | Accepted by SUNAT (CDR code 0) |
REJECTED | Rejected by SUNAT |
OBSERVED | Accepted with observations |
SIGN_ERROR | Signing failed |
SUNAT_ERROR | SUNAT server error (retryable) |
ERROR | Generic error |
Emit a Boleta (Receipt)
Section titled “Emit a Boleta (Receipt)”Boletas use the same structure but with a B series prefix and different customer identity types:
curl -X POST https://api.suit.pe/api/receipts \ -H "Authorization: Bearer sk_live_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "series": "B001", "correlative": 1, "issueDate": "2026-02-20", "currencyCode": "PEN", "customer": { "identityType": "1", "identityNumber": "12345678", "name": "Juan Perez" }, "items": [ { "code": "SRV-002", "description": "Corte de cabello premium", "quantity": 1, "unitCode": "ZZ", "unitPrice": 50.00, "igvType": "10" } ] }'What happens behind the scenes
Section titled “What happens behind the scenes”When you call the API, SUIT performs these steps automatically:
- Validates your input data using Zod schemas
- Generates the XML UBL 2.1 document
- Signs the XML with your SUNAT certificate
- Sends the signed XML to SUNAT via SOAP
- Parses the CDR (response from SUNAT)
- Stores the document, XML, and CDR in the database
- Generates a PDF of the document
- Creates an accounts receivable (CxC) entry if accepted
Next steps
Section titled “Next steps”- Read the full Facturas API reference for all available fields
- Learn about other document types
- See code examples in Node.js, Python, and PHP