Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
July 19, 2023 20:25
August 23, 2020 11:34
July 19, 2023 20:21
September 12, 2022 23:30
August 17, 2018 21:13
August 17, 2018 21:13
December 4, 2019 13:00
August 17, 2018 21:13

ConvertAPI Python Client

PyPI version Build Status License: MIT

Convert your files with our online file conversion API

ConvertAPI helps to convert various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files and many other manipulations. You can integrate it into your application in just a few minutes and use it easily.


Install with pip:

pip install --upgrade convertapi

Install from source with:

python install


  • Python 3.3+



You can get your secret at

import convertapi

convertapi.api_secret = 'your-api-secret'

Proxy configuration

If you need to use a proxy, you can specify it using HTTPS_PROXY environment variable when running your script.


CONVERT_API_SECRET=secret HTTPS_PROXY=https://user:pass@ python

File conversion

Convert a file to PDF example. All supported file formats and options can be found here.

result = convertapi.convert('pdf', { 'File': '/path/to/my_file.docx' })

# save to file'/path/to/save/file.pdf')

Other result operations:

# save all result files to folder

# get conversion cost
conversion_cost = result.conversion_cost

Convert file url

result = convertapi.convert('pdf', { 'File': 'https://website/my_file.docx' })

Specifying from format

result = convertapi.convert(
    { 'File': '/path/to/my_file' },
    from_format = 'docx'

Additional conversion parameters

ConvertAPI accepts additional conversion parameters depending on selected formats. All conversion parameters and explanations can be found here.

result = convertapi.convert(
        'File': '/path/to/my_file.docx',
        'PageRange': '1-10',
        'PdfResolution': '150',

User information

You can always check your remaining seconds amount programatically by fetching user information.

user_info = convertapi.user()


Alternative domain

Set base_uri parameter to use other service domains. Dedicated to the region domain list.

convertapi.base_uri = ''

More examples

Find more advanced examples in the /examples folder.


Execute CONVERT_API_SECRET=your_secret nosetests --nocapture to run the tests.


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


The gem is available as open source under the terms of the MIT License.