POST
/
api
/
ai_shorts
/
preview
curl --request POST \
  --url https://api.creatify.ai/api/ai_shorts/preview/ \
  --header 'Content-Type: application/json' \
  --header 'X-API-ID: <api-key>' \
  --header 'X-API-KEY: <api-key>' \
  --data '{
  "aspect_ratio": "9x16",
  "script": "<string>",
  "style": "4K realistic",
  "accent": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "caption_setting": {
    "style": "normal-black",
    "offset": {
      "x": 0,
      "y": 0.4
    },
    "font_family": "Montserrat",
    "font_size": 70,
    "font_style": "font-bold",
    "background_color": "<string>",
    "text_color": "<string>",
    "highlight_text_color": "<string>",
    "max_width": 123,
    "line_height": 123,
    "text_shadow": "<string>",
    "hidden": false
  },
  "background_music_url": "<string>",
  "background_music_volume": 0.5,
  "voiceover_volume": 0.5,
  "webhook_url": "<string>"
}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "media_job": "<string>",
  "status": "pending",
  "video_output": "<string>",
  "preview": "<string>",
  "credits_used": 123,
  "is_hidden": true,
  "progress": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "permission_type": "private",
  "name": "<string>",
  "script": "<string>",
  "aspect_ratio": "9x16",
  "style": "4K realistic",
  "created_from_api": true,
  "caption_setting": "<any>",
  "background_music_url": "<string>",
  "background_music_volume": 0.5,
  "voiceover_volume": 0.5,
  "webhook_url": "<string>",
  "user": 123,
  "workspace": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "accent": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Queue a preview generation task

Generate a preview of AI Shorts video.

import requests

url = "https://api.creatify.ai/api/ai_shorts/preview/"

payload = {
    "script": "Meet the Tesla Model X, where cutting-edge technology meets unparalleled performance. Designed with luxury and comfort in mind, the Model X offers a driving experience like no other.",
    "aspect_ratio": "9x16",
    "style": "4K realistic"
}
headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

Check preview status

Now our AI model is generating preview of AI Shorts video. It will return a id of the AI Shorts video. Then you can check the preview status of your video by sending a GET request to Get AI Shorts video by id endpoint.

import requests

url = "https://api.creatify.ai/api/ai_shorts/{id}/"

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

Once the preview of AI Shorts video is generated, there will be data in preview field. Then you can render the video by sending a POST request to Render a AI Shorts video endpoint.

Render the video

import requests

url = "https://api.creatify.ai/api/ai_shorts/{id}/render/"

payload = {}

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

Check render status

import requests

url = "https://api.creatify.ai/api/ai_shorts/{id}/"

headers = {
    "X-API-ID": "<your-x-api-id>",
    "X-API-KEY": "<your-x-api-key>"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

You will find the status to be done when finished. Meanwhile you can find the video output in video_output field.

Authorizations

X-API-ID
string
header
required

API ID, from your settings page.

X-API-KEY
string
header
required

API Key, from your settings page.

Body

aspect_ratio
enum<string>
required
  • 9x16 - 9X16
  • 16x9 - 16X9
  • 1x1 - 1X1
Available options:
9x16,
16x9,
1x1
script
string
required
style
enum<string>
required
  • 4K realistic - _4K_REALISTIC
  • 3D - _3D
  • Cinematic - CINEMATIC
  • Cartoonish - CARTOONISH
  • Line art - LINE_ART
  • Pixel art - PIXEL_ART
  • Mysterious - MYSTERIOUS
  • Steam punk - STEAM_PUNK
  • Collage - COLLAGE
  • Kawaii - KAWAII
Available options:
4K realistic,
3D,
Cinematic,
Cartoonish,
Line art,
Pixel art,
Mysterious,
Steam punk,
Collage,
Kawaii
accent
string | null

Accent to be used for the video, default null and default voice will be used

caption_setting
object

Caption setting, default null and default caption setting will be used

background_music_url
string | null

Background music URL for the video. Default is null, video will use random music.

Maximum length: 255
background_music_volume
number | null

Volume of the background music, ranging from 0.0 to 1.0. Default is null, video will use default music volume of visual_style.

Required range: 0 <= x <= 1
voiceover_volume
number | null

Volume of the voiceover, ranging from 0.0 to 1.0. Default is null, video will use default voiceover volume of visual_style.

Required range: 0 <= x <= 1
webhook_url
string | null

Webhook URL for status updates. Default is null.

Maximum length: 200

Response

200 - application/json
id
string
required
media_job
string | null
required
status
enum<string>
required
  • pending - Pending
  • in_queue - In Queue
  • running - Running
  • failed - Failed
  • done - Done
  • rejected - Rejected
Available options:
pending,
in_queue,
running,
failed,
done,
rejected
video_output
string | null
required
preview
string | null
required
credits_used
integer
required

Credits used in this api call

is_hidden
boolean
required
progress
number
required
created_at
string
required
updated_at
string
required
permission_type
enum<string>
required
  • private - Private
  • workspace - Workspace
  • public - Public
Available options:
private,
workspace,
public
user
integer | null
required
workspace
string | null
required
name
string
Maximum length: 255
script
string | null

Text to be converted to video

aspect_ratio

Aspect ratio of the video

  • 9x16 - 9X16
  • 16x9 - 16X9
  • 1x1 - 1X1
Available options:
9x16,
16x9,
1x1
style

Style to be used for the video

  • 4K realistic - _4K_REALISTIC
  • 3D - _3D
  • Cinematic - CINEMATIC
  • Cartoonish - CARTOONISH
  • Line art - LINE_ART
  • Pixel art - PIXEL_ART
  • Mysterious - MYSTERIOUS
  • Steam punk - STEAM_PUNK
  • Collage - COLLAGE
  • Kawaii - KAWAII
Available options:
4K realistic,
3D,
Cinematic,
Cartoonish,
Line art,
Pixel art,
Mysterious,
Steam punk,
Collage,
Kawaii
created_from_api
boolean

Flow is created from api or not

caption_setting
any | null

Caption setting, default null and default caption setting will be used

background_music_url
string | null

Background music URL for the video. Default is null, video will use random music.

Maximum length: 255
background_music_volume
number | null

Volume of the background music, ranging from 0.0 to 1.0. Default is null, video will use default music volume of visual_style.

Required range: 0 <= x <= 1
voiceover_volume
number | null

Volume of the voiceover, ranging from 0.0 to 1.0. Default is null, video will use default voiceover volume of visual_style.

Required range: 0 <= x <= 1
webhook_url
string | null

Webhook URL for status updates. Default is null.

Maximum length: 200
accent
string | null

Accent to be used for the video, default null and default voice will be used