# Add attachment (extra document) via Template

## Add attachment via Template

<mark style="color:green;">`POST`</mark> `https://api.zapsign.com.br/api/v1/models/{{original_doc_token}}/upload-extra-doc/`

This endpoint allows you to add attachments to your original document via [**Dynamic Template**](https://clients.zapsign.com.br/en/help/templates)**.** Its possible to add up to 14 extra docs (one at a time, therefore, one request for each attachment), counting the original doc your signer will be able to sign 15 documents at once. You must send all the replacements data in JSON format and will get the response in JSON format as well.

#### Headers

<table><thead><tr><th width="204">Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td>Authorization<mark style="color:red;">*</mark></td><td>string</td><td><p>apiToken ahead of the "Bearer" text. </p><p>Ex: Bearer c7f35c84-7893-4087-b4fb-d1f06c23</p></td></tr></tbody></table>

#### Request Body

<table><thead><tr><th width="193">Name</th><th width="118">Type</th><th>Description</th></tr></thead><tbody><tr><td>template_id<mark style="color:red;">*</mark></td><td>string</td><td><p>Dynamic template's Identifier/token </p><p>Ex: https://app.zapsign.co/conta/modelos/{TEMPLATE_ID}</p><p></p><p>To access yout templates list. just click here:<br><a href="https://app.zapsign.com.br/conta/modelos/">https://app.zapsign.co/conta/modelos/</a></p><p></p><p></p></td></tr><tr><td>data[]['de']</td><td>string</td><td><p>Variable to replace.</p><p>Ex: "{{FULL NAME}}"</p></td></tr><tr><td>data[]['para']</td><td>string</td><td>Value to replace the variable for. Ex: "John Doe"</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK Extra document successfully added." %}

```json
{
    "open_id": 17,
    // use this token in case you want to place signatures in this attachmentSSS
    "token": "50c7d90e-ead6-46b5-99d6-33d2d3b9a31f", 
    "name": "Contract",
    "original_file": "https://zapsign.s3.amazonaws.com/aaa/48025712-b429-4216-8a33-d90c575d0b7f/0e2d0a87-a0f6-4a49-a05f-7a439fd7308e.pdf",
    "signed_file": null
},
```

{% endtab %}

{% tab title="400: Bad Request Required fields are not present in the payload" %}

{% endtab %}

{% tab title="400: Bad Request Parent doc has already been signed, or is in itself an extra document" %}

{% endtab %}

{% tab title="402: Payment Required Current company doesn't have an API plan" %}

{% endtab %}

{% tab title="403: Forbidden Template has been deleted, is inactive or belongs to another company" %}

{% endtab %}

{% tab title="404: Not Found Specified document or template have not been found " %}

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Obs:** dont mistake the extra document with [the batch sign via API](https://docs.zapsign.com.br/english/signatarios/assinar-em-lote-via-api), because this one is made to sign multiple documents at the same time not to create attachments. They have different use cases.
{% endhint %}

### Request

{% embed url="<https://www.postman.com/zapsign/workspace/zapsign-workspace/request/27495556-750bab98-f46d-4a69-99d8-4d3f230ff77f>" %}

### Response

{% hint style="warning" %}
**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](https://docs.zapsign.com.br/english/documentos/detalhar-documento) endpoint every time your user needs a valid URL that will expires in more 60 minutes.
{% endhint %}

```javascript
{
    "open_id": 17,
    // use this token in case you want to place signatures in this attachment
    "token": "50c7d90e-ead6-46b5-99d6-33d2d3b9a31f", 
    "name": "Contract",
    "original_file": "https://zapsign.s3.amazonaws.com/aaa/48025712-b429-4216-8a33-d90c575d0b7f/0e2d0a87-a0f6-4a49-a05f-7a439fd7308e.pdf",
    "signed_file": null
},
```

### Frequently asked questions

#### Whats an attachment/extra document?

In case you use our web platform, you will notice that is possible to upload multiple PDFs at once to be signed by the same signers:

<figure><img src="https://1401277393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4noMoX5ZGb2-RhWjjf-1703796690%2Fuploads%2FM9fXzN0tnuekFrJkI9H4%2Fimage.png?alt=media&#x26;token=6295c788-011e-4822-9263-bdeacb83c64a" alt=""><figcaption><p>Example of the web application with 3 PDFs in one envelope.</p></figcaption></figure>

That way, when the signer is going to sign the document, she will be see all of them, to sign at once:

<figure><img src="https://1401277393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4noMoX5ZGb2-RhWjjf-1703796690%2Fuploads%2FvwNqxS0BPMGYUbZfR9Fz%2Fimage.png?alt=media&#x26;token=18897b64-abc1-442b-8ad0-f68a8a2f11cd" alt=""><figcaption></figcaption></figure>

**The original document will be the number 1** and the **attachments will appear to the signer as the documents number 2,3, etc**. Doing a GET request on the original document, the attachments will be on the **"extra\_docs"** paramenter.

**Can i place signatures on an attachment?**\
Yes! Just send yout attachment token on the [endpoint for placing signatures](https://docs.zapsign.com.br/english/documentos/opcional-posicionar-assinaturas)

**I've added attachment by mistake. Can i delete it?**\
No. For now, it's impossible to remove attachments after added. You can [delete de document](https://docs.zapsign.com.br/english/documentos/excluir-documento) and [re-create it](https://docs.zapsign.com.br/english/documentos/criar-documento).
