This solution demonstrates how to programmatically obtain an authentication token from Chile's Servicio de Impuestos Internos using WCF SOAP services. It makes use of the following official SOAP endpoints:
It includes:
- Minimal API for secure access to SOAP services
- XML Digital Signature using a .pfx certificate
- Digital certificate retrieval from Azure Blob Storage
This repository has no relationship with the government entity SII, only for educational purposes.
Package Reference | Version |
---|---|
Azure.Storage.Blobs | 12.24.0 |
Microsoft.Extensions.Azure | 1.7.6 |
This solution exposes a Minimal API endpoint that allows you to request through a simple HTTP GET. Once the app is running, you can call the endpoint:
curl http://localhost:5058/api/token \
-H "Accept: application/json"
The response will be a JSON payload with the token issued by the SII :
{
"token": "XYZ123456789",
"fecha": "2025-04-02T17:00:00Z"
}
Use appsettings.json
or environment variables to configure the certificate source:
{
"StorageConnection": "UseDevelopmentStorage=true",
"StorageConnection:ContainerName": "certificados",
"StorageConnection:BlobName": "certificado1.pfx",
"StorageConnection:CertPassword": "<your-cert-password>"
}
You may also define these as Azure App Settings if you're deploying the API to the cloud.
Feel free to file a new issue with a respective title and description on the Sii.ObtenerTokenAuth/issues repository.
If this tool was useful, consider contributing with ideas or improving it further.
All my repository content is released under the terms of the GNU General Public License v3.0.