Skip to main content
POST
/
v1
/
project
/
create
/
script-to-video
Create Script to Video
curl --request POST \
  --url https://b8e35428b2f8.ngrok-free.app/api/v1/project/create/script-to-video \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "script": "Artificial intelligence is transforming the way we work and live. From smart assistants to self-driving cars, AI is everywhere.",
  "voiceId": "confident_voice_id",
  "presetSettings": {
    "mediaType": "ai-images",
    "preset": "realistic",
    "quality": "pro"
  },
  "musicId": "2",
  "aspectRatio": "ratio_9_16",
  "caption": {
    "preset": "beast",
    "alignment": "bottom",
    "disabled": false
  },
  "language": "en",
  "addStickers": true,
  "audio": {
    "speed": 1,
    "stability": 0.5,
    "similarityBoost": 0.75,
    "style": 0,
    "useSpeakerBoost": true
  },
  "webhook": "https://yoursite.com/webhook",
  "metadata": {
    "contentType": "educational",
    "topic": "artificial-intelligence"
  }
}
'
{
  "success": true,
  "data": {
    "videoId": "vid_s2v_abc123xyz",
    "projectId": "proj_s2v_abc123xyz",
    "status": "STARTED"
  },
  "message": "Script to Video successfully created"
}
Try it out! Use the API playground on the right to test the Script to Video endpoint directly.

Overview

Script to Video transforms your written scripts into engaging videos with voice narration and auto-generated or custom media. This format is ideal for:
  • Educational content and tutorials
  • Social media content creation
  • Marketing videos
  • Storytelling and narrative content
  • News-style videos
Script to Video automatically generates visuals based on your script or allows you to provide custom media for full creative control.

Endpoint

POST /v1/project/create/script-to-video

Required Fields

script
string
required
The script for the video narration (1-10,000 characters). This will be converted to speech and synchronized with visuals.
voiceId
string
required
Voice ID from /v1/voice/list. The voice used for narrating the script.
presetSettings
object
required
Settings for auto-generated media (used when media is not provided)
caption
object
required
Caption settings for the video
aspectRatio
string
required
Video aspect ratio:
  • ratio_9_16: Vertical (TikTok, Reels, Shorts) - Recommended
  • ratio_16_9: Horizontal (YouTube)
  • ratio_1_1: Square (Instagram)
language
string
required
Language code for the video (2 characters). Example: en, es

Optional Fields

name
string
Video name (max 100 characters)
musicId
string
Music ID from /v1/music/list for background music.
media
array
Custom media items (max 50). If not provided, media will be auto-generated based on presetSettings.
gameplaySettings
object
Settings for gameplay footage (when presetSettings.mediaType is gameplay)
audio
object
Voice audio settings
addStickers
boolean
default:"false"
Enable automatic sticker generation for the video. Adds engaging visual elements automatically.
webhook
string
HTTPS URL to receive completion notification (max 500 characters). Highly recommended for production use.
metadata
object
Custom metadata object (max 5KB). Store any additional data you need to associate with this video.
{
  "campaignId": "summer2024",
  "contentType": "educational"
}

Request Examples

With AI-Generated Images

const response = await fetch('https://api.tryhooked.ai/v1/project/create/script-to-video', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.HOOKED_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    script: 'Artificial intelligence is transforming the way we work and live. From smart assistants to self-driving cars, AI is everywhere.',
    voiceId: 'confident_voice_id',
    presetSettings: {
      mediaType: "ai-images",
      preset: "realistic",
      quality: "pro"
    },
    musicId: "2",
    aspectRatio: 'ratio_9_16',
    caption: {
      preset: 'beast',
      alignment: 'bottom',
      disabled: false
    },
    language: 'en',
    addStickers: true,
    audio: {
      speed: 1,
      stability: 0.5,
      similarityBoost: 0.75,
      style: 0,
      useSpeakerBoost: true
    },
    webhook: 'https://yoursite.com/webhook',
    metadata: {
      contentType: 'educational',
      topic: 'artificial-intelligence'
    }
  })
});

const data = await response.json();
console.log('Video ID:', data.data.videoId);
console.log('Project ID:', data.data.projectId);

With AI-Generated Videos

const createAIImageVideo = async () => {
  const response = await fetch('https://api.tryhooked.ai/v1/project/create/script-to-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'AI Technology Explainer',
      script: 'Artificial intelligence is transforming the way we work and live. From smart assistants to self-driving cars, AI is everywhere. Let\'s explore how this technology is shaping our future.',
      voiceId: 'confident_voice_id',
      presetSettings: {
        mediaType: 'ai-videos',
        preset: 'anime',
        quality: 'base'
      },
      musicId: 'music_ambient_01',
      aspectRatio: 'ratio_9_16',
      caption: {
        preset: 'modern',
        alignment: 'bottom',
        disabled: false
      },
      language: 'en',
      addStickers: true,
      audio: {
        speed: 1,
        stability: 0.5,
        similarityBoost: 0.75,
        style: 0,
        useSpeakerBoost: true
      },
      webhook: 'https://yoursite.com/webhook',
      metadata: {
        contentType: 'educational',
        topic: 'artificial-intelligence'
      }
    })
  });

  return await response.json();
};

With Custom Media

const createCustomMediaVideo = async () => {
  const response = await fetch('https://api.tryhooked.ai/v1/project/create/script-to-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Product Showcase',
      script: 'Introducing our revolutionary new product. It\'s designed to make your life easier and more productive. Watch as we demonstrate its incredible features.',
      voiceId: 'enthusiastic_voice_id',
      media: [
        {
          id: 'intro_shot',
          type: 'video',
          title: 'Product Intro',
          url: 'https://your-cdn.com/intro.mp4',
          durationInFrames: 150,
          isAIGenerated: true
        },
        {
          id: 'demo_shot',
          type: 'video',
          title: 'Product Demo',
          url: 'https://your-cdn.com/demo.mp4',
          durationInFrames: 200,
          isAIGenerated: false
        },
        {
          id: 'feature_image',
          type: 'image',
          title: 'Feature Highlight',
          url: 'https://your-cdn.com/feature.jpg',
          durationInFrames: 75,
          isAIGenerated: false
        }
      ],
      musicId: 'music_upbeat_01',
      aspectRatio: 'ratio_9_16',
      caption: {
        preset: 'wrap1',
        alignment: 'bottom',
        disabled: false
      },
      presetSettings: {
        mediaType: 'media'
      },
      language: 'en',
      addStickers: true,
      audio: {
        speed: 1,
        stability: 0.5,
        similarityBoost: 0.75,
        style: 0,
        useSpeakerBoost: true
      },
      webhook: 'https://yoursite.com/webhook',
      metadata: {
        contentType: 'educational',
        topic: 'artificial-intelligence'
      }
    })
  });

  return await response.json();
};

With Gameplay

const createGamingVideo = async () => {
  const response = await fetch('https://api.tryhooked.ai/v1/project/create/script-to-video', {
    method: 'POST',
    headers: {
      'x-api-key': process.env.HOOKED_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Gaming Tips Video',
      script: 'Want to level up your gaming skills? Here are three pro tips that will help you dominate your opponents. Tip one: always check your surroundings...',
      voiceId: 'energetic_voice_id',
      presetSettings: {
        mediaType: 'gameplay'
      },
      gameplaySettings: {
        selectedGame: 'minecraft',
        selectedVideo: 'minecraft-1'
      },
      musicId: 'music_upbeat_01',
      aspectRatio: 'ratio_9_16',
      caption: {
        preset: 'beast',
        alignment: 'top',
        disabled: false
      },
      language: 'en',
      addStickers: true,
      audio: {
        speed: 1,
        stability: 0.5,
        similarityBoost: 0.75,
        style: 0,
        useSpeakerBoost: true
      },
      webhook: 'https://yoursite.com/webhook',
      metadata: {
        contentType: 'educational',
        topic: 'artificial-intelligence'
      }
    })
  });

  return await response.json();
};

Response

{
  "success": true,
  "data": {
    "videoId": "vid_s2v_abc123xyz",
    "projectId": "proj_s2v_abc123xyz",
    "status": "STARTED"
  },
  "message": "Script to Video successfully created"
}

Webhook Notification

When your video is ready, we’ll POST to your webhook URL:
Webhook Payload
{
  "status": "COMPLETED",
  "data": {
    "videoId": "vid_s2v_abc123xyz",
    "status": "COMPLETED",
    "url": "https://cdn.tryhooked.ai/videos/abc123xyz.mp4",
    "shareUrl": "https://cdn.tryhooked.ai/shared/abc123xyz.mp4",
    "metadata": {
      "projectId": "proj_s2v_abc123xyz",
      "productId": "PROD-001"
    }
  },
  "message": "Video completed"
}
Your webhook endpoint must return a 200 status code. We’ll retry up to 3 times if the request fails.

Media Types

Available media types for presetSettings.mediaType:
TypeDescription
ai-imagesAI-generated images based on your script content
ai-videosAI-generated video clips synchronized with narration
mediaStock media automatically selected based on script
gameplayGameplay footage from popular games

Caption Presets

Available caption presets for the caption.preset field:
PresetDescription
defaultDefault caption style with bold text and shadow effects
beastBold uppercase style with Komika font
umiYellow glowing text style
tiktokViral & trendy style, perfect for social media
wrap1Wrapped style with red background highlight
wrap2Wrapped style with blue background highlight (uppercase)
arielBold uppercase style with purple highlight
hookedBrand style with purple background
classicClean, simple captions with black background
activeGreen background with bold text
bubbleWhite background bubble style
glassGlassmorphic transparency effect
comicComic Sans font with colorful style
glowPink and orange glow effects
pastelSoft pastel pink background
neonGreen neon glow effect
retroTVRetro TV style with cyan glow
redRed glow effect with white text
markerYellow marker/highlighter style
modernContemporary white background style
blueBlue background style
vividVibrant pink background with uppercase text

Best Practices

Write Clear Scripts

Structure your script with clear sentences and natural pauses for better pacing.

Choose the Right Media Type

Use ai-images for educational content, gameplay for gaming, custom media for brands.

Match Voice to Content

Choose a voice that fits your content tone - energetic for gaming, professional for business.

Use Webhooks

Always use webhooks in production instead of polling for video status.

Error Handling

ErrorDescriptionSolution
script: Script is requiredMissing or empty scriptAdd the script field with your content
voiceId: Voice not foundInvalid voice IDUse a valid voice ID from /v1/voice/list
presetSettings.preset: Preset is requiredMissing preset when using auto-generated mediaAdd the preset field in presetSettings
webhook: Must be a valid HTTPS URLInvalid webhook URLEnsure webhook URL starts with https://
media: Cannot have more than 50 media itemsToo many media itemsReduce media array to 50 items or fewer
Not enough creditsInsufficient creditsTop up your account credits

Next Steps

Authorizations

x-api-key
string
header
required

Body

application/json
script
string
required

The script for the video narration (1-10,000 characters)

Required string length: 1 - 10000
voiceId
string
required

Voice ID from /v1/voice/list

Maximum string length: 30
presetSettings
object
required

Settings for auto-generated media

caption
object
required
aspectRatio
enum<string>
required

Video aspect ratio

Available options:
ratio_9_16,
ratio_16_9,
ratio_1_1
language
enum<string>
required

Language code (2 characters)

Available options:
en,
es
Required string length: 2
name
string

Video name (max 100 characters)

Maximum string length: 100
musicId
string

Music ID from /v1/music/list for background music

Maximum string length: 30
media
object[]

Custom media items (max 50). If not provided, media will be auto-generated.

Maximum array length: 50
gameplaySettings
object

Settings for gameplay footage

audio
object

Voice audio settings

addStickers
boolean
default:false

Enable automatic sticker generation for the video

webhook
string

HTTPS URL to receive completion notification

Maximum string length: 500
metadata
object

Custom metadata object (max 5KB)

Response

Script to Video created successfully

success
boolean
data
object
message
string