Getting Started
Get up and running with the Sketchpen API in under 5 minutes.
Prerequisites
- A Sketchpen account (sign up)
- An API key from your dashboard (Settings â API Keys)
Step 1: Make Your First API Call
Create a video using a text prompt:
curl -X POST https://api.sketchpen.app/api/v1/videos \
-H "X-Api-Key: sk_live_xyz..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "A beautiful sunset over the ocean with waves crashing",
"aspect_ratio": "16:9"
}'Response:
{
"id": "video_uuid",
"status": "scripting",
"prompt": "A beautiful sunset over the ocean with waves crashing",
"theme": "presentation",
"scenes": [],
"video_url": null,
"audio_url": null,
"created_at": "2024-01-01T00:00:00Z"
}â ī¸ Credits
Creating a video requires at least 1 credit. Each scene costs 1 credit. See Credit Costs for details.
âšī¸ Timing
Script generation typically takes 10-30 seconds. The scenes array populates once the script is ready (status changes to refining).
Step 2: Poll for Script Generation
The AI generates the script in the background. Poll until scenes appear:
curl https://api.sketchpen.app/api/v1/videos/{video_id} \
-H "X-Api-Key: sk_live_xyz..."When the script is ready, status changes to refining and scenes populates:
{
"id": "video_uuid",
"status": "refining",
"scenes": [
{
"id": "scene_uuid",
"speech": "Welcome to our stunning sunset scene...",
"visual_description": "A golden sunset over calm ocean waves",
"image_url": null,
"captions": []
}
],
"created_at": "2024-01-01T00:00:00Z"
}Step 3: Approve and Generate
Once you're happy with the script, approve it to start video generation:
curl -X POST https://api.sketchpen.app/api/v1/videos/{video_id}/approve \
-H "X-Api-Key: sk_live_xyz..."This triggers image generation, audio narration, and video rendering. The status changes to visualising.
âšī¸ Timing
Full video generation (approve â completed) typically takes 1-5 minutes depending on scene count. Longer videos take more time.
Step 4: Wait for Completion
Poll until the video is ready:
curl https://api.sketchpen.app/api/v1/videos/{video_id} \
-H "X-Api-Key: sk_live_xyz..."When complete:
{
"id": "video_uuid",
"status": "completed",
"scenes": [
{
"id": "scene_uuid",
"speech": "Welcome to our stunning sunset scene...",
"visual_description": "A golden sunset over calm ocean waves",
"image_url": null,
"captions": [
{"word": "Welcome", "start": 0.0, "end": 0.4},
{"word": "to", "start": 0.4, "end": 0.5}
]
}
],
"video_url": "https://bucket.s3.region.amazonaws.com/key?X-Amz-Algorithm=...",
"thumbnail_url": "https://bucket.s3.region.amazonaws.com/key?X-Amz-Algorithm=..."
}âšī¸ Presigned URLs
video_url and thumbnail_url are presigned S3 URLs that expire after 7 days. Download files you want to keep permanently.
Complete Example
Here's a runnable bash script that creates a video, waits for completion, and downloads it:
#!/bin/bash
API_KEY="sk_live_your_key_here"
BASE="https://api.sketchpen.app/api/v1"
# 1. Create video
VIDEO_ID=$(curl -s -X POST "$BASE/videos" \
-H "X-Api-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A beautiful sunset over the ocean"}' | jq -r '.id')
echo "Created: $VIDEO_ID"
# 2. Poll for script, then approve
while true; do
STATUS=$(curl -s "$BASE/videos/$VIDEO_ID" -H "X-Api-Key: $API_KEY" | jq -r '.status')
echo "Status: $STATUS"
[[ "$STATUS" == "refining" ]] && break
[[ "$STATUS" == "failed" ]] && echo "Script failed!" && exit 1
sleep 5
done
curl -s -X POST "$BASE/videos/$VIDEO_ID/approve" -H "X-Api-Key: $API_KEY"
echo "Approved - generating video..."
# 3. Poll for completion, then download
while true; do
RESP=$(curl -s "$BASE/videos/$VIDEO_ID" -H "X-Api-Key: $API_KEY")
STATUS=$(echo "$RESP" | jq -r '.status')
[[ "$STATUS" == "completed" ]] && break
[[ "$STATUS" == "failed" ]] && echo "Video failed!" && exit 1
echo "Status: $STATUS"
sleep 10
done
VIDEO_URL=$(echo "$RESP" | jq -r '.video_url')
curl -o video.mp4 "$VIDEO_URL"
echo "Downloaded video.mp4"Video Status Lifecycle
Videos progress through these statuses:
pending- Video created, processing not startedscripting- AI is generating the scriptrefining- Script is ready for reviewvisualising- Generating visual scenesnarrating- Generating audio voiceoverscurating- Synchronizing assetsrendering- Rendering final videocompleted- Video readyfailed- Generation failed (see Troubleshooting)
Next Steps
- Videos API - Full video endpoint reference
- Webhooks - Get notified when videos are ready
- Assets - Upload custom speakers and images
- Themes & Config - Customize video appearance