Quick Start - cURL & HTTP APIs
Get started with Importly using simple HTTP requests. Perfect for testing, debugging, or integrating with any programming language.
1. Get Your API Key
- Create an Account at Importly.io
- Find your API Key via the api key page
- Keep it secure—treat it like a password!
2. Your First Import
The main functionality of Importly is to import and process media from URLs:
bash1curl -X POST "https://api.importly.io/import" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "url": "https://example.com/your-media-url",6 "videoQuality": "1080p",7 "webhookUrl": "https://your-domain.com/webhook"8 }'
Expected Response:
json1{2 "success": true,3 "data": {4 "jobId": "abc123",5 "status": "queued",6 "message": "Media import has been queued. You will receive a webhook when it's complete."7 }8}
3. Check Import Status
bash1curl -X GET "https://api.importly.io/import/status?id=abc123" \2 -H "Authorization: Bearer YOUR_API_KEY"
Expected Response (when completed):
json1{2 "success": true,3 "data": {4 "jobId": "abc123",5 "status": "completed",6 "result": {7 "mediaUrl": "https://storage.importly.io/abc123/video.mp4",8 "title": "Your Media Title",9 "duration": 300,10 "creditsUsed": 53,11 "fileSizeBytes": 52428800,12 "filename": "video.mp4"13 },14 "startedAt": "2025-09-14T10:00:00Z",15 "completedAt": "2025-09-14T10:01:00Z"16 }17}
4. Get Metadata Only
If you want to retrieve media details without downloading:
bash1curl -X GET "https://api.importly.io/metadata?url=https://example.com/your-media-url" \2 -H "Authorization: Bearer YOUR_API_KEY"
Expected Response:
json1{2 "success": true,3 "data": {4 "jobId": "xyz789",5 "status": "queued",6 "message": "Metadata request queued."7 }8}
Check Metadata Status
bash1curl -X GET "https://api.importly.io/metadata/status?id=xyz789" \2 -H "Authorization: Bearer YOUR_API_KEY"
Expected Response (when completed):
json1{2 "success": true,3 "data": {4 "jobId": "xyz789",5 "status": "completed",6 "result": {7 "title": "Sample Video Title",8 "duration": 300,9 "thumbnailUrl": "https://storage.importly.io/xyz789/thumbnail.jpg",10 "description": "Video description",11 "uploader": "Channel Name",12 "uploadDate": "2025-09-01",13 "viewCount": 1000000,14 "availableQualities": ["480p", "720p", "1080p"],15 "creditsRequired": 5316 },17 "startedAt": "2025-09-14T10:00:00Z",18 "completedAt": "2025-09-14T10:00:15Z"19 }20}
5. Import Options
The import endpoint supports several customization options:
bash1curl -X POST "https://api.importly.io/import" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "url": "https://example.com/your-media-url",6 "includeVideo": true,7 "includeAudio": true,8 "videoQuality": "1080p",9 "audioQuality": "high",10 "webhookUrl": "https://your-domain.com/webhook",11 "formatSelector": "best[height<=1080]"12 }'
Available Options:
| Parameter | Type | Default | Description |
| ---------------- | ------- | ------------ | -------------------------------------------------------------------------- |
| url | string | required | The media URL to import |
| includeVideo | boolean | true | Whether to include video |
| includeAudio | boolean | true | Whether to include audio |
| videoQuality | string | "720p" | Desired video quality (480p, 720p, 1080p, 1440p, 2160p) |
| audioQuality | string | "medium" | Desired audio quality (low, medium, high) |
| webhookUrl | string | null | URL to receive completion notification |
| formatSelector | string | null | Advanced format selection (see format selectors) |
6. Error Handling
Importly returns standard HTTP status codes and detailed error messages:
Authentication Error (401)
bash1curl -X POST "https://api.importly.io/import" \2 -H "Authorization: Bearer INVALID_KEY" \3 -H "Content-Type: application/json" \4 -d '{"url": "https://example.com/video"}'
Response:
json1{2 "success": false,3 "error": "Invalid API key",4 "code": "INVALID_AUTH"5}
Insufficient Credits (402)
json1{2 "success": false,3 "error": "Insufficient credits. Required: 50, Available: 25",4 "code": "INSUFFICIENT_CREDITS"5}
Rate Limiting (429)
json1{2 "success": false,3 "error": "Rate limit exceeded. Try again in 60 seconds.",4 "code": "RATE_LIMITED",5 "retryAfter": 606}
Bad Request (400)
json1{2 "success": false,3 "error": "Invalid URL format",4 "code": "INVALID_URL"5}
7. Webhooks Setup
To receive automatic notifications when imports complete, set up a webhook endpoint:
Example Webhook Request
When your import completes, Importly will send a POST request to your webhook URL:
bash1# What Importly sends to your webhook URL2POST https://your-domain.com/webhook3Content-Type: application/json45{6 "type": "import.completed",7 "data": {8 "jobId": "abc123",9 "status": "completed",10 "result": {11 "mediaUrl": "https://storage.importly.io/abc123/video.mp4",12 "title": "Your Media Title",13 "duration": 300,14 "creditsUsed": 53,15 "fileSizeBytes": 52428800,16 "filename": "video.mp4"17 },18 "startedAt": "2025-09-14T10:00:00Z",19 "completedAt": "2025-09-14T10:01:00Z"20 }21}
Webhook Types
import.completed- Import finished successfullyimport.failed- Import failedmetadata.completed- Metadata extraction completedmetadata.failed- Metadata extraction failed
Test Your Webhook
Use tools like ngrok for local testing:
bash1# Terminal 1: Start your local server2python -m http.server 800034# Terminal 2: Expose it publicly5ngrok http 800067# Use the ngrok URL as your webhook URL8# https://abc123.ngrok.io/webhook
8. Batch Operations
Process multiple URLs by making parallel requests:
bash1#!/bin/bash23API_KEY="your_api_key_here"4WEBHOOK_URL="https://your-domain.com/webhook"56# Array of URLs to import7urls=(8 "https://example.com/video1"9 "https://example.com/video2"10 "https://example.com/video3"11)1213# Start all imports14for url in "${urls[@]}"; do15 echo "Starting import for: $url"1617 curl -X POST "https://api.importly.io/import" \18 -H "Authorization: Bearer $API_KEY" \19 -H "Content-Type: application/json" \20 -d "{21 \"url\": \"$url\",22 \"videoQuality\": \"1080p\",23 \"webhookUrl\": \"$WEBHOOK_URL\"24 }" &25done2627# Wait for all background jobs to complete28wait2930echo "All imports started!"
9. Polling for Status Updates
If you prefer polling over webhooks, you can check status periodically:
bash1#!/bin/bash23API_KEY="your_api_key_here"4IMPORT_ID="abc123"56check_status() {7 curl -s -X GET "https://api.importly.io/import/status?id=$IMPORT_ID" \8 -H "Authorization: Bearer $API_KEY" \9 | python -m json.tool10}1112echo "Checking import status..."1314while true; do15 response=$(check_status)16 status=$(echo "$response" | python -c "import sys, json; print(json.load(sys.stdin)['data']['status'])")1718 echo "Current status: $status"1920 if [[ "$status" == "completed" ]] || [[ "$status" == "failed" ]]; then21 echo "Final result:"22 echo "$response"23 break24 fi2526 echo "Still processing... checking again in 5 seconds"27 sleep 528done
10. Advanced Format Selection
Use format selectors for precise control over media quality:
bash1# Get the best quality under 1GB2curl -X POST "https://api.importly.io/import" \3 -H "Authorization: Bearer YOUR_API_KEY" \4 -H "Content-Type: application/json" \5 -d '{6 "url": "https://example.com/video",7 "formatSelector": "best[filesize<1000M]"8 }'910# Get audio only in MP3 format11curl -X POST "https://api.importly.io/import" \12 -H "Authorization: Bearer YOUR_API_KEY" \13 -H "Content-Type: application/json" \14 -d '{15 "url": "https://example.com/video",16 "includeVideo": false,17 "formatSelector": "bestaudio[ext=mp3]"18 }'1920# Get specific resolution and codec21curl -X POST "https://api.importly.io/import" \22 -H "Authorization: Bearer YOUR_API_KEY" \23 -H "Content-Type: application/json" \24 -d '{25 "url": "https://example.com/video",26 "formatSelector": "best[height=720][vcodec^=avc1]"27 }'
11. Rate Limiting & Best Practices
Respect rate limits and implement proper error handling:
bash1#!/bin/bash23make_request() {4 local url=$15 local max_retries=36 local retry_count=078 while [ $retry_count -lt $max_retries ]; do9 response=$(curl -w "%{http_code}" -s -X POST "https://api.importly.io/import" \10 -H "Authorization: Bearer $API_KEY" \11 -H "Content-Type: application/json" \12 -d "{\"url\": \"$url\"}")1314 http_code="${response: -3}"15 body="${response%???}"1617 case $http_code in18 200|201)19 echo "Success: $body"20 return 021 ;;22 429)23 echo "Rate limited, waiting 60 seconds..."24 sleep 6025 ;;26 *)27 echo "Error $http_code: $body"28 ;;29 esac3031 ((retry_count++))32 echo "Retry $retry_count of $max_retries"33 sleep $((retry_count * 2)) # Exponential backoff34 done3536 echo "Failed after $max_retries attempts"37 return 138}
12. Testing & Debugging
Useful commands for testing and debugging:
bash1# Test with verbose output2curl -v -X POST "https://api.importly.io/import" \3 -H "Authorization: Bearer YOUR_API_KEY" \4 -H "Content-Type: application/json" \5 -d '{"url": "https://example.com/video"}'67# Save response to file8curl -X GET "https://api.importly.io/import/status?id=abc123" \9 -H "Authorization: Bearer YOUR_API_KEY" \10 -o response.json1112# Pretty print JSON response13curl -s -X GET "https://api.importly.io/import/status?id=abc123" \14 -H "Authorization: Bearer YOUR_API_KEY" \15 | python -m json.tool1617# Check response time18curl -w "@curl-format.txt" -s -X POST "https://api.importly.io/import" \19 -H "Authorization: Bearer YOUR_API_KEY" \20 -H "Content-Type: application/json" \21 -d '{"url": "https://example.com/video"}'
Create curl-format.txt:
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
Why cURL?
cURL is perfect for:
- ✅ Quick testing - Test API endpoints instantly
- ✅ Debugging - Inspect requests and responses
- ✅ Automation - Create simple scripts and cron jobs
- ✅ Documentation - Easy to copy and share examples
- ✅ Language agnostic - Works with any tech stack
Next Steps
- Set up webhooks for real-time notifications
- Learn about format selectors for advanced control
- Check out SDK examples for your preferred language
- Review best practices for production usage
Complete Example
Check out our complete cURL examples on GitHub with advanced scripts and automation examples.