Code examples
View as MarkdownThis page has one program, in nine languages, that makes a video. Set your key and run it to get hello.mp4.
For whole apps built on the API, see the creative dashboard, the live ad builder and sheet to videos.
Before you run it
The program needs your API key, and reads it from the BLITFRAME_API_KEY environment variable. To create a key, see Get an API key. Most projects keep the key in a .env file and load that file the way the project usually does. Without a .env setup, set the key in the terminal you run the program from:
export BLITFRAME_API_KEY=blitframe_...
If the render fails, the program stops with the API's error code and message. Errors says what each code means.
The program
The program:
- Creates a project. A project holds a composition, its files and every version of them.
- Adds a composition, the
data.jsonfile that describes the video's layers and how they move. This one is a 3-second intro for a coffee shop: its name slides in, a cup pops in and a tagline fades in. - Renders the project as an MP4 and waits until the render finishes.
- Downloads the video and saves it as
hello.mp4.
This is the video it makes:

Pick your language. The comment at the top of each program says what it needs and how to run it.
# Needs curl and jq. Save as render.sh and run: bash render.sh
set -euo pipefail
BLITFRAME="${BLITFRAME:-https://blitframe.codeartworks.com/v1}"
COMPOSITION=$(cat <<'JSON'
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
JSON
)
PROJECT_ID=$(curl -s -X POST $BLITFRAME/projects \
-H "Authorization: Bearer $BLITFRAME_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Morning Beans"}' | jq -r .id)
VERSION=$(jq -n --arg content "$COMPOSITION" \
'{message: "First version", files: [{path: "data.json", content: $content}]}' \
| curl -s -X POST $BLITFRAME/projects/$PROJECT_ID/versions \
-H "Authorization: Bearer $BLITFRAME_API_KEY" \
-H "Content-Type: application/json" \
-d @-)
if [ "$(echo "$VERSION" | jq -r .renderable)" != true ]; then
echo "Not renderable: $(echo "$VERSION" | jq -r '.problems | join("; ")')" >&2
exit 1
fi
RENDER=$(curl -s -X POST $BLITFRAME/renders \
-H "Authorization: Bearer $BLITFRAME_API_KEY" \
-H "Content-Type: application/json" \
-d '{"projectId":"'$PROJECT_ID'","format":"mp4"}')
RENDER_ID=$(echo "$RENDER" | jq -r .id)
STATUS=$(echo "$RENDER" | jq -r .status)
while [ "$STATUS" = queued ] || [ "$STATUS" = rendering ]; do
sleep 2
RENDER=$(curl -s $BLITFRAME/renders/$RENDER_ID \
-H "Authorization: Bearer $BLITFRAME_API_KEY")
STATUS=$(echo "$RENDER" | jq -r .status)
done
if [ "$STATUS" != succeeded ]; then
echo "Render $STATUS: $(echo "$RENDER" | jq -r '"\(.error.code): \(.error.message)"')" >&2
exit 1
fi
curl -s -o hello.mp4 "$(echo "$RENDER" | jq -r .output.mp4Url)"
echo "Saved hello.mp4"
# Needs Python 3.9 or later and requests (pip install requests). Save as render.py and run: python render.py
import os
import time
import requests
api = os.environ.get("BLITFRAME", "https://blitframe.codeartworks.com/v1")
headers = {"Authorization": f"Bearer {os.environ['BLITFRAME_API_KEY']}"}
composition = """
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
"""
response = requests.post(f"{api}/projects", headers=headers, json={"name": "Morning Beans"})
project = response.json()
project_id = project["id"]
response = requests.post(f"{api}/projects/{project_id}/versions", headers=headers, json={
"message": "First version",
"files": [{"path": "data.json", "content": composition}],
})
version = response.json()
if not version["renderable"]:
raise RuntimeError("Not renderable: " + "; ".join(version["problems"]))
response = requests.post(f"{api}/renders", headers=headers, json={"projectId": project_id, "format": "mp4"})
render = response.json()
render_id = render["id"]
while render["status"] in ("queued", "rendering"):
time.sleep(2)
response = requests.get(f"{api}/renders/{render_id}", headers=headers)
render = response.json()
if render["status"] != "succeeded":
error = render["error"] or {}
raise RuntimeError(f"Render {render['status']}: {error.get('code')}: {error.get('message')}")
video = requests.get(render["output"]["mp4Url"])
with open("hello.mp4", "wb") as file:
file.write(video.content)
print("Saved hello.mp4")
// Needs Node.js 18 or later and no packages. Save as render.js and run: node render.js
const { writeFile } = require("node:fs/promises");
const { setTimeout: sleep } = require("node:timers/promises");
const api = process.env.BLITFRAME ?? "https://blitframe.codeartworks.com/v1";
const apiKey = process.env.BLITFRAME_API_KEY;
const composition = `
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}`;
async function main() {
const response = await fetch(`${api}/projects`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ name: "Morning Beans" }),
});
const project = await response.json();
const projectId = project.id;
const versionResponse = await fetch(`${api}/projects/${projectId}/versions`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({
message: "First version",
files: [{ path: "data.json", content: composition }],
}),
});
const version = await versionResponse.json();
if (!version.renderable) throw new Error("Not renderable: " + version.problems.join("; "));
const renderResponse = await fetch(`${api}/renders`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ projectId, format: "mp4" }),
});
let render = await renderResponse.json();
const renderId = render.id;
while (render.status === "queued" || render.status === "rendering") {
await sleep(2000);
const statusResponse = await fetch(`${api}/renders/${renderId}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
render = await statusResponse.json();
}
if (render.status !== "succeeded") {
throw new Error(`Render ${render.status}: ${render.error?.code}: ${render.error?.message}`);
}
const video = await fetch(render.output.mp4Url);
const bytes = await video.arrayBuffer();
await writeFile("hello.mp4", Buffer.from(bytes));
console.log("Saved hello.mp4");
}
main();
// Needs Node.js 22.18 or later and no packages. Save as render.ts and run: node render.ts
import { writeFile } from "node:fs/promises";
import { setTimeout as sleep } from "node:timers/promises";
const api = process.env.BLITFRAME ?? "https://blitframe.codeartworks.com/v1";
const apiKey = process.env.BLITFRAME_API_KEY;
const composition = `
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}`;
const response = await fetch(`${api}/projects`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ name: "Morning Beans" }),
});
const project = await response.json();
const projectId = project.id;
const versionResponse = await fetch(`${api}/projects/${projectId}/versions`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({
message: "First version",
files: [{ path: "data.json", content: composition }],
}),
});
const version = await versionResponse.json();
if (!version.renderable) throw new Error("Not renderable: " + version.problems.join("; "));
const renderResponse = await fetch(`${api}/renders`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ projectId, format: "mp4" }),
});
let render = await renderResponse.json();
const renderId = render.id;
while (render.status === "queued" || render.status === "rendering") {
await sleep(2000);
const statusResponse = await fetch(`${api}/renders/${renderId}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
render = await statusResponse.json();
}
if (render.status !== "succeeded") {
throw new Error(`Render ${render.status}: ${render.error?.code}: ${render.error?.message}`);
}
const video = await fetch(render.output.mp4Url);
const bytes = await video.arrayBuffer();
await writeFile("hello.mp4", Buffer.from(bytes));
console.log("Saved hello.mp4");
<?php
// Needs PHP 8.1 or later with the curl extension. Save as render.php and run: php render.php
$api = getenv("BLITFRAME") ?: "https://blitframe.codeartworks.com/v1";
$apiKey = getenv("BLITFRAME_API_KEY");
$composition = <<<'JSON'
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
JSON;
$ch = curl_init("$api/projects");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ["Authorization: Bearer $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(["name" => "Morning Beans"]),
]);
$response = curl_exec($ch);
$project = json_decode($response, true);
$projectId = $project["id"];
$ch = curl_init("$api/projects/$projectId/versions");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ["Authorization: Bearer $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"message" => "First version",
"files" => [["path" => "data.json", "content" => $composition]],
]),
]);
$response = curl_exec($ch);
$version = json_decode($response, true);
if (!$version["renderable"]) {
throw new RuntimeException("Not renderable: " . implode("; ", $version["problems"]));
}
$ch = curl_init("$api/renders");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ["Authorization: Bearer $apiKey", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(["projectId" => $projectId, "format" => "mp4"]),
]);
$response = curl_exec($ch);
$render = json_decode($response, true);
$renderId = $render["id"];
while (in_array($render["status"], ["queued", "rendering"])) {
sleep(2);
$ch = curl_init("$api/renders/$renderId");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer $apiKey"],
]);
$response = curl_exec($ch);
$render = json_decode($response, true);
}
if ($render["status"] !== "succeeded") {
$code = $render["error"]["code"] ?? "";
$message = $render["error"]["message"] ?? "";
throw new RuntimeException("Render {$render['status']}: $code: $message");
}
$download = curl_init($render["output"]["mp4Url"]);
curl_setopt($download, CURLOPT_RETURNTRANSFER, true);
$video = curl_exec($download);
file_put_contents("hello.mp4", $video);
echo "Saved hello.mp4\n";
# Needs Ruby 3.0 or later and no gems. Save as render.rb and run: ruby render.rb
require "net/http"
require "json"
api = ENV.fetch("BLITFRAME", "https://blitframe.codeartworks.com/v1")
api_key = ENV.fetch("BLITFRAME_API_KEY")
headers = { "Authorization" => "Bearer #{api_key}", "Content-Type" => "application/json" }
composition = <<~'JSON'
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
JSON
uri = URI("#{api}/projects")
response = Net::HTTP.post(uri, { name: "Morning Beans" }.to_json, headers)
project = JSON.parse(response.body)
project_id = project["id"]
uri = URI("#{api}/projects/#{project_id}/versions")
body = { message: "First version", files: [{ path: "data.json", content: composition }] }
response = Net::HTTP.post(uri, body.to_json, headers)
version = JSON.parse(response.body)
raise "Not renderable: #{version["problems"].join("; ")}" unless version["renderable"]
uri = URI("#{api}/renders")
response = Net::HTTP.post(uri, { projectId: project_id, format: "mp4" }.to_json, headers)
render = JSON.parse(response.body)
render_id = render["id"]
uri = URI("#{api}/renders/#{render_id}")
while %w[queued rendering].include?(render["status"])
sleep 2
response = Net::HTTP.get_response(uri, { "Authorization" => "Bearer #{api_key}" })
render = JSON.parse(response.body)
end
unless render["status"] == "succeeded"
error = render["error"] || {}
raise "Render #{render["status"]}: #{error["code"]}: #{error["message"]}"
end
video = Net::HTTP.get(URI(render["output"]["mp4Url"]))
File.binwrite("hello.mp4", video)
puts "Saved hello.mp4"
// Needs Go 1.21 or later and only the standard library. Save as main.go and run: go run main.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
const composition = `
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}`
func main() {
api := os.Getenv("BLITFRAME")
if api == "" {
api = "https://blitframe.codeartworks.com/v1"
}
apiKey := os.Getenv("BLITFRAME_API_KEY")
client := &http.Client{}
request, err := http.NewRequest("POST", api+"/projects", strings.NewReader(`{"name": "Morning Beans"}`))
if err != nil {
panic(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
var project map[string]any
if err := json.NewDecoder(response.Body).Decode(&project); err != nil {
panic(err)
}
projectID := project["id"].(string)
versionBody, err := json.Marshal(map[string]any{
"message": "First version",
"files": []map[string]string{{"path": "data.json", "content": composition}},
})
if err != nil {
panic(err)
}
versionRequest, err := http.NewRequest("POST", api+"/projects/"+projectID+"/versions", bytes.NewReader(versionBody))
if err != nil {
panic(err)
}
versionRequest.Header.Set("Authorization", "Bearer "+apiKey)
versionRequest.Header.Set("Content-Type", "application/json")
versionResponse, err := client.Do(versionRequest)
if err != nil {
panic(err)
}
defer versionResponse.Body.Close()
var version map[string]any
if err := json.NewDecoder(versionResponse.Body).Decode(&version); err != nil {
panic(err)
}
if version["renderable"] != true {
panic(fmt.Sprint("Not renderable: ", version["problems"]))
}
renderBody, err := json.Marshal(map[string]string{"projectId": projectID, "format": "mp4"})
if err != nil {
panic(err)
}
renderRequest, err := http.NewRequest("POST", api+"/renders", bytes.NewReader(renderBody))
if err != nil {
panic(err)
}
renderRequest.Header.Set("Authorization", "Bearer "+apiKey)
renderRequest.Header.Set("Content-Type", "application/json")
renderResponse, err := client.Do(renderRequest)
if err != nil {
panic(err)
}
defer renderResponse.Body.Close()
var render map[string]any
if err := json.NewDecoder(renderResponse.Body).Decode(&render); err != nil {
panic(err)
}
renderID := render["id"].(string)
for render["status"] == "queued" || render["status"] == "rendering" {
time.Sleep(2 * time.Second)
statusRequest, err := http.NewRequest("GET", api+"/renders/"+renderID, nil)
if err != nil {
panic(err)
}
statusRequest.Header.Set("Authorization", "Bearer "+apiKey)
statusResponse, err := client.Do(statusRequest)
if err != nil {
panic(err)
}
render = map[string]any{}
err = json.NewDecoder(statusResponse.Body).Decode(&render)
statusResponse.Body.Close()
if err != nil {
panic(err)
}
}
if render["status"] != "succeeded" {
panic(fmt.Sprint("Render ", render["status"], ": ", render["error"]))
}
output := render["output"].(map[string]any)
video, err := http.Get(output["mp4Url"].(string))
if err != nil {
panic(err)
}
defer video.Body.Close()
file, err := os.Create("hello.mp4")
if err != nil {
panic(err)
}
defer file.Close()
if _, err := io.Copy(file, video.Body); err != nil {
panic(err)
}
fmt.Println("Saved hello.mp4")
}
// Needs .NET 8 or later and no packages. Run "dotnet new console", replace Program.cs with this, then "dotnet run".
using System.Net.Http.Json;
using System.Text.Json.Nodes;
var api = Environment.GetEnvironmentVariable("BLITFRAME") ?? "https://blitframe.codeartworks.com/v1";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("BLITFRAME_API_KEY"));
var composition = """
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
""";
var response = await client.PostAsJsonAsync($"{api}/projects", new { name = "Morning Beans" });
var project = await response.Content.ReadFromJsonAsync<JsonNode>();
var projectId = (string?)project?["id"];
var versionResponse = await client.PostAsJsonAsync($"{api}/projects/{projectId}/versions", new
{
message = "First version",
files = new[] { new { path = "data.json", content = composition } },
});
var version = await versionResponse.Content.ReadFromJsonAsync<JsonNode>();
if (!(bool)version!["renderable"]!)
{
var problems = version["problems"]!.AsArray().Select(problem => (string?)problem);
throw new Exception("Not renderable: " + string.Join("; ", problems));
}
var renderResponse = await client.PostAsJsonAsync($"{api}/renders", new { projectId, format = "mp4" });
var render = await renderResponse.Content.ReadFromJsonAsync<JsonNode>();
var renderId = (string?)render?["id"];
while ((string?)render?["status"] is "queued" or "rendering")
{
await Task.Delay(2000);
var statusResponse = await client.GetAsync($"{api}/renders/{renderId}");
render = await statusResponse.Content.ReadFromJsonAsync<JsonNode>();
}
if ((string?)render?["status"] != "succeeded")
throw new Exception($"Render {render?["status"]}: {render?["error"]?["code"]}: {render?["error"]?["message"]}");
using var download = new HttpClient(); // download links are signed URLs: send them no API key
var mp4Url = (string)render["output"]!["mp4Url"]!;
var video = await download.GetByteArrayAsync(mp4Url);
await File.WriteAllBytesAsync("hello.mp4", video);
Console.WriteLine("Saved hello.mp4");
// Needs Java 17 or later and Jackson (the jackson-databind dependency).
// Save as Example.java in a Maven or Gradle project that has it and run the Example class.
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Path;
public class Example {
static final String COMPOSITION = """
{"v": "5.12.2", "nm": "Morning Beans", "fr": 30, "ip": 0, "op": 90, "w": 1280, "h": 720, "ddd": 0, "assets": [],
"fonts": {"list": [{"fName": "Montserrat-Bold", "fFamily": "Montserrat", "fStyle": "Bold"}]},
"layers": [
{"ty": 5, "ind": 1, "nm": "Name", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"p": {"a": 1, "k": [{"t": 0, "s": [-500, 400, 0], "o": {"x": 0.2, "y": 0}, "i": {"x": 0.2, "y": 1}},
{"t": 20, "s": [640, 400, 0]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Morning Beans", "f": "Montserrat-Bold", "s": 96, "lh": 110, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 5, "ind": 2, "nm": "Tagline", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 480, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0},
"o": {"a": 1, "k": [{"t": 40, "s": [0], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 60, "s": [100]}]}},
"t": {"d": {"k": [{"t": 0, "s": {"t": "Fresh every day", "f": "Montserrat-Bold", "s": 40, "lh": 48, "tr": 0,
"j": 2, "fc": [1, 1, 1]}}]},
"a": [], "m": {"g": 1, "a": {"a": 0, "k": [0, 0]}}}},
{"ty": 4, "ind": 3, "nm": "Cup", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [640, 210, 0]}, "r": {"a": 0, "k": 0},
"o": {"a": 0, "k": 100},
"s": {"a": 1, "k": [{"t": 10, "s": [0, 0, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.3, "y": 1}},
{"t": 22, "s": [115, 115, 100], "o": {"x": 0.3, "y": 0}, "i": {"x": 0.7, "y": 1}},
{"t": 28, "s": [100, 100, 100]}]}},
"shapes": [
{"ty": "gr", "nm": "Body", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [130, 110]}, "r": {"a": 0, "k": 24}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle hole", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [40, 40]}},
{"ty": "fl", "c": {"a": 0, "k": [0.784, 0.392, 0.118, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Handle", "it": [
{"ty": "el", "d": 1, "p": {"a": 0, "k": [88, 0]}, "s": {"a": 0, "k": [80, 80]}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]},
{"ty": "gr", "nm": "Saucer", "it": [
{"ty": "rc", "d": 1, "p": {"a": 0, "k": [10, 78]}, "s": {"a": 0, "k": [230, 16]}, "r": {"a": 0, "k": 8}},
{"ty": "fl", "c": {"a": 0, "k": [1, 1, 1, 1]}, "o": {"a": 0, "k": 100}, "r": 1},
{"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "a": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}}]}]},
{"ty": 1, "ind": 4, "nm": "Background", "ip": 0, "op": 90, "st": 0, "sr": 1,
"ks": {"a": {"a": 0, "k": [0, 0, 0]}, "p": {"a": 0, "k": [0, 0, 0]}, "s": {"a": 0, "k": [100, 100, 100]},
"r": {"a": 0, "k": 0}, "o": {"a": 0, "k": 100}},
"sw": 1280, "sh": 720, "sc": "#C8641E"}]}
""";
public static void main(String[] args) throws Exception {
String api = System.getenv().getOrDefault("BLITFRAME", "https://blitframe.codeartworks.com/v1");
String apiKey = System.getenv("BLITFRAME_API_KEY");
HttpClient client = HttpClient.newHttpClient();
ObjectMapper mapper = new ObjectMapper();
HttpRequest request = HttpRequest.newBuilder(URI.create(api + "/projects"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("""
{"name": "Morning Beans"}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
JsonNode project = mapper.readTree(response.body());
String projectId = project.get("id").asText();
String content = mapper.writeValueAsString(COMPOSITION);
String versionBody = """
{"message": "First version", "files": [{"path": "data.json", "content": %s}]}
""".formatted(content);
HttpRequest versionRequest = HttpRequest.newBuilder(URI.create(api + "/projects/" + projectId + "/versions"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(versionBody))
.build();
HttpResponse<String> versionResponse = client.send(versionRequest, HttpResponse.BodyHandlers.ofString());
JsonNode version = mapper.readTree(versionResponse.body());
if (!version.get("renderable").asBoolean()) {
throw new RuntimeException("Not renderable: " + version.get("problems"));
}
String renderBody = """
{"projectId": "%s", "format": "mp4"}
""".formatted(projectId);
HttpRequest renderRequest = HttpRequest.newBuilder(URI.create(api + "/renders"))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(renderBody))
.build();
HttpResponse<String> renderResponse = client.send(renderRequest, HttpResponse.BodyHandlers.ofString());
JsonNode render = mapper.readTree(renderResponse.body());
String renderId = render.get("id").asText();
String status = render.get("status").asText();
while (status.equals("queued") || status.equals("rendering")) {
Thread.sleep(2000);
HttpRequest statusRequest = HttpRequest.newBuilder(URI.create(api + "/renders/" + renderId))
.header("Authorization", "Bearer " + apiKey)
.build();
HttpResponse<String> statusResponse = client.send(statusRequest, HttpResponse.BodyHandlers.ofString());
render = mapper.readTree(statusResponse.body());
status = render.get("status").asText();
}
if (!status.equals("succeeded")) {
throw new RuntimeException("Render " + status + ": " + render.get("error"));
}
String mp4Url = render.get("output").get("mp4Url").asText();
HttpRequest download = HttpRequest.newBuilder(URI.create(mp4Url)).build();
client.send(download, HttpResponse.BodyHandlers.ofFile(Path.of("hello.mp4")));
System.out.println("Saved hello.mp4");
}
}
Quickstart: Code goes through the same steps one request at a time and explains each response.
Adapting the examples
To turn the program into your own, change these parts:
| To | Change |
|---|---|
| Render your own composition | Replace the composition in the program with your own data.json, exported from After Effects or written in code. Add every file your composition uses, such as an image, to the files of the edit, the request that adds the composition, at the path the composition names. See data.json basics. |
| Add a font | Add the font file to the edit's files as fonts/, named after the font's family and style, and send "fontLicenseAccepted": true in the same edit. That field confirms you are licensed to use the font. See Fonts. |
| Add sound | Add the audio file to the edit's files, and name its path in the edit's soundtrack. See Soundtrack. |
| Change an existing project | Send another edit to the same project, with only the files that change. Blitframe keeps the others. See Editing a project. |
| Send large files | A file in contentBase64 can be up to 1 MB, and the whole request up to 64 MB. Send a larger file through an upload, or the whole project as a ZIP. |
| Make many videos from one project | Use a batch render, which queues up to 1,000 renders in one request. See Many videos from a data sheet. |
| Wait with fewer requests | Send the Prefer: wait=50 header with GET /. Blitframe then holds the request for up to 50 seconds, until the render finishes. Or register a webhook, and Blitframe calls your server when the render succeeds (render.succeeded). |