AI Image & Video Generation
Full documentation of all UlazAI API endpoints, authentication methods, and error handling.
UlazAI supports two authentication methods: Token Authentication and API Key Authentication.
/api/register/
Create a new user account
{
"username": "johndoe",
"email": "[email protected]",
"password": "secure_password123"
}
{
"token": "your-auth-token-here",
"user": {
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"credits_balance": 0
}
}
/api/login/
Login with username and password to get authentication token
{
"username": "johndoe",
"password": "secure_password123"
}
{
"token": "your-auth-token-here",
"user": {
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"credits_balance": 100
}
}
/api/api-keys/
Auth Required
Create a new API key for authentication
Authorization: Token your-auth-token-here
{
"name": "Production API Key"
}
{
"id": "uuid-here",
"name": "Production API Key",
"key": "ulazai_live_abc123...", // Only shown once!
"key_preview": "ulazai_li...",
"created_at": "2025-01-15T10:00:00Z"
}
⚠️ Important: The full API key is only shown once during creation. Store it securely!
Authorization: Token your-auth-token-here
Authorization: Bearer ulazai_live_abc123...
/api/v1/generate/
Auth Required
Generate a new image from a text prompt
{
"prompt": "A beautiful sunset over mountains with a lake in foreground",
"size": "3:2" // Options: "1:1", "3:2", "2:3"
}
{
"success": true,
"data": {
"generation_id": "uuid-here",
"status": "processing",
"credits_used": 8,
"credits_remaining": 92,
"message": "Image generation started successfully"
}
}
All image sizes cost 8 credits per generation
/api/v1/generate/history/
Auth Required
Get your generation history
?limit=20&offset=0&type=image
/api/v1/generate/video/
Auth Required
Generate a new video from text or image
{
"prompt": "A cat playing in a garden",
"video_model": "veo3_fast", // Options: "veo3_fast", "veo3"
"aspect_ratio": "16:9", // Options: "16:9", "9:16"
"watermark_text": "MyBrand", // Optional, max 50 chars
"source_image_urls": [] // Optional, for image-to-video
}
• veo3_fast (16:9): 130 credits
• veo3_fast (9:16): 150 credits
• veo3 (all ratios): 300 credits
/api/v1/generate/{generation_id}/
Auth Required
Check the status of any generation (image or video)
{
"id": "uuid-here",
"generation_type": "video",
"status": "completed",
"prompt": "A cat playing in a garden",
"video_url": "https://cdn.ulazai.com/videos/...",
"video_model": "veo3_fast",
"credits_used": 130,
"created_at": "2025-01-15T10:00:00Z",
"completed_at": "2025-01-15T10:01:30Z"
}
/api/profile/
Auth Required
Get current user profile information
{
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"credits_balance": 92,
"total_images_generated": 12,
"enable_watermark": true,
"watermark_text": "MyBrand",
"created_at": "2025-01-10T08:00:00Z"
}
/api/profile/
Auth Required
Update user profile settings
{
"enable_watermark": true,
"watermark_text": "MyBrand.com"
}
/payments/api/credits/
Auth Required
Get current credit balance
{
"credits_balance": 92,
"total_spent": "25.00",
"total_credits_purchased": 2400
}
/payments/api/transactions/
Auth Required
Get transaction history
{
"success": false,
"error": "Error message here",
"details": {
"field_name": "Specific field error"
}
}
Invalid request parameters
The request is malformed or missing required fields
Missing or invalid authentication
No valid authentication token or API key provided
Insufficient credits
Not enough credits to complete the requested operation
Access denied
You don't have permission to access this resource
Resource not found
The requested resource doesn't exist
Rate limit exceeded
Too many requests in a short period. Please slow down
Server error
Something went wrong on our end. Please try again
import requests
import time
# Configuration
API_KEY = "ulazai_live_your_api_key_here"
BASE_URL = "https://ulazai.com"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Generate a video
video_data = {
"prompt": "A beautiful sunset timelapse over the ocean",
"video_model": "veo3_fast",
"aspect_ratio": "16:9",
"watermark_text": "MyBrand"
}
response = requests.post(f"{BASE_URL}/api/v1/generate/video/",
json=video_data, headers=headers)
if response.status_code == 201:
result = response.json()
generation_id = result["data"]["generation_id"]
print(f"Video generation started: {generation_id}")
# Poll for status
while True:
status_response = requests.get(
f"{BASE_URL}/api/v1/generate/{generation_id}/",
headers=headers
)
status_data = status_response.json()
if status_data["status"] == "completed":
print(f"Video ready: {status_data['video_url']}")
break
elif status_data["status"] == "failed":
print(f"Generation failed: {status_data.get('error_message')}")
break
print(f"Status: {status_data['status']}...")
time.sleep(10) # Wait 10 seconds before next check
else:
print(f"Error: {response.json()}")
• WhatsApp: Ask us anything
• Documentation: docs.ulazai.com