curl --request POST \
--url https://brew.new/api/v1/content/animation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"html": "<string>",
"script": "<string>",
"height": 123,
"css": "",
"fps": 25,
"seed": 1
}
'import requests
url = "https://brew.new/api/v1/content/animation"
payload = {
"title": "<string>",
"html": "<string>",
"script": "<string>",
"height": 123,
"css": "",
"fps": 25,
"seed": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
html: '<string>',
script: '<string>',
height: 123,
css: '',
fps: 25,
seed: 1
})
};
fetch('https://brew.new/api/v1/content/animation', 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://brew.new/api/v1/content/animation",
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([
'title' => '<string>',
'html' => '<string>',
'script' => '<string>',
'height' => 123,
'css' => '',
'fps' => 25,
'seed' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://brew.new/api/v1/content/animation"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brew.new/api/v1/content/animation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/content/animation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}"
response = http.request(request)
puts response.read_body{
"gifUrl": "<string>",
"stillUrl": "<string>",
"mp4Url": "<string>",
"contactSheetUrl": "<string>",
"sceneUrl": "<string>",
"format": "email",
"width": 123,
"height": 123,
"displayWidth": 123,
"durationMs": 1,
"frameCount": 123,
"gifBytes": 1,
"notes": [
"<string>"
]
}Create an animation
Renders an Anime.js v5 scene into a hosted, on-brand animation: a GIF for email, plus an MP4 for the social formats. Credit-metered (fixed cost).
Input html and css for one frame, using the brand CSS variables (--brand-primary, --brand-on-primary, --brand-bg, --brand-ink, --brand-heading-font, --brand-body-font), and a script ES module whose default export build({ root, brand, anime, random }) returns the timeline it built with a finite loop. A poster label names the frame the GIF opens on.
Returns gifUrl, stillUrl (the poster frame), mp4Url, contactSheetUrl, sceneUrl (the scene as sent, for edits), the frame size and the timing. The same scene for the same brand returns the same URLs.
Errors 422 CONTENT_OPERATION_FAILED with param script when the scene throws, never ends, runs past its format limit or cannot fit an email GIF; the message says what to change. No credits are charged then.
curl --request POST \
--url https://brew.new/api/v1/content/animation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"html": "<string>",
"script": "<string>",
"height": 123,
"css": "",
"fps": 25,
"seed": 1
}
'import requests
url = "https://brew.new/api/v1/content/animation"
payload = {
"title": "<string>",
"html": "<string>",
"script": "<string>",
"height": 123,
"css": "",
"fps": 25,
"seed": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
html: '<string>',
script: '<string>',
height: 123,
css: '',
fps: 25,
seed: 1
})
};
fetch('https://brew.new/api/v1/content/animation', 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://brew.new/api/v1/content/animation",
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([
'title' => '<string>',
'html' => '<string>',
'script' => '<string>',
'height' => 123,
'css' => '',
'fps' => 25,
'seed' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://brew.new/api/v1/content/animation"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://brew.new/api/v1/content/animation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brew.new/api/v1/content/animation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"html\": \"<string>\",\n \"script\": \"<string>\",\n \"height\": 123,\n \"css\": \"\",\n \"fps\": 25,\n \"seed\": 1\n}"
response = http.request(request)
puts response.read_body{
"gifUrl": "<string>",
"stillUrl": "<string>",
"mp4Url": "<string>",
"contactSheetUrl": "<string>",
"sceneUrl": "<string>",
"format": "email",
"width": 123,
"height": 123,
"displayWidth": 123,
"durationMs": 1,
"frameCount": 123,
"gifBytes": 1,
"notes": [
"<string>"
]
}Authorizations
Headers
The brand this request acts on. REQUIRED for organization-scoped credentials (otherwise 400 BRAND_ID_REQUIRED — there is no default brand); list ids with GET /v1/brands. Brand-scoped credentials may omit it, and sending a different brand returns 403 BRAND_SCOPE_MISMATCH. A brand outside your organization returns 404 BRAND_NOT_FOUND.
1 - 64Body
One Anime.js scene: title, format, html, css, script, and optional height, fps and seed.
Response
The operation result.
Was this page helpful?