🚀 TubeMagic API
Access TubeMagic's powerful AI tools programmatically. Generate video titles, descriptions, tags, thumbnails, and more through our RESTful API.
Getting Started
Base URL
https://api.tubemagic.com/v2
✅ What You Can Do
- • Generate AI-powered video titles
- • Create optimized descriptions
- • Suggest relevant tags
- • Analyze video performance
- • Generate thumbnail ideas
- • Script generation and optimization
⚠️ Requirements
- • Valid TubeMagic API key
- • HTTPS requests only
- • JSON request/response format
- • Rate limit compliance
- • Proper error handling
Authentication
🔑 API Key Authentication
Include your API key in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://api.tubemagic.com/v2/generate/title
🔐 Getting Your API Key
- 1. Log into your TubeMagic dashboard
- 2. Navigate to Settings → API Keys
- 3. Click "Generate New Key"
- 4. Copy and securely store your key
🛡️ Security Best Practices
- • Never expose API keys in client-side code
- • Use environment variables
- • Rotate keys regularly
- • Monitor API usage
API Endpoints
POST /generate/title
Generate AI-powered video titles
Request Body:
{
"topic": "How to grow YouTube channel",
"style": "clickbait", // clickbait, professional, educational
"length": "medium", // short, medium, long
"count": 5
}
Response:
{
"success": true,
"data": {
"titles": [
"This SECRET Will Grow Your YouTube Channel 10x Faster!",
"I Tried Every YouTube Growth Hack - Here's What Actually Works",
"The #1 Mistake Killing Your YouTube Channel Growth"
]
},
"usage": {
"credits_used": 1,
"remaining_credits": 999
}
}
POST /generate/description
Create optimized video descriptions
Request Body:
{
"title": "How to Grow Your YouTube Channel Fast",
"video_length": "15:30",
"target_keywords": ["youtube growth", "subscribers"],
"include_timestamps": true,
"call_to_action": true
}
POST /generate/tags
Generate relevant video tags
Request Body:
{
"title": "How to Grow Your YouTube Channel Fast",
"description": "Learn proven strategies...",
"category": "Education",
"max_tags": 20
}
GET /analytics/video/{video_id}
Get video performance analytics
Response:
{
"success": true,
"data": {
"video_id": "dQw4w9WgXcQ",
"title_score": 85,
"description_score": 92,
"tag_relevance": 78,
"seo_score": 88,
"recommendations": [
"Add more specific keywords to title",
"Include video timestamps in description"
]
}
}
📚 Complete Endpoint Reference
Content Generation:
- • POST /generate/title
- • POST /generate/description
- • POST /generate/tags
- • POST /generate/script
- • POST /generate/thumbnail-ideas
Analytics & Optimization:
- • GET /analytics/video/id
- • POST /optimize/title
- • POST /optimize/description
- • GET /trends/keywords
- • GET /competitor/analysis
Rate Limits
Plan | Requests/Hour | Requests/Day | Burst Limit |
---|---|---|---|
Free | 100 | 1,000 | 10/minute |
Pro | 1,000 | 10,000 | 50/minute |
Enterprise | 10,000 | 100,000 | 200/minute |
⚡ Rate Limit Headers
Every API response includes rate limit information:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1609459200
Retry-After: 3600
Webhooks
📡 Available Webhook Events
- •
content.generated
- When AI content generation completes - •
analysis.completed
- When video analysis finishes - •
quota.warning
- When approaching API limits - •
quota.exceeded
- When API limits are reached
🔧 Webhook Configuration
POST /webhooks
{
"url": "https://yourapp.com/webhooks/tubemagic",
"events": ["content.generated", "analysis.completed"],
"secret": "your_webhook_secret"
}
SDKs & Libraries
🟨 JavaScript/Node.js
npm install tubemagic-js
const TubeMagic = require('tubemagic-js');
const client = new TubeMagic('your-api-key');
const titles = await client.generateTitles({
topic: 'YouTube growth',
count: 5
});
🐍 Python
pip install tubemagic-python
from tubemagic import TubeMagicClient
client = TubeMagicClient('your-api-key')
titles = client.generate_titles(
topic='YouTube growth',
count=5
)
💎 Ruby
gem install tubemagic-ruby
require 'tubemagic'
client = TubeMagic::Client.new('your-api-key')
titles = client.generate_titles(
topic: 'YouTube growth',
count: 5
)
🟦 PHP
composer require tubemagic/php-sdk
use TubeMagic\Client;
$client = new Client('your-api-key');
$titles = $client->generateTitles([
'topic' => 'YouTube growth',
'count' => 5
]);
Code Examples
🎯 Complete Video Optimization Workflow
// 1. Generate titles
const titles = await client.generateTitles({
topic: 'AI content creation',
style: 'professional',
count: 3
});
// 2. Create description
const description = await client.generateDescription({
title: titles.data.titles[0],
video_length: '12:45',
target_keywords: ['AI', 'content creation'],
include_timestamps: true
});
// 3. Generate tags
const tags = await client.generateTags({
title: titles.data.titles[0],
description: description.data.description,
max_tags: 15
});
// 4. Analyze optimization
const analysis = await client.analyzeVideo({
title: titles.data.titles[0],
description: description.data.description,
tags: tags.data.tags
});
📊 Bulk Processing Example
const videos = [
{ topic: 'YouTube SEO' },
{ topic: 'Content strategy' },
{ topic: 'Video editing tips' }
];
const results = await Promise.all(
videos.map(async (video) => {
const titles = await client.generateTitles(video);
const tags = await client.generateTags({
title: titles.data.titles[0],
max_tags: 10
});
return {
...video,
optimized_title: titles.data.titles[0],
suggested_tags: tags.data.tags
};
})
);
Error Handling
Status Code | Error Type | Description |
---|---|---|
400 | Bad Request | Invalid request parameters |
401 | Unauthorized | Invalid or missing API key |
429 | Rate Limited | Exceeded rate limits |
500 | Server Error | Internal server error |
📝 Error Response Format
{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid",
"details": {
"timestamp": "2025-01-08T12:00:00Z",
"request_id": "req_123456"
}
}
}
🤝 API Support
Need help with API integration?
📧 Email: api-support@tubemagic.com
💬 Discord: Join our developer community
📚 Examples: GitHub repository