Quickstart
This guide will get you all set up and ready to use the Video Jungle API. We'll cover how to get started using one of our API clients and how to make your first API request.
Before you can make requests to the Video Jungle API, you will need to grab your API key from your dashboard. You find it under Settings.
Choose your client
Before making your first API request, you need to pick which API client you will use.
# Install the Protocol Python SDK
pip install videojungle
Generating your first Video
After picking your preferred client, you are ready to make your first call to the Protocol API. Below, you can see how to send a GET request to the Conversations endpoint to get a list of all your conversations. In the cURL example, results are limited to ten conversations, the default page length for each client.
from videojungle import ApiClient
import os
# Assumes you've set your API key as an environment variable
VJ_API_KEY = os.environ['VJ_API_KEY']
# Initialize API client
vj = ApiClient(token=VJ_API_KEY)
# Define your video generation task, along with variables to pass on generation
prompt = vj.prompts.generate(task="a horoscope reader who wants to leave the person excited about their future",
parameters=["zodiac sign", "lucky number", "date"])
# Alternatively, create your own prompt:
# prompt = vj.prompts.create(prompt="generate a horoscope for ${ZODIAC SIGN}, with lucky number ${LUCKY NUMBER} on ${DATE}",
# parameters=["ZODIAC SIGN", "LUCKY NUMBER", "DATE"], name="Horoscope Reader", task="a horoscope generator",
# persona="A psychic squid who sees into the future")
# Print out the generated prompt
print(prompt.value)
# Create a project to hold generated files, using our prompt we've generated
project = vj.projects.create(name="First Project", description="My first project", prompt_id=prompt.id)
# Get first script for the generation process
# (Scripts define the video generation method from a prompt)
script = project.scripts[0]
script_id = script.id
# Print out parameters required for generation
print(project.prompts[0]['parameters'])
# Generate a video from our created prompt with dynamic variables
video = vj.projects.generate(script_id=script_id,
project_id=project.id,
parameters={"zodiac sign": "Aries",
"lucky number": "7",
"date": "September 3, 2024"})
print(video)
# Get the video file ID from the generated video
asset_id = video["asset_id"]
# Save the video file to disk, automatically waits for generation
print(f"Generating video with asset id: {asset_id}")
video_file = vj.assets.download(asset_id, "generated_horoscope.mp4")
print(f"Video generated and saved to: {video_file}")
What's next?
Great, you're now set up with an API client and have generated your first Video. Here are a few links that might be handy as you venture further into the Video Jungle API: