Uploading Files

You can attach files to a request while you create it. Send the same POST /v2/forms/{formId}/requests call as a
multipart/form-data body instead of JSON, and the files are uploaded and stored alongside the prefilled answers in one step.

It is all-or-nothing: if any file fails, the whole request is rolled back and every file already uploaded is removed. You never end up with a half-created request.

This is the only way to put a value into a FILE field up front. FILE fields cannot be prefilled through the JSON body.

Upload files with a request

POST /v2/forms/{formId}/requests
Content-Type: multipart/form-data

The body is a sequence of parts. The first part is
request and carries the same JSON body you would send for a fileless request. After it, send two parts per file, in this
order
:

PartTypeDescription
file_infoJSONWhere the file goes and what it is (see below).
the filebinaryThe file content.

The file_info part

{
    "formVersion": "1",
    "sectionSlug": "documents",
    "sectionInstanceIndex": 0,
    "fieldName": "id_scan",
    "fileName": "passport.pdf",
    "size": 20481
}
PropertyTypeDescription
formVersionstringThe form's active version. Must match, or the request is rejected.
sectionSlugstringThe slug of the section the field lives in.
sectionInstanceIndexintegerWhich instance of the section this file belongs to (0 for a normal section).
fieldNamestringThe FILE field to attach the file to.
fileNamestringThe original filename.
sizeintegerThe file size in bytes.

Rules

  • At most 10 files per request.
  • A FILE field accepts more than one file only if it is multi-entry. A normal file field takes a single file.
  • Filenames must be valid (max 255 characters, no path separators or OS-reserved names).
  • 100 MB per file.
  • If the FILE field is signable, the file must be a PDF. Whether a field is signable is set on the form, not in this request.

Example

Attaching an ID scan to a documents section:

POST /v2/forms/a1b2c3d4-e5f6-7890-abcd-ef1234567890/requests
Authorization: Bearer <your_api_token>
Content-Type: multipart/form-data; boundary=----boundary

------boundary
Content-Disposition: form-data; name="request"
Content-Type: application/json

{ "answers": { "personal": [ { "full_name": { "value": "Jane Smith", "editable": false } } ] } }
------boundary
Content-Disposition: form-data; name="file_info"
Content-Type: application/json

{ "formVersion": "1", "sectionSlug": "documents", "sectionInstanceIndex": 0, "fieldName": "id_scan", "fileName": "passport.pdf", "size": 20481 }
------boundary
Content-Disposition: form-data; name="file"; filename="passport.pdf"
Content-Type: application/pdf

<binary content>
------boundary--

Response

Identical to a fileless request — you get back the requestId, submissionId, and
requestUrl. Retrieve the files later together with the other answers using the requestId (see Submissions).

Errors

StatusWhen
400 Bad RequestWrong part order, unknown or non-file field target, wrong formVersion, more than one file on a non-multi-entry field, invalid filename, or more than 10 files.
404 Not FoundThe form doesn't exist or isn't ACTIVE.