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
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
| Field | Type | Description |
|---|---|---|
Idempotency-Key | string | Up 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
| Field | Type | Description |
|---|---|---|
size required | integer | Bytes |
filename | string | The file’s name, used to name the output. Never logged. Up to 255 characters. |
{ "size": 48213, "filename": "report.docx"}Responses
201 Created
The upload
| Field | Type | Description |
|---|---|---|
id | string | Name it in a job’s input once the file is PUT |
url | string | PUT the file’s bytes here |
method | "PUT" | |
headers | object (map) | Send these exactly |
expires_at | string | The URL works until then |
max_bytes | number | The largest file the key may upload |
{ "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.
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | The body failed validation. |
| 401 | unauthorized | No API key, or one that’s unknown or revoked. |
| 403 | forbidden | The key lacks the convert scope, or the plan has no API. |
| 409 | idempotency_conflict | The Idempotency-Key was used for a different request in the last 24 hours, or its first request is still running. |
| 413 | file_too_large | Larger than the plan (or test mode) allows. |
| 429 | rate_limited | More requests than the plan allows in 10 seconds: wait Retry-After seconds. |