AI Video API: Integrating Generation into Your App
Video Studio provides a comprehensive REST API that allows developers to integrate AI video generation into their own applications, websites, and workflows.
**Why Use the Video Studio API?**
- **Automation**: Generate videos programmatically without manual intervention
- **Scalability**: Handle thousands of generation requests
- **Integration**: Embed video generation into your existing tools
- **Customization**: Control every parameter of the generation process
**API Endpoints**
The API provides the following main endpoints:
1. **Create Generation Task**
POST to submit a new video generation request with prompt, references, and settings.
2. **Check Task Status**
GET to poll the status of a generation task (pending, running, succeeded, failed).
3. **Retrieve Result**
Download the generated video once the task is complete.
**Key Parameters**
- `prompt`: Text description of the desired video
- `image_refs`: Array of reference image URLs (max 2)
- `video_ref`: URL of a reference video (optional)
- `audio_ref`: URL of reference audio (optional)
- `duration`: Video length in seconds (3-30)
- `aspect_ratio`: "16:9", "9:16", or "1:1"
- `watermark`: Boolean to include watermark
**Authentication**
API requests require an API key. You can generate keys from your Video Studio account dashboard. Include the key in the Authorization header.
**Rate Limits**
- Free tier: 10 requests/hour
- Paid plans: Higher limits based on subscription
**Code Example (JavaScript)**
```javascript
const response = await fetch('https://api.getvideostudio.com/v1/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A cinematic drone shot flying over a misty mountain range at sunrise',
duration: 10,
aspect_ratio: '16:9'
})
});
const data = await response.json();
```
**Best Practices**
- Implement polling with exponential backoff
- Use webhook callbacks for async completion (coming soon)
- Cache results to avoid redundant generations
- Handle errors gracefully with retry logic
The Video Studio API opens up endless possibilities for automated content creation. Visit the API documentation page to get started.