API Integration Guide for File Conversion
Learn how to integrate BatchMorph's file conversion API into your applications for automated, programmatic file processing.
Why Use the BatchMorph API?
Modern applications often need automated file conversion without user interaction. Whether you're building a document management system, a content platform, or an automation workflow, the BatchMorph API provides powerful, programmatic access to professional file conversion capabilities.
Key Benefits
- Automate repetitive conversion tasks
- Process files at scale (batch operations)
- Integrate into existing workflows
- No manual intervention required
- High-speed processing infrastructure
- Comprehensive error handling
Use Cases
- E-commerce product image processing
- Document management systems
- Content publishing platforms
- Email attachment processing
- Cloud storage integrations
- Automated reporting systems
Getting Started with the API
Step 1: Obtain API Credentials
API access is available for Business and Enterprise plan subscribers. To get your API key:
- Upgrade to Business or Enterprise plan
- Navigate to your dashboard settings
- Click "API Access" tab
- Generate a new API key
- Store your key securely (never commit to version control)
Security Warning: Never expose your API key in client-side code. Always make API calls from your backend server.
Step 2: Review API Documentation
Our comprehensive API documentation includes:
- Complete endpoint reference
- Request/response examples
- Authentication details
- Rate limiting information
- Error code definitions
- Code samples in multiple languages
API Authentication
BatchMorph API uses Bearer token authentication. Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY_HERE
Example Authentication Headers
import requests
API_KEY = "your_api_key_here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(
"https://batchmorph.com/api/v1/convert",
headers=headers,
json={"format": "pdf", "file": file_data}
)
const axios = require('axios');
const API_KEY = process.env.BATCHMORPH_API_KEY;
const response = await axios.post(
'https://batchmorph.com/api/v1/convert',
{ format: 'pdf', file: fileData },
{
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
}
);
curl -X POST https://batchmorph.com/api/v1/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "file=@document.docx" \
-F "output_format=pdf"
Common API Workflows
Single File Conversion
Convert a single file from one format to another:
Request
POST /api/v1/convert
{
"file": "base64_encoded_file",
"input_format": "docx",
"output_format": "pdf",
"quality": "high"
}
Response
{
"status": "success",
"conversion_id": "abc123",
"download_url": "https://...",
"expires_at": "2025-10-..."
}
Batch Conversion
Process multiple files in a single API call:
POST /api/v1/batch-convert
{
"files": [
{"file": "file1_base64", "output_format": "pdf"},
{"file": "file2_base64", "output_format": "jpg"},
{"file": "file3_base64", "output_format": "png"}
],
"webhook_url": "https://your-app.com/webhook"
}
Webhook Notifications
For long-running conversions, use webhooks to receive completion notifications:
- Provide a
webhook_urlin your conversion request - We'll POST conversion results to your endpoint when complete
- Includes download URL and conversion metadata
- Retries up to 3 times if webhook delivery fails
Rate Limits & Quotas
| Plan | Requests/Minute | Concurrent Jobs | Max File Size |
|---|---|---|---|
| Business | 60 | 10 | 250 MB |
| Enterprise | 300 | 50 | 1 GB |
If you exceed rate limits, you'll receive a 429 Too Many Requests response. Implement exponential backoff and retry logic in your application.
Error Handling Best Practices
Common Error Codes
400 Bad Request- Invalid parameters or malformed request401 Unauthorized- Missing or invalid API key403 Forbidden- API access not enabled for your plan413 Payload Too Large- File exceeds size limit415 Unsupported Media Type- Invalid input format429 Too Many Requests- Rate limit exceeded500 Internal Server Error- Server processing error
Example Error Response
{
"error": {
"code": "UNSUPPORTED_FORMAT",
"message": "Input format 'xyz' is not supported",
"details": "Supported formats: pdf, docx, jpg, png, heic, mov, mp4"
}
}
Security Best Practices
API Key Security
- Store keys in environment variables
- Never commit keys to version control
- Rotate keys periodically
- Use separate keys for dev/production
- Revoke compromised keys immediately
Data Security
- All API calls use HTTPS encryption
- Files are deleted after 24 hours
- No file content is logged or stored
- Webhook URLs should use HTTPS
- Validate webhook signatures
Testing Your Integration
Before going to production, thoroughly test your API integration:
Ready to Integrate?
Get started with BatchMorph API and automate your file conversion workflows today.
Upgrade to Business View API Docs