Generate Content
REST API
Generate Content
Manually trigger content generation for YouTube videos
POST
Generate Content
Endpoint
Description
Manually triggers the full content generation pipeline, including strategy development, script writing, thumbnail design, SEO optimization, and production processing. The generated content is saved to the database and scheduled for publishing.Request Body
The topic for the video content. If not provided, the Content Strategy Agent will automatically select a trending topic based on analytics and research.
The style or format for the video. Options depend on your channel configuration.Examples:
"tutorial", "vlog", "review", "educational"Target length for the video content.Common values:
"short"- Short-form content (< 60 seconds)"medium"- Standard content (5-15 minutes)"long"- Long-form content (15+ minutes)
Response
Indicates whether content generation succeeded.
Contains the generated content details.
Unique identifier for the generated content. Use this ID with the
/publish/:contentId endpoint.The generated video title.
ISO 8601 timestamp when the content is scheduled for automatic publishing.
Error message if
success is false.Example Requests
Example Response
Success
Error
Response Codes
| Status Code | Description |
|---|---|
| 200 | Content generation successful |
| 500 | Server error during content generation |
Generation Pipeline
The/generate endpoint executes the following steps:
- Content Strategy - Analyzes trends and generates content strategy
- Script Writing - Creates the video script based on the strategy
- Thumbnail Design - Generates an eye-catching thumbnail
- SEO Optimization - Optimizes title, description, tags, and metadata
- Production Processing - Processes all content for publishing
- Database Save - Stores the content and schedules automatic publishing
Content generation can take 30-90 seconds depending on the complexity and AI model response times. Consider implementing a timeout of at least 120 seconds for this endpoint.
Use Cases
Manual Content Creation
Generate content on-demand outside the automated schedule:Batch Content Generation
Generate multiple pieces of content programmatically:Error Handling
Common errors and their causes:| Error Message | Cause | Solution |
|---|---|---|
| API quota exceeded | External API limits reached | Wait for quota reset or upgrade API plan |
| Invalid credentials | YouTube API credentials missing | Run npm run credentials:setup |
| Database error | Database connection failed | Check database configuration |
| Agent not initialized | System still starting up | Wait for initialization to complete |