Skip to Content

Go

Official Go SDK for TemplateFox.

Go Reference GitHub Repository 

Installation

go get github.com/TemplateFoxPDF/gosdk

Generate a PDF

package main import ( "context" "fmt" "log" templatefox "github.com/TemplateFoxPDF/gosdk" ) func main() { // Initialize the client config := templatefox.NewConfiguration() config.AddDefaultHeader("x-api-key", "your-api-key") client := templatefox.NewAPIClient(config) ctx := context.Background() // Generate a PDF request := templatefox.CreatePdfRequest{ TemplateId: "YOUR_TEMPLATE_ID", Data: map[string]interface{}{ "name": "John Doe", "invoice_number": "INV-001", "total_amount": 150.00, }, } response, _, err := client.PDFApi.CreatePdf(ctx, request) if err != nil { log.Fatal(err) } fmt.Printf("PDF URL: %s\n", *response.Url) fmt.Printf("Credits remaining: %d\n", *response.CreditsRemaining) }

Configuration

import "os" config := templatefox.NewConfiguration() config.AddDefaultHeader("x-api-key", os.Getenv("TEMPLATEFOX_API_KEY")) client := templatefox.NewAPIClient(config)

Full SDK Reference

For the complete API coverage including templates, account, S3 integration, and error handling, see the GitHub repository README .

Last updated on