Create template (DOCX)

DOCX templates in ZapSign allow for the automation of documents with dynamic fields, facilitating the generation of contracts, agreements, and other recurring documents. Creating documents from a template is useful for various use cases, such as:

  • Sending a document to the signer to complete a form, and using that information to create the document. Examples include insurance policy applications, informed consent forms, event registrations, and more.

  • Sending the document to the signer partially filled out, allowing them to complete the form and fill in the missing fields. The document will be created, and the signer will proceed with the signing process. Examples include bank account openings and loan applications.

  • Filling in all dynamic fields to create the final document, where the signer only needs to sign it. Examples include employment contracts, promissory notes, and lease agreements.

Creating the Document in Word (DOCX)

Before using the endpoint to create a template in ZapSign, you need to prepare the DOCX file with dynamic fields that will be replaced with specific information during each document generation. Follow these steps:

1. Create the Base Document

  • Use Microsoft Word, Google Docs (exporting to DOCX), or any compatible DOCX editor.

  • Draft the document content, ensuring it is properly structured.

2. Define Dynamic Fields

  • Dynamic fields are represented with double curly braces {{field}} within the document.

  • Example: {{name}}, {{date}}, {{email}}.

3. Avoid Images and Tables

  • We recommend avoiding images and tables in the DOCX document, as they may interfere with the proper functionality.

4. Save and Export

  • Save the file in .docx format.

  • Verify that the dynamic fields are correctly written and placed.

Once the DOCX document is prepared, you can use the corresponding endpoint to upload the template to ZapSign and start generating documents automatically.

Create DOCX Template

POST https://api.zapsign.com.br/api/v1/templates/create

Headers

Name
Type
Description

Authorization*

string

apiToken ahead of the "Bearer" text.

Ex: Bearer c7f35c84-7893-4087-b4fb-d1f06c23

Request Body

Name
Type
Description

name

string

Title of the document. String of up to 255 characters

url_docx

string

Public URL of the document (maximum file size: 10MB).

base64_docx

string

Document converted to a Base64 string.

lang

string

Document language. Possible values: "pt-br" (Portuguese), "es" (Spanish), "en" (English), "fr" (French). Default: "pt-br"

observers

array<string>

Represents document observers (limit 20), i.e. email addresses that will be notified upon completion of the signature flow. It's an array of strings.

first_signer

object

Document signer configuration

  • blank_email (boolean): If set to true, the signer's email will not be requested and will not be included in the signature report. It is mandatory to have either the email or the phone number of the signer. Default: false.

  • blank_phone (boolean): If set to true, the signer's phone number will not be requested and will not be included in the signature report. It is mandatory to have either the email or the phone number of the signer. Default: false.

  • qualification (string): The signer's role that will be displayed in the signature report. For example, "Witness" will be shown as "Signed as Witness". Default: "".

  • auth_mode (string): Select the authentication method for the signer. This adds extra security to the signed document. For more information on authentication methods, click here. Default: "assinaturaTela".

auth_mode
Description
Additional cost

"assinaturaTela"

On-screen signature

Free

"tokenEmail"

Email token

Free

"assinaturaTela-tokenEmail"

On-screen signature and email token

Free

"tokenSms"

SMS token

Free

"assinaturaTela-tokenSms"

On-screen signature and SMS token

Free

"tokenWhatsapp"

WhatsApp token

5 credits = USD$0.1

"assinaturaTela-tokenWhatsapp"

On-screen signature and WhatsApp token

5 credits = USD$0.1

  • require_selfie_photo (boolean): If set to true, the signer will be asked to take a selfie during the signing process (no photo validation is performed). Default: false.

  • require_document_photo (boolean): If set to true, the signer will be asked to take a photo of the front and back of their identity document during the signing process (no photo validation is performed). Default: false.

  • selfie_validation_type (string): Advanced biometric methods to validate the signer's identity. To learn more about each method, click here.

Selfie_validation_type
Description
Countries
Price per validation

liveness-document-match

Facial recognition that requires the signer to upload a photo of their identity document and record their face. It validates that the person is the same as in the document and that the person is present at the time of sign

CO, BR, MX, CL, PE

25 credits = $0.5 USD

identity-verification

Document validation and facial biometrics. It validates that the person is present at the time of signing, that the document is real, that the person is the same as in the document, and that the document is registered in government databases.

CO, MX, CL, PE

55 credits = $1.0 USD

identity-verification-global

Document validation and facial biometrics, ensuring that the signer is present, the document is authentic (using fraud detection models), and the name extracted from the document matches the signer's name. Note: it does not include validation against government databases.

Global

50 credits = $0.9 USD

Request

{
    "name": "Template Name",
    "docx_url": "https://zapsign.s3.amazonaws.com/dev/2025/1/docs/1b1e8e16-b9ce-45f4-8dc8-c0320af371a5/29812f55-eb17-4182-b65e-09e895a861ad.docx",
    "lang": "en",
    "observers": [
        "email@email.com"
    ],
    "first_signer": {
        "blank_email": false,
        "blank_phone": false,
        "auth_mode": "assinaturaTela",
        "require_selfie_photo": false,
        "require_document_photo": false,
        "selfie_validation_type": "",
        "qualification": "Witness"
    }
}

Response

{
    "token": "272xxxd4-ecda-47xx2-be7e-59e2beb752xx",
    "template_type": "docx",
    "name": "Template name",
    "active": true,
    "template_file": "https://zapsign.s3.amazonaws.com/dev/2025/1/api/45f39edb-c78d-42e4-a450-22cd7c62d656.docx?AWSAccessKeyId=AKIASUFZJ7JCTI2ZRGWX&Signature=v8haa5obmuOzV88e3naQDXnPVr8%3D&Expires=1738258954",
    "created_at": "2025-01-30T16:42:34.703412Z",
    "last_update_at": "2025-01-30T16:42:34.741300Z",
    "redirect_link": "",
    "folder_path": "/",
    "lang": "en",
    "signers": [
        {
            "name": "First signer",
            "auth_mode": "assinaturaTela",
            "email": "",
            "phone_country": "1",
            "phone_number": "",
            "lock_name": true,
            "lock_phone": false,
            "lock_email": false,
            "hide_phone": false,
            "blank_phone": false,
            "hide_email": false,
            "blank_email": true,
            "require_selfie_photo": false,
            "require_document_photo": false,
            "selfie_validation_type": "none",
            "qualification": "Witness"
        }
    ],
    "inputs": [
        {
            "variable": "{{name}}",
            "input_type": "input",
            "label": "name",
            "help_text": "",
            "options": "",
            "required": true,
            "order": 1
        },
        {
            "variable": "{{email}}",
            "input_type": "input",
            "label": "email",
            "help_text": "",
            "options": "",
            "required": true,
            "order": 2
        },
        {
            "variable": "{{document}}",
            "input_type": "input",
            "label": "document",
            "help_text": "",
            "options": "",
            "required": true,
            "order": 3
        },
        {
            "variable": "{{address}}",
            "input_type": "input",
            "label": "address",
            "help_text": "",
            "options": "",
            "required": true,
            "order": 4
        }
    ],
    "extra_templates": [],
    "notify_extra_emails": "email@email.com",
    "custom_intro": "",
    "youtube_video_code": ""
}

Next Steps

  • If the signer needs to complete dynamic fields in the form during signing, you must configure the form using the "Template Form Configuration" endpoint.

To create documents from this template, go to the "Create Document via Template" section.

About Base64

Base64 is a simple way to convert files into text. If you want to learn more about what Base64 is, you can check out the full definition here. Converting a file to Base64 and sending it as text in the request body makes it easier to handle compared to formats like multipart/form-data.

To test the API, you can manually convert your DOCX file to Base64 using various online tools, such as this one.

Once the API is integrated into your system, look for the appropriate function in your programming language to convert files to Base64.

Important: you must send the base64_pdf parameter only with the base64 file conversion. Dont send the data:application/pdf;base64, on your parameter.

Last updated

Was this helpful?