API Documentation

The Canvas Labs API gives you programmatic access to all our AI generation tools. Build integrations, automate workflows, or create entirely new products on top of our platform.

Authentication

All API requests require a Bearer token in the Authorization header. Generate your API key from the Dashboard under Settings → API Keys.

bash
curl https://api.canvaslabs.us/v1/account/credits \
  -H "Authorization: Bearer cl_live_abc123def456"

Keep your API key secret. Do not expose it in client-side code or public repositories. Rotate compromised keys immediately from the Dashboard.

Base URL

https://api.canvaslabs.us/v1

All endpoints are relative to this base URL. HTTPS is required.

Rate Limits

Plan Requests / min Concurrent jobs
Starter 10 2
Pro 60 10
Enterprise Custom Custom

Rate limit headers (X-RateLimit-Remaining) are included in every response.

Endpoints

POST /v1/video/generate

Generate an AI video from a text prompt or reference image.

Parameter Type Required Description
prompt string Yes Text description of the video to generate.
image_url string No Reference image URL for image-to-video generation.
duration integer No Video length in seconds. Options: 5, 10, 15. Default: 5.
resolution string No Output resolution. Options: 720p, 1080p, 4k. Default: 1080p.
audio boolean No Generate synchronized audio. Default: false.
POST /v1/image/generate

Generate a photorealistic image from a text prompt.

Parameter Type Required Description
prompt string Yes Text description of the image to generate.
reference_images array No Up to 3 reference image URLs for image-to-image.
aspect_ratio string No Options: 1:1, 16:9, 9:16, 4:3, 3:4. Default: 1:1.
resolution string No Options: 720p, 1080p, 4k. Default: 1080p.
POST /v1/scene/compose

Combine multiple photos into an AI-generated scene.

Parameter Type Required Description
images array Yes Array of image URLs (2-3 photos).
scene string No Preset scene name or custom description.
resolution string No Options: 720p, 1080p, 4k. Default: 1080p.
POST /v1/style/transfer

Apply a style to a photo while preserving identity.

Parameter Type Required Description
image_url string Yes Source photo URL.
style string No Preset style name or custom description.
resolution string No Options: 720p, 1080p, 4k. Default: 1080p.
GET /v1/jobs/{job_id}

Get the status and result of a generation job.

Parameter Type Required Description
job_id string Yes The job ID returned from a generation request.
GET /v1/account/credits

Get current credit balance and usage statistics.

Code Examples

Python

python
import canvaslabs

client = canvaslabs.Client(api_key="cl_live_abc123")

# Generate a video
job = client.video.generate(
    prompt="A golden retriever running through autumn leaves",
    duration=10,
    resolution="1080p",
    audio=True
)

# Wait for completion
result = job.wait()
print(f"Video URL: {result.url}")
print(f"Credits used: {result.credits_used}")

Node.js

javascript
import { CanvasLabs } from '@canvaslabs/sdk';

const client = new CanvasLabs({ apiKey: 'cl_live_abc123' });

const job = await client.video.generate({
  prompt: 'A golden retriever running through autumn leaves',
  duration: 10,
  resolution: '1080p',
  audio: true,
});

const result = await job.waitForCompletion();
console.log('Video URL:', result.url);
console.log('Credits used:', result.creditsUsed);

Go

go
client := canvaslabs.NewClient("cl_live_abc123")

job, err := client.Video.Generate(ctx, &canvaslabs.VideoRequest{
    Prompt:     "A golden retriever running through autumn leaves",
    Duration:   10,
    Resolution: "1080p",
    Audio:      true,
})

result, err := job.Wait(ctx)
fmt.Printf("Video URL: %s\n", result.URL)
fmt.Printf("Credits used: %d\n", result.CreditsUsed)

Webhooks

Configure a webhook URL in your Dashboard to receive POST notifications when jobs complete. Each webhook payload includes the job ID, status, result URL, and credits used.

json — webhook payload
{
  "event": "job.completed",
  "job_id": "job_8f3k2m1n",
  "status": "completed",
  "type": "video",
  "result": {
    "url": "https://cdn.canvaslabs.us/v/8f3k2m1n.mp4",
    "duration": 10,
    "resolution": "1080p",
    "size_bytes": 15234567
  },
  "credits_used": 45,
  "created_at": "2026-03-20T14:30:00Z",
  "completed_at": "2026-03-20T14:30:42Z"
}

Error Codes

Code Meaning
400 Bad Request — invalid parameters
401 Unauthorized — invalid or missing API key
402 Insufficient Credits — purchase more credits
404 Not Found — resource does not exist
429 Rate Limit Exceeded — slow down
500 Internal Error — contact support
503 Service Unavailable — temporary outage

Official SDKs

Python

pip install canvaslabs

v1.2.0

Node.js

npm install @canvaslabs/sdk

v1.1.3

Go

go get canvaslabs.us/sdk

v1.0.1