🔧 API Documentation

Integrate Comprimir-Video's powerful compression technology into your applications with our comprehensive REST API.

API Status: Operational

Quick Start

Get Your API Key

Step 1: Generate API Key

Access your dashboard and generate API keys for free or upgrade to Pro+ for higher limits.

API Overview

RESTful API architecture
Supports all major video formats
Customizable compression settings
Webhook notifications

Authentication

All API requests require authentication using a Bearer token in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Security Note

Keep your API keys secure. Never expose them in client-side code or public repositories. Use environment variables or secure key management.

API Endpoints

POST
/v1/compress

Compress a video file by providing a URL or direct upload.

Request Parameters

video_url(optional)

URL of the video to compress

video_file(optional)

Base64 encoded video file

quality(required)

high, medium, low

format(required)

mp4, avi, mov, etc.

target_size(optional)

Desired output file size

callback_url(optional)

Webhook URL for completion notification

Response

{ "id": "compress_123456789", "status": "processing", "original_size": "50.2MB", "estimated_compression": "60%", "download_url": null, "webhook_url": "https://api.comprimir-video.com/v1/webhooks/...", "created_at": "2024-10-02T10:00:00Z", "estimated_completion": "2024-10-02T10:05:00Z" }
GET
/v1/status/{id}

Check the compression status and download the compressed file when ready.

GET /v1/status/compress_123456789 Response: { "id": "compress_123456789", "status": "completed", "progress": 100, "original_size": "50.2MB", "compressed_size": "20.1MB", "compression_ratio": "60%", "download_url": "https://cdn.comprimir-video.com/download/...", "download_expires": "2024-10-03T10:00:00Z", "processing_time": "3m 45s" }

Code Examples

cURL Request

Command Line
curl -X POST 'https://api.comprimir-video.com/v1/compress' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "video_url": "https://example.com/video.mp4",
    "quality": "high",
    "format": "mp4",
    "target_size": "10MB"
  }'
JS

JavaScript

Browser/Node.js
// Compress a video using our API
const response = await fetch('https://api.comprimir-video.com/v1/compress', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    video_url: 'https://example.com/video.mp4',
    quality: 'high',
    format: 'mp4',
    target_size: '10MB',
    callback_url: 'https://yourapp.com/webhook'
  })
});

const result = await response.json();
console.log('Compression ID:', result.id);
Py

Python

Python 3.x
import requests

# Compress a video
url = 'https://api.comprimir-video.com/v1/compress'
headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
}

data = {
    'video_url': 'https://example.com/video.mp4',
    'quality': 'high',
    'format': 'mp4',
    'target_size': '10MB'
}

response = requests.post(url, headers=headers, json=data)
result = response.json()
print(f"Compression ID: {result['id']}")

Rate Limits

Free
100 requests/day
Perfect for testing and small projects
Pro
10,000 requests/day
Ideal for growing applications
Enterprise
Unlimited
Custom limits and SLA

Rate Limit Headers

API responses include rate limit information in headers:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

Webhooks

Receive real-time notifications when your video compression is complete. Configure webhook URLs in your compression requests.

Webhook Payload

{ "event": "compression.completed", "data": { "id": "compress_123456789", "status": "completed", "original_size": "50.2MB", "compressed_size": "20.1MB", "download_url": "https://cdn.comprimir-video.com/download/...", "download_expires": "2024-10-03T10:00:00Z", "processing_time": "3m 45s", "error": null }, "timestamp": "2024-10-02T10:05:00Z" }

Security

  • • Verify webhook signatures using HMAC
  • • Use HTTPS endpoints for webhooks
  • • Implement idempotent processing
  • • Set up retry mechanisms for failed delivery
X-Comprimir-Video-Signature: SHA256=ab3d...

Error Handling

HTTP Status Codes

200Success
400Bad Request
401Unauthorized
429Rate Limited
202Processing
422Validation Error
500Server Error
503Service Unavailable

Error Response Format

{ "error": { "code": "validation_error", "message": "Invalid video URL provided", "details": { "field": "video_url", "reason": "URL must be publicly accessible" }, "timestamp": "2024-10-02T10:00:00Z" } }

Need Help with Integration?

Our technical team is ready to help you integrate Comprimir-Video's API into your application.

Email us at: api-support@comprimir-video.com