Skip to main content

Prerequisites

Before installing go-siat, ensure you have:
1

Go 1.26 or higher

Check your Go version:
go version
If you need to update, visit go.dev
2

A Go module initialized

If you haven’t initialized a Go module yet:
go mod init your-project-name
3

SIAT API credentials

You’ll need a valid SIAT API token to make requests. Contact Bolivia’s tax authority to obtain credentials.

Install via go get

Install the latest version of go-siat using Go’s package manager:
go get github.com/ron86i/go-siat@latest
This will:
  • Download the go-siat SDK
  • Add it to your go.mod file
  • Download all required dependencies

Verify Installation

Create a simple test file to verify the installation:
test.go
package main

import (
    "fmt"
    "github.com/ron86i/go-siat"
)

func main() {
    s, err := siat.New("https://pilotosiatservicios.impuestos.gob.bo/v2", nil)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    fmt.Println("go-siat initialized successfully!")
}
Run the test:
go run test.go
You should see:
go-siat initialized successfully!

Package Structure

Once installed, you’ll have access to these key packages:
import "github.com/ron86i/go-siat"

Environment Configuration

Testing Environment

For development and testing, use the pilot SIAT URL:
s, err := siat.New("https://pilotosiatservicios.impuestos.gob.bo/v2", nil)

Production Environment

For production, use your production SIAT URL:
s, err := siat.New("https://your-production-siat-url.com/v2", nil)

Custom HTTP Client

You can provide a custom HTTP client with specific timeout and transport settings:
import (
    "net/http"
    "time"
    "github.com/ron86i/go-siat"
)

customClient := &http.Client{
    Timeout: 30 * time.Second,
    Transport: &http.Transport{
        MaxIdleConns:       10,
        IdleConnTimeout:    90 * time.Second,
    },
}

s, err := siat.New("https://pilotosiatservicios.impuestos.gob.bo/v2", customClient)
If no HTTP client is provided, go-siat uses a default client with a 15-second timeout.

Additional Dependencies for Invoice Signing

If you plan to sign invoices (required for CompraVenta operations), you’ll need:
  1. Digital certificate (.crt file) issued by a Bolivian certification authority
  2. Private key (.pem file) corresponding to your certificate
These are used by the SignXML utility:
signedXML, err := models.CompraVenta.SignXML(xmlData, "key.pem", "cert.crt")

Troubleshooting

If you encounter module download issues:
# Clear module cache
go clean -modcache

# Re-download dependencies
go mod download
Ensure your go.mod specifies Go 1.26+:
go.mod
module your-project

go 1.26

require github.com/ron86i/go-siat latest
After installation, update dependencies:
go mod tidy

Next Steps

Quickstart Guide

Learn how to make your first SIAT API call with a complete working example

Build docs developers (and LLMs) love