Generate All Edge Videos

Generate transition videos for every edge in your canvas that does not yet have a video. One call kicks off all the jobs and returns a summary of what was queued.

POST/v1/collections/:id/canvases/:canvasId/generate-all
curl -X POST https://api.masko.ai/v1/collections/COLLECTION_ID/canvases/CANVAS_ID/generate-all \
  -H "Authorization: Bearer masko_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "skip_completed": true,
    "duration": 4
  }'

How It Works

The endpoint scans every edge in the canvas and generates a video for each one that is missing a videoAssetId. The skip_completed parameter defaults to true, meaning edges that already have a completed video are skipped. Set it to false to regenerate everything from scratch.

Each generated job follows the same lifecycle as a regular animation job - you can poll individual jobs or use the canvas status endpoint to track overall progress.

Edge Classification

Not all edges cost the same. The endpoint classifies each edge before generation:

TypeConditionCostNotes
Loopsource == targetPaidLooping animation on a single pose
Forwardsource != targetPaidTransition from one pose to another
ReverseAuto-generated from forward0 creditsTriggered automatically when forward completes
Any Statesource = "*"SkippedVirtual edges resolved at runtime, no video needed

Cost Calculation

Only loops and forward transitions cost credits. The formula is:

(loops + forwards) x 5 x duration_seconds

For example, a canvas with 4 loop edges and 3 forward edges at 4 seconds each:

Paid edges: 4 loops + 3 forwards = 7
Cost per edge: 5 credits/sec x 4 sec = 20 credits
Total: 7 x 20 = 140 credits

Reverse edges (auto): 3 (one per forward) = 0 credits
Any State edges: skipped = 0 credits

The response includes a total_credits field so you know the exact cost before generation begins. If you do not have enough credits, the request returns a 402 error with the required amount.

Auto-Reverse

When a forward transition completes (e.g. Idle to Waving), the reverse transition (Waving to Idle) is automatically triggered at 0 credits. You do not need to request it separately. The reverse job appears in the canvas status response alongside the forward jobs.

If a forward edge already has a matching reverse edge in the canvas, the auto-reverse fills in the reverse edge video. If no reverse edge exists, one is created automatically.

Poll Progress

After kicking off generation, poll the canvas status endpoint to track overall progress:

GET/v1/collections/:id/canvases/:canvasId/status
curl https://api.masko.ai/v1/collections/COLLECTION_ID/canvases/CANVAS_ID/status \
  -H "Authorization: Bearer masko_YOUR_API_KEY"

# Response:
# {
#   "canvas_id": "abc-123",
#   "total_edges": 14,
#   "completed": 10,
#   "pending": 3,
#   "failed": 1,
#   "ready": false,
#   "progress": 0.71
# }
Tip

When ready is true, every edge in the canvas has a completed video and the canvas can be exported. You can safely call the export endpoint at that point.