Skip to content

Make an upload

POST /v1/uploads

Make an upload: a presigned URL to PUT a file to.

For files you send from where your code runs. PUT the bytes to url with headers, then name the upload’s id in a job’s input (or inputs). An upload makes one job; one that isn’t used is deleted 60 minutes after it arrives.

API key with the convert scope.

Request

Terminal window
curl -X POST "https://api.formatjet.com/v1/uploads" \
-H "Authorization: Bearer $FORMATJET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"size": 48213,
"filename": "report.docx"
}'

Headers

FieldTypeDescription
Idempotency-KeystringUp to 255 printable ASCII characters, such as a UUID. A repeat of the same request within 24 hours gets the first one’s successful answer again (Idempotent-Replayed: true); the same key with a different request is a 409.

Body

application/json

FieldTypeDescription
size requiredintegerBytes
filenamestringThe file’s name, used to name the output. Never logged. Up to 255 characters.
Example
{
"size": 48213,
"filename": "report.docx"
}

Responses

201 Created

The upload

FieldTypeDescription
idstringName it in a job’s input once the file is PUT
urlstringPUT the file’s bytes here
method"PUT"
headersobject (map)Send these exactly
expires_atstringThe URL works until then
max_bytesnumberThe largest file the key may upload
Example
{
"id": "up_01JBXA3Q6M2T8V4W9Y5Z7B1C3D",
"url": "https://<account>.r2.cloudflarestorage.com/formatjet-files-us/in/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D/file_01JBXA3PZK4M6N8P0Q2R4S6T8V?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=…",
"method": "PUT",
"headers": {
"Content-Type": "application/octet-stream"
},
"expires_at": "2026-10-24T10:15:00.000Z",
"max_bytes": 104857600
}

Errors

Problem documents (application/problem+json); see Errors.

StatusCodeWhen
400invalid_requestThe body failed validation.
401unauthorizedNo API key, or one that’s unknown or revoked.
403forbiddenThe key lacks the convert scope, or the plan has no API.
409idempotency_conflictThe Idempotency-Key was used for a different request in the last 24 hours, or its first request is still running.
413file_too_largeLarger than the plan (or test mode) allows.
429rate_limitedMore requests than the plan allows in 10 seconds: wait Retry-After seconds.