API Integration
Integration Guide for the Issuance of Electronic Tax Documents (DTE)
LibreDTE Web Services
LibreDTE offers a web platform primarily focused on Electronic Invoicing. It provides a web application designed to generate electronic tax documents, known in Chile as “Documentros Tributarios Electrónicos” or “DTE”.
Throught its RESTful Web Services, LibreDTE enables external systems to integrate with its platform and issue DTEs directly from third-party software.
The complete official documentation is available at libredte.cl/doc.
Authentication via Hash
LibreDTE’s Web Services use HTTP Basic authentication based on a 32-character hash, which you can obtain from your user profile on the platform.
Authentication Options
1. Using the API HASH
The hash is available in the API hash field of your user profile.
The following image shows the corresponding field:
To authenticate requests, this hash must be sent using HTTP Basic Auth, where the username is the letter “X” and the password is your user’s hash.
If your user hash is “hash123” (real values are 32 characters long), then your API credentials must be Base64-encoded as follows:
// Example usage in PHP.
$hash = 'hash123';
$credentials = base64_encode('X:' . $hash);
$headers = ['Authorization' => 'Basic ' . $credentials];
The resulting header will look like this:
Authorization: Basic WDpoYXNoMTIz
2. Using the API Key
Alternatively, you can use the Base64-encoded value available directly in the API KEY field of your profile.
The following image shows the corresponding field:
This API key can be used directly in HTTP header:
Authorization: Basic APIKEY