Attachment fields

Attachment field - a type of field that contains an attached file.

To add an Attachment field to a document, make a PUT /document/.../{document_id} request, open fields array in the request body, add a field and specify its "type" parameter as "attachment".

Request body to add an Attachment field
{
  "fields": [
    {
      "page_number": 0,
      "type": "attachment",
      "name": "AttachmentName",
      "role": "Signer 1",
      "label": "AttachmentLabel",
      "required": true,
      "height": 40,
      "width": 35,
      "x": 70,
      "y": 350
    }
  ]
}

Here’s a response example when an Attachment field has been added to the document*.

*In this example we show the response to a GET .../document/{document_id} request. The response to a PUT .../document/{document_id} is only a document ID, e.g. "id": "3db38d8c1fdfca762b25d57d82b3cf327a65485e".

{
  "attachments": [],
  "fields": [
    {
      "id": "98e9a9e470834b16a81d51f7d260849dea79b789",
      "type": "attachment",
      "role_id": "ed1fe6496119438081b464f15e47557837626908",
      "json_attributes": {
        "page_number": 0,
        "x": 70,
        "y": 350,
        "width": 35,
        "height": 40,
        "required": true,
        "name": "AttachmentName",
        "label": "AttachmentLabel"
      },
      "role": "Signer 1",
      "originator": "document_owner@signnow.com",
      "fulfiller": "signer1@gmail.com",
      "field_request_id": "783262096c88498c9b118a8fe860761eb10986e4",
      "element_id": null,
      "field_request_canceled": null,
      "template_field_id": null,
      "field_id": "783262096c88498c9b118a8fe860761eb10986e4"
    }
  ]
}

The Signer gets the opportunity to upload files and attach them to the field. In a JSON response when the files have been attached, the API user gets the attachment ID which can later be used to download the attachments.

The attachment ID value is stored in the "id" parameter of the "attachments" array and the "element_id" parameter of the "fields" array.

{
  "attachments": [
    {
      "id": "31581a46edf1c1a160d125f2f501a9bfb7970323",  // equals the "element_id" in the "fields" array
      "user_id": "a954c1e8a45ff6bb0d233d8ac160bd4e3271ca94",
      "page_number": "0",
      "width": "131",
      "height": "22",
      "x": "639",
      "y": "388",
      "line_height": "145.00",
      "created": "1581419101",
      "original_attachment_name": "repository-open-graph-template.png",
      "filename": "40a594f2c3e4dd09735ed2f46fdbe7f6d2c39eaf.png",
      "file_type": "0",
      "mime_type": "png",
      "file_size": "51470",
      "json_attributes": {
        "scan_determination": "Unsupported file format"
      }
    }
  ],
  "fields": [
    {
      "id": "98e9a9e470834b16a81d51f7d260849dea79b789",
      "type": "attachment",
      "role_id": "ed1fe6496119438081b464f15e47557837626908",
      "json_attributes": {
        "page_number": 0,
        "x": 70,
        "y": 350,
        "width": 35,
        "height": 40,
        "required": true,
        "name": "AttachmentName",
        "label": "AttachmentLabel"
      },
      "role": "Signer 1",
      "originator": "document_owner@signnow.com",
      "fulfiller": "signer1@gmail.com",
      "field_request_id": "783262096c88498c9b118a8fe860761eb10986e4",
      "element_id": "31581a46edf1c1a160d125f2f501a9bfb7970323",  // contains the attachment.id
      "field_request_canceled": null,
      "template_field_id": null,
      "field_id": "783262096c88498c9b118a8fe860761eb10986e4"
    }
  ]
}