Create document via Template

Create document via Template

POST https://api.zapsign.com.br/api/v1/models/create-doc/

This endpoint allows you to create a document using a DOCX Template. You only need to send the data that will replace the dynamic fields in the template in JSON format, and you will receive the response in JSON as well.

Before getting started, you must create the Template on the ZapSign web platform in the Templates section and select the DOCX option (this feature is not available for PDF templates). See the tutorial for creating a dynamic template.

Headers

Name
Type
Description

Authorization*

string

apiToken ahead of the "Bearer" text.

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

Request Body

Name
Type
Description

template_id*

string

Dynamic template's Identifier/token

Ex: https://app.zapsign.co/conta/modelos/{TEMPLATE_ID}

To access yout templates list. just click here: https://app.zapsign.co/conta/modelos/

signer_name*

string

Signer's name. If there is more than one signer on your document, you can add it latter using the Add signer endpoint.

data[]['de']

string

Variable to replace.

Ex: "{{FULL NAME}}"

data[]['para']

string

Value to replace the variable for. Ex: "John Doe"

signer_email

string

Signer's email. If there is more than one signer on your document, you can add it latter using the Add signer endpoint.

signer_phone_country

String

Signer's country code (Ex: 1). If there is more than one signer on your document, you can add it latter using the Add signer endpoint.

signer_phone_number

String

Signer's phone number (Ex: 11999999999). If there is more than one signer on your document, you can add it latter using the Add signer endpoint.

lang

string

Document's language. Possible values:

"pt-br" (portugues)

"es" (spanish)

"en" (english).

Default: "pt-br"

disable_signer_emails

boolean

To deactivate all emails sent to signers, send this parameter as true.

Default: false

brand_logo

string

If you want to use your brand on the signing experience insted of ZapSign's logo, send here your logo's URL (it has to be publicly accesible)

Default: ""

brand_primary_color

string

If you want to use your brand color on the signing experience as the primary button color, send here the rgb or hexadecimal.

Ex: "#0011ee".

Default: ""

brand_name

string

If you want to set the sender name of all email's sent to signers, send here the brand name.

Ex: if "Lorem Lawyers" is sent, the email's sender will be "Lorem Lawyers via ZapSign".

Max-length: 100 caracteres.

Default: ""

external_id

string

This doc ID on your application.

Default: ""

folder_path

string

path of the folder inside ZapSign where the document will be placed. If the folders do not exist, they will be created automatically. Requirements: (1) folder_path can be up to 255 characters long, (2) each folder can be up to 50 characters long, (3) there is a limit of 5 folder levels.

Ex.: "/api/" or "/folder1/folder2/folder3/". Default: "/" (no folder).

created_by

string

email of the user who will be defined as creator of the document, for internal organization purposes. If the email does not exist or is not your account user, this parameter will be ignored.

Default: "" (document will have template owner as creator)

send_automatic_email

boolean

If true, ZapSign will send an email to the signers with the signature link. If false (default), you will have to send this link to your signer.

Attention: for this field to work, you have to set the signer's email as a dynamic field, ex: {{SIGNER EMAIL}}, and this value must be sent along with the replacement values

custom_message

string

(only if send_automatic_email: true).

The custom_message is the message you can add to the signer's email sent by ZapSign.

Ex: "Helo John, \n This is your job contract. \n

The \n its for "breaking lines" on the email's text.

Default: ""

signer_has_incomplete_fields

bolean

If set to true, the signer will be redirected to fill out the template form before signing the document.

Default: false

reminder_every_n_days

integer

Represents the interval of days between reminders that will be sent to signers, as long as they don`t sign. There will be 3 tries at most. Observation: this field must only be filled if send_automatic_whatsapp or send_automatic_email are true. Example: if setted to 8 it will be sent one email every 7 days, until it's signed, for at most 21 days.

allow_refuse_signature

boolean

If true, signers have the option to refuse to sign. Default: false.

disable_signers_get_original_file

boolean

If true, signers do not have the option to download the original document. Default: false.

signature_order_active

boolean

If true, the signer's signatures will be ordered sequentially. Default: false. Always true when signer_has_incomplete_fields = true.

send_automatic_whatsapp

boolean

If true, ZapSign will send a whatsapp message to the signer with the link to sign the document. Note: For this to work, it is mandatory that the signer's phone number is defined. each automatic sending via WhatsApp (tokenWhatsapp) costs 0,1 USD. Buy credits in Configuration > Plan.

send_automatic_whatsapp_signed_file

boolean

If true, ZapSign will send a whatsapp message to the signer with the link to the signed document. Note: For this to work, it is mandatory that the signer's phone number is defined. each automatic sending via WhatsApp (tokenWhatsapp) costs 0,1 USD. Buy credits in Configuration > Plan.

{
    "open_id": 5,
    "token": "eb9c367a-e62f-4992-8360-b0219deaeecc",
    "status": "pending",
    "name": "Employment Contract",
    "original_file": "https://zapsign.s3.amazonaws.com/pdf/62xxxxx-d8fc-4392-8575-f3c46c3cfc7a/df6bac91-2766-4182-8c8b-ded5287e4c0f.pdf",
    "signed_file": null,
    "created_at": "2020-04-16T03:33:46.241747Z",
    "last_update_at": "2020-04-16T03:33:46.241775Z",
    "signers": [
        {
            "token": "921c115d-4a6e-445d-bdca-03fadedbbc0b",
            "sign_url": "https://app.zapsign.com.br/verificar/921c115d-4a6e-445d-bdca-03fadedbbc0b",
            "status": "new",
            "name": "João da Silva",
            "email": "",
            "phone_country": "",
            "phone_number": "",
            "times_viewed": 0,
            "last_view_at": null,
            "signed_at": null
        }
    ],
    "answers": [ // list of variables and responses in the dynamic model (if the document was created using a dynamic model).
        {
            "variable": "COMPLETE NAME",
            "value": "Name Test"
        },
        {
            "variable": "FULL ADDRESS",
            "value": "Address Test"
        }
    ]
}

Request

URL for postman Create doc from Template endpoint

Response

After a successfull request, you should get a response like this:

Caution: the original_file and signed_file links are temporary and expires in 60 minutes. In case your system needs to save those links it is recommended that you save them in your own CDN or that you call the Detail document endpoint every time your user needs a valid URL that will expires in more 60 minutes.

{
    "open_id": 5,
    "token": "eb9c367a-e62f-4992-8360-b0219deaeecc",
    "status": "pending",
    "name": "Job contract",
    "original_file": "https://zapsign.s3.amazonaws.com/pdf/62xxxxx-d8fc-4392-8575-f3c46c3cfc7a/df6bac91-2766-4182-8c8b-ded5287e4c0f.pdf",
    "signed_file": null,
    "created_at": "2020-04-16T03:33:46.241747Z",
    "last_update_at": "2020-04-16T03:33:46.241775Z",
    "signers": [
        {
            "token": "921c115d-4a6e-445d-bdca-03fadedbbc0b",
            "sign_url": "https://app.zapsign.co/verificar/921c115d-4a6e-445d-bdca-03fadedbbc0b",
            "status": "new",
            "name": "John Doe",
            "email": "",
            "phone_country": "",
            "phone_number": "",
            "times_viewed": 0,
            "last_view_at": null,
            "signed_at": null,
            "resend_attempts": null
        }
    ],
    "answers": [
        {
            "variable": "FULL NAME",
            "value": "Foo bar"
        },
        {
            "variable": "SOCIAL SECURITY NUMBER",
            "value": "999-99-XXXX"
        },
        {
            "variable": "FULL ADDRESS",
            "value": "2989 Heller Crossing Apt. 023 - Springfield, NY / 13347"
        }
    ]
}

What you should do with this response is send the signature link to the signer through your application.

The signature link consists of the route: https://app.zapsign.co/verificar/{signer_token}

Thus, in the example above, where we have one signer, you must send the following signature link: - https://app.zapsign.co/verificar/921c115d-4a6e-445d-bdca-03fadedbbc0b And now just wait for your signer to sign!

More than one signer?

If you want to add more signers, use the "Add Signer" endpoint, receive the new signer's token and send the signature link as explained above.

How to create a Dynamic Template at ZapSign

Enter our help center and check the step-by-step:

Chat with Gepeto!

Have any questions? Use our artificial intelligence trained with all the API documentation. =)

Last updated