Video Download API Documentation
Our Any4K.com Video Download API allows you to easily download videos from popular social media platforms including YouTube, TikTok, and Twitter and more. The API supports various video qualities, formats, and provides both video and audio extraction capabilities.
API Endpoints
Video Information Check
Retrieves video metadata and available download formats.
Endpoint: https://api.any4k.com/v1/dlp/check
Method: POST
Content-Type: application/json
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Yes | The video URL to download |
lang | string | No | Language code (default: en) |
country | string | No | Country code (default: US) |
platform | string | No | Platform name (default: Web) |
deviceId | string | No | Unique device identifier |
Example Request
cURL
curl -X POST https://api.any4k.com/v1/dlp/check \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"lang": "en",
"country": "US",
"platform": "Web",
"deviceId": "your-device-id"
}'
Node.js
const axios = require('axios');
async function checkVideo() {
try {
const response = await axios.post('https://api.any4k.com/v1/dlp/check', {
url: 'https://www.youtube.com/watch?v=VIDEO_ID',
lang: 'en',
country: 'US',
platform: 'Web',
deviceId: 'your-device-id'
}, {
headers: {
'Content-Type': 'application/json'
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
}
Response Format
{
"err_code": 0,
"err_msg": "",
"data": {
"id": "VIDEO_ID",
"title": "Video Title",
"description": "Video description",
"duration": 180,
"view_count": 1000000,
"upload_date": "20240401",
"extractor": "youtube",
"is_live": false,
"thumbnail": "https://example.com/thumbnail.jpg",
"download": [
{
"id": "format_id",
"ext": "mp4",
"res_text": "1080p",
"filesize": 104857600
}
],
"raw_video": [
{
"id": "format_id",
"ext": "mp4",
"res_text": "4K",
"filesize": 524288000,
"vcodec": "h264"
}
],
"raw_audio": [
{
"id": "format_id",
"ext": "m4a",
"filesize": 3145728,
"acodec": "aac",
"asr": 44100
}
]
}
}
Video Download
Downloads the video in the specified format.
Endpoint: https://api.any4k.com/v1/dlp/download
Method: POST
Content-Type: application/json
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url | string | Yes | The video URL |
format | string | Yes | Format ID from check response |
lang | string | No | Language code (default: en) |
country | string | No | Country code (default: US) |
Example Request
cURL
curl -X POST https://api.any4k.com/v1/dlp/download \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"format": "format_id",
"lang": "en",
"country": "US"
}'
Node.js
const axios = require('axios');
async function downloadVideo() {
try {
const response = await axios.post('https://api.any4k.com/v1/dlp/download', {
url: 'https://www.youtube.com/watch?v=VIDEO_ID',
format: 'format_id',
lang: 'en',
country: 'US'
}, {
headers: {
'Content-Type': 'application/json'
},
responseType: 'stream'
});
// Handle the video stream
response.data.pipe(fs.createWriteStream('video.mp4'));
} catch (error) {
console.error('Error:', error.message);
}
}
Error Codes
Code | Description |
---|---|
0 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
403 | Forbidden - Access denied |
404 | Not Found - Video not found |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
502 | Bad Gateway - Video platform error |
Supported Platforms
- YouTube
- TikTok
- Vimeo
- Dailymotion
- And more...
Rate Limits
- Free tier: 100 requests per day
- Pro tier: 1000 requests per day
- Enterprise tier: Custom limits
Best Practices
- Always check video information before downloading
- Handle rate limits appropriately
- Implement proper error handling
- Cache responses when possible
- Use appropriate timeout values
Support
For technical support or questions, please contact:
- Email: api@any4k.com
- Documentation: https://any4k.com/api