Installation & Setup
Install Document Stack SDKs and configure API access for your application.
Choose Your SDK
Document Stack provides official SDKs for three languages. Pick the one that matches your application stack:
| Language | Package | Min Version |
|---|---|---|
| Node.js / TypeScript | @documentstack/sdk | Node 18+ |
| Python | documentstack | Python 3.8+ |
| Go | github.com/documentstack/sdk-go | Go 1.21+ |
Node.js / TypeScript
Install the SDK with your preferred package manager:
Bash
# npm
npm install @documentstack/sdk
# yarn
yarn add @documentstack/sdk
# pnpm
pnpm add @documentstack/sdk
# bun
bun add @documentstack/sdkPython
Install from PyPI:
Bash
# pip
pip install documentstack
# poetry
poetry add documentstack
# pipenv
pipenv install documentstackGo
Add the module to your project:
Bash
go get github.com/documentstack/sdk-goGet Your API Key
Before using any SDK, you need an API key. If you haven't created one yet:
- Open your Project in the Document Stack dashboard
- Go to the API Keys tab
- Click Create API Key
- Copy the key — it starts with
ds_live_ords_test_
Keep Keys Secret
Never commit API keys to version control. Use environment variables or a secrets manager in production.Configure Environment Variables
Store your API key in an environment variable so your code doesn't contain secrets:
Bash
# .env or .env.local
DOCUMENT_STACK_API_KEY=ds_live_your_api_key_hereVerify Installation
Run a quick test to make sure everything is working. This generates a PDF from one of your templates:
Node.js
TypeScript
import { DocumentStack } from "@documentstack/sdk";
const client = new DocumentStack({
apiKey: process.env.DOCUMENT_STACK_API_KEY!,
});
const pdf = await client.documents.generate({
templateId: "your-template-id",
data: { name: "Test" },
});
console.log("PDF generated:", pdf.url);Python
Python
from documentstack import DocumentStack
client = DocumentStack(api_key=os.environ["DOCUMENT_STACK_API_KEY"])
pdf = client.documents.generate(
template_id="your-template-id",
data={"name": "Test"},
)
print(f"PDF generated: {pdf.url}")Go
Go
package main
import (
"fmt"
"os"
documentstack "github.com/documentstack/sdk-go"
)
func main() {
client := documentstack.New(os.Getenv("DOCUMENT_STACK_API_KEY"))
pdf, err := client.Documents.Generate(&documentstack.GenerateParams{
TemplateID: "your-template-id",
Data: map[string]interface{}{"name": "Test"},
})
if err != nil {
panic(err)
}
fmt.Println("PDF generated:", pdf.URL)
}Replace
your-template-id with the ID of an actual template from your project. You can find template IDs in the dashboard or via the Templates API.Using the REST API Directly
Don't see your language? You can call the Document Stack API directly over HTTP. Any language or tool that can make HTTP requests works:
Bash
curl -X POST https://api.documentstack.dev/api/v1/generate \
-H "Authorization: Bearer ds_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"templateId": "your-template-id",
"data": { "name": "Test" }
}'Next Steps
- Quick Start — Build and generate your first PDF
- API Keys — Learn about key scoping and security
- Node.js SDK — Full Node.js SDK reference
- Python SDK — Full Python SDK reference
- Go SDK — Full Go SDK reference