Get Storyboard Preview Job by ID
curl --request GET \
--url https://api.pictory.ai/pictoryapis/v1/jobs/{jobid} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "in-progress"
}
}
{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "completed",
"renderParams": {
"output": {
"width": 1920,
"height": 1080,
"format": "mp4",
"name": "demo_text_to_video.mp4",
"title": "demo_text_to_video",
"description": "",
"frameRendererVersion": "v3"
},
"elements": [
{
"type": "audio",
"id": "voiceOver",
"elementType": "audioElement",
"url": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"type": "audio",
"id": "bgMusic",
"elementType": "audioElement",
"fade": true,
"url": "https://tracks.melod.ie/track_versions/.../music.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 0.1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"id": "backgroundElement_...",
"elementType": "backgroundElement",
"type": "video",
"url": "https://media.gettyimages.com/id/.../video.mp4",
"backgroundColor": "rgba(0, 0, 0, 1)",
"width": "100%",
"objectMode": "cover",
"loop": true,
"mute": true,
"startTime": 0,
"duration": 7.5,
"visualType": "video",
"library": "getty"
},
{
"fontFamily": "Space Grotesk",
"fontSize": "48",
"fontColor": "rgb(255,255,255)",
"textAlign": "center",
"startTime": 0,
"duration": 7.5,
"id": "...",
"elementType": "layerItem",
"type": "text",
"text": "AI's Impact on Educators and Creators",
"width": "90.00%",
"preset": "center-center"
}
],
"sceneMarkers": [
{
"time": 7.5,
"showSceneNumber": "Scene 1",
"uuid": "202603261544455263c22b912026443bea93884eecfd4fd0c",
"startTime": 0
},
{
"time": 10.5,
"showSceneNumber": "Scene 2",
"uuid": "202603261544465266e15765260d944fb917c28bda80a01aa",
"startTime": 7.5
}
],
"subtitles": [
{
"subtitle": "AI is poised to significantly impact educators and course creators on social media.",
"start": 0,
"end": 7.5
},
{
"subtitle": "By automating tasks like content generation, visual design, and video editing, AI will save time and enhance consistency.",
"start": 7.5,
"end": 18
}
],
"projectId": "a1d36612-326d-4b81-aece-411f8aed4c70",
"projectAuthorId": "Google_113965628153287895479"
},
"storyboard": {
"videoName": "demo_text_to_video",
"webhook": "https://webhook.site/your-webhook-id",
"webhookInput": {
"aiVoice": "Brian"
},
"smartLayoutName": "Wanderlust",
"voiceOver": {
"enabled": true
},
"backgroundMusic": {
"enabled": true,
"volume": 0.1,
"autoMusic": false,
"musicUrl": "https://tracks.melod.ie/track_versions/.../music.mp3"
},
"scenes": [
{
"story": "<strong>AI</strong> is poised to significantly <strong>impact</strong> <strong>educators</strong> and <strong>course creators</strong> on <strong>social media</strong>.",
"voiceOver": {
"enabled": true,
"externalVoice": {
"voiceUrl": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"clips": [
{
"start": 0,
"end": 7.535
}
],
"amplificationLevel": 0
}
},
"backgroundMusic": {
"enabled": true
},
"background": {
"visualUrl": "https://media.gettyimages.com/id/.../video.mp4",
"type": "video",
"settings": {
"mute": true,
"loop": true
}
}
}
],
"language": "en"
},
"previewUrl": "https://video.pictory.ai/v2/preview/a1d36612-326d-4b81-aece-411f8aed4c70?mode=player",
"projectUrl": "https://app.pictory.ai/story/20260326192215799c0a92885a9db478594c3840411873b6a",
"projectId": "20260326192215799c0a92885a9db478594c3840411873b6a",
"aiCreditsUsed": 24
}
}
The projectUrl and projectId fields are present only when saveProject was set to true in the original Create Storyboard Preview request.
{
"job_id": "0bb0116b-d476-4b60-85ac-ce40ed711991",
"success": false,
"data": {
"status": "failed",
"error_code": "TEXT_TO_VIDEO_FAILED",
"error_message": "The AI voice speaker [Timm] is invalid and is not supported. Please provide valid AI voice speaker."
}
}
{
"message": "Unauthorized"
}
{
"id": "a1d36612-326d-4b81-aece-411f8aed4c71",
"success": false,
"data": {
"error_code": "5000",
"error_message": "JOB_NOT_FOUND"
}
}
Pictory Jobs
Get Storyboard Preview Job by ID
Retrieve the status and results of a storyboard preview job
GET
/
pictoryapis
/
v1
/
jobs
/
{jobid}
Get Storyboard Preview Job by ID
curl --request GET \
--url https://api.pictory.ai/pictoryapis/v1/jobs/{jobid} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "in-progress"
}
}
{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "completed",
"renderParams": {
"output": {
"width": 1920,
"height": 1080,
"format": "mp4",
"name": "demo_text_to_video.mp4",
"title": "demo_text_to_video",
"description": "",
"frameRendererVersion": "v3"
},
"elements": [
{
"type": "audio",
"id": "voiceOver",
"elementType": "audioElement",
"url": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"type": "audio",
"id": "bgMusic",
"elementType": "audioElement",
"fade": true,
"url": "https://tracks.melod.ie/track_versions/.../music.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 0.1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"id": "backgroundElement_...",
"elementType": "backgroundElement",
"type": "video",
"url": "https://media.gettyimages.com/id/.../video.mp4",
"backgroundColor": "rgba(0, 0, 0, 1)",
"width": "100%",
"objectMode": "cover",
"loop": true,
"mute": true,
"startTime": 0,
"duration": 7.5,
"visualType": "video",
"library": "getty"
},
{
"fontFamily": "Space Grotesk",
"fontSize": "48",
"fontColor": "rgb(255,255,255)",
"textAlign": "center",
"startTime": 0,
"duration": 7.5,
"id": "...",
"elementType": "layerItem",
"type": "text",
"text": "AI's Impact on Educators and Creators",
"width": "90.00%",
"preset": "center-center"
}
],
"sceneMarkers": [
{
"time": 7.5,
"showSceneNumber": "Scene 1",
"uuid": "202603261544455263c22b912026443bea93884eecfd4fd0c",
"startTime": 0
},
{
"time": 10.5,
"showSceneNumber": "Scene 2",
"uuid": "202603261544465266e15765260d944fb917c28bda80a01aa",
"startTime": 7.5
}
],
"subtitles": [
{
"subtitle": "AI is poised to significantly impact educators and course creators on social media.",
"start": 0,
"end": 7.5
},
{
"subtitle": "By automating tasks like content generation, visual design, and video editing, AI will save time and enhance consistency.",
"start": 7.5,
"end": 18
}
],
"projectId": "a1d36612-326d-4b81-aece-411f8aed4c70",
"projectAuthorId": "Google_113965628153287895479"
},
"storyboard": {
"videoName": "demo_text_to_video",
"webhook": "https://webhook.site/your-webhook-id",
"webhookInput": {
"aiVoice": "Brian"
},
"smartLayoutName": "Wanderlust",
"voiceOver": {
"enabled": true
},
"backgroundMusic": {
"enabled": true,
"volume": 0.1,
"autoMusic": false,
"musicUrl": "https://tracks.melod.ie/track_versions/.../music.mp3"
},
"scenes": [
{
"story": "<strong>AI</strong> is poised to significantly <strong>impact</strong> <strong>educators</strong> and <strong>course creators</strong> on <strong>social media</strong>.",
"voiceOver": {
"enabled": true,
"externalVoice": {
"voiceUrl": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"clips": [
{
"start": 0,
"end": 7.535
}
],
"amplificationLevel": 0
}
},
"backgroundMusic": {
"enabled": true
},
"background": {
"visualUrl": "https://media.gettyimages.com/id/.../video.mp4",
"type": "video",
"settings": {
"mute": true,
"loop": true
}
}
}
],
"language": "en"
},
"previewUrl": "https://video.pictory.ai/v2/preview/a1d36612-326d-4b81-aece-411f8aed4c70?mode=player",
"projectUrl": "https://app.pictory.ai/story/20260326192215799c0a92885a9db478594c3840411873b6a",
"projectId": "20260326192215799c0a92885a9db478594c3840411873b6a",
"aiCreditsUsed": 24
}
}
The projectUrl and projectId fields are present only when saveProject was set to true in the original Create Storyboard Preview request.
{
"job_id": "0bb0116b-d476-4b60-85ac-ce40ed711991",
"success": false,
"data": {
"status": "failed",
"error_code": "TEXT_TO_VIDEO_FAILED",
"error_message": "The AI voice speaker [Timm] is invalid and is not supported. Please provide valid AI voice speaker."
}
}
{
"message": "Unauthorized"
}
{
"id": "a1d36612-326d-4b81-aece-411f8aed4c71",
"success": false,
"data": {
"error_code": "5000",
"error_message": "JOB_NOT_FOUND"
}
}
Overview
This endpoint retrieves the current status and results of a storyboard preview job using its unique job ID. While processing is in progress, it returns the current job status. Once the job completes, it returns the full storyboard preview data, including render parameters, the processed storyboard, and the preview URL.A valid API key is required to use this endpoint. Obtain your API key from the API Access page in your Pictory dashboard.
API Endpoint
GET https://api.pictory.ai/pictoryapis/v1/jobs/{jobid}
Request Parameters
Path Parameters
The unique identifier (UUID) of the storyboard preview job. This value is the
jobId returned by the Create Storyboard Preview endpoint.Example: "a1d36612-326d-4b81-aece-411f8aed4c70"Headers
API key for authentication (starts with
pictai_)Authorization: YOUR_API_KEY
Response
In-Progress Response
Returned while the storyboard preview is still being generated:The unique identifier of the storyboard preview job
true while the job is processingFailed Response
Returned when the storyboard preview job has failed during processing:The unique identifier of the storyboard preview job
false when the job has failedCompleted Response
Returned when the storyboard preview has been successfully generated. The response contains the full preview data:The unique identifier of the storyboard preview job
true when the job has completed successfullyContains the complete storyboard preview results.
"completed" — the storyboard preview has been generated successfullyShow renderParams
Show renderParams
The rendering data used for previewing and rendering videos. This object contains the complete scene composition, including output settings, audio elements, background visuals, and text overlays.
Array of video elements including audio tracks (voice-over, background music), background visuals (videos, images, solid colors), and text overlays (scene text, titles). Each element includes
startTime, duration, elementType, and type-specific properties.Array of scene marker objects that define scene boundaries.Each marker contains:
time(number) — Scene duration in secondsshowSceneNumber(string) — Scene label (e.g.,"Scene 1")uuid(string) — Unique scene identifierstartTime(number) — Scene start time in seconds
Array of subtitle objects with timing information.Each subtitle contains:
subtitle(string) — The subtitle textstart(number) — Start time in secondsend(number) — End time in seconds
The project ID (matches the job ID)
Show storyboard
Show storyboard
The processed input storyboard. This is the fully resolved version of the original storyboard request, with all scenes broken down, voice-over URLs generated, and visual selections applied.
Name of the video project
The webhook URL configured for the job
Custom data passed through from the original request
The smart layout applied to the video
Voice-over configuration
Background music configuration, including
enabled, volume, autoMusic, and musicUrlArray of processed scene objects. Each scene contains:
story(string) — Scene text with keyword highlights in<strong>tagsvoiceOver(object) — Voice-over configuration with the generated audio URL and timing clipsbackgroundMusic(object) — Per-scene music settingsbackground(object) — Visual background withvisualUrl,type, and settings
Language code (e.g.,
"en")URL to view the storyboard preview in a browser. This URL can also be embedded in an iframe for app integrations. Refer to the Embed Preview Player guide for details.
URL to open the saved project in the Pictory web app. Present only when
saveProject was set to true in the storyboard request.Unique identifier of the saved project. Use this value with the Render Project or Get Project by ID APIs. Present only when
saveProject was set to true in the storyboard request.Total AI credits consumed for generating AI visuals (images and video clips) in this storyboard. Present only when the storyboard includes scenes with
aiVisual configuration. The value is the sum of credits used across all AI-generated scenes.Response Examples
{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "in-progress"
}
}
{
"job_id": "a1d36612-326d-4b81-aece-411f8aed4c70",
"success": true,
"data": {
"status": "completed",
"renderParams": {
"output": {
"width": 1920,
"height": 1080,
"format": "mp4",
"name": "demo_text_to_video.mp4",
"title": "demo_text_to_video",
"description": "",
"frameRendererVersion": "v3"
},
"elements": [
{
"type": "audio",
"id": "voiceOver",
"elementType": "audioElement",
"url": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"type": "audio",
"id": "bgMusic",
"elementType": "audioElement",
"fade": true,
"url": "https://tracks.melod.ie/track_versions/.../music.mp3",
"segments": [
{
"startTime": 0,
"duration": 7.5,
"volume": 0.1,
"audioTime": 0
}
],
"startTime": 0,
"duration": 100000
},
{
"id": "backgroundElement_...",
"elementType": "backgroundElement",
"type": "video",
"url": "https://media.gettyimages.com/id/.../video.mp4",
"backgroundColor": "rgba(0, 0, 0, 1)",
"width": "100%",
"objectMode": "cover",
"loop": true,
"mute": true,
"startTime": 0,
"duration": 7.5,
"visualType": "video",
"library": "getty"
},
{
"fontFamily": "Space Grotesk",
"fontSize": "48",
"fontColor": "rgb(255,255,255)",
"textAlign": "center",
"startTime": 0,
"duration": 7.5,
"id": "...",
"elementType": "layerItem",
"type": "text",
"text": "AI's Impact on Educators and Creators",
"width": "90.00%",
"preset": "center-center"
}
],
"sceneMarkers": [
{
"time": 7.5,
"showSceneNumber": "Scene 1",
"uuid": "202603261544455263c22b912026443bea93884eecfd4fd0c",
"startTime": 0
},
{
"time": 10.5,
"showSceneNumber": "Scene 2",
"uuid": "202603261544465266e15765260d944fb917c28bda80a01aa",
"startTime": 7.5
}
],
"subtitles": [
{
"subtitle": "AI is poised to significantly impact educators and course creators on social media.",
"start": 0,
"end": 7.5
},
{
"subtitle": "By automating tasks like content generation, visual design, and video editing, AI will save time and enhance consistency.",
"start": 7.5,
"end": 18
}
],
"projectId": "a1d36612-326d-4b81-aece-411f8aed4c70",
"projectAuthorId": "Google_113965628153287895479"
},
"storyboard": {
"videoName": "demo_text_to_video",
"webhook": "https://webhook.site/your-webhook-id",
"webhookInput": {
"aiVoice": "Brian"
},
"smartLayoutName": "Wanderlust",
"voiceOver": {
"enabled": true
},
"backgroundMusic": {
"enabled": true,
"volume": 0.1,
"autoMusic": false,
"musicUrl": "https://tracks.melod.ie/track_versions/.../music.mp3"
},
"scenes": [
{
"story": "<strong>AI</strong> is poised to significantly <strong>impact</strong> <strong>educators</strong> and <strong>course creators</strong> on <strong>social media</strong>.",
"voiceOver": {
"enabled": true,
"externalVoice": {
"voiceUrl": "https://audios-prod.pictorycontent.com/polly/production/projects/.../voiceover.mp3",
"clips": [
{
"start": 0,
"end": 7.535
}
],
"amplificationLevel": 0
}
},
"backgroundMusic": {
"enabled": true
},
"background": {
"visualUrl": "https://media.gettyimages.com/id/.../video.mp4",
"type": "video",
"settings": {
"mute": true,
"loop": true
}
}
}
],
"language": "en"
},
"previewUrl": "https://video.pictory.ai/v2/preview/a1d36612-326d-4b81-aece-411f8aed4c70?mode=player",
"projectUrl": "https://app.pictory.ai/story/20260326192215799c0a92885a9db478594c3840411873b6a",
"projectId": "20260326192215799c0a92885a9db478594c3840411873b6a",
"aiCreditsUsed": 24
}
}
The
projectUrl and projectId fields are present only when saveProject was set to true in the original Create Storyboard Preview request.{
"job_id": "0bb0116b-d476-4b60-85ac-ce40ed711991",
"success": false,
"data": {
"status": "failed",
"error_code": "TEXT_TO_VIDEO_FAILED",
"error_message": "The AI voice speaker [Timm] is invalid and is not supported. Please provide valid AI voice speaker."
}
}
{
"message": "Unauthorized"
}
{
"id": "a1d36612-326d-4b81-aece-411f8aed4c71",
"success": false,
"data": {
"error_code": "5000",
"error_message": "JOB_NOT_FOUND"
}
}
Key Response Fields
| Field | Description |
|---|---|
renderParams | The rendering data for the video. To customize the video, modify this data and submit it to the Render Video API. To update the preview with changes, save the modified data using the Update Storyboard Elements API. After saving, the preview URL will reflect the updates. |
storyboard | The processed input storyboard with all scenes resolved. Use this object to submit a new storyboard request with modifications. Re-submissions process faster because the scenes, voices, and visuals have already been resolved. |
previewUrl | URL to view the storyboard preview. Open in a browser or embed in an iframe. Refer to the Embed Preview Player guide for integration details. |
projectUrl | URL to open the saved project in the Pictory web app. Present only when saveProject: true. |
projectId | Unique identifier of the saved project. Use with the Render Project or Get Project by ID APIs. Present only when saveProject: true. |
aiCreditsUsed | Total AI credits consumed for generating AI visuals (images and video clips). Present only when the storyboard includes scenes with aiVisual configuration. |
Code Examples
Replace
YOUR_API_KEY with your actual API key and use the jobId returned from the Create Storyboard Preview endpoint.curl --request GET \
--url 'https://api.pictory.ai/pictoryapis/v1/jobs/a1d36612-326d-4b81-aece-411f8aed4c70' \
--header 'Authorization: YOUR_API_KEY' \
--header 'accept: application/json' | python -m json.tool
import requests
import time
def poll_storyboard_job(api_key, job_id, max_wait=600, poll_interval=15):
"""
Poll for storyboard preview job completion.
Args:
api_key: Your Pictory API key
job_id: The storyboard preview job ID
max_wait: Maximum wait time in seconds (default 10 minutes)
poll_interval: Polling interval in seconds (default 15 seconds)
"""
url = f"https://api.pictory.ai/pictoryapis/v1/jobs/{job_id}"
headers = {
"Authorization": api_key,
"accept": "application/json"
}
start_time = time.time()
while time.time() - start_time < max_wait:
response = requests.get(url, headers=headers)
data = response.json()
if not data.get("success"):
print("Job failed")
return data
status = data.get("data", {}).get("status")
if status == "in-progress":
print(f"Storyboard generation in progress... (elapsed: {int(time.time() - start_time)}s)")
time.sleep(poll_interval)
continue
if status == "completed":
job_data = data["data"]
print("Storyboard preview ready!")
print(f"Preview URL: {job_data.get('previewUrl')}")
print(f"Scenes: {len(job_data.get('storyboard', {}).get('scenes', []))}")
return data
# Unknown status
print(f"Unexpected status: {status}")
return data
print("Timeout waiting for storyboard preview")
return None
# Usage
result = poll_storyboard_job("YOUR_API_KEY", "a1d36612-326d-4b81-aece-411f8aed4c70")
if result and result.get("success"):
data = result["data"]
# Access the preview URL
preview_url = data.get("previewUrl")
print(f"Preview: {preview_url}")
# Access renderParams for customization
render_params = data.get("renderParams")
# Access processed storyboard for re-submission
storyboard = data.get("storyboard")
const jobId = 'a1d36612-326d-4b81-aece-411f8aed4c70';
async function pollStoryboardJob(apiKey, jobId, maxWait = 600000, pollInterval = 15000) {
const url = `https://api.pictory.ai/pictoryapis/v1/jobs/${jobId}`;
const startTime = Date.now();
while (Date.now() - startTime < maxWait) {
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': apiKey,
'accept': 'application/json'
}
});
const data = await response.json();
if (!data.success) {
console.log('Job failed');
return data;
}
const status = data.data?.status;
if (status === 'in-progress') {
console.log(`Storyboard generation in progress... (${Math.round((Date.now() - startTime) / 1000)}s)`);
await new Promise(resolve => setTimeout(resolve, pollInterval));
continue;
}
if (status === 'completed') {
console.log('Storyboard preview ready!');
console.log(`Preview URL: ${data.data.previewUrl}`);
console.log(`Scenes: ${data.data.storyboard?.scenes?.length}`);
return data;
}
console.log(`Unexpected status: ${status}`);
return data;
}
console.log('Timeout waiting for storyboard preview');
return null;
}
// Usage
const result = await pollStoryboardJob('YOUR_API_KEY', jobId);
if (result?.success) {
const { previewUrl, renderParams, storyboard } = result.data;
console.log(`Preview: ${previewUrl}`);
}
<?php
function pollStoryboardJob($apiKey, $jobId, $maxWait = 600, $pollInterval = 15) {
$url = "https://api.pictory.ai/pictoryapis/v1/jobs/{$jobId}";
$startTime = time();
while (time() - $startTime < $maxWait) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $apiKey,
'accept: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if (!$data['success']) {
echo "Job failed\n";
return $data;
}
$status = $data['data']['status'] ?? null;
if ($status === 'in-progress') {
$elapsed = time() - $startTime;
echo "Storyboard generation in progress... ({$elapsed}s)\n";
sleep($pollInterval);
continue;
}
if ($status === 'completed') {
echo "Storyboard preview ready!\n";
echo "Preview URL: " . ($data['data']['previewUrl'] ?? '') . "\n";
echo "Scenes: " . count($data['data']['storyboard']['scenes'] ?? []) . "\n";
return $data;
}
echo "Unexpected status: {$status}\n";
return $data;
}
echo "Timeout waiting for storyboard preview\n";
return null;
}
// Usage
$result = pollStoryboardJob('YOUR_API_KEY', 'a1d36612-326d-4b81-aece-411f8aed4c70');
if ($result && $result['success']) {
$previewUrl = $result['data']['previewUrl'] ?? '';
echo "Preview: {$previewUrl}\n";
}
?>
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"time"
)
func pollStoryboardJob(apiKey, jobID string, maxWait, pollInterval time.Duration) (map[string]interface{}, error) {
url := fmt.Sprintf("https://api.pictory.ai/pictoryapis/v1/jobs/%s", jobID)
startTime := time.Now()
for time.Since(startTime) < maxWait {
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", apiKey)
req.Header.Set("accept", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
body, _ := io.ReadAll(resp.Body)
resp.Body.Close()
var data map[string]interface{}
json.Unmarshal(body, &data)
success, _ := data["success"].(bool)
if !success {
fmt.Println("Job failed")
return data, nil
}
jobData, _ := data["data"].(map[string]interface{})
status, _ := jobData["status"].(string)
if status == "in-progress" {
elapsed := int(time.Since(startTime).Seconds())
fmt.Printf("Storyboard generation in progress... (%ds)\n", elapsed)
time.Sleep(pollInterval)
continue
}
if status == "completed" {
fmt.Println("Storyboard preview ready!")
if previewUrl, ok := jobData["previewUrl"].(string); ok {
fmt.Printf("Preview URL: %s\n", previewUrl)
}
return data, nil
}
fmt.Printf("Unexpected status: %s\n", status)
return data, nil
}
return nil, fmt.Errorf("timeout waiting for storyboard preview")
}
func main() {
result, err := pollStoryboardJob(
"YOUR_API_KEY",
"a1d36612-326d-4b81-aece-411f8aed4c70",
10*time.Minute,
15*time.Second,
)
if err != nil {
fmt.Println("Error:", err)
return
}
if success, ok := result["success"].(bool); ok && success {
data := result["data"].(map[string]interface{})
if previewUrl, ok := data["previewUrl"].(string); ok {
fmt.Printf("Preview: %s\n", previewUrl)
}
}
}
Working with the Completed Response
Customizing and Rendering the Video
After the storyboard preview is ready, the following options are available:Review the Preview
Open the
previewUrl in a browser to review the storyboard preview, including all scenes, visuals, and text overlays.Update Elements (Optional)
To modify scene visuals, text, or other elements, update the
renderParams.elements data and save it using the Update Storyboard Elements API. The preview URL will reflect the saved changes.Render the Final Video
Submit the
renderParams data (modified or as-is) to the Render Video API to produce the final rendered video file.Re-submitting a Modified Storyboard
To change the original storyboard structure (for example, different text, a different voice, or different scenes), use thestoryboard object from the completed response as the request body for a new Create Storyboard Preview request. This approach processes faster because the scenes, voice-over audio, and visual selections have already been resolved.
Polling Best Practices
Use a polling interval of 10–30 seconds when checking job status. Polling too frequently may result in rate limiting.
-
Use webhooks when possible. Configure a
webhookURL in the storyboard request to receive automatic notification when the job completes, rather than polling. - Implement timeouts. Set a maximum wait time. Storyboard previews typically complete within a few minutes, depending on the number of scenes and voice-over generation requirements.
-
Cache results. Once a storyboard job completes, store the
renderParamsandstoryboarddata locally. Completed job data may be cleaned after a retention period.
Was this page helpful?
⌘I
