Documint/ API Reference

Documint API Reference

Generate certificates, invoices, cards, PNGs, PDFs, and merged template packets from your backend.

API Reference

Generate documents from templates.

Use Documint APIs to list workspace templates, validate payloads, generate PNG or PDF output, and merge multiple templates into one PDF packet.

Authentication

Send an API key with every request.

Generation and validation endpoints accept API key authentication. Dashboard-only key management uses the signed-in session.

Authorization: Bearer YOUR_API_KEY
x-api-key: YOUR_API_KEY
api-key: YOUR_API_KEY
List workspace templates
GET/api/documents/templates

List workspace templates

Returns templates owned by the authenticated workspace user. Use this to show template IDs and required parameters before generation.

  • Lists templates owned by the authenticated workspace.
  • Use requiredParams to prepare payload fields.
  • Public template discovery is handled in the product UI.
Request
GET /api/documents/templates HTTP/1.1
Authorization: Bearer YOUR_API_KEY
Response
{
  "success": true,
  "templates": [
    {
      "id": "template_cert_completion",
      "name": "Course completion certificate",
      "isPublic": false,
      "requiredParams": ["client.name", "course.name"],
      "previewUrl": "https://...",
      "pageCount": 1,
      "updatedAt": "2026-06-06T10:00:00.000Z"
    }
  ]
}
Validate payload data
POST/api/documents/validate-data

Validate payload data

Checks whether a payload contains every required placeholder for a template before generating output.

  • payload and data are both accepted.
  • Flat keys such as client.name are normalized automatically.
  • A missing template returns a 404 response.
Request
POST /api/documents/validate-data HTTP/1.1
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body
{
  "templateId": "template_cert_completion",
  "payload": {
    "client": { "name": "Ayesha Khan" },
    "course": { "name": "Design Systems" }
  }
}
Response
{
  "valid": true,
  "requiredPlaceholders": ["client.name", "course.name"],
  "missingFields": []
}
Generate one document
POST/api/documents/generate

Generate one document

Generates one PNG or PDF from a saved template and a payload.

  • output can be png or pdf.
  • If required values are missing, the API returns status 422.
  • Use certificate.fileUrl or certificate.dataUrl depending on your environment.
Request
POST /api/documents/generate HTTP/1.1
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body
{
  "templateId": "template_cert_completion",
  "output": "pdf",
  "payload": {
    "client": {
      "name": "Ayesha Khan",
      "email": "ayesha@example.com"
    },
    "course": { "name": "Design Systems" },
    "certificate": { "issueDate": "2026-06-06" },
    "qrurl": "https://example.com/verify/CERT-1024"
  }
}
Response
{
  "success": true,
  "certificate": {
    "id": "generated_file_id",
    "templateId": "template_cert_completion",
    "outputType": "pdf",
    "fileUrl": "https://cdn.example.com/output.pdf"
  }
}
Generate a multi-template PDF
POST/api/documents/generate

Generate a multi-template PDF

Sends several template and payload pairs in one request and returns one merged PDF document.

  • documents, templates, items, and root arrays are accepted.
  • Multi-template output is PDF only.
  • Each document item gets its own payload.
Request
POST /api/documents/generate HTTP/1.1
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body
{
  "output": "pdf",
  "documents": [
    {
      "templateId": "template_certificate",
      "payload": {
        "client": { "name": "Ayesha Khan" }
      }
    },
    {
      "templateId": "template_transcript",
      "payload": {
        "client": { "name": "Ayesha Khan" }
      }
    }
  ]
}
Response
{
  "success": true,
  "document": {
    "id": "merged_document_id",
    "outputType": "pdf",
    "fileUrl": "https://cdn.example.com/packet.pdf"
  }
}
Generate from rows
POST/api/documents/generate-bulk

Generate from rows

Generates documents from row data. Use it for CSV-style generation where each row becomes one finished file.

  • rows must contain at least one object.
  • Flat CSV-style keys are converted to nested payload data.
  • Larger uploads return progress details for follow-up checks.
Request
POST /api/documents/generate-bulk HTTP/1.1
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body
{
  "templateId": "template_cert_completion",
  "output": "pdf",
  "rows": [
    {
      "client.name": "Ayesha Khan",
      "course.name": "Design Systems"
    },
    {
      "client.name": "Omar Malik",
      "course.name": "Node APIs"
    }
  ]
}
Response
{
  "success": true,
  "queued": false,
  "summary": {
    "total": 2,
    "generated": 2,
    "failed": 0
  },
  "certificates": []
}
Schemas

Common request fields

NameTypeDescription
templateIdstringSaved template ID from the dashboard.
templateobjectInline template object, when not using templateId.
outputpng | pdfOutput format. Defaults to png.
payloadobjectNested values for placeholders.
dataobjectAlias for payload.
rowsobject[]List of flat or nested row objects for bulk generation.
documentsobject[]Template and payload pairs for merged PDF output.
Responses

Response conventions

Successful requests include success: true. Validation issues return clear missing-field details, and generation output is returned on the certificate or document object.