Skip to main content
SignatureAPI can generate a document from a static DOCX template combined with dynamic data you provide. Use this to create personalized documents without editing files manually before each send.
To add signature fields or display dynamic values like a recipient’s name, see Places.

How it works

Create a DOCX file and embed fields and conditionals using double curly braces: {{key}}. When you create an envelope, provide the data in the data property of the document. SignatureAPI merges the template with your data and produces the final document. Provide the template URL in the url property and set format to docx.
// POST https://api.signatureapi.com/v1/envelopes
// X-API-Key: key_test_...
// Content-Type: application/json

{
  "title": "Exploration Agreement",
  "documents": [
    {
      "url": "https://www.example.com/agreement-template.docx",
      "format": "docx",
      "data": {
        "person": {
          "name": "Sherlock Holmes",
          "address": "221b Baker Street, London"
        },
        "jurisdiction": "The United Kingdom",
        "mediation": false
      }
    }
  ],
  //...
}
DOCX files created with software other than Microsoft Word (like Google Docs or LibreOffice) may not process correctly. If you get a cannot-parse-document error, open the file in Microsoft Word and save it again. Contact support if you don’t have Microsoft Word.
{{double curly braces}} vs [[double brackets]]: these serve different purposes:
  • {{field_key}}: Template fields. Inject dynamic content (names, dates, addresses) into the document text before signing. Only available in DOCX documents.
  • [[place_key]]: Place placeholders. Position signature fields, text inputs, checkboxes, and other interactive places. Works in both PDF and DOCX documents. See Place Positioning.
A DOCX document can use both: {{}} to inject content and [[]] to position places.

Fields

Fields mark locations in the template where data is inserted. Use double curly braces to define a field: {{key}}. Template:
This agreement is entered into by {{name}}.
Data:
{
  "name": "Sherlock Holmes"
}
Result:
This agreement is entered into by Sherlock Holmes.

Nested objects

Data values can be nested objects. Use dot notation in the template to reference nested keys. Template:
This agreement is entered into by {{person.name}}, residing at {{person.address.houseNumber}} {{person.address.streetName}}, {{person.address.city}}.
Data:
{
  "person": {
    "name": "Sherlock Holmes",
    "address": {
      "houseNumber": "221b",
      "streetName": "Baker Street",
      "city": "London"
    }
  }
}
Result:
This agreement is entered into by Sherlock Holmes, residing at 221b Baker Street, London.

Conditionals

Conditionals control which sections appear in the final document based on your data.

If

Use {{if condition}} and {{endif}} to show or hide a block of content. Template:
Please read before proceeding.{{if showDisclaimer}}
Information provided is for educational purposes only and should not be considered as professional advice.
{{endif}}
Use at your own discretion.
With "showDisclaimer": true, the disclaimer appears. With "showDisclaimer": false, it is omitted.

If-Else

Use {{if condition}}, {{else}}, and {{endif}} to display one of two blocks based on a condition. Template:
{{if mediation}}
Any dispute shall be resolved by mediation, with each party bearing its own costs.
{{else}}
Any dispute shall be settled by arbitration, and the arbitrator’s decision is final.
{{endif}}
With "mediation": true:
Any dispute shall be resolved by mediation, with each party bearing its own costs.
With "mediation": false:
Any dispute shall be settled by arbitration, and the arbitrator’s decision is final.