Skip to main content

Create a Template via API Key: POST /createNewTemplate

Use this API to create a reusable template from a PDF. Optionally include recipients to immediately instantiate a document and send notifications.

Endpoint and Auth

  • Method: POST
  • Path: /createNewTemplate
  • Auth: Header x-api-key: YOUR_API_KEY
  • Content-Type: multipart/form-data

Multipart form fields

  • Required
    • document (file, binary): The template PDF or DOCX file to upload (Note: You can upload a DOCX file, it will be converted to a PDF).
    • templateName (string): A human-readable name for the template.
    • fields (JSON string): Array of arrays representing fields grouped by recipient index.
      • Each inner array corresponds to a recipient’s field group.
      • Field object shape:
        • id (string): Stable ID for the field (e.g., sig-1).
        • x (number), y (number): Position on the page.
        • page (integer): 1-based page index.
        • type (string): e.g., Signature, Text.
        • recipient (integer): Group index this field belongs to.
  • Optional
    • recipients (JSON string): If provided, the server immediately creates a document instance from the template and notifies these recipients.
      • Array of objects { name: string, email: string, phone?: string }
    • autoReleaseSignatures (boolean): Defaults to true if omitted; auto-finalize when all signatures are collected.

Important notes

  • Do NOT manually set the Content-Type header for multipart; let your HTTP client set the boundary.
  • fields and recipients must be JSON-encoded strings in the form data.
  • Coordinates (x, y) and page should match your PDF’s coordinate system (page is 1-based).

Example: Node.js to upload PDF

Example: Node.js to upload a DOCX

Example: cURL

Successful responses

  • Template only (no recipients):
  • Template created and document sent (with recipients):

Error responses

  • 400 Bad Request:
    • { "message": "No file uploaded." }
    • { "message": "Template name is required." }
    • { "message": "Invalid fields data." }
    • { "message": "Recipients must be an array." }
  • 401 Unauthorized:
    • { "message": "API key is required." }
    • { "message": "Invalid or expired API key." }
  • 500 Internal Server Error:
    • { "message": "Internal Server Error" }