DocuStream
← Documentation

User Guide

End-to-end workflow guide — from creating your first template to generating and sharing a PDF.

Overview

DocuStream works in three simple steps:

1. Create a Template
2. Generate a PDF
3. Share the Signed URL

Web Dashboard

Access the web dashboard at your service URL (e.g., https://your-app.docustream.com). Sign in with your account credentials.

Dashboard Home

The dashboard home page lists all your saved templates. From here you can:

  • Click Generate PDF on any template to fill variables and produce a PDF
  • Click Edit to modify a template's HTML content
  • Click Delete to remove a template permanently
  • Click New Template to create a template from scratch

Creating a Template

  1. Click the New Template button in the top right of the dashboard.
  2. Enter a Template Name (e.g., “Monthly Invoice”).
  3. Paste your HTML content. Use {{variableName}} placeholders for dynamic values.
  4. Variables are auto-detected and shown in the Detected Variables panel.
  5. Click Save Template.

Example template HTML:

<!DOCTYPE html>
<html>
<head>
  <style>
    body { font-family: Arial, sans-serif; padding: 40px; }
    h1   { color: #333; }
  </style>
</head>
<body>
  <h1>Invoice #{{invoiceNumber}}</h1>
  <p><strong>Bill To:</strong> {{clientName}}</p>
  <p><strong>Due Date:</strong> {{dueDate}}</p>
  <p><strong>Amount Due:</strong> {'$'}{{amount}}</p>
</body>
</html>

Generating a PDF

  1. Click Generate PDF next to the template you want to use.
  2. Fill in each variable value in the form that appears.
  3. Click Generate PDF.
  4. The result screen shows a Download PDF button and the signed URL.

Downloading and Sharing

The PDF is stored securely in cloud storage and accessed via a signed URL that expires automatically.

  • Click Download PDF to open the PDF in a new tab.
  • Copy the signed URL to share via email or Slack — no login required for recipients.
  • After expiry, call the download endpoint to get a fresh URL.
⚠️ Signed URLs are not password-protected — anyone with the link can download the PDF.

API Workflow

Prefer to integrate directly? Use the REST API.

Step 1 – Create a Template

curl -X POST https://your-api.docustream.com/api/templates \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoice Template",
    "content": "<html><body><h1>Invoice #{{invoiceNumber}}</h1></body></html>"
  }'

Step 2 – Generate a PDF

curl -X POST https://your-api.docustream.com/api/pdfs/generate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "tmpl_abc123",
    "variables": {
      "invoiceNumber": "INV-2026-001",
      "clientName": "Acme Corp",
      "amount": "1,250.00"
    }
  }'

Step 3 – Refresh an Expired URL

curl "https://your-api.docustream.com/api/pdfs/pdf_xyz789/download?accessedBy=user@acme.com" \
  -H "x-api-key: YOUR_API_KEY"

Template Design Tips

  • Keep HTML self-contained — use inline CSS and base64-encoded images; external resources may not load reliably.
  • Control page size — use @page { size: A4; margin: 20mm; } in your stylesheet.
  • Force page breaks — use <div style="page-break-after: always;"></div> between sections.
  • Preview first — open your HTML in a browser with sample values before saving the template.

Common Use Cases

Use CaseExample Variables
InvoiceinvoiceNumber, clientName, total, dueDate
ContractpartyName, effectiveDate, terms
CertificaterecipientName, courseName, completionDate
ReportreportTitle, generatedDate, summaryText

Troubleshooting

401 Invalid API Key

Verify you are sending the x-api-key header (not Authorization: Bearer). Contact your admin for a new key.

PDF looks wrong or blank

Open the raw HTML in a browser to confirm it renders. Check that all {{variable}} names exactly match the keys you send (case-sensitive).

Signed URL has expired

Call GET /api/pdfs/:id/download to get a fresh URL. The original PDF is still in storage.

429 Rate Limit Exceeded

The API allows 100 requests per 15-minute window. Slow down requests or contact your admin for a higher limit.