Code Examples Overview
This section provides complete, copy-paste-ready code examples for every major operation in the SUIT API. Examples are available in:
- cURL — Universal command-line HTTP client
- Node.js — Using the native
fetchAPI - Python — Using the
requestslibrary - PHP — Using PHP cURL
What is covered
Section titled “What is covered”Each language page includes examples for:
- Emit a Factura (Invoice) —
POST /api/invoices - Emit a Boleta (Receipt) —
POST /api/receipts - Emit a Nota de Credito (Credit Note) —
POST /api/credit-notes - Emit a Nota de Debito (Debit Note) —
POST /api/debit-notes - Send a Comunicacion de Baja (Voided Document) —
POST /api/voided-documents - Check async ticket status —
POST /api/documents/:id/check-ticket - List documents —
GET /api/documents - Download PDF —
GET /api/documents/:id/pdf - Retry a failed document —
POST /api/documents/:id/retry
Common setup
Section titled “Common setup”All examples use these base values. Replace them with your actual credentials:
Base URL: https://api.suit.peAPI Key: sk_live_YOUR_API_KEYFor sandbox testing:
Base URL: https://api-staging.suit.peAPI Key: sk_live_YOUR_SANDBOX_API_KEYQuick reference: cURL examples
Section titled “Quick reference: cURL examples”Emit a Factura
Section titled “Emit a Factura”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" } ] }'List documents
Section titled “List documents”curl https://api.suit.pe/api/documents?page=1&limit=20&type=01 \ -H "Authorization: Bearer sk_live_YOUR_API_KEY"Download PDF
Section titled “Download PDF”curl -o invoice.pdf \ https://api.suit.pe/api/documents/DOCUMENT_ID/pdf \ -H "Authorization: Bearer sk_live_YOUR_API_KEY"Retry a failed document
Section titled “Retry a failed document”curl -X POST https://api.suit.pe/api/documents/DOCUMENT_ID/retry \ -H "Authorization: Bearer sk_live_YOUR_API_KEY"Next steps
Section titled “Next steps”Choose your language for complete examples: