API v1

API Documentation

Convert files programmatically using our powerful REST API. Support for video, audio, image, and document conversions.

https://api.convertintomp4.com/v1

Introduction

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/v1
text

Request Format

  • All requests must include Content-Type: application/json header
  • 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"
  }
}
json

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"
bash

API Scopes

ScopeDescription
convertCreate and manage conversion tasks
files:readRead file information and download converted files
files:writeUpload and delete files
webhooksManage webhook subscriptions
usage:readView 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"
      }
    }
  }'
bash

Step 3: Check Job Status

curl https://api.convertintomp4.com/v1/jobs/job_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"
bash

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"
      }
    }
  }
}
json

Tasks

Tasks are the building blocks of file processing. Each task performs a single operation.

Task Types

TypeOperationDescription
Importimport/urlImport file from URL
Importimport/uploadDirect file upload
Importimport/s3Import from Amazon S3
ProcessconvertConvert file format
ProcesscompressOptimize/compress file
ProcessmergeMerge multiple files
Exportexport/urlGenerate download URL
Exportexport/s3Export to Amazon S3

Task Status

  • pending - Task is waiting to be processed
  • processing - Task is currently being processed
  • completed - Task finished successfully
  • failed - Task encountered an error
  • cancelled - 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"
    }
  }
}
json

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

OptionTypeDescription
qualitystringlow, medium, high, highest
resolutionstring480p, 720p, 1080p, 4k
codecstringh264, h265, vp9
fpsintegerFrame rate (1-60)
bitratestringVideo 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"
}
json

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": "..."
}
json

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"
}
json

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": "..."
}
json

Webhooks

Webhooks allow you to receive real-time notifications when jobs complete or fail.

Events

  • job.completed - Job and all tasks completed successfully
  • job.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"
        }
      }
    }
  }
}
json

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)
  );
}
javascript

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"
    }
  }
}
json
CodeStatusDescription
INVALID_API_KEY401The provided API key is invalid or has been revoked.
MISSING_API_KEY401No API key was provided in the Authorization header.
INSUFFICIENT_SCOPE403Your API key does not have the required scope for this operation.
RATE_LIMITED429You have exceeded the rate limit. Check the Retry-After header for when to retry.
INVALID_INPUT400The request body contains invalid data. Check the errors field for details.
FILE_TOO_LARGE413The uploaded file exceeds the maximum allowed size for your plan.
UNSUPPORTED_FORMAT422The requested conversion is not supported.
TASK_NOT_FOUND404The specified task ID does not exist or has expired.
JOB_NOT_FOUND404The specified job ID does not exist or has expired.
CONVERSION_FAILED500The conversion process encountered an error. Check the task details for more information.
TIMEOUT504The 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/v1
text

Sandbox Limits

LimitValue
Max file size1 MB
Monthly credits100
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: 97
text

PDF Operations

Dedicated endpoints for advanced PDF processing. All PDF operations are also available as task types within jobs.

Available Operations

EndpointDescription
POST /v1/pdf/ocrExtract text from scanned PDFs using OCR
POST /v1/pdf/splitSplit a PDF into multiple files by page ranges
POST /v1/pdf/mergeMerge multiple PDFs into a single file
POST /v1/pdf/encryptAdd password protection to a PDF
POST /v1/pdf/decryptRemove password protection from a PDF
POST /v1/pdf/rotateRotate pages in a PDF
POST /v1/pdf/compressOptimize PDF file size
POST /v1/pdf/to-pdfaConvert to PDF/A archival format
POST /v1/pdf/extract-pagesExtract specific pages from a PDF
POST /v1/pdf/watermarkAdd 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"
  }'
bash

Example: Merge PDFs

{
  "files": [
    "https://example.com/part1.pdf",
    "https://example.com/part2.pdf",
    "https://example.com/part3.pdf"
  ],
  "output_filename": "merged.pdf"
}
json

Example: Encrypt PDF

{
  "file": "https://example.com/document.pdf",
  "password": "secure-password-123",
  "permissions": {
    "printing": true,
    "copying": false,
    "modifying": false
  }
}
json

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=..."
}
json

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": "..."
  }
}
json

SFTP

{
  "operation": "import/sftp",
  "host": "sftp.example.com",
  "port": 22,
  "username": "user",
  "private_key": "-----BEGIN RSA PRIVATE KEY-----...",
  "path": "/uploads/video.mp4"
}
json

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
  }
}
json

Crop Options

OptionTypeDescription
xintegerLeft offset in pixels
yintegerTop offset in pixels
widthintegerCrop width in pixels
heightintegerCrop 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"
  }
}
json

Trim Options

OptionTypeDescription
start_timestringStart time (HH:MM:SS or seconds)
end_timestringEnd time (HH:MM:SS or seconds)
durationstringDuration 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/merge
text

Response

{
  "success": true,
  "data": [
    {
      "name": "mp4",
      "category": "video",
      "targets": ["mov", "avi", "mkv", "webm", "gif"]
    },
    {
      "name": "jpg",
      "category": "image",
      "targets": ["png", "webp", "gif", "bmp", "tiff"]
    }
  ]
}
json

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

VariableDefaultDescription
baseUrlhttps://api.convertintomp4.com/v1API base URL
apiKeyYOUR_API_KEYYour API key

SDKs & Libraries

We provide official SDKs for 8 programming languages plus cURL support:

JavaScript

@convertintomp4/sdk

npm install @convertintomp4/sdk
bash

Python

convertintomp4

pip install convertintomp4
bash

PHP

convertintomp4/sdk

composer require convertintomp4/sdk
bash

Java

com.convertintomp4:sdk

<!-- Maven -->
<dependency>
  <groupId>com.convertintomp4</groupId>
  <artifactId>sdk</artifactId>
  <version>1.0.0</version>
</dependency>
bash

C#

ConvertIntoMP4.SDK

dotnet add package ConvertIntoMP4.SDK
bash

Ruby

convertintomp4

gem install convertintomp4
bash

Go

github.com/convertintomp4/go-sdk

go get github.com/convertintomp4/go-sdk
bash

Kotlin

com.convertintomp4:sdk

// Gradle
implementation("com.convertintomp4:sdk:1.0.0")
bash

Swift

convertintomp4/sdk-swift

.package(url: "https://github.com/convertintomp4/sdk-swift.git", from: "1.0.0")
bash

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