Facturas (01)
Facturas are the standard commercial invoice in Peru, used for B2B transactions. They require the customer to have a valid RUC (identity type 6).
Endpoint
Section titled “Endpoint”POST /api/invoices
Authentication
Section titled “Authentication”Authorization: Bearer sk_live_YOUR_API_KEY or Authorization: Bearer JWT_TOKEN
Request body
Section titled “Request body”{ "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" } ], "observations": "Factura por servicios de febrero 2026", "purchaseOrder": "OC-2026-0042", "paymentTerms": "Credito 30 dias", "detraction": { "code": "022", "percentage": 12, "amount": 141.60, "bankAccount": "00-123-456789" }}Field reference
Section titled “Field reference”Root fields
Section titled “Root fields”| Field | Type | Required | Description |
|---|---|---|---|
series | string | Yes | Invoice series. Must match pattern F\d{3} (e.g., F001) |
correlative | number | No | Sequential number. Auto-assigned if omitted |
issueDate | string | Yes | Issue date in YYYY-MM-DD format |
dueDate | string | No | Due date in YYYY-MM-DD format |
currencyCode | string | No | ISO 4217 currency code. Default: PEN. Accepts PEN or USD |
customer | object | Yes | Customer data (see below) |
items | array | Yes | Line items (minimum 1) |
observations | string | No | Free-text observations |
purchaseOrder | string | No | Purchase order reference |
paymentTerms | string | No | Payment terms description |
detraction | object | No | Detraction data (see below) |
Customer object
Section titled “Customer object”| Field | Type | Required | Description |
|---|---|---|---|
identityType | string | Yes | Identity document type code |
identityNumber | string | Yes | Identity document number (RUC for facturas) |
name | string | Yes | Customer legal name |
address | string | No | Customer address |
Identity types:
| Code | Type |
|---|---|
6 | RUC (required for Facturas) |
1 | DNI |
4 | Carnet de Extranjeria |
7 | Pasaporte |
0 | Otros |
Item object
Section titled “Item object”| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Product/service code |
description | string | Yes | Description of the item |
quantity | number | Yes | Quantity (must be positive) |
unitCode | string | Yes | Unit of measure code |
unitPrice | number | Yes | Unit price before tax |
igvType | string | No | IGV tax type. Default: 10 |
discount | number | No | Discount amount |
iscRate | number | No | ISC rate (0-1) |
iscSystemType | string | No | ISC system type |
IGV types:
| Code | Description | Rate |
|---|---|---|
10 | Gravado (con IGV) | 18% |
20 | Exonerado | 0% |
30 | Inafecto | 0% |
Common unit codes:
| Code | Description |
|---|---|
NIU | Unidad (item) |
ZZ | Servicio |
KGM | Kilogramo |
LTR | Litro |
MTR | Metro |
Detraction object (optional)
Section titled “Detraction object (optional)”| Field | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Detraction code (SUNAT catalog) |
percentage | number | Yes | Detraction percentage |
amount | number | Yes | Detraction amount |
bankAccount | string | Yes | Bank of the Nation account number |
Response
Section titled “Response”Success (201 Created)
Section titled “Success (201 Created)”{ "id": "cm3abc123", "documentId": "20123456789-01-F001-00000001", "status": "ACCEPTED", "cdrResponseCode": "0", "cdrDescription": "La Factura numero F001-00000001, ha sido aceptada", "ticket": null}Validation error (400 Bad Request)
Section titled “Validation error (400 Bad Request)”{ "statusCode": 400, "error": "Bad Request", "message": "Validation error: series must match pattern F\\d{3}"}Related endpoints
Section titled “Related endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /api/documents | List all documents (paginated) |
| GET | /api/documents/:id | Get document by ID |
| GET | /api/documents/:id/pdf | Download PDF |
| GET | /api/documents/:id/xml | Download signed XML |
| GET | /api/documents/:id/cdr | Download CDR response |
| POST | /api/documents/:id/retry | Retry failed document |
Code examples
Section titled “Code examples”- cURL example (shown above)
- Node.js
- Python
- PHP