DocuStream
← Documentation

Admin Guide

Manage customers, configure plans, and review billing.

Admin Authentication

Admin endpoints are protected by a separate key set via the ADMIN_API_KEY environment variable. Include it in every admin request:

curl -H "x-admin-key: YOUR_ADMIN_API_KEY" ...
Keep this key secret — it grants full access to all customer data.

Admin Dashboard (Web UI)

The admin dashboard is accessible at /admin on your frontend URL. Sign in with your ADMIN_API_KEY.

  • View all registered customers and their PDF usage
  • Click View Details to see a customer's API key and statistics
  • Click New Customer to provision a new customer account
  • Navigate to /admin/billing for a platform-wide billing overview

Managing Customers

Create a Customer (API)

curl -X POST https://your-api.docustream.com/api/admin/customers \
  -H "x-admin-key: YOUR_ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "email": "admin@acme.com",
    "plan": "starter"
  }'

The response includes an apiKey. It is shown only once — copy and deliver it to the customer securely.

Create a Customer (Dashboard)

  1. Go to /admin
  2. Click New Customer
  3. Fill in Name, Email, and Plan
  4. Click Create
  5. Copy the generated API key from the confirmation dialog

View Customer Statistics

curl https://your-api.docustream.com/api/admin/customers/cust_abc123/stats \
  -H "x-admin-key: YOUR_ADMIN_API_KEY"

Response:

{
  "customerId": "cust_abc123",
  "pdfsGenerated": {
    "thisMonth": 47,
    "lastMonth": 120,
    "total": 342
  },
  "apiCalls": {
    "thisMonth": 215,
    "total": 1873
  }
}

Billing Overview

curl https://your-api.docustream.com/api/admin/billing \
  -H "x-admin-key: YOUR_ADMIN_API_KEY"

Response:

[
  {
    "customerId": "cust_abc123",
    "customerName": "Acme Corp",
    "month": "2026-04",
    "pdfsGenerated": 47,
    "plan": "starter"
  }
]