Skip to content

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 fetch API
  • Python — Using the requests library
  • PHP — Using PHP cURL

Each language page includes examples for:

  1. Emit a Factura (Invoice)POST /api/invoices
  2. Emit a Boleta (Receipt)POST /api/receipts
  3. Emit a Nota de Credito (Credit Note)POST /api/credit-notes
  4. Emit a Nota de Debito (Debit Note)POST /api/debit-notes
  5. Send a Comunicacion de Baja (Voided Document)POST /api/voided-documents
  6. Check async ticket statusPOST /api/documents/:id/check-ticket
  7. List documentsGET /api/documents
  8. Download PDFGET /api/documents/:id/pdf
  9. Retry a failed documentPOST /api/documents/:id/retry

All examples use these base values. Replace them with your actual credentials:

Base URL: https://api.suit.pe
API Key: sk_live_YOUR_API_KEY

For sandbox testing:

Base URL: https://api-staging.suit.pe
API Key: sk_live_YOUR_SANDBOX_API_KEY
Terminal window
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"
}
]
}'
Terminal window
curl https://api.suit.pe/api/documents?page=1&limit=20&type=01 \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
Terminal window
curl -o invoice.pdf \
https://api.suit.pe/api/documents/DOCUMENT_ID/pdf \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
Terminal window
curl -X POST https://api.suit.pe/api/documents/DOCUMENT_ID/retry \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"

Choose your language for complete examples: