Skip to main content

Python REST API wrapper for cloud convert

Project description


This is the official Python SDK v2 for the CloudConvert API v2. For API v1, please use v1 branch of this repository.

Build Status


 pip install cloudconvert

Creating API Client

  import cloudconvert

  cloudconvert.configure(api_key = 'API_KEY', sandbox = False)

Or set the environment variable CLOUDCONVERT_API_KEY and use:

  import cloudconvert


Creating Jobs

 import cloudconvert

 cloudconvert.configure(api_key = 'API_KEY')

     "tasks": {
         'import-my-file': {
              'operation': 'import/url',
              'url': 'https://my-url'
         'convert-my-file': {
             'operation': 'convert',
             'input': 'import-my-file',
             'output_format': 'pdf',
             'some_other_option': 'value'
         'export-my-file': {
             'operation': 'export/url',
             'input': 'convert-my-file'

Downloading Files

CloudConvert can generate public URLs for using export/url tasks. You can use these URLs to download output files.

exported_url_task_id = "84e872fc-d823-4363-baab-eade2e05ee54"
res = cloudconvert.Task.wait(id=exported_url_task_id) # Wait for job completion
file = res.get("result").get("files")[0]
res =['filename'], url=file['url'])

Uploading Files

Uploads to CloudConvert are done via import/upload tasks (see the docs). This SDK offers a convenient upload method:

job = cloudconvert.Job.create(payload={
    'tasks': {
        'upload-my-file': {
            'operation': 'import/upload'

upload_task_id = job['tasks'][0]['id']

upload_task = cloudconvert.Task.find(id=upload_task_id)
res = cloudconvert.Task.upload(file_name='path/to/sample.pdf', task=upload_task)

res = cloudconvert.Task.find(id=upload_task_id)

Webhook Signing

The node SDK allows to verify webhook requests received from CloudConvert.

payloadString = '...'; # The JSON string from the raw request body.
signature = '...'; # The value of the "CloudConvert-Signature" header.
signingSecret = '...'; # You can find it in your webhook settings.

isValid = cloudconvert.Webhook.verify(payloadString, signature, signingSecret); # returns true or false

Unit Tests

# Run Task tests
$ python tests/unit/

# Run Job tests
$ python tests/unit/

# Run Webhook tests
$ python tests/unit/

Integration Tests

# Run Integration test for task
$ python tests/integration/ 

# Run Integration test for Job
$ python tests/integration/ 


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudconvert-2.0.0.tar.gz (13.9 kB view hashes)

Uploaded source

Built Distribution

cloudconvert-2.0.0-py3-none-any.whl (19.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page