API Documentation
Convert files programmatically using our powerful REST API. Support for video, audio, image, and document conversions.
https://api.convertintomp4.com/v1Introduction
Welcome to the ConvertIntoMP4 API! Our REST API allows you to convert files between formats programmatically. The API uses a task-based architecture where each operation (import, convert, export) is a task that can be combined into jobs for complex workflows.
Base URL
https://api.convertintomp4.com/v1Request Format
- All requests must include
Content-Type: application/jsonheader - All requests must include authentication via Bearer token
- Request bodies should be valid JSON
Response Format
{
"success": true,
"data": { ... },
"meta": {
"requestId": "req_abc123",
"timestamp": "2024-01-15T10:30:00Z"
}
}Authentication
All API requests require authentication using an API key. Include your API key in the Authorization header of every request.
Bearer Token
Include your API key as a Bearer token in the Authorization header:
curl https://api.convertintomp4.com/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"API Scopes
| Scope | Description |
|---|---|
| convert | Create and manage conversion tasks |
| files:read | Read file information and download converted files |
| files:write | Upload and delete files |
| webhooks | Manage webhook subscriptions |
| usage:read | View usage statistics and quotas |
Quick Start
Step 1: Get Your API Key
Sign up at convertintomp4.com/signup and create an API key in your dashboard.
Step 2: Make Your First Conversion
Create a job that imports a file from URL, converts it, and exports a download link:
curl -X POST https://api.convertintomp4.com/v1/jobs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tasks": {
"import-file": {
"operation": "import/url",
"url": "https://example.com/video.mov"
},
"convert-file": {
"operation": "convert",
"input": "import-file",
"output_format": "mp4",
"options": {
"quality": "high"
}
},
"export-file": {
"operation": "export/url",
"input": "convert-file"
}
}
}'Step 3: Check Job Status
curl https://api.convertintomp4.com/v1/jobs/job_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"Step 4: Download the Result
Once complete, the export task contains a download URL:
{
"tasks": {
"export-file": {
"status": "completed",
"result": {
"url": "https://files.convertintomp4.com/abc123/output.mp4",
"expires_at": "2024-01-16T10:30:00Z"
}
}
}
}Tasks
Tasks are the building blocks of file processing. Each task performs a single operation.
Task Types
| Type | Operation | Description |
|---|---|---|
| Import | import/url | Import file from URL |
| Import | import/upload | Direct file upload |
| Import | import/s3 | Import from Amazon S3 |
| Process | convert | Convert file format |
| Process | compress | Optimize/compress file |
| Process | merge | Merge multiple files |
| Export | export/url | Generate download URL |
| Export | export/s3 | Export to Amazon S3 |
Task Status
pending- Task is waiting to be processedprocessing- Task is currently being processedcompleted- Task finished successfullyfailed- Task encountered an errorcancelled- Task was cancelled
Jobs
Jobs allow you to combine multiple tasks into a single workflow. This is the recommended way to perform conversions as it allows you to chain operations and handle the entire workflow with a single API call.
Job Structure
A job contains named tasks that reference each other:
{
"tasks": {
"import-1": {
"operation": "import/url",
"url": "https://example.com/file.mov"
},
"convert-1": {
"operation": "convert",
"input": "import-1",
"output_format": "mp4"
},
"export-1": {
"operation": "export/url",
"input": "convert-1"
}
}
}Convert
The convert operation transforms files from one format to another.
Supported Formats
video
Input:
mp4, mov, avi, mkv, webm, wmv, flv, m4v, 3gp, mpeg, ogv
Output:
mp4, mov, avi, mkv, webm, gif, mp3, wav
audio
Input:
mp3, wav, flac, aac, ogg, m4a, wma, aiff, opus
Output:
mp3, wav, flac, aac, ogg, m4a
image
Input:
jpg, jpeg, png, gif, webp, bmp, tiff, svg, heic, ico, raw
Output:
jpg, png, gif, webp, bmp, tiff, ico, pdf
document
Input:
pdf, docx, doc, xlsx, xls, pptx, ppt, odt, ods, odp, txt, rtf, html
Output:
pdf, docx, txt, html, jpg, png
Video Options
| Option | Type | Description |
|---|---|---|
| quality | string | low, medium, high, highest |
| resolution | string | 480p, 720p, 1080p, 4k |
| codec | string | h264, h265, vp9 |
| fps | integer | Frame rate (1-60) |
| bitrate | string | Video bitrate (e.g., 2M, 5M) |
Import Files
Before converting files, you need to import them into the system. We support multiple import methods.
Import from URL
{
"operation": "import/url",
"url": "https://example.com/file.mp4",
"filename": "my-video.mp4"
}Import from S3
{
"operation": "import/s3",
"bucket": "my-bucket",
"region": "us-east-1",
"key": "path/to/file.mp4",
"access_key_id": "AKIA...",
"secret_access_key": "..."
}Export Files
After conversion, export files to retrieve them via download URL or directly to cloud storage.
Export to URL
{
"operation": "export/url",
"input": "convert-task-name"
}The result includes a download URL that expires after 24 hours.
Export to S3
{
"operation": "export/s3",
"input": "convert-task-name",
"bucket": "my-bucket",
"region": "us-east-1",
"key": "converted/output.mp4",
"access_key_id": "AKIA...",
"secret_access_key": "..."
}Webhooks
Webhooks allow you to receive real-time notifications when jobs complete or fail.
Events
job.completed- Job and all tasks completed successfullyjob.failed- Job failed (one or more tasks failed)job.cancelled- Job was cancelled
Webhook Payload
{
"event": "job.completed",
"timestamp": "2024-01-15T10:31:23Z",
"job": {
"id": "job_abc123",
"status": "completed",
"tasks": {
"export-file": {
"status": "completed",
"result": {
"url": "https://files.convertintomp4.com/abc123/output.mp4"
}
}
}
}
}Signature Verification
Verify webhooks using HMAC-SHA256:
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}Errors
The API uses standard HTTP status codes and returns detailed error information.
Error Response
{
"success": false,
"error": {
"code": "INVALID_INPUT",
"message": "The request contains invalid data",
"details": {
"field": "output_format",
"error": "Unsupported format"
}
}
}| Code | Status | Description |
|---|---|---|
| INVALID_API_KEY | 401 | The provided API key is invalid or has been revoked. |
| MISSING_API_KEY | 401 | No API key was provided in the Authorization header. |
| INSUFFICIENT_SCOPE | 403 | Your API key does not have the required scope for this operation. |
| RATE_LIMITED | 429 | You have exceeded the rate limit. Check the Retry-After header for when to retry. |
| INVALID_INPUT | 400 | The request body contains invalid data. Check the errors field for details. |
| FILE_TOO_LARGE | 413 | The uploaded file exceeds the maximum allowed size for your plan. |
| UNSUPPORTED_FORMAT | 422 | The requested conversion is not supported. |
| TASK_NOT_FOUND | 404 | The specified task ID does not exist or has expired. |
| JOB_NOT_FOUND | 404 | The specified job ID does not exist or has expired. |
| CONVERSION_FAILED | 500 | The conversion process encountered an error. Check the task details for more information. |
| TIMEOUT | 504 | The operation took too long to complete. Try with a smaller file or simpler conversion. |
Rate Limits
Rate limits vary by plan. When you exceed the rate limit, you'll receive a 429 status code with a Retry-After header.
free
- Requests
- 100/hour
- Max file size
- 100MB
- Files per job
- 5
- Concurrent jobs
- 2
pro
- Requests
- 1000/hour
- Max file size
- 2GB
- Files per job
- 50
- Concurrent jobs
- 10
enterprise
- Requests
- 10000/hour
- Max file size
- 10GB
- Files per job
- 100
- Concurrent jobs
- 50
Sandbox Environment
Test your integration risk-free using our sandbox environment. Sandbox mode uses a separate base URL and test API key with limited quotas.
Sandbox Base URL
https://sandbox.api.convertintomp4.com/v1Sandbox Limits
| Limit | Value |
|---|---|
| Max file size | 1 MB |
| Monthly credits | 100 |
| Rate limit (POST) | 1 req/sec |
| Rate limit (GET) | 3 req/sec |
Identifying Sandbox Responses
Sandbox responses include additional headers:
X-Sandbox: true
X-Credits-Remaining: 97PDF Operations
Dedicated endpoints for advanced PDF processing. All PDF operations are also available as task types within jobs.
Available Operations
| Endpoint | Description |
|---|---|
| POST /v1/pdf/ocr | Extract text from scanned PDFs using OCR |
| POST /v1/pdf/split | Split a PDF into multiple files by page ranges |
| POST /v1/pdf/merge | Merge multiple PDFs into a single file |
| POST /v1/pdf/encrypt | Add password protection to a PDF |
| POST /v1/pdf/decrypt | Remove password protection from a PDF |
| POST /v1/pdf/rotate | Rotate pages in a PDF |
| POST /v1/pdf/compress | Optimize PDF file size |
| POST /v1/pdf/to-pdfa | Convert to PDF/A archival format |
| POST /v1/pdf/extract-pages | Extract specific pages from a PDF |
| POST /v1/pdf/watermark | Add text or image watermark |
Example: OCR a PDF
curl -X POST https://api.convertintomp4.com/v1/pdf/ocr \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file": "https://example.com/scanned-doc.pdf",
"language": "eng",
"output_format": "pdf-searchable"
}'Example: Merge PDFs
{
"files": [
"https://example.com/part1.pdf",
"https://example.com/part2.pdf",
"https://example.com/part3.pdf"
],
"output_filename": "merged.pdf"
}Example: Encrypt PDF
{
"file": "https://example.com/document.pdf",
"password": "secure-password-123",
"permissions": {
"printing": true,
"copying": false,
"modifying": false
}
}Cloud Storage
Import and export files directly from your cloud storage providers. We support Amazon S3, Azure Blob Storage, Google Cloud Storage, and SFTP.
Supported Providers
Amazon S3
import/s3, export/s3
Azure Blob Storage
import/azure, export/azure
Google Cloud Storage
import/gcs, export/gcs
SFTP
import/sftp, export/sftp
Azure Blob Storage
{
"operation": "import/azure",
"storage_account": "myaccount",
"container": "my-container",
"blob": "path/to/file.mp4",
"sas_token": "sv=2023-01-03&st=...&sig=..."
}Google Cloud Storage
{
"operation": "import/gcs",
"bucket": "my-bucket",
"project_id": "my-project-id",
"key": "path/to/file.mp4",
"credentials": {
"type": "service_account",
"project_id": "my-project-id",
"private_key": "..."
}
}SFTP
{
"operation": "import/sftp",
"host": "sftp.example.com",
"port": 22,
"username": "user",
"private_key": "-----BEGIN RSA PRIVATE KEY-----...",
"path": "/uploads/video.mp4"
}Crop & Trim
Crop video frames or trim audio/video to specific time ranges. Available as task operations within jobs.
Video Crop
Crop the video frame to a specific region:
{
"operation": "crop",
"input": "import-task",
"options": {
"x": 100,
"y": 50,
"width": 1280,
"height": 720
}
}Crop Options
| Option | Type | Description |
|---|---|---|
| x | integer | Left offset in pixels |
| y | integer | Top offset in pixels |
| width | integer | Crop width in pixels |
| height | integer | Crop height in pixels |
Audio/Video Trim
Trim media to a specific time range:
{
"operation": "trim",
"input": "import-task",
"options": {
"start_time": "00:01:30",
"end_time": "00:05:00"
}
}Trim Options
| Option | Type | Description |
|---|---|---|
| start_time | string | Start time (HH:MM:SS or seconds) |
| end_time | string | End time (HH:MM:SS or seconds) |
| duration | string | Duration from start (alternative to end_time) |
Format Queries
Query which formats are supported for each operation. Useful for building dynamic UIs that show available conversions.
Query by Operation
GET /v1/formats/query/convert
GET /v1/formats/query/compress
GET /v1/formats/query/crop
GET /v1/formats/query/trim
GET /v1/formats/query/mergeResponse
{
"success": true,
"data": [
{
"name": "mp4",
"category": "video",
"targets": ["mov", "avi", "mkv", "webm", "gif"]
},
{
"name": "jpg",
"category": "image",
"targets": ["png", "webp", "gif", "bmp", "tiff"]
}
]
}Postman Collection
Import our complete API collection into Postman for interactive testing. The collection includes all endpoints with pre-configured example requests and environment variables.
Collection Variables
| Variable | Default | Description |
|---|---|---|
| baseUrl | https://api.convertintomp4.com/v1 | API base URL |
| apiKey | YOUR_API_KEY | Your API key |
SDKs & Libraries
We provide official SDKs for 8 programming languages plus cURL support:
JavaScript
@convertintomp4/sdk
npm install @convertintomp4/sdkPython
convertintomp4
pip install convertintomp4PHP
convertintomp4/sdk
composer require convertintomp4/sdkJava
com.convertintomp4:sdk
<!-- Maven -->
<dependency>
<groupId>com.convertintomp4</groupId>
<artifactId>sdk</artifactId>
<version>1.0.0</version>
</dependency>C#
ConvertIntoMP4.SDK
dotnet add package ConvertIntoMP4.SDKRuby
convertintomp4
gem install convertintomp4Go
github.com/convertintomp4/go-sdk
go get github.com/convertintomp4/go-sdkKotlin
com.convertintomp4:sdk
// Gradle
implementation("com.convertintomp4:sdk:1.0.0")Swift
convertintomp4/sdk-swift
.package(url: "https://github.com/convertintomp4/sdk-swift.git", from: "1.0.0")Best Practices
- Always handle errors - Wrap API calls in try/catch blocks
- Use webhooks - Avoid polling when possible
- Implement retry logic - Handle rate limits with exponential backoff
- Store API keys securely - Never commit API keys to version control