Developer guide
Integrate DocsNG document generation into your software. The same three steps apply as in the GUI — define data models, create Word templates, then generate over the RESTful API.
The three steps
- Define data models in the GUI (or rely on inline data via the API). See concepts.
- Create templates in MS Word with merge fields and ranges. See template authoring.
- Generate documents by calling the API. Full contract in generating documents.
Authenticate
# returns a Bearer token curl -X POST "$BASE/api/Account/Login?username=$U&password=$P"
Send Authorization: Bearer <token> on subsequent calls.
Generate
curl -X POST "$BASE/api/Document/GenerateDocumentFromJson?templateId=3&outputType=2" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d @invoice.json # response: the id of the generated document
outputType: 1 = DOCX, 2 = PDF. Optional query params: culture, encryptPwd, pfxPwd. The request body is a JSON array of documents — see the full JSON structure and example.
Download
curl -L "$BASE/api/Document/DownloadDocument?id=1024&jwtToken=$TOKEN" -o invoice.pdf
Verify
curl -X POST "$BASE/api/Document/ValidatePdf" -F "pdf=@invoice.pdf"
API keys & service accounts
For automation, authenticate with a scoped API key / service account rather than a user login — independent of interactive users and revocable at any time. Keys carry scopes (generate, sign, read-templates) enforced per endpoint.
Batch & async
For high volume, submit an async job and poll or receive a signed webhook callback, and use batch generation to produce many documents in one call.
Postman, OpenAPI & SDKs
A public Postman collection runs against the demo environment. DocsNG also exposes an OpenAPI (Swagger) description on your instance, from which you can generate typed clients for C#, TypeScript/JavaScript or Python. See the API reference.
Error handling
The API uses standard HTTP status codes (200 success, 400 bad request, 401/403 auth, 404 not found). Handle 401 by re-authenticating. Set Accept-Language to localise API messages.
Need help? Contact us or try the live demo.
