Documentation menu

URL-Based Conversions

When files or web pages are accessible from the Internet, a single link is enough to convert them - no request body, no SDK. This turns ConvertAPI into a virtual file server for your documents: the source is converted on demand whenever the link is opened, and the result is displayed in the browser or downloaded.

URL-based requests authenticate with the token query parameter, since a plain link cannot carry headers (see Authentication).

The download parameter

The download parameter controls how the browser handles the conversion result:

  • download=inline - the conversion result is displayed in the browser
  • download=attachment - the conversion result is downloaded

It sets the response content-type and content-disposition header values:

Value of "download" parameter content-type content-disposition
not set default not set
attachment application/octet-stream attachment
inline application/octet-stream inline

Converting a web page by URL

[GET/POST]
https://v2.convertapi.com/convert/web/to/pdf?download=inline&token=your_api_token&url=http%3A%2F%2Fexample.com
[response]
PDF file contents displayed in a browser

Converting a document by URL

[GET/POST]
https://v2.convertapi.com/convert/docx/to/pdf?download=inline&token=your_api_token&file=https%3A%2F%2Fexample.com%2Fmy_file.docx
[response]
PDF file contents displayed in a browser

A URL passed as a query parameter must be percentage encoded (e.g. http://example.com should be encoded as http%3A%2F%2Fexample.com).

Embedding conversion links

Conversion links can be embedded directly in your pages, turning any document or web page into an on-demand PDF:

<a href="https://v2.convertapi.com/convert/web/to/pdf?token=your_api_token&download=inline&url=http%3A%2F%2Fexample.com%2F" rel="nofollow">View page as PDF</a>
<a href="https://v2.convertapi.com/convert/web/to/pdf?token=your_api_token&download=attachment&url=http%3A%2F%2Fexample.com%2F" rel="nofollow">Save page as PDF</a>

Viewing stored results in the browser

The same parameter works on stored conversion results: append ?download=inline to a result file download link and the file is viewed in the browser rather than downloaded.

[GET]
https://v2.convertapi.com/d/0ba132ddd698aaeafcf19ec0015e10e0/my_file.pdf?download=inline