Skip to main content
POST
/
api
/
v1
/
f
/
{form_token}
/
entry_attachments
Prepare an entry-attachment upload
curl --request POST \
  --url https://formhug.ai/api/v1/f/{form_token}/entry_attachments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "field_api_code": "field_3",
  "file_name": "design.pdf",
  "content_type": "application/pdf",
  "file_size": 5242880,
  "dimension_api_code": "col_a"
}
'
{
  "data": {
    "upload_id": "<string>",
    "upload_url": "<string>",
    "expires_at": "2023-11-07T05:31:56Z",
    "field_api_code": "<string>",
    "dimension_api_code": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Personal Access Token prefixed with fh_. Sent as Authorization: Bearer fh_xxx. The scope required by each endpoint is listed in that endpoint's description.

Path Parameters

form_token
string
required

Form token

Body

application/json
field_api_code
string
required

api_code of the target attachment field on this form.

Example:

"field_3"

file_name
string
required

Original file name (with extension).

Example:

"design.pdf"

content_type
string
required

MIME type. Must satisfy the field's media_type configuration and not be in the global blacklist (text/html, text/css, text/javascript, application/x-httpd-php).

Example:

"application/pdf"

file_size
integer
required

File size in bytes. Must be ≤ field.max_size * 1MB.

Example:

5242880

dimension_api_code
string

api_code of the matrix/table dimension when the target field is tabular (e.g. file column inside a table field). Omit for non-tabular attachment fields.

Example:

"col_a"

Response

Init for an attachment field inside a table field (tabular)

data
object
required

Prepare-step response for the 2-step entry-attachment upload. Send the file to upload_url with an HTTP PUT: the raw file bytes as the request body and the Content-Type header set to the value you declared in content_type (it must match). Use upload_url exactly as returned. Then submit the upload_id under the matching attachment field in field_values when creating the entry — the entry-create endpoint registers the attachment. upload_id is a self-describing handle (<form_token>.<field_api_code>[.<dimension_api_code>].<random>).

Last modified on June 2, 2026