Introduction
The Electronic Invoice Processing API is a FastAPI-based service that transforms Excel spreadsheets containing invoice data into structured JSON documents following the Venezuelan electronic invoice standard.Base URL
Authentication
Currently, this API does not require authentication. All endpoints are publicly accessible.Available Endpoints
The API currently provides one main endpoint:POST /process_excel
Upload an Excel file and receive a ZIP archive containing structured JSON invoices
Rate Limiting
There are currently no rate limits enforced on API endpoints.For production deployments, consider implementing rate limiting to prevent abuse and ensure service availability.
Response Format
The API returns responses in the following format:- Success Response:
application/zip- A ZIP file containing organized JSON invoice documents - Error Response:
application/json- Standard FastAPI error response with detail message
ZIP File Organization
The returned ZIP file is structured as follows:Invoices are automatically organized into batches of 100 documents, with each batch in a separate folder.
Error Handling
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
200 | Request successful - ZIP file returned |
422 | Validation error - Invalid file format or missing required fields |
500 | Internal server error - Processing failed |
Error Response Structure
CORS Configuration
CORS settings (main.py:16-22):- Allowed Origins:
*(all origins) - Allow Credentials:
true - Allowed Methods:
*(all methods) - Allowed Headers:
*(all headers)
For production environments, restrict
allow_origins to specific domains (e.g., ["http://localhost:3000"] or your frontend domain).Data Processing
The API performs the following transformations:- Excel Parsing: Reads uploaded Excel file using pandas
- Data Transformation: Converts each row into a structured JSON document following Venezuelan electronic invoice standards
- Calculations: Automatically calculates IVA (VAT), currency conversions, and amount-to-words conversions
- Batch Organization: Groups invoices into batches of 100 documents
- ZIP Generation: Creates an in-memory ZIP archive with organized JSON files
Supported Invoice Fields
The API expects Excel files with the following columns:- Correlativo (Invoice number)
- Fecha Emision (Issue date)
- Fecha Vencimiento (Due date)
- Fecha Pago (Payment date)
- Cliente (Customer name)
- Documento (Document type)
- DNI/C.I./C.C./IFE (ID number)
- Dirección (Address)
- Telefono (Phone)
- Correo (Email)
- Plan (Service description)
- Total (Total in USD)
- bolivares (Total in Bolivares)
- bolivares sin iva (Bolivares without VAT)
- precio sin iva (USD without VAT)
- Tasa (Exchange rate)
- Forma de Pago (Payment method)
- ID Servicio (Service ID)
Next Steps
Process Excel Endpoint
View detailed endpoint documentation
Response Structure
Learn about the JSON invoice format