SDK Overview
Official client libraries for Node.js, Python, and Go to integrate Document Stack into your application.
Available SDKs
Document Stack provides official SDKs for three languages. Each SDK wraps the REST API, handles authentication, and provides typed interfaces for all operations.
| Language | Package | Min Version |
|---|---|---|
| Node.js / TypeScript | @document-stack/sdk-node | Node 18+ |
| Python | document-stack | Python 3.9+ |
| Go | github.com/documentstack/sdk-go | Go 1.21+ |
Quick Install
Node.js
npm install @document-stack/sdk-nodePython
pip install document-stackGo
go get github.com/documentstack/sdk-goBasic Usage
Every SDK follows the same pattern: create a client with your API key, then call methods on it.
Node.js
import { DocumentStack } from "@document-stack/sdk-node";
const client = new DocumentStack({ apiKey: process.env.DS_API_KEY! });
const pdf = await client.generate({
templateId: "tmpl_abc123",
data: { customerName: "Alice", amount: 99.99 },
});
console.log("PDF URL:", pdf.url);Python
from document_stack import DocumentStack
client = DocumentStack(api_key=os.environ["DS_API_KEY"])
pdf = client.generate(
template_id="tmpl_abc123",
data={"customerName": "Alice", "amount": 99.99},
)
print("PDF URL:", pdf.url)Go
package main
import (
"fmt"
"os"
ds "github.com/documentstack/sdk-go"
)
func main() {
client := ds.NewClient(os.Getenv("DS_API_KEY"))
pdf, err := client.Generate(ds.GenerateParams{
TemplateID: "tmpl_abc123",
Data: map[string]interface{}{
"customerName": "Alice",
"amount": 99.99,
},
})
if err != nil {
panic(err)
}
fmt.Println("PDF URL:", pdf.URL)
}Common Features
All SDKs share these capabilities:
- Authentication — API key passed once at client creation
- PDF generation — Generate PDFs from templates with dynamic data
- Template management — List and retrieve templates
- Project management — List and manage projects
- Error handling — Typed errors with status codes and messages
- Automatic retries — Configurable retry logic for transient failures
All SDKs are open source. Contributions are welcome on GitHub.
Next Steps
- Node.js SDK — Getting started with Node.js
- Python SDK — Getting started with Python
- Go SDK — Getting started with Go
- API Overview — Direct REST API usage