API Documentation

← Back to Dashboard

Getting Started

The PromptToVideo API allows you to programmatically generate AI videos, check status, and manage your account. All API requests require authentication using a Bearer token.

Base URL

https://prompttovideo.com

Authentication

Include your API token in the Authorization header:

Authorization: Bearer YOUR_TOKEN_HERE

Rate Limits

Subscription Tier Daily API Calls Reset Time
Free 10 calls/day Daily at midnight UTC
Basic 100 calls/day Daily at midnight UTC
Pro 1,000 calls/day Daily at midnight UTC
Enterprise Unlimited N/A
POST

Generate Video

/api/v1/generate

Request Body

{
  "prompt": "A beautiful sunset over the ocean",
  "quality": "free"  // or "premium"
}

Response

{
  "success": true,
  "video_id": 123,
  "status": "pending",
  "credits_remaining": 15,
  "queue_position": 5,
  "estimated_wait_time": 25
}

Error Responses

401 Unauthorized: Invalid or missing token
402 Payment Required: Insufficient credits
429 Too Many Requests: Rate limit exceeded
GET

Get Video Status

/api/v1/video/{video_id}/status

Response

{
  "video_id": 123,
  "status": "completed",
  "prompt": "A beautiful sunset over the ocean",
  "quality": "free",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:35:00Z",
  "video_url": "https://storage.googleapis.com/...",
  "duration": 30,
  "thumbnail_url": "https://storage.googleapis.com/...",
  "completed_at": "2024-01-15T10:35:00Z"
}

Status Values

pending: Video is in queue
processing: Video is being generated
completed: Video is ready
failed: Video generation failed
GET

List Videos

/api/v1/videos?page=1&per_page=20&status=completed

Query Parameters

page: Page number (default: 1)
per_page: Items per page, max 100 (default: 20)
status: Filter by status (pending, processing, completed, failed)

Response

{
  "videos": [
    {
      "id": 123,
      "prompt": "A beautiful sunset over the ocean",
      "quality": "360p",
      "status": "completed",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:35:00Z",
      "video_url": "https://storage.googleapis.com/...",
      "duration": 30,
      "thumbnail_url": "https://storage.googleapis.com/..."
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 20,
    "total": 45,
    "pages": 3,
    "has_next": true,
    "has_prev": false
  }
}
GET

Get Account Information

/api/v1/account

Response

{
  "user_id": 456,
  "email": "user@example.com",
  "credits": 25,
  "subscription_tier": "pro",
  "rate_limit_info": {
    "tier": "pro",
    "limit": 1000,
    "used": 45,
    "remaining": 955,
    "reset_time": "2024-01-16T00:00:00Z"
  },
  "created_at": "2024-01-01T00:00:00Z"
}
GET

Get Queue Status

/api/v1/queue/status

Response

{
  "user_videos": [
    {
      "video_id": 123,
      "prompt": "A beautiful sunset over the ocean...",
      "quality": "360p",
      "position": 5,
      "estimated_wait_minutes": 25,
      "queued_at": "2024-01-15T10:30:00Z"
    }
  ],
  "queue_stats": {
    "total_pending": 45,
    "currently_processing": 3,
    "user_pending_count": 2
  }
}

Code Examples

Python

import requests

API_TOKEN = "your_token_here"
BASE_URL = "https://prompttovideo.com"

headers = {
    "Authorization": f"Bearer {API_TOKEN}",
    "Content-Type": "application/json"
}

# Generate a video
response = requests.post(f"{BASE_URL}/api/v1/generate", 
    headers=headers,
    json={
        "prompt": "A beautiful sunset over the ocean",
        "quality": "free"
    }
)

if response.status_code == 200:
    data = response.json()
    video_id = data["video_id"]
    print(f"Video {video_id} queued for generation")
    
    # Check status
    status_response = requests.get(f"{BASE_URL}/api/v1/video/{video_id}/status", 
        headers=headers
    )
    print(status_response.json())
else:
    print(f"Error: {response.status_code} - {response.text}")

JavaScript

const API_TOKEN = "your_token_here";
const BASE_URL = "https://prompttovideo.com";

const headers = {
    "Authorization": `Bearer ${API_TOKEN}`,
    "Content-Type": "application/json"
};

// Generate a video
async function generateVideo(prompt, quality = "free") {
    try {
        const response = await fetch(`${BASE_URL}/api/v1/generate`, {
            method: "POST",
            headers,
            body: JSON.stringify({ prompt, quality })
        });
        
        if (response.ok) {
            const data = await response.json();
            return data.video_id;
        } else {
            throw new Error(`HTTP ${response.status}: ${response.statusText}`);
        }
    } catch (error) {
        console.error("Error generating video:", error);
    }
}

// Check video status
async function checkVideoStatus(videoId) {
    try {
        const response = await fetch(`${BASE_URL}/api/v1/video/${videoId}/status`, {
            headers
        });
        
        if (response.ok) {
            return await response.json();
        }
    } catch (error) {
        console.error("Error checking status:", error);
    }
}

// Usage
generateVideo("A beautiful sunset over the ocean").then(videoId => {
    console.log(`Video ${videoId} queued for generation`);
});

cURL

# Generate a video
curl -X POST https://prompttovideo.com/api/v1/generate \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A beautiful sunset over the ocean",
    "quality": "free"
  }'

# Check video status
curl -X GET https://prompttovideo.com/api/v1/video/123/status \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"

# List videos
curl -X GET "https://prompttovideo.com/api/v1/videos?page=1&per_page=20" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"

Need Help?

If you need assistance with the API or have questions about integration, please don't hesitate to reach out to our support team.