📋 Document sequences
What is the series in a Peruvian electronic voucher?
In Peruvian e-invoicing, the series is a key component of the electronic voucher number. It identifies the document type, the issuing establishment, and the emission sequence within the SUNAT system (National Superintendence of Customs and Tax Administration).
A Peruvian electronic voucher is identified by:
SERIES – SEQUENTIAL NUMBER
Example: F001-00012345
- Series: 4-character alphanumeric code
- Sequential number: Up to 8 digits
The series + sequential number combination must be unique per document type and issuer. In the API, the series is sent as document_sequence_code and the sequential number is the document number assigned by the sequence.
What does the series represent?
The series has several roles:
1. Identifies the document type
The following document types and series are supported in the API. The first character(s) of the series identify the document type; see the Table of codes for full document_type_id reference.
2. Identifies the point of emission
The last 3 characters of the series usually represent the establishment or point of sale. For invoices (document_type_id 96), you can use different series for each location (e.g. F001 for head office, F002 for branch 1). Each series has its own sequential number sequence.
This allows each location to have its own independent numbering. Use only series that are configured for your account and that match the document type (see supported series above and Create new documents).
3. Independent numbering per series
Each series has its own sequential (document number) sequence:
- F001-00000001, F001-00000002, …
- F002-00000001, F002-00000002, …
So the first invoice at point of sale 1 (F001) gets document number 1, and the first invoice at point of sale 2 (F002) also gets document number 1, without conflict between locations or systems.
SUNAT rules for electronic series
Main operational rules:
- Maximum 4 characters for the series
- First character(s) according to document type (e.g. F for invoice, B for receipt, FC/FD for notes, T for waybill, R for retention — see supported series above)
- Sequential number: numeric, up to 8 digits
- The series–sequential number combination must not be repeated
- Each series must be registered in the issuer’s system (SEE)
How it works in the API
Sequences are independent per point of sale. Each point of sale (or establishment) uses its own document_sequence_code (the series). The document number (sequential number) counter is separate for each code.
When creating a document, send the document_sequence_code that identifies the series (and thus the point of emission). Do not send document_number if you want the sequential number to be assigned automatically from the sequence.
Request example (invoice – series F001)
For a second point of sale (e.g. branch), use a different document_sequence_code (e.g. "F002"); that series will have its own sequential number sequence starting at 1 for its first document.
For the full request body and all required fields, see Create new documents.
Automatic document number assignment
By default, you should not send the document_number field. The API assigns the next sequential number (document number) from the sequence for the given document_type_id and document_sequence_code. Only use document_number when you need to force a specific value (e.g. for special cases or migration). The document types endpoint (PATCH) allows you to set the initial last_sequence_number when configuring or resetting a sequence.