ES | EN

Examples by country

➕ Create new documents

Postman collection

To help you with your integration, download our Postman Collection here: https://github.com/koyweforest/api-billing-postman

To help with testing, you can use the following information when issuing documents

account_id RUC legal_name activity postalcode
16268 20610383727

Invoice (Factura electrónica)

In order to create a new peruvian invoice, you need to use the /documents endpoint with the proper parameters.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"F001",
      "received_issued_flag":0,
      "issue_date":"2025-02-03",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with zero cost (Factura electrónica con costo cero)

In order to create a Peruvian invoice with zero cost (for example, promotional samples), you need to use the /documents endpoint with the proper parameters. Line amounts and totals must be zero, and include the tax_base_amount field in taxes to indicate the reference tax base.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FZ03",
      "received_issued_flag":0,
      "issue_date":"2026-07-01",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "observations":"Muestra promocional",
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":0,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":0,
         "modifier_percentage":0,
         "total_amount_line":0,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":0,
               "tax_base_amount":1000
            }
         ]
      }
   ],
   "totals":{
      "net_amount":0,
      "taxes_amount":0,
      "total_amount":0
   }
}

Invoice with pdf thermal 80mm (Factura electrónica con pdf térmico 80mm)

In order to create a new peruvian invoice, you need to use the /documents endpoint with the proper parameters.

Support for thermal 80mm in document_type_id 96, 97 and 100, please review the table of codes.

{
  "options": {
    "template_id": 5000
  },
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "received_issued_flag":0,
      "issue_date":"2025-02-03",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice on exports use case (Factura electrónica para casos de exportación)

In order to create a new peruvian export invoice, you need to use the /documents endpoint with the proper parameters. Please note that unlike other countries, the document type remains the same as regular invoices, as this is just a special use case of the regular e-invoice.

{
   "header":{
      "account_id":179,
      "document_type_id":"96",
      "document_sequence_code":"F001",
      "received_issued_flag":0,
      "issue_date":"2025-04-21",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"851855616",
      "receiver_tax_id_type":"US-EIN",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0200"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba ROW",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":0,
         "modifier_percentage":0,
         "total_amount_line":1000,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"425",
               "tax_percentage":0,
               "tax_amount":0
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":0,
      "total_amount":1000
   }
}

Invoice with reference to other documents (reference_number)

In order to create a new Peruvian invoice with referenced documents, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original document to which the invoice refers.

Use reference_number or reference_document_id to identify the referenced document (not both at the same time). If the document already exists in Facto, you can use reference_document_id instead of reference_number. The fields reference_date and description are mandatory.

About reference_code:

  • "6": reference to a bill of lading / guía de remisión (document_type_id "100").
  • "5": reference to a non-tax document (purchase order, contract, etc.), indicating reference_type (801-815).
{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "reference_type":"802",
         "reference_number":"435624",
         "reference_code":"5",
         "description":"Num Pedido",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with reference to other documents (reference_document_id)

In order to create a new Peruvian invoice with referenced documents, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original document to which the invoice refers.

Use reference_number or reference_document_id to identify the referenced document (not both at the same time). If the document already exists in Facto, you can use reference_document_id instead of reference_number. The fields reference_date and description are mandatory.

About reference_code:

  • "6": reference to a bill of lading / guía de remisión (document_type_id "100").
  • "5": reference to a non-tax document (purchase order, contract, etc.), indicating reference_type (801-815).
{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_document_id":"1587",
         "reference_code":"6",
         "description":"Guia",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with reference to bill of lading (reference_number)

To reference a bill of lading (guía de remisión) on a Peruvian invoice, use document_type_id "100" and reference_code "6" in the references block. Identify the guía with reference_number (for example "T002-00000099") or with reference_document_id (not both at the same time). The guía must have been issued in Facto by the same company. The fields reference_date and description are mandatory.

Remember: reference_code "6" is for bill of lading and "5" for non-tax documents.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_code":"6",
         "reference_number":"T002-00000099",
         "description":"Guía de remisión",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with reference to bill of lading (reference_document_id)

To reference a bill of lading (guía de remisión) on a Peruvian invoice when the guía already exists in Facto, use document_type_id "100", reference_code "6", and reference_document_id in the references block (without reference_number). The fields reference_date and description are mandatory.

Remember: reference_code "6" is for bill of lading and "5" for non-tax documents.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_code":"6",
         "reference_document_id":"1587",
         "description":"Guía de remisión",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with general detraction (Factura electrónica sujeta a detracción 1001)

To create a Peruvian invoice subject to general detraction, use the /documents endpoint with pe_header.operation_type "1001" and the pe_detraction block. This example uses detraction code "022" at 9% of the invoice total (amount = 9% of total_amount). See the codes table for the full catalog.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FC01",
      "received_issued_flag":0,
      "issue_date":"2026-08-31",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"1001"
         },
         "pe_detraction":{
            "code":"022",
            "percent":9.00,
            "amount":106.20,
            "nation_bank_account":"00-000-000000",
            "payment_means_code":"001"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with passenger transport detraction (Factura electrónica sujeta a detracción 1003)

To create a Peruvian invoice subject to passenger transport detraction, use the /documents endpoint with pe_header.operation_type "1003" and the pe_detraction block. This example uses detraction code "028" at 10% of the invoice total (amount = 10% of total_amount).

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FC01",
      "received_issued_flag":0,
      "issue_date":"2026-08-31",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"1003"
         },
         "pe_detraction":{
            "code":"028",
            "percent":10.00,
            "amount":118.00,
            "nation_bank_account":"00-000-000000",
            "payment_means_code":"001"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Servicio de transporte de pasajeros",
         "unit_measure":"ZZ",
         "unit_price":1000,
         "long_description":"Venta sujeta a detraccion 1003",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"028-PASAJ",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Invoice with cargo transport detraction (Factura electrónica sujeta a detracción 1004)

To create a Peruvian invoice subject to cargo transport detraction, use the /documents endpoint with pe_header.operation_type "1004", the pe_detraction block, and the pe_cargo_transport block. This example uses detraction code "027" at 12% of the invoice total (amount = 12% of total_amount).

IMPORTANT: For 1004 operations you must send pe_cargo_transport (origin and destination ubigeo and address, trip detail, and reference amounts). If it is missing, E-Fact rejects the voucher with error 3116.

{
   "header":{
      "account_id":16268,
      "document_type_id":"96",
      "document_sequence_code":"FC01",
      "received_issued_flag":0,
      "issue_date":"2026-08-31",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"1004"
         },
         "pe_detraction":{
            "code":"027",
            "percent":12.00,
            "amount":141.60,
            "nation_bank_account":"00-000-000000",
            "payment_means_code":"001"
         },
         "pe_cargo_transport":{
            "origin_ubigeo":"150102",
            "origin_address":"PUNTO ORIGEN DIRECCION DETALLADA",
            "destination_ubigeo":"150119",
            "destination_address":"PUNTO DESTINO DIRECCION DETALLADA",
            "trip_detail":"DETALLE DEL VIAJE",
            "service_reference_amount":1000.00,
            "effective_load_reference_amount":1000.00,
            "payload_reference_amount":1000.00
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Servicio de transporte de carga",
         "unit_measure":"ZZ",
         "unit_price":1000,
         "long_description":"Venta sujeta a detraccion 1004",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"027-CARGA",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Receipt (Boleta electrónica)

In order to create a new peruvian receipt, you need to use the /documents endpoint with the proper parameters. You can issue receipts to recipients identified with a DNI by using the field "receiver_tax_id_type" with the value "PE-DNI".

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"B001",
      "received_issued_flag":0,
      "issue_date":"2025-02-03",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Receipt with zero cost (Boleta electrónica con costo cero)

In order to create a Peruvian receipt with zero cost (for example, promotional samples), you need to use the /documents endpoint with the proper parameters. Line amounts and totals must be zero, and include the tax_base_amount field in taxes to indicate the reference tax base.

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"BZ03",
      "received_issued_flag":0,
      "issue_date":"2026-07-01",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "observations":"Muestra promocional",
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":0,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":0,
         "modifier_percentage":0,
         "total_amount_line":0,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":0,
               "tax_base_amount":1000
            }
         ]
      }
   ],
   "totals":{
      "net_amount":0,
      "taxes_amount":0,
      "total_amount":0
   }
}

Receipt under 700 soles (Boleta electrónica)

If the total amount of the receipt is less than 700 soles, it is not necessary to include the customer's information.

In order to create a new peruvian receipt, you need to use the /documents endpoint with the proper parameters. You can issue receipts to recipients identified with a DNI by using the field "receiver_tax_id_type" with the value "PE-DNI".

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"B001",
      "received_issued_flag":0,
      "issue_date":"2025-07-21",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba ROW",
         "unit_measure":"NIU",
         "unit_price":500,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":90,
         "modifier_percentage":0,
         "total_amount_line":590,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"412",
               "tax_percentage":18,
               "tax_amount":90
            }
         ]
      }
   ],
   "totals":{
      "net_amount":500,
      "taxes_amount":90,
      "total_amount":590
   }
}

Receipt issued to a foreign customer (Boleta electrónica nominativa con receptor extranjero)

In order to create a new Peruvian receipt, you need to use the /documents endpoint with the proper parameters. You can issue receipts to both local and foreign recipients by setting the receiver_tax_id_type field accordingly. For example, use "PE-DNI" for Peruvian national IDs, or "US-EIN" for recipients identified with a U.S.

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
    "header": {
        "account_id": 16268,
        "document_type_id": "97",
        "document_sequence_code":"B001",
        "received_issued_flag": 1,
        "issue_date": "2025-07-23",
        "issuer_tax_id_code": "20610383727",
        "issuer_tax_id_type": "PE-RUC",
        "issuer_legal_name": "KOYWE PERU SAC",
        "issuer_address": "AV. REPUBLICA DE PANAMA NRO. 3535 INT. 403",
        "issuer_district": "SAN ISIDRO",
        "issuer_department": "LIMA",
        "issuer_city": "LIMA",
        "issuer_phone": "+51949944464",
        "issuer_activity": "OTROS TIPOS DE INTERMEDIACIoN MONETARIA",
        "issuer_postalcode": "15036",
        "issuer_country_id": "83",
        "receiver_tax_id_type": "US-EIN",
        "receiver_tax_id_code": "10752012",
        "receiver_legal_name": "Hapi Corp",
        "receiver_email": "[email protected]",
        "receiver_address": "2261 Market Street #4257",
        "receiver_district": "San Francisco ",
        "receiver_city": "San Francisco ",
        "receiver_activity": "Brokers de acciones",
        "receiver_country_id": "83",
        "receiver_department": "",
        "payment_conditions": "0",
        "currency_id": 7,
        "additional": {
            "pe_header": {
                "signature_id": "ASDFG",
                "operation_type": "0101"
            }
        }
    },
    "details": [
        {
            "quantity": 1,
            "unit_price": 400,
            "unit_measure": "NIU",
            "line_description": "Servicio de obtencion de bienes digitales por su cuenta y orden. Orden ID c4250e3d-95db-4da3-a01f-14e6b3b0b239. Monto Total: 18.00 PEN",
            "long_description": "Servicio de obtencion de bienes digitales por su cuenta y orden. Orden ID c4250e3d-95db-4da3-a01f-14e6b3b0b239. Monto Total: 18.00 PEN",
            "taxes": [
                {
                    "tax_type_id": "413",
                    "tax_percentage": 18,
                    "tax_amount": 72
                }
            ]
        }
    ],
    "totals": {
        "net_amount": 400,
        "taxes_amount": 72,
        "total_amount": 472
    }
}

Receipt with reference to other documents (reference_number)

In order to create a new Peruvian receipt with referenced documents, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original document to which the receipt refers.

Use reference_number or reference_document_id to identify the referenced document (not both at the same time). If the document already exists in Facto, you can use reference_document_id instead of reference_number. The fields reference_date and description are mandatory.

About reference_code:

  • "6": reference to a bill of lading / guía de remisión (document_type_id "100").
  • "5": reference to a non-tax document (purchase order, contract, etc.), indicating reference_type (801-815).

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"BZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "reference_type":"802",
         "reference_number":"A00000046",
         "reference_code":"5",
         "description":"Num Pedido",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Receipt with reference to other documents (reference_document_id)

In order to create a new Peruvian receipt with referenced documents, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original document to which the receipt refers.

Use reference_number or reference_document_id to identify the referenced document (not both at the same time). If the document already exists in Facto, you can use reference_document_id instead of reference_number. The fields reference_date and description are mandatory.

About reference_code:

  • "6": reference to a bill of lading / guía de remisión (document_type_id "100").
  • "5": reference to a non-tax document (purchase order, contract, etc.), indicating reference_type (801-815).

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"BZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_document_id":"190",
         "reference_code":"6",
         "description":"Guia",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Receipt with reference to bill of lading (reference_number)

To reference a bill of lading (guía de remisión) on a Peruvian receipt, use document_type_id "100" and reference_code "6" in the references block. Identify the guía with reference_number (for example "T002-00000099") or with reference_document_id (not both at the same time). The guía must have been issued in Facto by the same company. The fields reference_date and description are mandatory.

Remember: reference_code "6" is for bill of lading and "5" for non-tax documents.

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"BZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_code":"6",
         "reference_number":"T002-00000099",
         "description":"Guía de remisión",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Receipt with reference to bill of lading (reference_document_id)

To reference a bill of lading (guía de remisión) on a Peruvian receipt when the guía already exists in Facto, use document_type_id "100", reference_code "6", and reference_document_id in the references block (without reference_number). The fields reference_date and description are mandatory.

Remember: reference_code "6" is for bill of lading and "5" for non-tax documents.

IMPORTANT: When issuing receipts, you MUST use TODAY issue_date. Otherwise you will receive a "Error 1079: Solo puede enviar el comprobante en un resumen diario" which means that you are not allowed to issue individuals receipts for previous dates.

{
   "header":{
      "account_id":16268,
      "document_type_id":"97",
      "document_sequence_code":"BZ01",
      "received_issued_flag":0,
      "issue_date":"2026-07-28",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"100",
         "reference_code":"6",
         "reference_document_id":"190",
         "description":"Guía de remisión",
         "reference_date":"2026-07-28"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Credit note for Invoice with reference_number (Nota de crédito electrónica para Factura)

In order to create a new Peruvian credit note, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original document (such as an invoice) to which the credit note refers.

{
   "header": {
      "account_id": 16268,
      "document_type_id": "98",
      "document_sequence_code":"FC01",
      "received_issued_flag": 0,
      "issue_date": "2025-01-27",
      "issuer_tax_id_code": "20610383727",
      "issuer_tax_id_type": "PE-RUC",
      "issuer_legal_name": "<string>",
      "issuer_address": "<string>",
      "issuer_district": "<string>",
      "issuer_city": "<string>",
      "issuer_department":"<string>",
      "issuer_country_id": "80",
      "issuer_phone": "<string>",
      "issuer_activity": "<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code": "20473731828",
      "receiver_tax_id_type": "PE-RUC",
      "receiver_legal_name": "ESCUELA KEMPER URGATES",
      "receiver_address": "<string>",
      "receiver_district": "<string>",
      "receiver_city": "<string>",
      "receiver_department":"<string>",
      "receiver_country_id": "80",
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions": "0",
      "currency_id": 7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details": [
      {
         "quantity": 1,
         "line_description": "Prueba Koywe",
         "unit_measure": "NIU",
         "unit_price": 1000,
         "long_description": "Test descripcion",
         "modifier_amount": 0,
         "total_taxes": 180,
         "modifier_percentage": 0,
         "total_amount_line": 1180,
         "sku": "3245",
         "taxes": [
            {
               "tax_type_id": "413",
               "tax_percentage": 18,
               "tax_amount": 180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id": "96",
         "reference_number": "F001-00000087",
         "reference_code": "01",
         "description": "Anulacion solicitada por el emisor",
         "reference_date": "2025-01-27"
      }
   ],
   "totals": {
      "net_amount": 1000,
      "taxes_amount": 180,
      "total_amount": 1180
   }
}

Credit note for Invoice with reference_document_id (Nota de crédito electrónica para Factura)

In order to create a new Peruvian credit note, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original document (such as an invoice) to which the credit note refers.

{
   "header": {
      "account_id": 16268,
      "document_type_id": "98",
      "received_issued_flag": 0,
      "document_sequence_code":"FC01",
      "issue_date": "2025-11-11",
      "issuer_tax_id_code": "20610383727",
      "issuer_tax_id_type": "PE-RUC",
      "issuer_legal_name": "<string>",
      "issuer_address": "<string>",
      "issuer_district": "<string>",
      "issuer_city": "<string>",
      "issuer_department":"<string>",
      "issuer_country_id": "80",
      "issuer_phone": "<string>",
      "issuer_activity": "<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code": "20473731828",
      "receiver_tax_id_type": "PE-RUC",
      "receiver_legal_name": "ESCUELA KEMPER URGATES",
      "receiver_address": "<string>",
      "receiver_district": "<string>",
      "receiver_city": "<string>",
      "receiver_department":"<string>",
      "receiver_country_id": "80",
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions": "0",
      "currency_id": 7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details": [
      {
         "quantity": 1,
         "line_description": "Prueba Koywe",
         "unit_measure": "NIU",
         "unit_price": 1000,
         "long_description": "Test descripcion",
         "modifier_amount": 0,
         "total_taxes": 180,
         "modifier_percentage": 0,
         "total_amount_line": 1180,
         "sku": "3245",
         "taxes": [
            {
               "tax_type_id": "413",
               "tax_percentage": 18,
               "tax_amount": 180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id": "96",
         "reference_document_id": "1587",
         "reference_code": "01",
         "description": "Anulacion solicitada por el emisor",
         "reference_date": "2025-11-11"
      }
   ],
   "totals": {
      "net_amount": 1000,
      "taxes_amount": 180,
      "total_amount": 1180
   }
}

Credit note for Receipt with reference_number (Nota de crédito electrónica para Boleta)

In order to create a new Peruvian credit note for a receipt, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original receipt (boleta) to which the credit note refers.

{
   "header": {
      "account_id": 16268,
      "document_type_id": "155",
      "document_sequence_code":"BC01",
      "received_issued_flag": 1,
      "issue_date": "2025-01-27",
      "issuer_tax_id_code": "20610383727",
      "issuer_tax_id_type": "PE-RUC",
      "issuer_legal_name": "<string>",
      "issuer_address": "<string>",
      "issuer_district": "<string>",
      "issuer_city": "<string>",
      "issuer_department":"<string>",
      "issuer_country_id": "83",
      "issuer_phone": "<string>",
      "issuer_activity": "<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code": "20473731828",
      "receiver_tax_id_type": "PE-RUC",
      "receiver_legal_name": "ESCUELA KEMPER URGATES",
      "receiver_address": "<string>",
      "receiver_district": "<string>",
      "receiver_city": "<string>",
      "receiver_department":"<string>",
      "receiver_country_id": "83",
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions": "0",
      "currency_id": 7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details": [
      {
         "quantity": 1,
         "line_description": "Prueba Koywe",
         "unit_measure": "NIU",
         "unit_price": 1000,
         "long_description": "Test descripcion",
         "modifier_amount": 0,
         "total_taxes": 180,
         "modifier_percentage": 0,
         "total_amount_line": 1180,
         "sku": "3245",
         "taxes": [
            {
               "tax_type_id": "413",
               "tax_percentage": 18,
               "tax_amount": 180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id": "97",
         "reference_number": "B001-00000087",
         "reference_code": "01",
         "description": "Anulacion solicitada por el emisor",
         "reference_date": "2025-01-27"
      }
   ],
   "totals": {
      "net_amount": 1000,
      "taxes_amount": 180,
      "total_amount": 1180
   }
}

Credit note for Receipt with reference_document_id (Nota de crédito electrónica para Boleta)

In order to create a new Peruvian credit note for a receipt, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original receipt (boleta) to which the credit note refers.

{
   "header": {
      "account_id": 16268,
      "document_type_id": "155",
      "document_sequence_code":"BC01",
      "received_issued_flag": 1,
      "issue_date": "2025-01-27",
      "issuer_tax_id_code": "20610383727",
      "issuer_tax_id_type": "PE-RUC",
      "issuer_legal_name": "<string>",
      "issuer_address": "<string>",
      "issuer_district": "<string>",
      "issuer_city": "<string>",
      "issuer_department":"<string>",
      "issuer_country_id": "83",
      "issuer_phone": "<string>",
      "issuer_activity": "<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code": "20473731828",
      "receiver_tax_id_type": "PE-RUC",
      "receiver_legal_name": "ESCUELA KEMPER URGATES",
      "receiver_address": "<string>",
      "receiver_district": "<string>",
      "receiver_city": "<string>",
      "receiver_department":"<string>",
      "receiver_country_id": "83",
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions": "0",
      "currency_id": 7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details": [
      {
         "quantity": 1,
         "line_description": "Prueba Koywe",
         "unit_measure": "NIU",
         "unit_price": 1000,
         "long_description": "Test descripcion",
         "modifier_amount": 0,
         "total_taxes": 180,
         "modifier_percentage": 0,
         "total_amount_line": 1180,
         "sku": "3245",
         "taxes": [
            {
               "tax_type_id": "413",
               "tax_percentage": 18,
               "tax_amount": 180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id": "97",
         "reference_document_id": "190",
         "reference_code": "01",
         "description": "Anulacion solicitada por el emisor",
         "reference_date": "2025-01-27"
      }
   ],
   "totals": {
      "net_amount": 1000,
      "taxes_amount": 180,
      "total_amount": 1180
   }
}

Debit note with reference_number (Nota de débito electrónica)

In order to create a new Peruvian debit note, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original document (such as an invoice or receipt) to which the debit note refers.

{
   "header":{
      "account_id":16268,
      "document_type_id":"99",
      "document_sequence_code":"FD01",
      "received_issued_flag":0,
      "issue_date":"2025-01-23",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id":"96",
         "reference_number":"F001-00000080",
         "reference_code":"03",
         "description":"Penalidad/otros conceptos",
         "reference_date":"2025-01-23"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Debit note with reference_document_id (Nota de débito electrónica)

In order to create a new Peruvian debit note, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original document (such as an invoice or receipt) to which the debit note refers.

{
   "header":{
      "account_id":16268,
      "document_type_id":"99",
      "document_sequence_code":"FD01",
      "received_issued_flag":0,
      "issue_date":"2025-01-23",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "signature_id":"ASDFG",
            "operation_type":"0101"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references": [
      {
         "document_type_id":"96",
         "reference_document_id": "1587",
         "reference_code":"03",
         "description":"Penalidad/otros conceptos",
         "reference_date":"2025-01-23"
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Bill of lading - sender (Guía de remisión electrónica remitente)

In order to create a new Peruvian sender's bill of lading (document_type_id "100", SUNAT code "09"), you need to use the /documents endpoint with the proper parameters and add the additional shipping fields. The series usually starts with T (for example T002).

pe_shipping.delivery holds both ends of the transfer: dispatch is the departure point and delivery_address the arrival point. Each one carries its 6-digit UBIGEO code in ubigeo_code (the former name id is still accepted). In delivery_address you must identify the consignee / destinatario with party_tax_id_code, party_tax_id_type and party_legal_name (mandatory). The sender is the issuer, so dispatch does not carry party_*. The header receiver (receiver_*) is the document counterpart in Facto.

For the carrier's bill of lading (document_type_id "101"), see the following example.

{
   "header":{
      "account_id":16268,
      "document_type_id":"100",
      "document_sequence_code":"T002",
      "received_issued_flag":0,
      "issue_date":"2026-02-17",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20610383727",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_department":"<string>",
      "receiver_city":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         },
         "pe_shipping":{
            "handling_code":"13",
            "special_instructions":6,
            "handling_instructions":"DESCRIPCION DEL MOTIVO DE TRASLADO",
            "gross_weight_measure":"500",
            "gross_weight_measure_id":"KGM",
            "shipment_stage":{
               "transport_mode_code":"01",
               "transit_period":"2026-02-17",
               "driver_person":{
                  "driver_id":"72257341",
                  "first_name":"NOMBRE CONDUCTOR",
                  "family_name":"APELLIDOS CONDUCTOR",
                  "identity_document_reference":"LICENC1234"
               },
               "carrier_party":{
                  "party_identification": "20104498044",
                  "party_legal_entity_name": "EMPRESA TRANSPORTISTA",
                  "party_legal_entity_id": "NUMREGISTRANS",
                  "agent_party_id": "NUMAUTRANS"
               }
            },
            "delivery":{
               "delivery_address":{
                  "party_tax_id_code":"20473731828",
                  "party_tax_id_type":"PE-RUC",
                  "party_legal_name":"EMPRESA DESTINATARIA SAC",
                  "ubigeo_code":"150110",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION PUNTO LLEGADA",
                  "country_id":"83"
               },
               "dispatch":{
                  "ubigeo_code":"150112",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION PUNTO PARTIDA",
                  "country_id":"83"
               }
            },
            "transport_handling_unit":{
               "transport_equipment_id":"PLACA1"
            }
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "long_description":"Test descripcion",
         "sku":"3245"
      }
   ]
}

Bill of lading - carrier (Guía de remisión electrónica transportista)

To create a Peruvian carrier's bill of lading, use document_type_id "101" (SUNAT code "31") on the /documents endpoint. The issuer is the transport company; the header receiver (receiver_*) is the document counterpart in Facto (for example, whoever hires the transport).

The series must start with V (for example V001). In pe_shipping.delivery.dispatch you must identify the sender / remitente (who ships the goods) and in pe_shipping.delivery.delivery_address the consignee / destinatario (who receives them), each with party_tax_id_code, party_tax_id_type and party_legal_name, next to the 6-digit UBIGEO code of the departure and arrival points in ubigeo_code (the former name id is still accepted). The pe_shipping.despatch_party field is no longer accepted. The driver (driver_person) and vehicle plate (transport_handling_unit.transport_equipment_id) are mandatory. Line items do not include amounts or taxes.

If the sender's bill of lading (document_type_id "100") was also issued in Facto by the same company, you may reference it in references with reference_code "6". References to third-party documents are not accepted.

{
   "header":{
      "account_id":16268,
      "document_type_id":"101",
      "document_sequence_code":"V001",
      "received_issued_flag":0,
      "issue_date":"2026-09-14",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_department":"<string>",
      "receiver_city":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         },
         "pe_shipping":{
            "handling_code":"01",
            "handling_instructions":"TRANSPORTE DE MERCADERIA",
            "gross_weight_measure":"500",
            "gross_weight_measure_id":"KGM",
            "shipment_stage":{
               "transport_mode_code":"01",
               "transit_period":"2026-09-14",
               "driver_person":{
                  "driver_id":"72257341",
                  "first_name":"NOMBRE CONDUCTOR",
                  "family_name":"APELLIDOS CONDUCTOR",
                  "identity_document_reference":"LICENC1234"
               },
               "carrier_party":{
                  "party_identification":"20610383727",
                  "party_legal_entity_name":"EMPRESA TRANSPORTISTA",
                  "party_legal_entity_id":"NUMREGISTRANS",
                  "agent_party_id":"NUMAUTRANS"
               }
            },
            "delivery":{
               "delivery_address":{
                  "party_tax_id_code":"20473731828",
                  "party_tax_id_type":"PE-RUC",
                  "party_legal_name":"EMPRESA DESTINATARIA SAC",
                  "ubigeo_code":"150110",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION PUNTO LLEGADA",
                  "country_id":"83"
               },
               "dispatch":{
                  "party_tax_id_code":"20100070970",
                  "party_tax_id_type":"PE-RUC",
                  "party_legal_name":"EMPRESA REMITENTE SAC",
                  "ubigeo_code":"150112",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION PUNTO PARTIDA",
                  "country_id":"83"
               }
            },
            "transport_handling_unit":{
               "transport_equipment_id":"ABC123"
            }
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "long_description":"Test descripcion",
         "sku":"3245"
      }
   ]
}

Bill of lading - carrier by event (Guía de remisión electrónica transportista por evento)

When an event occurs during transport that prevents it from continuing under the conditions of the original bill of lading (for example, a vehicle change due to a breakdown, a transshipment, a driver change, or the impossibility of reaching the destination or delivering the goods), the carrier must issue a new carrier's bill of lading after the event occurs and before transport resumes.

The bill of lading by event is the same document type (document_type_id "101") with the updated transport data. In this example, a vehicle change, it reports the new plate and the new driver, and the place where the event occurred as the departure point. In references you must identify the bill of lading being modified, with reference_code "6" (bill of lading reference) and the same document_type_id "101", using reference_document_id with the Facto ID of the original bill of lading.

  • The series must start with V (for example V001). EG series (EG03, EG05, etc.) are reserved for bills of lading issued from the SUNAT portal or the Emprender app and cannot be used through the API.

  • The referenced bill of lading must have been issued in Facto by the same company; references to third-party documents are not accepted. The series, number and issuer of the reference are taken from that document.

  • A sender's bill of lading by event works the same way: issue a new "100" bill of lading (series T) that references the original "100" with reference_code "6".

  • Endpoint: https://apifacto.com/v1/documents

  • Method: POST

  • Required headers:

  • Content-Type: application/json

  • Authorization: Bearer \<token>

  • Accept: */*

{
   "header":{
      "account_id":16268,
      "document_type_id":"101",
      "document_sequence_code":"V001",
      "received_issued_flag":0,
      "issue_date":"2026-09-30",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"83",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_department":"<string>",
      "receiver_city":"<string>",
      "receiver_country_id":"83",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         },
         "pe_shipping":{
            "handling_code":"01",
            "handling_instructions":"CAMBIO DE VEHICULO POR DESPERFECTO MECANICO",
            "gross_weight_measure":"500",
            "gross_weight_measure_id":"KGM",
            "shipment_stage":{
               "transport_mode_code":"01",
               "transit_period":"2026-09-30",
               "driver_person":{
                  "driver_id":"45871236",
                  "first_name":"NOMBRE NUEVO CONDUCTOR",
                  "family_name":"APELLIDOS NUEVO CONDUCTOR",
                  "identity_document_reference":"Q45871236"
               },
               "carrier_party":{
                  "party_identification":"20610383727",
                  "party_legal_entity_name":"EMPRESA TRANSPORTISTA",
                  "party_legal_entity_id":"NUMREGISTRANS",
                  "agent_party_id":"NUMAUTRANS"
               }
            },
            "delivery":{
               "delivery_address":{
                  "party_tax_id_code":"20473731828",
                  "party_tax_id_type":"PE-RUC",
                  "party_legal_name":"EMPRESA DESTINATARIA SAC",
                  "ubigeo_code":"150110",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION PUNTO LLEGADA",
                  "country_id":"83"
               },
               "dispatch":{
                  "party_tax_id_code":"20100070970",
                  "party_tax_id_type":"PE-RUC",
                  "party_legal_name":"EMPRESA REMITENTE SAC",
                  "ubigeo_code":"150112",
                  "city_subdivision_name":"URBANIZACION",
                  "city_name":"PROVINCIA",
                  "country_subentity":"DEPARTAMENTO",
                  "district":"DISTRITO",
                  "address_line":"DIRECCION DONDE OCURRIO EL EVENTO",
                  "country_id":"83"
               }
            },
            "transport_handling_unit":{
               "transport_equipment_id":"XYZ789"
            }
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "long_description":"Test descripcion",
         "sku":"3245"
      }
   ],
   "references":[
      {
         "reference_code":"6",
         "document_type_id":"101",
         "reference_document_id":"3808",
         "description":"Guia de remision transportista modificada por cambio de vehiculo",
         "reference_date":"2026-09-30"
      }
   ]
}

Retention receipt with reference_number (Comprobante de retención)

In order to create a new Peruvian retention receipt, you need to use the /documents endpoint with the proper parameters and add a reference_number field that indicates the number of the original document (such as an invoice) to which the retention receipt refers, along with the required retention fields.

{
   "header":{
      "account_id":16268,
      "document_type_id":"109",
      "document_sequence_code":"R001",
      "received_issued_flag":0,
      "issue_date":"2025-01-24",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_email":"[email protected]",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         },
         "pe_retention_header":{
            "pe_sunat_retention_system_code":"01",
            "pe_sunat_retention_percent":"3.00",
            "pe_sunat_total_paid":"1144.60"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"96",
         "reference_number":"F001-00000080",
         "reference_code":1,
         "description":"Pago",
         "reference_date":"2025-01-24",
         "additional":{
            "pe_retention_details":{
               "reference_paid_amount":"1144.60",
               "reference_total_invoice_amount": "1180",
               "reference_paid_date":"2025-01-24",
               "reference_payment_id":"1",
               "pe_reference_sunat_retention_amount":"34.34",
               "pe_reference_sunat_retention_date":"2025-01-23",
               "calculation_rate":"1",
               "currency_id":"7"
            }
         }
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Retention receipt with reference_document_id (Comprobante de retención)

In order to create a new Peruvian retention receipt, you need to use the /documents endpoint with the proper parameters and add a reference_document_id field that indicates the ID of the original document (such as an invoice) to which the retention receipt refers, along with the required retention fields.

{
   "header":{
      "account_id":16268,
      "document_type_id":"109",
      "document_sequence_code":"R001",
      "received_issued_flag":0,
      "issue_date":"2025-01-24",
      "issuer_tax_id_code":"20610383727",
      "issuer_tax_id_type":"PE-RUC",
      "issuer_legal_name":"<string>",
      "issuer_address":"<string>",
      "issuer_district":"<string>",
      "issuer_city":"<string>",
      "issuer_department":"<string>",
      "issuer_country_id":"80",
      "issuer_phone":"<string>",
      "issuer_activity":"<string>",
      "issuer_postalcode":"12345456",
      "receiver_tax_id_code":"20473731828",
      "receiver_tax_id_type":"PE-RUC",
      "receiver_legal_name":"ESCUELA KEMPER URGATES",
      "receiver_address":"<string>",
      "receiver_district":"<string>",
      "receiver_city":"<string>",
      "receiver_department":"<string>",
      "receiver_country_id":"80",
      "receiver_phone":"<string>",
      "receiver_activity":"<string>",
      "receiver_email":"[email protected]",
      "receiver_postalcode":"12343456",
      "payment_conditions":"0",
      "currency_id":7,
      "additional":{
         "pe_header":{
            "operation_type":"0101"
         },
         "pe_retention_header":{
            "pe_sunat_retention_system_code":"01",
            "pe_sunat_retention_percent":"3.00",
            "pe_sunat_total_paid":"1144.60"
         }
      }
   },
   "details":[
      {
         "quantity":1,
         "line_description":"Prueba Koywe",
         "unit_measure":"NIU",
         "unit_price":1000,
         "long_description":"Test descripcion",
         "modifier_amount":0,
         "total_taxes":180,
         "modifier_percentage":0,
         "total_amount_line":1180,
         "sku":"3245",
         "taxes":[
            {
               "tax_type_id":"413",
               "tax_percentage":18,
               "tax_amount":180
            }
         ]
      }
   ],
   "references":[
      {
         "document_type_id":"96",
         "reference_document_id": "511",
         "reference_code":1,
         "description":"Pago",
         "reference_date":"2025-01-24",
         "additional":{
            "pe_retention_details":{
               "reference_paid_amount":"1144.60",
               "reference_total_invoice_amount": "1180",
               "reference_paid_date":"2025-01-24",
               "reference_payment_id":"1",
               "pe_reference_sunat_retention_amount":"34.34",
               "pe_reference_sunat_retention_date":"2025-01-23",
               "calculation_rate":"1",
               "currency_id":"7"
            }
         }
      }
   ],
   "totals":{
      "net_amount":1000,
      "taxes_amount":180,
      "total_amount":1180
   }
}

Response status in the REST API result

status description
0 The draft was created successfully, signed, and sent to the SII successfully.
1 There are errors in the input, so the draft was not generated nor sent to the SII. The error details will be in error_message.
2 The draft was created successfully; however, there are other issues (e.g., lack of folios) that prevented it from being sent to the SII. The error details will be in error_message.

After issuing a document in Peru, the API retrieves the CDR (after the XML) and includes it in electronic_document as document_cdr (base64) and document_cdr_filename (for example, F001-00000001.cdr), along with document_xml and document_pdf.

{
   "document_id": 377,
   "header":    {
      "account_id": 14540,
      "document_type_id": 82,
      "document_type_taxbureau": "01",
      "document_number": 1040447,
      "received_issued_flag": 1,
      "taxbureau_validation_status": null,
      "issue_date": "2025-04-15",
      "issuer_tax_id_code": "860517022-2",
      "issuer_tax_id_type": "PE-RUC",
      "issuer_legal_name": "Demo Colombia",
      "issuer_address": "",
      "issuer_district": "",
      "issuer_city": "",
      "issuer_country_id": 253,
      "issuer_phone": "442020550",
      "issuer_activity": "",
      "receiver_tax_id_code": "1097491385-1",
      "receiver_tax_id_type": "PE-RUC",
      "receiver_legal_name": "ESCUELAa KEMPER URGATE",
      "receiver_address": "",
      "receiver_district": "",
      "receiver_city": "",
      "receiver_country_id": 66,
      "receiver_phone": "<string>",
      "receiver_activity": "<string>",
      "document_status": 1,
      "payment_conditions": "0",
      "currency_id": 28
   },
   "details": [   {
      "quantity": "1.000000",
      "line_description": "Prueba Koywe",
      "long_description": "Esta es una linea de prueba",
      "unit_measure": "70",
      "unit_price": "3660.000000",
      "vat_status": "0"
   }],
   "references": null,
   "global_modifiers": null,
   "totals":    {
      "net_amount": 3660,
      "taxes_amount": 695.4,
      "total_amount": "4355.40"
   },
   "electronic_document":    {
      "document_xml": "PD94bWwgdmVyc2lvbj0iMS4wIiB...",
      "document_cdr": "PD94bWwgdmVyc2lvbj0iMS4wIiB...",
      "document_cdr_filename": "F001-00000001.cdr",
      "document_pdf": "JVBERi0xLjMKMyAwIG9iago8PC9..."
   },
   "payment_link": null,
   "result":    {
      "status": 0,
      "error_message": ""
   },
   "_links": {"self": {"href": "https://apifacto.com/v1/documents"}}
}

API Reference POST /documents

Detailed endpoint documentation