Developer's guide
Request Content Types
Request Content Types HTTP Requests must be sent with one of the following content types: application/json multipart/form-data application/octet-stream application/json File data must be encoded with Base64 encoding, provided as a URL or uploaded File ID. DOC to PDF exampleFew readersAuthentication
ConvertAPI Authentication Methods ConvertAPI supports URL Parameters and Bearer Authentication for stateless authentication. Overview URL Parameters Authentication Authenticate by including your secret key or token as a URL parameter: Using SecretFew readersUser information API
The endpoint returns information about a user account. It is helpful to check the account balance status and other data. The /user endpoint can be authenticated only with a secret. The token is not accepted. User information request exampleFew readersResponse Status Codes
The example response body of authentication failure: Response Header Response body Result 200 OK Conversion completed succesFew readersResponse Content Types
Response Content Types Response headers and body contain this information: ConversionTime - time in seconds that took to convert the file. This amount of seconds will be deducted from your balance after the conversion. FileName - name of the converted file. FileSize - converted file size in bytes. FileData - converted file content. FileUrl - link to a converted file if StoreFile parameter was set to true. application/json Single file result exampleFew readers
Best practices
Conversion Workflows
Converted files that are stored on the convertapi.com server can be accessed for further conversion operations. This method allows conversion workflows without increased network load. Example: conversion PDF to JPG produces as many files as there are pages in PDF file. If these files are stored on the serveFew readersFile upload
When source files must be converted multiple times, conversion performance can be increased by uploading files once and converting it multiple times without uploading it again. The uploaded file will be stored in convertapi.com server for maximum period of 3 hours and will be accessible by secret URL with UUID. In conversion request file can be referred by the File ID, which will be returned after a successful file upload. Another benefit of the uploaded file is that conversion requests can be fFew readersConverter Information API
It is possible to get an information about all supported conversions and formats with parameter descriptions in JSON or XML formats. Using this endpoint you can create a dynamic document converter. Visual representation of the structure can be found here: https://www.convertapi.com/docx-to-pdf. This page and the whole https://www.convertapi.com/conversions sectFew readersAsynchronous Conversions
Asynchronous file conversions are made by setting the /async path prefix. The response of the asynchronous conversion contains the JobId parameter, which can be used to get the conversion result. Optionally, you can subscribe to a WebHook with your specified URL that will be called after the successful conversion. Asynchronous conversion request Optionally, it iFew readersVirtual File Server
ConvertAPI can be used as a virtual file server for all your files or web pages that need to be converted. The file is being converted on-demand whenever user clicks on the link. The result can be displayed in a web browser or downloaded. Parameter "download" The download parameter is mandatory and must be set in order to get the file as a request result. download=inline - conversion result will be displayed in a browser download=attachment - conversion result will be downloadFew readers
Tips & Tricks
Web to PDF Header and footer images and fonts
In this brief article, we will describe how to use web to pdf converter's header and footer parameters to include images and custom fonts. Adding an image to the PDF header Converter's parameter header and footer accepts a string with the HTML source code. Unfortunately, it is impossible to use any remote assets (images, fonts, etc..). HTML string should contain all the assets as a data URI. Here isFew readersConversion using JSON format
DOCX conversion to PDF using JSON format example:Few readersConversion using just the URL
When files or web pages are accessible from the Internet it is enough to open a link to convert them. Conversion web url to PDF example DOCX conversion to PDF exampleFew readersView file in a browser
If ?download=inline is appended to a stored conversion result file download link, the file will be viewed in browser rather than downloaded.Few readers
Infrastructure
Servers Location
ConvertAPI instances are hosted by IBM Cloud in GEO locations listed below and Rest API requests are routed automatically to the nearest data center. Europe's Rest API instance complies with GDPR. Please find the regions listed below and contact us to set up ConvertAPI in your GEO location. Check DNS resolution Servers Location (https://storage.crisp.chaFew readersArchitecture Schema
ConvertAPI system architecture diagram represents our service structure at a high level. It depicts how our system interacts between clients, file servers and service workers.Few readers