Convert a file
POST /v1/convert
Convert one file and get the result in the response (up to 25 MB).
Send the file as multipart/form-data (a file part) or as the raw body; for a conversion that joins files (merge-pdf, image-to-pdf), send a file part for each, in order, 25 MB in all. Or send its address in a url part instead, and we fetch it as POST /v1/jobs does. The same pipeline as a job: if it hasn’t finished within 30 seconds (or wait), the answer is 202 with the job, which carries on. response=job, or Accept: application/json without response, answers with the job and its download URL instead of the file; response=file answers with the file whatever Accept says. A conversion that makes several files (Split PDF, a PDF’s pages as images, a workbook’s sheets as CSV) always answers with the job, whose outputs list them in order.
API key with the convert scope.
Request
curl -X POST "https://api.formatjet.com/v1/convert?to=pdf" \ -H "Authorization: Bearer $FORMATJET_API_KEY" \ -F file=@report.docx \ -o report.pdfQuery parameters
| Field | Type | Description |
|---|---|---|
conversion | string | |
from | string | |
to | string | |
recipe | string | A recipe’s ID (rcp_…) instead of conversion or to: its steps and output name run on the file |
options | string | The step’s options, as a JSON object. A password is refused here: send it in a multipart options part |
filename | string | The file’s name, for a raw body. Never logged. |
output_filename | string | |
ttl | integer | Seconds the output is kept after completion (default 86400) |
response | string | What a finished conversion answers with: file, or job (the job, with download URLs). Left out, Accept: application/json asks for the job |
wait | integer | Seconds to wait for the conversion before answering 202 with the job, 0 to 30 (the default). Less suits a caller whose own time is short, such as an automation platform's step |
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
multipart/form-data or application/octet-stream
| Field | Type | Description |
|---|---|---|
file | file | The file; one part a file for a conversion that joins files |
url | string | Instead of file: an http or https URL we fetch the file from, held to your plan’s file size rather than 25 MB. Never logged; private addresses, and video and social platforms, are refused Up to 2048 characters. |
options | string | The step’s options as a JSON object, instead of the options query parameter. A password (unlock-pdf) goes only here, never in the URL |
webhook | string | A URL that gets the job’s event when it ends, as POST /v1/jobs’ webhook does: signed with your organization’s job-webhook secret (GET /v1/webhooks/job-secret) Up to 2048 characters. |
metadata | string | A JSON object of up to 20 string values, 2 KB in all, kept with the job and sent in its events: webhook endpoints can be limited to jobs with given values Up to 4096 characters. |
Responses
200 OK
The converted file (Content-Disposition names it), or the job with response=job (or Accept: application/json) or when the conversion made several files
{ "id": "job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "status": "completed", "mode": "live", "conversion": "word-to-pdf", "progress": 100, "steps": [ { "op": "convert", "conversion": "word-to-pdf", "from": "docx", "to": "pdf", "options": {}, "status": "completed", "credits": 2, "units": 1, "engine": "office", "engine_version": "libreoffice-25.8+runner-7" } ], "input": { "upload_id": "up_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "format": "docx", "bytes": 48213, "filename": "report.docx" }, "inputs": [ { "upload_id": "up_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "format": "docx", "bytes": 48213, "filename": "report.docx" } ], "outputs": [ { "id": "file_01JBXA3R2N5P7Q9S1T3V5W7X9Z", "filename": "report.pdf", "bytes": 61874, "mime": "application/pdf", "url": "https://<account>.r2.cloudflarestorage.com/formatjet-files-us/out/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D/file_01JBXA3R2N5P7Q9S1T3V5W7X9Z?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=…", "expires_at": "2026-10-25T10:00:06.000Z", "deleted_at": null } ], "estimate": { "credits": 2, "unit": "file", "units": 1 }, "credits": 2, "engine": "office", "engine_version": "libreoffice-25.8+runner-7", "error": null, "metadata": {}, "created_at": "2026-10-24T10:00:02.000Z", "finished_at": "2026-10-24T10:00:06.000Z", "links": { "self": "https://api.formatjet.com/v1/jobs/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "events": "https://api.formatjet.com/v1/jobs/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D/events" }}202 Accepted
Still converting after 30 s (or wait): the job, which carries on
| Field | Type | Description |
|---|---|---|
id | string | |
status | "created" | "awaiting_upload" | "queued" | "processing" | "completed" | "failed" | "canceled" | awaiting_upload while a URL input is being fetched |
mode | "live" | "test" | |
conversion | string | |
progress | number | |
steps | object[] | Every step in order: each converts what the step before made, and the last makes the output |
steps[].op | "convert" | |
steps[].conversion | string | |
steps[].from | string (a format ID) | |
steps[].to | string (a format ID) | |
steps[].options | object (map) | |
steps[].status | "created" | "awaiting_upload" | "queued" | "processing" | "completed" | "failed" | "canceled" | |
steps[].credits | number | null | What the step costs if the job succeeds; null once the job’s details have expired |
steps[].units | number | null | The pages or minutes the step counted (1 for a step priced per file); null until measured |
steps[].engine | string | null | |
steps[].engine_version | string | null | |
input | object | The file, or the first of inputs |
input.upload_id | string | |
input.format | string (a format ID) | |
input.bytes | number | null | |
input.filename | string | null | |
inputs | object[] | Every input in order, input first: more than one when the job joins files. Empty once the job’s details have expired. |
inputs[].upload_id | string | |
inputs[].format | string (a format ID) | |
inputs[].bytes | number | null | |
inputs[].filename | string | null | |
outputs | object[] | |
outputs[].id | string | |
outputs[].filename | string | null | |
outputs[].bytes | number | |
outputs[].mime | string | |
outputs[].url | string | null | Null once the file is deleted |
outputs[].expires_at | string | null | |
outputs[].deleted_at | string | null | When the file was deleted from storage; null until then |
estimate | object | What the job costs, and what that counts (P3-2) |
estimate.credits | number | What the job costs if it succeeds. A conversion priced per page or minute counts one unit until the file is measured, then what its pages or minutes cost |
estimate.unit | "file" | "page" | "output_minute" | "audio_minute" | What the conversion is priced by |
estimate.units | number | null | Units counted: 1 for a conversion priced per file; the pages to read or started minutes once the file is measured, null until then |
credits | number | Credits charged: only for a job that succeeded |
engine | string | null | |
engine_version | string | null | |
error | object | null | |
error.code | string | |
error.detail | string | |
metadata | object (map) | |
created_at | string | |
finished_at | string | null | |
links | object | |
links.self | string | |
links.events | string |
{ "id": "job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "status": "completed", "mode": "live", "conversion": "word-to-pdf", "progress": 100, "steps": [ { "op": "convert", "conversion": "word-to-pdf", "from": "docx", "to": "pdf", "options": {}, "status": "completed", "credits": 2, "units": 1, "engine": "office", "engine_version": "libreoffice-25.8+runner-7" } ], "input": { "upload_id": "up_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "format": "docx", "bytes": 48213, "filename": "report.docx" }, "inputs": [ { "upload_id": "up_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "format": "docx", "bytes": 48213, "filename": "report.docx" } ], "outputs": [ { "id": "file_01JBXA3R2N5P7Q9S1T3V5W7X9Z", "filename": "report.pdf", "bytes": 61874, "mime": "application/pdf", "url": "https://<account>.r2.cloudflarestorage.com/formatjet-files-us/out/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D/file_01JBXA3R2N5P7Q9S1T3V5W7X9Z?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=…", "expires_at": "2026-10-25T10:00:06.000Z", "deleted_at": null } ], "estimate": { "credits": 2, "unit": "file", "units": 1 }, "credits": 2, "engine": "office", "engine_version": "libreoffice-25.8+runner-7", "error": null, "metadata": {}, "created_at": "2026-10-24T10:00:02.000Z", "finished_at": "2026-10-24T10:00:06.000Z", "links": { "self": "https://api.formatjet.com/v1/jobs/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D", "events": "https://api.formatjet.com/v1/jobs/job_01JBXA3Q6M2T8V4W9Y5Z7B1C3D/events" }}Errors
Problem documents (application/problem+json); see Errors.
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | The query or body is wrong: no conversion named, an empty file, both a file and a url. |
| 401 | unauthorized | No API key, or one that’s unknown or revoked. |
| 402 | insufficient_credits | Not enough credits for the job. |
| 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_largetoo_long | Larger than 25 MB, or than the plan, test mode or the engine takes. More pages or minutes than one job takes on the plan, counted once the file arrives (no charge). |
| 422 | unsupported_conversionunsupported_documentcorrupt_filepassword_protected | A conversion we can’t run for this file. A kind of document the conversion doesn’t take yet, such as a layout it isn’t open to (no charge). A file the engine couldn’t read. A file protected with a password. |
| 429 | rate_limited | Over the rate limit, or as many jobs running as the plan allows: wait Retry-After seconds. |
| 500 | engine_failed | The conversion failed (no charge). |
| 504 | engine_timeout | The engine took too long (no charge). |