Skip to content
DocsMenu

Create a file

View as Markdown

Open this page inChatGPTClaudeCursor

In the Esign Comply API, POST /v1/files starts a file upload by declaring the name, size and SHA-256, and returns the file ID with an upload URL. Call it from your server before you PUT the bytes and reference the file in a supplement.

POST /v1/files · API version 2026-11-21

Authentication

Send a secret key in the Authorization header: Bearer $ESIGNCOMPLY_API_KEY. The key needs full_access or recording_access permission. Test keys and live keys both work, and each reads and writes the objects of its own environment. Call it from your server: a secret key never goes to a browser. Keys and permissions are described under Authentication.

Request example

cURL

curl https://esigncomply.com/v1/files \
  -H "Authorization: Bearer $ESIGNCOMPLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "renewal-notice.eml",
    "size": 237,
    "content_type": "message/rfc822",
    "sha256": "f96e3ce7bb168d8bfb92cacceece9d9f778e27e04118e2fb90d9436e704100cb"
  }'

This request ran against the API on November 26, 2026, and the response below is what came back. IDs are example values, and long values are shortened with ....

What it does

Text and JSON travel in the supplement call. Files go from your server straight to storage in three steps:

  1. POST /v1/files with the name, size and SHA-256 of the file. The response carries id and an upload_url on a path used only for that file. The URL is valid for 2 hours.
  2. PUT the bytes to upload_url. An upload never overwrites an existing object.
  3. Reference the file ID in files on POST /v1/supplements. Esign Comply reads the stored object, recomputes the hash and copies the file to write-once storage. A file is sealed when a supplement references it. A file not referenced within 7 days is deleted.

Parameters

Body fields

Field Type Required Description
name string Yes File name, up to 255 characters. Executable extensions are refused.
size integer Yes Size in bytes. Must equal the bytes you upload.
content_type string No Media type, stored as sent.
sha256 string Yes SHA-256 of the bytes in lower-case hexadecimal, with or without the sha256: prefix.

For a file larger than 6 MB the response also carries resumable_url and resumable_chunk_bytes (6 MB chunks). esc.files.upload() in the Node SDK performs all three steps, including chunked uploads.

Headers: Idempotency-Key (optional, up to 255 characters) and Esign-Comply-Version (optional, a dated API version). See API conventions.

Response

201 Created with a File object.

{
  "object": "file",
  "id": "fil_dZ8g",
  "livemode": false,
  "name": "renewal-notice.eml",
  "content_type": "message/rfc822",
  "size": 237,
  "sha256": "sha256:f96e3ce7...",
  "status": "pending",
  "supplement": null,
  "created_at": "2026-11-26T00:16:53.772Z",
  "upload_url": "https://storage.example/storage/v1/object/upload/sign/customer_material/dom_4Kx9/test/fil_dZ8g?token=eyJhbG...",
  "upload_method": "PUT",
  "upload_expires_in": 7200
}

Response fields

Field Type Description
object string
id string
livemode boolean
name string
content_type string
size integer
sha256 string
status string
reject_reason string
supplement string
created_at datetime
upload_url string
upload_method string
upload_expires_in integer
resumable_url string

Errors

Code HTTP When
invalid_request 400 The request is malformed: the body is not valid JSON, a known field has the wrong type, a required field is missing, a value is out of range, or a limit was passed (for example metadata over 50 keys, context.extra over 16 KB, event data over 256 KB, an Idempotency-Key over 255 characters, an unknown Esign-Comply-Version).
file_type_refused 422 The name has an executable extension.
file_too_large 422 size exceeds the plan's file limit.
storage_limit_reached 402 The storage allowance is used up. Text and JSON supplements are still accepted, so a report is never lost for lack of file storage.

Like every call made with a secret key, it can also return missing_api_key, invalid_api_key, domain_not_verified, insufficient_permission, idempotency_conflict, region_mismatch, rate_limit_exceeded and internal_error.

Every error has the same body: error.type, error.code, error.message, error.doc_url and error.request_id. See Errors.

Questions about POST /v1/files

Which credential does POST /v1/files need?

A secret key with full_access or recording_access permission. Send it as a Bearer token in the Authorization header, from your server only. A session client token is refused with insufficient_permission.

Does POST /v1/files work with a test key?

Yes. It works with test keys and live keys. A test key reads and writes test objects only, and a live key works once the domain is verified.

Does POST /v1/files count as a signature event?

No. A signature event is counted when a live record is written, by completing a session or by submitting a deferred acceptance. This call writes no record.

Is POST /v1/files idempotent?

Yes, with an Idempotency-Key header of up to 255 characters. A repeat with the same key and the same bytes in the body returns the original response, with the header Idempotent-Replayed: true. The same key with a different body answers 409 idempotency_conflict.

What is the rate limit for POST /v1/files?

The limit is counted for each key and depends on the plan: 2 requests per second on Free, 10 on Starter, 50 on Unlimited and 100 on Enterprise. Past the limit the API answers 429 rate_limit_exceeded with a Retry-After header.

Does the Node SDK have a method for POST /v1/files?

No. Call it over HTTP, or with esc.request() in the esigncomply package, which sends the key and returns { data, error }.

Last updated · API version 2026-11-21