Skip to main content

SUNAT Electronic Invoicing API for Peru

Complete Laravel-based API for Peruvian electronic invoicing with Greenter integration. Generate XML UBL 2.1, sign documents, and communicate directly with SUNAT.

Laravel 12 + PHP 8.2+
Greenter 5.1 Integration
UBL 2.1 XML Generation
SUNAT Certified

Quick Start

Get your first invoice generated in minutes

1

Install the API

Clone the repository and install dependencies using Composer.
git clone https://github.com/yorchavez9/Api-de-facturacion-electronica-sunat-Peru.git
cd Api-de-facturacion-electronica-sunat-Peru
composer install
2

Configure your environment

Set up your database connection and SUNAT certificates.
cp .env.example .env
php artisan key:generate
php artisan migrate
Place your SUNAT certificate (.pfx or .pem) in storage/certificates/ and configure the path in your .env file.
3

Authenticate and create your first invoice

Get an authentication token and create your first electronic invoice.
curl -X POST http://localhost:8000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "password"}'
Use the returned token to create invoices, boletas, and other SUNAT documents through the REST API.

Explore by Topic

Learn about the key features and capabilities

Electronic Documents

Create facturas, boletas, credit notes, and debit notes compliant with SUNAT regulations.

SUNAT Integration

Send documents to SUNAT and automatically retrieve CDR responses with validation.

PDF Generation

Generate professional PDF documents with customizable templates for all document types.

Multi-Company Setup

Manage multiple companies and branches with independent configurations and certificates.

XML Signing

Digital signature implementation using SUNAT-certified .pfx or .pem certificates.

Authentication

OAuth2 authentication with Laravel Sanctum for secure API access and user management.

Ready to integrate SUNAT invoicing?

Start generating SUNAT-compliant electronic documents in minutes with our complete Laravel API solution.

Start Building Now

Build docs developers (and LLMs) love