Document Stack
Document Stack
Docs

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:

LanguagePackageMin Version
Node.js / TypeScript@documentstack/sdkNode 18+
PythondocumentstackPython 3.8+
Gogithub.com/documentstack/sdk-goGo 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/sdk

Python

Install from PyPI:

Bash
# pip
pip install documentstack

# poetry
poetry add documentstack

# pipenv
pipenv install documentstack

Go

Add the module to your project:

Bash
go get github.com/documentstack/sdk-go

Get Your API Key

Before using any SDK, you need an API key. If you haven't created one yet:

  1. Open your Project in the Document Stack dashboard
  2. Go to the API Keys tab
  3. Click Create API Key
  4. Copy the key — it starts with ds_live_ or ds_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_here

Verify 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