📋 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.

document_sequence_codeDocument type (table of codes)document_type_id
F001Issued invoice96
B001Issued sales receipt97
FC01Credit note for issued invoice98
FD01Issued debit note99
BC01Credit note for issued receipt155
T002Issued shipping guide (shipper)100
R001Issued retention receipt109

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.

document_sequence_codeTypical use
F001Head office
F002Branch 1

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.

Point of saledocument_sequence_codeFirst invoice document numberSecond invoice document number
1 (e.g. head office)F00112
2 (e.g. branch 1)F00212

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)

1{
2 "header": {
3 "account_id": 16268,
4 "document_type_id": "96",
5 "document_sequence_code": "F001",
6 "received_issued_flag": 0,
7 "issue_date": "2025-02-03",
8 "issuer_tax_id_code": "20610383727",
9 "issuer_tax_id_type": "PE-RUC",
10 "issuer_legal_name": "<string>",
11 "issuer_address": "<string>",
12 "issuer_district": "<string>",
13 "issuer_city": "<string>",
14 "issuer_department": "<string>",
15 "issuer_country_id": "83",
16 "issuer_phone": "<string>",
17 "issuer_activity": "<string>",
18 "issuer_postalcode": "12345456",
19 "receiver_tax_id_code": "20473731828",
20 "receiver_tax_id_type": "PE-RUC",
21 "receiver_legal_name": "ESCUELA KEMPER URGATES",
22 "receiver_address": "<string>",
23 "receiver_district": "<string>",
24 "receiver_city": "<string>",
25 "receiver_department": "<string>",
26 "receiver_country_id": "83",
27 "receiver_phone": "<string>",
28 "receiver_activity": "<string>",
29 "receiver_postalcode": "12343456",
30 "payment_conditions": "0",
31 "currency_id": 7,
32 "additional": {
33 "pe_header": {
34 "signature_id": "ASDFG",
35 "operation_type": "0101"
36 }
37 }
38 },
39 "details": [ ... ],
40 "totals": { ... }
41}

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.