API Documentation

Convert files programmatically with our REST API

Quick Start

Base URL

https://pro.convertcom.online/apiv2

Authentication

All API requests require authentication using signature-based headers. Get a signature first, then include the required headers in all subsequent requests.

Endpoints

POST /signature

Get authentication signature for API requests

Request

{
  "email": "[email protected]"
}

Response

{
  "signature": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
  "timestamp": 1698765432,
  "expires_in": 300
}

Headers for all subsequent requests:

  • X-Signature: Signature from response
  • X-Timestamp: Timestamp from response
  • X-User-Email: User email
POST /upload-chunk

Upload file in chunks for conversion

Form Data

FieldTypeRequiredDescription
fileFileYesFile data (binary)
chunk_indexStringYesChunk number (0, 1, 2...)
total_chunksStringYesTotal number of chunks
file_nameStringYesOriginal filename
target_formatStringYesTarget format (jpg, png, pdf, etc.)
job_idStringNoJob ID (only for subsequent chunks)

Response

{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "message": "File assembled and queued for conversion"
}
GET /conversion/status/{job_id}

Check the status of a conversion job

Response

{
  "status": "processing",
  "progress": 45,
  "created_at": 1698765432.123,
  "download_count": 0,
  "max_downloads": 3
}

Status Values

  • queued: Waiting to start
  • processing: Currently converting
  • completed: Conversion finished
  • error: Conversion failed
GET /conversion/result/{job_id}

Download the converted file

Response

Returns the converted file as binary data with headers:

  • Content-Disposition: attachment; filename="converted_file.jpg"
GET /formats

Get list of supported conversion formats

Response

{
  "categories": {
    "imagens": {
      "jpg": "JPEG",
      "png": "PNG",
      "gif": "GIF"
    },
    "documentos": {
      "pdf": "PDF",
      "docx": "Word",
      "txt": "Text"
    }
  },
  "total_formats": 15
}

Important Notes

  • Signature Validity: 5 minutes (300 seconds)
  • Automatic Conversion: Server starts conversion automatically after upload
  • No Manual Conversion Call: Do NOT call /convert-chunks manually
  • Individual Files: Each file gets its own unique job_id
  • Rate Limiting: 20 files per minute (3 seconds between files)
  • Download Limit: Maximum 3 downloads per conversion
  • File Expiry: Files are deleted after 60 minutes

Complete Working Example

Python Example

import os
import time
import requests
from pathlib import Path
import json

# Configuration
folder_path = r"user folder"  # Folder with images
base_url = "https://pro.convertcom.online/apiv2"
signature_url = f"{base_url}/signature"
upload_url = f"{base_url}/upload-chunk"
status_url = f"{base_url}/conversion/status"
result_url = f"{base_url}/conversion/result"
formats_url = f"{base_url}/formats"
output_folder = r"user folder"  # Output folder
email = "[email protected]"  # Replace with your real email
target_format = "jpg"  # Adjust to desired format

# Setup session
session = requests.Session()

# Create output folder if it doesn't exist
Path(output_folder).mkdir(parents=True, exist_ok=True)

# Validate formats
formats_response = session.get(formats_url)
if formats_response.status_code == 200:
    formats_data = formats_response.json()
    categories = formats_data.get("categories", {})
    all_formats = []
    
    for category, formats in categories.items():
        all_formats.extend(formats.keys())
    
    if all_formats and target_format.lower() not in [fmt.lower() for fmt in all_formats]:
        print(f"Warning: Format {target_format} not found in available formats.")
        print(f"Available formats: {all_formats}")
    else:
        print(f"Format {target_format} validated successfully.")

# List files
image_files = [f for f in os.listdir(folder_path) if f.lower().endswith(('.jpg', '.png', '.jpeg'))]
total_files = len(image_files)
print(f"Total images: {total_files}")

# Get initial signature (valid for 5 minutes)
signature_response = session.post(signature_url, json={"email": email})
if signature_response.status_code != 200:
    raise Exception(f"Error getting initial signature: {signature_response.text}")
signature_data = signature_response.json()
signature = signature_data["signature"]
timestamp = signature_data["timestamp"]
expires_in = signature_data.get("expires_in", 300)
print(f"Signature obtained, valid for {expires_in} seconds")

# Process each file individually
for idx, filename in enumerate(image_files, 1):
    file_path = os.path.join(folder_path, filename)
    job_id = None

    # 1. Upload image
    with open(file_path, 'rb') as file_obj:
        upload_headers = {
            "X-Signature": signature,
            "X-Timestamp": str(timestamp),
            "X-User-Email": email
        }
        
        upload_files = {"file": (filename, file_obj, "application/octet-stream")}
        upload_data = {
            "chunk_index": "0",
            "total_chunks": "1", 
            "file_name": filename,
            "target_format": target_format.lower()
        }
        
        print(f"Sending file {idx}/{total_files}: {filename}")
        upload_response = session.post(upload_url, files=upload_files, data=upload_data, headers=upload_headers)
        
        if upload_response.status_code != 200:
            raise Exception(f"Upload failed for {filename}: {upload_response.text}")
        
        upload_result = upload_response.json()
        if upload_result.get("status") == "completed" or upload_result.get("file_complete"):
            job_id = upload_result.get("job_id")
            print(f"File {filename} uploaded, job_id: {job_id}")
        else:
            raise Exception(f"Incomplete upload for {filename}: {upload_response.text}")

    # 2. Conversion starts automatically by server
    print(f"File uploaded successfully. Server will start conversion automatically for job_id: {job_id}")
    
    # 3. Status polling
    status_headers = {
        "X-Signature": signature,
        "X-Timestamp": str(timestamp),
        "X-User-Email": email
    }
    
    while True:
        status_response = session.get(f"{status_url}/{job_id}", headers=status_headers)
        if status_response.status_code != 200:
            raise Exception(f"Status error for {filename}: {status_response.text}")
        status_data = status_response.json()
        print(f"Status for {filename}: {status_data['status']}, Progress: {status_data['progress']}%")
        if status_data["status"] == "completed":
            break
        time.sleep(5)  # Polling every 5s

    # 4. Get result
    result_response = session.get(f"{result_url}/{job_id}", headers=status_headers)
    if result_response.status_code == 200:
        with open(os.path.join(output_folder, f"converted_{filename}"), 'wb') as f:
            f.write(result_response.content)
        print(f"File {filename} converted and downloaded!")
    else:
        print(f"Download error for {filename}: {result_response.text}")

    # Rate limit: 3s per file
    time.sleep(3)

    # Renew signature if close to expiration
    if time.time() > timestamp + expires_in - 30:
        signature_response = session.post(signature_url, json={"email": email})
        if signature_response.status_code != 200:
            raise Exception(f"Error renewing signature: {signature_response.text}")
        signature_data = signature_response.json()
        signature = signature_data["signature"]
        timestamp = signature_data["timestamp"]
        expires_in = signature_data.get("expires_in", 300)
        print(f"Signature renewed, valid for {expires_in} seconds")

print("Completed!")

Common Errors

  • "chunk missing" - File not properly included in multipart form data
  • "missing parameters" - Required form fields missing
  • "internal error" - Server-side error (usually resolved by not calling convert-chunks manually)
  • "QUOTA_EXCEEDED" - Monthly storage quota exceeded
  • "FILE_TOO_LARGE" - File exceeds size limit

Support

Need help with the API? We're here to help: