Getting started overview

Integrating with the CloudConvert API involves a series of steps designed to get you from account creation to a successful file conversion. This guide outlines the essential process, focusing on obtaining API credentials and executing a basic conversion job. CloudConvert provides a RESTful API for programmatic access to its file conversion services, supporting a range of input and output formats.

The core workflow involves creating an account, generating an API key, and then using this key to authenticate requests to the API. Developers can either make direct HTTP requests or utilize one of the CloudConvert SDKs for specific programming languages to simplify interaction with the API. The platform operates on a credit-based system, where conversion minutes are consumed per task, with a free tier available for initial testing.

This introductory guide focuses on the critical steps to establish connectivity and perform a fundamental conversion. Subsequent development can then explore advanced features such as webhook notifications, custom conversion settings, and batch processing.

Quick reference steps

Step What to do Where
1. Create Account Sign up for a CloudConvert account. CloudConvert registration page
2. Get API Key Generate an API key from your dashboard. CloudConvert API Keys page
3. Set up Environment Choose an SDK or prepare for direct HTTP requests. CloudConvert SDK documentation
4. Make First Request Create a conversion job and process a file. CloudConvert Create a Job documentation
5. Monitor Job Status Check the progress and retrieve the converted file. CloudConvert Get Job Status documentation

Create an account and get keys

Accessing the CloudConvert API requires an active account and an API key for authentication. The process begins by registering on the CloudConvert website.

Account registration

  1. Navigate to the CloudConvert registration page.
  2. Provide a valid email address and create a password.
  3. Complete any required verification steps, such as email confirmation.
  4. Upon successful registration, you will be redirected to your CloudConvert dashboard.

Generating an API key

The API key is a unique identifier used to authenticate your requests. CloudConvert uses Bearer Token authentication, where the API key is included in the Authorization header of your HTTP requests. To generate your key:

  1. From your CloudConvert dashboard, navigate to the API Keys section.
  2. Click the "Create API Key" button.
  3. Give your API key an optional descriptive name (e.g., "Development Key").
  4. The new API key will be displayed. It is important to copy this key immediately, as it may not be fully retrievable later for security reasons. Store this key securely; it grants access to your CloudConvert account and resources.

This API key will be used as a Bearer token in the Authorization header for all authenticated API calls. For example, the header would look like Authorization: Bearer YOUR_API_KEY. This method is a common practice for authenticating API requests with bearer tokens.

Your first request

Once you have an API key, you can make your first request to the CloudConvert API. This example demonstrates how to create a basic conversion job to convert a PDF file to a JPG image using a direct HTTP request. While SDKs abstract much of this, understanding the underlying HTTP request is beneficial.

Prepare your environment

Choose a method for making HTTP requests. For direct interaction, tools like curl or programming language libraries (e.g., Python's requests, Node.js's axios) are suitable. For this example, we'll use curl to illustrate the request structure.

Upload file for conversion

CloudConvert jobs typically involve two main steps: creating the job and then processing the tasks within it. Before you can convert a file, it needs to be accessible by CloudConvert. For simplicity in a first request, you can use a publicly accessible URL or directly upload a file if using an SDK.

For this example, we'll assume a publicly accessible PDF file for conversion. The CloudConvert API works with "jobs" which contain "tasks." A job might involve an import task, a convert task, and an export task.

Create a conversion job

The first step is to create a job that defines the conversion process. This involves specifying the input file and the desired output format. The following curl command creates a job to convert a PDF from a URL to a JPG.

curl -X POST "https://api.cloudconvert.com/v2/jobs" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "tasks": {
         "import-1": {
           "operation": "import/url",
           "url": "https://cdn.cloudconvert.com/assets/downloads/cloudconvert.pdf"
         },
         "convert-1": {
           "operation": "convert",
           "input": "import-1",
           "output_format": "jpg",
           "engine": "imagemagick",
           "quality": 80
         },
         "export-1": {
           "operation": "export/url",
           "input": "convert-1"
         }
       }
     }'

Replace YOUR_API_KEY with the key you generated. This request defines three linked tasks:

  • import-1: Imports the PDF from the specified URL.
  • convert-1: Converts the imported PDF (input: "import-1") to a JPG.
  • export-1: Exports the converted JPG (input: "convert-1") to a temporary URL for download.

The API will respond with a JSON object containing the job details, including a job_id. This job_id is crucial for tracking the conversion status and retrieving the output.

Monitor job status and retrieve output

Conversion jobs run asynchronously. You need to poll the job status using the job_id returned from the previous step.

curl -X GET "https://api.cloudconvert.com/v2/jobs/YOUR_JOB_ID" \
     -H "Authorization: Bearer YOUR_API_KEY"

Continue polling this endpoint until the job's status field indicates finished. Once finished, the response JSON will contain details about the tasks, including an export-1 task with a files array. Each file in this array will have a url property, pointing to the converted file. You can then download this file using a standard HTTP GET request.

For more detailed information on job management and task operations, refer to the CloudConvert Jobs documentation.

Common next steps

After successfully completing your first conversion, consider these common next steps to expand your integration:

  • Explore SDKs: CloudConvert provides SDKs for PHP, Node.js, Python, Ruby, Go, and Java. These SDKs handle authentication, request formatting, and response parsing, simplifying development compared to direct HTTP calls.
  • Handle different input/output sources: Beyond URL imports, explore options for uploading files directly from your application or importing from cloud storage services like S3 or Google Cloud Storage.
  • Implement webhook notifications: Polling for job status can be inefficient. Configure webhooks to receive real-time notifications when a job changes status (e.g., finished or error). This allows your application to react immediately without constant polling.
  • Error handling: Implement robust error handling for API responses. CloudConvert provides specific error codes and messages that can help diagnose issues.
  • Monitor usage: Keep track of your API usage and remaining conversion minutes through your CloudConvert dashboard to manage costs and avoid service interruptions.
  • Advanced conversion options: Investigate the extensive range of conversion options and settings available for various file formats, such as specifying image quality, PDF compression, or video codecs.
  • Security considerations: Ensure your API key is kept confidential and is not exposed in client-side code. For server-side applications, use environment variables or secure configuration management.

Troubleshooting the first call

New API integrations often encounter initial challenges. Here are common issues and troubleshooting steps for your first CloudConvert API call:

  • Invalid API Key:
    • Symptom: HTTP 401 Unauthorized error.
    • Resolution: Double-check that your API key is correct and included in the Authorization: Bearer YOUR_API_KEY header. Ensure there are no leading/trailing spaces or incorrect characters. Generate a new key if unsure.
  • Incorrect Content-Type Header:
    • Symptom: HTTP 415 Unsupported Media Type or HTTP 400 Bad Request.
    • Resolution: For most CloudConvert API requests, especially when creating jobs, the Content-Type header should be application/json. Verify your request includes this header correctly.
  • Malformed JSON Payload:
    • Symptom: HTTP 400 Bad Request with a message indicating JSON parsing error.
    • Resolution: Review your JSON payload for syntax errors (e.g., missing commas, unclosed braces, incorrect quotes). Use a JSON linter or validator to check its correctness.
  • Rate Limiting:
    • Symptom: HTTP 429 Too Many Requests.
    • Resolution: CloudConvert implements rate limiting to prevent abuse. If you are making many requests in a short period, you might hit this limit. Implement exponential backoff or space out your requests.
  • Job Status Not Changing:
    • Symptom: Polling the job status consistently returns waiting or processing for an extended period without resolution.
    • Resolution: Check the job details for any error messages within the task responses. Ensure the input URL is publicly accessible and the file exists. Verify you have sufficient conversion minutes in your account.
  • Invalid Input/Output Formats:
    • Symptom: Job fails with a conversion error.
    • Resolution: Confirm that the specified input format matches the actual file type and that the requested output format is supported for that input. Refer to the CloudConvert supported formats documentation.
  • Firewall or Network Issues:
    • Symptom: Connection timeouts or network unreachable errors.
    • Resolution: Ensure your network or firewall settings allow outbound connections to api.cloudconvert.com on standard HTTPS ports (443).