Generate Video
curl --request POST \
--url https://api.pictory.ai/pictoryapis/v1/aistudio/videos \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"aspectRatio": "<string>",
"duration": "<string>",
"audio": true,
"firstFrameImageUrl": "<string>",
"endFrameImageUrl": "<string>",
"extendVideoUrl": "<string>",
"referenceImageUrls": [
{}
],
"trainingPreset": "<string>",
"enhancePrompt": true,
"resolution": "<string>",
"webhook": "<string>"
}
'import requests
url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
payload = {
"prompt": "<string>",
"model": "<string>",
"aspectRatio": "<string>",
"duration": "<string>",
"audio": True,
"firstFrameImageUrl": "<string>",
"endFrameImageUrl": "<string>",
"extendVideoUrl": "<string>",
"referenceImageUrls": [{}],
"trainingPreset": "<string>",
"enhancePrompt": True,
"resolution": "<string>",
"webhook": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
prompt: '<string>',
model: '<string>',
aspectRatio: '<string>',
duration: '<string>',
audio: true,
firstFrameImageUrl: '<string>',
endFrameImageUrl: '<string>',
extendVideoUrl: '<string>',
referenceImageUrls: [{}],
trainingPreset: '<string>',
enhancePrompt: true,
resolution: '<string>',
webhook: '<string>'
})
};
fetch('https://api.pictory.ai/pictoryapis/v1/aistudio/videos', 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/aistudio/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model' => '<string>',
'aspectRatio' => '<string>',
'duration' => '<string>',
'audio' => true,
'firstFrameImageUrl' => '<string>',
'endFrameImageUrl' => '<string>',
'extendVideoUrl' => '<string>',
'referenceImageUrls' => [
[
]
],
'trainingPreset' => '<string>',
'enhancePrompt' => true,
'resolution' => '<string>',
'webhook' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pictory.ai/pictoryapis/v1/aistudio/videos")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/aistudio/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"jobId": "4a09edf9-d071-4847-bda5-8dea913d80fe"
}
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "prompt",
"errors": "prompt is required"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "extendVideoUrl",
"errors": "extendVideoUrl is not allowed"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "audio",
"errors": "The selected model does not support audio generation"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "duration",
"errors": "duration must be one of the allowed values for the selected model when referenceImageUrls are provided: [8s]"
}
]
}
{
"message": "Unauthorized"
}
{
"message": "Internal Server Error"
}
AI Studio
Generate Video
Generate an AI video from a text prompt using a selection of AI video models
POST
/
pictoryapis
/
v1
/
aistudio
/
videos
Generate Video
curl --request POST \
--url https://api.pictory.ai/pictoryapis/v1/aistudio/videos \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"prompt": "<string>",
"model": "<string>",
"aspectRatio": "<string>",
"duration": "<string>",
"audio": true,
"firstFrameImageUrl": "<string>",
"endFrameImageUrl": "<string>",
"extendVideoUrl": "<string>",
"referenceImageUrls": [
{}
],
"trainingPreset": "<string>",
"enhancePrompt": true,
"resolution": "<string>",
"webhook": "<string>"
}
'import requests
url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
payload = {
"prompt": "<string>",
"model": "<string>",
"aspectRatio": "<string>",
"duration": "<string>",
"audio": True,
"firstFrameImageUrl": "<string>",
"endFrameImageUrl": "<string>",
"extendVideoUrl": "<string>",
"referenceImageUrls": [{}],
"trainingPreset": "<string>",
"enhancePrompt": True,
"resolution": "<string>",
"webhook": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
prompt: '<string>',
model: '<string>',
aspectRatio: '<string>',
duration: '<string>',
audio: true,
firstFrameImageUrl: '<string>',
endFrameImageUrl: '<string>',
extendVideoUrl: '<string>',
referenceImageUrls: [{}],
trainingPreset: '<string>',
enhancePrompt: true,
resolution: '<string>',
webhook: '<string>'
})
};
fetch('https://api.pictory.ai/pictoryapis/v1/aistudio/videos', 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/aistudio/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model' => '<string>',
'aspectRatio' => '<string>',
'duration' => '<string>',
'audio' => true,
'firstFrameImageUrl' => '<string>',
'endFrameImageUrl' => '<string>',
'extendVideoUrl' => '<string>',
'referenceImageUrls' => [
[
]
],
'trainingPreset' => '<string>',
'enhancePrompt' => true,
'resolution' => '<string>',
'webhook' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pictory.ai/pictoryapis/v1/aistudio/videos")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v1/aistudio/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"prompt\": \"<string>\",\n \"model\": \"<string>\",\n \"aspectRatio\": \"<string>\",\n \"duration\": \"<string>\",\n \"audio\": true,\n \"firstFrameImageUrl\": \"<string>\",\n \"endFrameImageUrl\": \"<string>\",\n \"extendVideoUrl\": \"<string>\",\n \"referenceImageUrls\": [\n {}\n ],\n \"trainingPreset\": \"<string>\",\n \"enhancePrompt\": true,\n \"resolution\": \"<string>\",\n \"webhook\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"jobId": "4a09edf9-d071-4847-bda5-8dea913d80fe"
}
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "prompt",
"errors": "prompt is required"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "extendVideoUrl",
"errors": "extendVideoUrl is not allowed"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "audio",
"errors": "The selected model does not support audio generation"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "duration",
"errors": "duration must be one of the allowed values for the selected model when referenceImageUrls are provided: [8s]"
}
]
}
{
"message": "Unauthorized"
}
{
"message": "Internal Server Error"
}
Overview
The Generate Video API creates an AI-generated video based on a text prompt. You can choose from multiple AI video models, specify an aspect ratio and duration, generate synchronized audio, and optionally provide a first frame image (with an optional end frame for a transition), a video to extend, or reference images to guide the output. The API returns a job ID that you can use to poll for the result once the video generation is complete.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
POST https://api.pictory.ai/pictoryapis/v1/aistudio/videos
Request Headers
string
required
API key for authentication (starts with
pictai_)Authorization: YOUR_API_KEY
string
required
Must be
application/jsonRequest Body
string
required
A text description of the video you want to generate. The prompt must be between 5 and 5,000 characters.Example:
"A drone flying over a lush green forest with sunlight filtering through the canopy"string
The AI model to use for video generation. Each model offers different quality levels, durations, aspect ratios, and features. Defaults to
Feature Support by Model:
pixverse5.6 if not specified.Supported models: pixverse6, pixverse5.6, veo3.1, veo3.1_fast, omni-flashModel Capabilities and Pricing:| Model | Supported Aspect Ratios | Supported Durations | AI Credits per Second | With Audio |
|---|---|---|---|---|
pixverse6 | 16:9, 4:3, 1:1, 3:4, 9:16, 2:3, 3:2, 21:9 | 5s, 8s, 10s, 15s | 2.7 | 3.7 |
pixverse5.6 | 16:9, 9:16, 1:1, 3:4, 4:3 | 5s, 8s, 10s | 1.6 | 2.1 |
veo3.1 | 16:9, 9:16 | 4s, 6s, 8s | 20 | 40 |
veo3.1_fast | 16:9, 9:16 | 4s, 6s, 8s | 10 | 15 |
omni-flash | 16:9, 9:16 | 10s | 13 (audio always included) | 13 |
| Model | Reference Images | First Frame | First + End Frame | Extend | Audio |
|---|---|---|---|---|---|
pixverse6 | Up to 4 | Yes | Yes | Yes | Optional |
pixverse5.6 | Up to 4 | Yes | Yes | No | Optional |
veo3.1 | Up to 3 (8s only) | Yes | No | Yes (fixed 7s) | Optional |
veo3.1_fast | Up to 3 (8s only) | Yes | No | Yes (fixed 7s) | Optional |
omni-flash | 1 | Yes | No | No | Always on |
pixverse5.6 is the budget option: the same durations and aspect ratios as before at the lowest rate. pixverse6 adds 15s, wide and portrait ratios such as 21:9 and 2:3, and video extension. Requests that still send the retired pixverse5.5 are served and billed as pixverse5.6; validation still runs against the pixverse5.5 entry, so send pixverse5.6 to use audio.string
The aspect ratio for the generated video. The available values depend on the selected model. Defaults to
16:9. Refer to the model table above for supported aspect ratios per model. An extension (extendVideoUrl) or a transition (firstFrameImageUrl with endFrameImageUrl) follows the source video or the frames, so the field has no effect there.string
The duration of the generated video. The available values depend on the selected model. Defaults to the shortest duration of the chosen model (
5s on Pixverse, 4s on Veo, 10s on omni-flash). Refer to the model table above for supported durations per model.Two situations narrow the list:- Reference images on Veo:
veo3.1andveo3.1_fastgenerate8svideos whenreferenceImageUrlsis provided. Any other value is rejected, and the default becomes8s. - Extending on Veo: the continuation is a fixed
7s, so7sis the only accepted value and the default.
boolean
Generate synchronized audio (ambient sound, effects, and speech implied by the prompt) with the video. Defaults to
false. Audio is billed at the model’s “With Audio” rate shown in the table above, per second of video.omni-flash always produces audio and cannot be muted: the field defaults to true for that model, and sending audio: false is rejected with a 400 validation error.Setting
audio: true on a model that does not support audio returns a 400 validation error.string
An optional URL of an image to use as the first frame of the video. This guides the visual starting point for the generation. The URL must be a valid, publicly accessible URI.
This parameter cannot be used together with
extendVideoUrl or referenceImageUrls.string
An optional URL of an image the video should end on. Requires
firstFrameImageUrl: the model generates a transition that starts on the first frame and ends on this one. Supported by pixverse6 and pixverse5.6. The URL must be a valid, publicly accessible URI.This is the end frame you supply as input. The lastFrameImageUrl returned on completed jobs is the last frame extracted from the generated video, which you can feed into a follow-up request.Sending
endFrameImageUrl without firstFrameImageUrl, or on a model without first and end frame support, returns a 400 validation error.string
An optional URL of an existing video to extend. The AI model will generate additional content that continues from the end of the provided video. The URL must be a valid, publicly accessible
http or https URI. Supported by pixverse6, veo3.1, and veo3.1_fast; the default model for an extension request is pixverse6.On veo3.1 and veo3.1_fast the continuation is a fixed 7s, and the delivered file contains the source video followed by the new segment. On pixverse6 the duration you request is the length of the new segment.This parameter cannot be used together with
firstFrameImageUrl, endFrameImageUrl, or referenceImageUrls.array
An optional array of image URLs to use as visual references for the generated video. The AI model uses these images to keep subjects, objects, or styles consistent in the output. Each URL must be a valid, publicly accessible URI.The maximum number of references depends on the model: up to 4 on
pixverse6 and pixverse5.6, up to 3 on veo3.1 and veo3.1_fast, and 1 on omni-flash. Sending more than the model allows returns a 400 validation error.On pixverse6 and pixverse5.6 you can name each reference in the prompt as @subject1, @subject2, and so on, in array order. References you do not mention are appended to the prompt automatically.This parameter cannot be used together with
firstFrameImageUrl or extendVideoUrl. On veo3.1 and veo3.1_fast, reference images require an 8s duration.string
Steer the generation toward a training-content use case. The preset is a fixed directive applied during prompt enhancement, so sending it always turns enhancement on, even when
enhancePrompt is false. Supported values: sales-training, product-training, soft-skills-training.boolean
Whether Pictory rewrites your prompt with an AI enhancer before generation, adding cinematic and compositional detail. Off by default: your prompt goes to the model exactly as written. Set to
true to enhance it. Sending a trainingPreset always turns enhancement on, even when enhancePrompt is false. When enhancement runs, the completed job returns the rewritten text as enhancedPrompt.string
Output resolution:
"1080p" (default) or "720p". Without it, you get the highest resolution the model supports. The model delivers the highest it supports up to this value: omni-flash is always 720p, pixverse6 at 15s is 720p, and Veo is 1080p at 8s only. Credits do not change with resolution.string
An optional webhook URL that will receive a notification when the video generation job completes. The URL must be a valid URI.
Response
Success Response (200)
boolean
true when the job has been created successfullyobject
string
The unique identifier (UUID) of the video generation job. Use this ID to poll for the result using the Get Video Generation Job endpoint.
Response Examples
{
"success": true,
"data": {
"jobId": "4a09edf9-d071-4847-bda5-8dea913d80fe"
}
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "prompt",
"errors": "prompt is required"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "extendVideoUrl",
"errors": "extendVideoUrl is not allowed"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "audio",
"errors": "The selected model does not support audio generation"
}
]
}
{
"code": "INVALID_REQUEST_BODY",
"message": "Request body validation failed.",
"fields": [
{
"name": "duration",
"errors": "duration must be one of the allowed values for the selected model when referenceImageUrls are provided: [8s]"
}
]
}
{
"message": "Unauthorized"
}
{
"message": "Internal Server Error"
}
Status Codes
| Status Code | Description |
|---|---|
| 200 | Job created successfully. Use the returned jobId to poll for the result. |
| 400 | Invalid request body. Check the fields array for specific validation errors. This also occurs when mutually exclusive parameters are used together. |
| 401 | Unauthorized. The API key in the Authorization header is missing or invalid. |
| 500 | Internal server error. Retry the request after a brief delay. |
Output Resolution
Every video is delivered at the highest resolution its model supports; there is no quality parameter to set. For 1080p that is 1920×1080 for16:9, 1080×1920 for 9:16, and the matching 1080-pixel size for the other ratios.
| Model | Maximum | Delivered at 720p when |
|---|---|---|
pixverse6 | 1080p | duration is 15s |
pixverse5.6 | 1080p | Never |
veo3.1, veo3.1_fast | 1080p | duration is 4s or 6s, or the request is an extension |
omni-flash | 720p | Always (the model’s maximum) |
maxResolution per model. The width and height on the completed job always report the delivered size. Credits do not depend on resolution.
Parameter Exclusivity
ThefirstFrameImageUrl, extendVideoUrl, and referenceImageUrls parameters are mutually exclusive. You may use only one of these in a single request. Providing more than one will result in a 400 validation error. endFrameImageUrl is the one addition: it is only valid alongside firstFrameImageUrl. audio, trainingPreset, and enhancePrompt can be combined with any of them.
| Parameter | Can be combined with |
|---|---|
firstFrameImageUrl | endFrameImageUrl, prompt, model, aspectRatio, duration, audio, trainingPreset, enhancePrompt, webhook |
endFrameImageUrl | firstFrameImageUrl (required), prompt, model, aspectRatio, duration, audio, trainingPreset, enhancePrompt, webhook |
extendVideoUrl | prompt, model, aspectRatio, duration, audio, trainingPreset, enhancePrompt, webhook |
referenceImageUrls | prompt, model, aspectRatio, duration, audio, trainingPreset, enhancePrompt, webhook |
Code Examples
Replace
YOUR_API_KEY with your actual API key from the API Access page.curl --request POST \
--url 'https://api.pictory.ai/pictoryapis/v1/aistudio/videos' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "A drone flying over a lush green forest with sunlight filtering through the canopy",
"model": "pixverse6",
"aspectRatio": "16:9",
"duration": "8s",
"audio": true
}'
import requests
url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
headers = {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"prompt": "A drone flying over a lush green forest with sunlight filtering through the canopy",
"model": "pixverse6",
"aspectRatio": "16:9",
"duration": "8s",
"audio": True
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
if data.get("success"):
job_id = data["data"]["jobId"]
print(f"Video generation job created: {job_id}")
else:
print(f"Error: {data}")
const url = 'https://api.pictory.ai/pictoryapis/v1/aistudio/videos';
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: 'A drone flying over a lush green forest with sunlight filtering through the canopy',
model: 'pixverse6',
aspectRatio: '16:9',
duration: '8s',
audio: true
})
});
const data = await response.json();
if (data.success) {
console.log(`Video generation job created: ${data.data.jobId}`);
} else {
console.log('Error:', data);
}
<?php
$url = "https://api.pictory.ai/pictoryapis/v1/aistudio/videos";
$payload = json_encode([
"prompt" => "A drone flying over a lush green forest with sunlight filtering through the canopy",
"model" => "pixverse6",
"aspectRatio" => "16:9",
"duration" => "8s",
"audio" => true
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: YOUR_API_KEY',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($data['success']) {
echo "Video generation job created: " . $data['data']['jobId'] . "\n";
} else {
echo "Error: " . json_encode($data) . "\n";
}
?>
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v1/aistudio/videos"
payload := map[string]interface{}{
"prompt": "A drone flying over a lush green forest with sunlight filtering through the canopy",
"model": "pixverse6",
"aspectRatio": "16:9",
"duration": "8s",
"audio": true,
}
jsonPayload, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
req.Header.Set("Authorization", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]interface{}
json.Unmarshal(body, &data)
if success, ok := data["success"].(bool); ok && success {
jobData := data["data"].(map[string]interface{})
fmt.Printf("Video generation job created: %s\n", jobData["jobId"])
} else {
fmt.Println("Error:", string(body))
}
}
Next Steps
After receiving thejobId, poll for the video generation result using the Get Video Generation Job endpoint. Use a polling interval of 10–30 seconds to check the job status.Was this page helpful?
