Document from a template (API)

Modified on Sat, 3 Oct at 2:51 PM

Instead of a ready-made file, you can create a document from a template — a template stored in Signi with fillable fields. Through the API you then send only the field values, no file.

Templates are a paid extension of the Signi service.

Creating templates

You can create templates in the app in the Template Editor. A template contains the document text with fillable fields — via the API you just insert values into those fields.

How it works

In the JSON instructions, instead of the file field you use template — the template ID and the values of its parameters:

{
    "people": [
        {
            "is_proposer": true,
            "email": "vas@email.cz",
            "contract_role": "sign"
        },
        {
            "is_proposer": false,
            "party_order": 2,
            "email": "protistrana@email.cz",
            "contract_role": "sign",
            "first_name": "Jan",
            "last_name": "Novák",
            "person_type": "legal"
        }
    ],
    "template": {
        "id": 8,
        "parameters": [
            { "id": "11", "value": "Praha" }
        ]
    }
}

The call is then simpler — you only send JSON, no file:

curl -X POST "https://api.signi.com/api/v1/contract/" \
  -H "x-api-key: VAS_API_KLIC" \
  -F "data=@dokument.json;type=application/json"

What party_order is for

A template has predefined contract parties (e.g. the client and the contractor). party_order indicates which template party the person belongs to — the party number. In the example above the counterparty is party no. 2.

You don't need to deal with signature positions — they are set by the template.

A concrete example

Try filling in a Consent to Electronic Communication — download the sample JSON (replace the emails and phone with your own):

{
    "contract_name": "Souhlas s elektronickou komunikací - Test Tester",
    "locale": "cs",
    "state": "pending",
    "settings": {
        "signing_order": "all_at_once",
        "autosign_proposers": "V Praze"
    },
    "people": [
        {
            "is_proposer": true,
            "email": "test@signi.com",
            "contract_role": "sign"
        },
        {
            "is_proposer": false,
            "email": "test+1@signi.com",
            "contract_role": "sign",
            "phone": "603123456",
            "first_name": "Test",
            "last_name": "Tester",
            "person_type": "nature"
        }
    ],
    "template": {
        "id": "2105",
        "parameters": [
            { "id": "101", "name": "Jméno / Název společnosti", "value": "Test Tester" },
            { "id": "102", "name": "Adresa / Místo podnikání", "value": "Testovací 123, 110 00 Praha" },
            { "id": "103", "name": "Datum narození / IČO", "value": "8.8.2006" },
            { "id": "131", "name": "Název", "value": "Ukázková firma s.r.o." },
            { "id": "132", "name": "IČO", "value": "12345678" },
            { "id": "121", "name": "např", "value": "pracovní smlouvy, dohody, mzdové výměry" },
            { "id": "141", "name": "Pro společnost", "value": "Ukázková firma s.r.o." },
            { "id": "142", "name": "IČ", "value": "12345678" },
            { "id": "143", "name": "Sídlo", "value": "Firemní 1, 110 00 Praha" },
            { "id": "151", "name": "Email", "value": "test+1@signi.com" },
            { "id": "152", "name": "Telefon", "value": "603123456" }
        ]
    }
}

Note the fields contract_name (document name), locale (communication language) and settings.autosign_proposers — the proposer signs automatically, only the place of signature is added.

Sending:

curl -X POST "https://api.signi.com/api/v1/contract/" \
  -H "x-api-key: VAS_API_KLIC" \
  -F "data=@vzor-souhlas-el-komunikace.json;type=application/json"

What comes back:

{
    "contract_id": 1234567,
    "state": "pending",
    "notifications": [
        { "email": "vas@email.cz",
          "links": { "contract": "https://app.signi.com/dashboard/workspace/…/documents/1234567" } },
        { "email": "protistrana@email.cz",
          "links": { "contract": "https://app.signi.com/signing/…/received" } }
    ]
}
  • contract_id — the document ID for further calls (status, download).
  • notifications — links for individual people: the proposer to the workspace, the counterparty directly to the signing page. You can show the link to the counterparty right in your own application, so they don't have to wait for an email.

Where to find the template and parameter IDs

The list of the workspace's templates is returned by:

curl -H "x-api-key: VAS_API_KLIC" https://api.signi.com/api/v1/contract/templates
{
    "templates": [
        {
            "id": 123,
            "name": "Souhlas s elektronickou komunikací",
            "parameters": [
                { "id": "101", "type": "con-textarea", "name": "Jméno / Název společnosti", "values": null },
                { "id": "131", "type": "con-options", "name": "Předmět smlouvy", "values": ["první", "druhá"] }
            ]
        }
    ]
}

For each template you see the ID and the list of parameters — the con-options type means a selection from the values in values.

Where to go next

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article