Data Models

Detailed structure of the core objects used in the API, matching the database schema.

Product Object

Represents a product in your catalog.

{
  "id": "uuid",
  "user_id": "uuid",
  "name": "Wireless Headphones",
  "image_url": "https://example.com/image.jpg",
  "description": "Premium noise-canceling headphones",
  "created_at": "2023-11-23T10:00:00Z"
}

Video Object

Represents a generated video.

{
  "id": "uuid",
  "user_id": "uuid",
  "product_id": "uuid",
  "template_id": "uuid",
  "status": "completed", // pending, processing, completed, failed
  "video_url": "https://cdn.example.com/video.mp4",
  "thumbnail_url": "https://cdn.example.com/thumb.jpg",
  "user_prompt": {},
  "credits_used": 10,
  "n8n_job_id": "job_123",
  "error_message": null,
  "created_at": "2023-11-23T10:05:00Z",
  "completed_at": "2023-11-23T10:06:30Z",
  "language": "en"
}

Template Object

Represents a video template.

{
  "id": "uuid",
  "name": "Product Showcase",
  "description": "Showcase your product features",
  "preview_image_url": "https://example.com/preview.jpg",
  "prompt_template": "Create a video about {{product_name}}...",
  "environment": "production",
  "is_active": true,
  "sort_order": 0,
  "created_at": "2023-11-23T10:00:00Z",
  "category": "marketing"
}

Transaction Object

Represents a balance transaction.

{
  "id": "uuid",
  "user_id": "uuid",
  "amount": 100,
  "type": "purchase", // purchase, video_creation, assistant_usage, refund, bonus
  "description": "Credits purchase",
  "video_id": null,
  "transaction_id": "tx_123",
  "product_id": null,
  "platform": "stripe",
  "metadata": {},
  "created_at": "2023-11-23T10:00:00Z"
}