Convert a document
Changed onConvert your documents to 100+ formats, including PDF, ODT, DOCX, JPG, PNG, Markdown, CSV, ODS, XLSX, CSV, ODP, PPTX, XML, HTML, TXT, IDML, and many more. See the full conversion matrix for all supported input/output format combinations.
Two workflows are available for document conversion:
- Inline (base64): Send the document as a base64-encoded string in the request body field named "template". Use the special endpoint POST /render/template?download=true. No prior upload is needed.
- Pre-uploaded template: Upload the document once with POST /template, then convert it on demand using its templateId or versionId via POST /render/{templateId-or-versionId}?download=true.
Converters: set the converter field to L (LibreOffice, default), I (Carbone ICE, the fastest for DOCX/ODT to PDF), C (Chromium, for HTML) or O (OnlyOffice). See the converter field below and the converters documentation.
Notes:
- Set the download query parameter to true to receive the converted file as a direct stream, or false (default) to receive a renderId for a separate GET /render/{renderId} download call.
- For large files, set the carbone-webhook-url header: Carbone processes the conversion in the background and POSTs the result to your server when done.
Request
- Base URLhttps://api.carbone.io
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Query parameters
Controls how the document is returned.
- true: returns the document directly as a file stream (the Content-Type reflects the output format). The file is not stored on Carbone servers and no renderId is issued, so there is no need to call GET /render/{renderId}.
- false: returns a JSON object with a renderId; use GET /render/{renderId} to download the file in a second call.
Headers
Carbone API major version to use. Only a major version can be specified: it automatically includes all future minor versions and patches.
- 5: latest version, recommended.
- 4: default when the header is not provided.
- 3: legacy.
- staging: not intended for production environments.
It is strongly recommended to always set this header explicitly to avoid unexpected behavior. See API versioning documentation
URL that Carbone calls (HTTP POST) when an asynchronous render or conversion finishes. Providing it enables asynchronous mode, which raises the rendering timeout to 5 minutes.
Custom header forwarded on the webhook call only. It follows the carbone-webhook-header-<name> pattern, where any header <name> can be sent to your webhook (authorization is the most common). For the authorization header, this overrides carbone-egress-header-authorization for webhook calls.
Sets the authorization header Carbone sends on all egress traffic for this render: webhook calls, dynamic image URLs, and files fetched by appendFile. Example: carbone-egress-header-authorization: my-secret makes Carbone send authorization: my-secret on each outbound request. Only the authorization header can be customized, and the value must be shorter than 512 characters. For webhook calls, carbone-webhook-header-authorization overrides this value (webhook only).
Request body
Example request
{
"template": "PCFET0NUWVBFIGh0bWw+...",
"convertTo": "pdf",
"converter": "L",
"timezone": "Europe/Paris",
"lang": "fr-fr",
"complement": {},
"variableStr": "{#def = d.id}",
"reportName": "{d.date}",
"enum": {},
"translations": {
"fr": {
"one": "un"
},
"es": {
"one": "uno"
}
},
"currencySource": "EUR",
"currencyTarget": "USD",
"currencyRates": {
"EUR": 1,
"USD": 1.2
},
"batchSplitBy": "d.items",
"batchOutput": "zip",
"batchReportName": "report-{d.id}",
"preReleaseFeatureIn": 5000000,
"failOn": [
"IMAGE_URL_ERROR"
]
}Response
On success, by default a JSON response containing the renderId is returned. If the query parameter download=true is used, the response body is the converted/generated file stream and the Content-Type reflects the output format.
Example response
{
"data": {
"renderId": "MTAuMjAuMjEuMTAgICAg.pdf"
},
"message": "A render ID will be sent to your callback URL when the document is generated"
}Changes
- breaking
the
carbone-versionrequest header's property undefined was restricted to a list of enum values - breaking
the
headerrequest parametercarbone-versionwas restricted to a list of enum values - breaking
for the
queryrequest parameterdownload, default value was changed fromtruetofalse - breaking
request property
was restricted to a list of enum values - breaking
request property
///was restricted to a list of enum values - breaking
request property
///was restricted to a list of enum values - breaking
request property
///was restricted to a list of enum values - breaking
request property
///was restricted to a list of enum values - breaking
the
///request property type changed fromnumbertointeger - breaking
the
///request property type changed fromnumbertointeger - warning
the
///request property's max was set to100.00 - warning
the
///request property's min was set to0.00 - info
added the new optional
headerrequest parametercarbone-egress-header-authorization - info
added the new optional
headerrequest parametercarbone-webhook-header-authorization - info
added the new optional
headerrequest parametercarbone-webhook-url - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
/// - info
added the new optional request property
- info
added the new optional request property
- info
added the new enum value
3to theheaderrequest parametercarbone-version - info
added the new enum value
4to theheaderrequest parametercarbone-version - info
added the new enum value
5to theheaderrequest parametercarbone-version - info
added the new enum value
stagingto theheaderrequest parametercarbone-version - info
for the
headerrequest parametercarbone-version, the type was generalized fromintegertostring, and format fromint32to no format - info
the request property
became optional - info
the
request property default valuezipwas added - info
the
request property default valueLwas added - info
the
request property default value100was removed - info
added the new
0.00enum value to the request property/// - info
added the new
0.00enum value to the request property/// - info
added the new
0.00enum value to the request property/// - info
added the new
1.00enum value to the request property/// - info
added the new
1.00enum value to the request property/// - info
added the new
1.00enum value to the request property/// - info
added the new
1200.00enum value to the request property/// - info
added the new
15.00enum value to the request property/// - info
added the new
150.00enum value to the request property/// - info
added the new
16.00enum value to the request property/// - info
added the new
17.00enum value to the request property/// - info
added the new
2.00enum value to the request property/// - info
added the new
2.00enum value to the request property/// - info
added the new
2.00enum value to the request property/// - info
added the new
20.00enum value to the request property/// - info
added the new
3.00enum value to the request property/// - info
added the new
3.00enum value to the request property/// - info
added the new
300.00enum value to the request property/// - info
added the new
4.00enum value to the request property/// - info
added the new
4.00enum value to the request property/// - info
added the new
600.00enum value to the request property/// - info
added the new
75.00enum value to the request property/// - info
added the new
Ienum value to the request property - info
added the new
pdfenum value to the request property - info
added the new
zipenum value to the request property - info
request property
list-of-types was widened by adding typesarrayto media typeapplication/json - info
the
/////request property's minLength was decreased from1to0 - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the optional property
to the response with the status
- breaking
- info
endpoint added
- info