Add document generation & e-signing to your app.
DocsNG exposes a clean REST API. Your users design templates in Word; your code turns data into signed, verifiable documents. Self-hosted, so integration keeps everything inside your boundary.
Three calls: authenticate → generate → download
Get a token
Exchange credentials (or an API key) for a JWT bearer token.
Generate
POST a template id and your JSON data; DocsNG merges, signs and stores the result.
Download or verify
Fetch the signed PDF, or let any recipient validate it.
# 1 · Authenticate TOKEN=$(curl -s -X POST \ "$BASE/api/Account/Login?username=$U&password=$P") # 2 · Generate a signed PDF from template + data DOC=$(curl -s -X POST \ "$BASE/api/Document/GenerateDocumentFromJson\ ?templateId=42&outputType=Pdf" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d @invoice.json) # 3 · Download it curl -L "$BASE/api/Document/DownloadDocument\ ?id=$DOC&jwtToken=$TOKEN" -o invoice.pdf
// C#
var http = new HttpClient { BaseAddress = new(baseUrl) };
var token = await http.PostAndReadAsync(
$"/api/Account/Login?username={u}&password={p}");
http.DefaultRequestHeaders.Authorization = new("Bearer", token);
var docId = await http.PostAsJsonAsync(
"/api/Document/GenerateDocumentFromJson" +
"?templateId=42&outputType=Pdf", entries)
.Result.Content.ReadFromJsonAsync<int>();
var pdf = await http.GetByteArrayAsync(
$"/api/Document/DownloadDocument?id={docId}&jwtToken={token}");
await File.WriteAllBytesAsync("invoice.pdf", pdf);// JavaScript / Node
const token = await (await fetch(
`${base}/api/Account/Login?username=${u}&password=${p}`,
{ method: "POST" })).text();
const docId = await (await fetch(
`${base}/api/Document/GenerateDocumentFromJson` +
`?templateId=42&outputType=Pdf`,
{ method: "POST",
headers: { Authorization: `Bearer ${token}`,
"Content-Type": "application/json" },
body: JSON.stringify(entries) })).json();
const pdf = await fetch(`${base}/api/Document/` +
`DownloadDocument?id=${docId}&jwtToken=${token}`);# Python
import requests
base = "https://docs.acme.com"
token = requests.post(f"{base}/api/Account/Login",
params={"username": u, "password": p}).text
doc_id = requests.post(
f"{base}/api/Document/GenerateDocumentFromJson",
params={"templateId": 42, "outputType": "Pdf"},
headers={"Authorization": f"Bearer {token}"},
json=entries).json()
pdf = requests.get(f"{base}/api/Document/DownloadDocument",
params={"id": doc_id, "jwtToken": token}).content
open("invoice.pdf", "wb").write(pdf)What the API gives you
Generate
Merge JSON or entity ids into PDF, DOCX or HTML. Choose culture, encryption and signing options per request.
Sign & encrypt
Apply PAdES-LTV signatures with a local cert, KMS or HSM; set open/permission passwords and PDF permissions.
Verify
Validate any signed PDF and read back signer, timestamp and integrity — no auth required for public verification.
Batch
Generate many documents from one template for statement and mailing runs, zipped or merged.
Async jobs
Submit long-running work, poll status, or receive a signed webhook callback on completion.
Data & templates
Create/search data entries and manage template versions through the same API.
The routes you'll use most
| Method | Route | Purpose |
|---|---|---|
| POST | /api/Account/Login | Authenticate → JWT bearer token |
| POST | /api/Document/GenerateDocumentFromJson | Template + JSON data → generated document |
| POST | /api/Document/GenerateDocument | Template + entity ids → generated document |
| POST | /api/Document/SignDocument | Sign an existing stored document |
| GET | /api/Document/DownloadDocument | Download a generated document |
| POST | /api/Document/ValidatePdf | Verify a signed PDF (public) |
| GET | /api/DefModel/List | List data models & fields (for template mapping) |
| POST | /api/Data/Edit | Create or update a data entry |
Authentication
DocsNG issues JWT bearer tokens. Send Authorization: Bearer <token> on every call. For server-to-server integrations, use scoped API keys / service accounts so automation is independent of interactive users and can be revoked without disruption.
SDKs & OpenAPI
The API ships an OpenAPI (Swagger) description. Generate a typed client for C#, TypeScript/JavaScript or Python, or call the endpoints directly. Contract-tested so the spec matches runtime behaviour.
Ship your first signed document today
Spin up a trial instance, grab a token, and generate a signed PDF in minutes.
