curl -X GET "https://api.hooked.so/v1/project/cm4x9k2p10001ab12cd34ef56/captions" \
-H "x-api-key: your_api_key_here"
const projectId = "cm4x9k2p10001ab12cd34ef56";
const response = await fetch(`https://api.hooked.so/v1/project/${projectId}/captions`, {
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const { data } = await response.json();
for (const segment of data.segments) {
console.log(segment.index, `${segment.startMs}ms`, segment.text);
}
import os
import requests
project_id = "cm4x9k2p10001ab12cd34ef56"
response = requests.get(
f"https://api.hooked.so/v1/project/{project_id}/captions",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
for segment in response.json()["data"]["segments"]:
print(segment["index"], segment["startMs"], segment["text"])
{
"success": true,
"message": "Captions fetched successfully",
"data": {
"projectId": "cm4x9k2p10001ab12cd34ef56",
"hasCaptions": true,
"disabled": false,
"preset": "classic",
"alignment": "bottom",
"segments": [
{
"index": 0,
"text": "Three habits that",
"startMs": 0,
"endMs": 1200,
"words": [
{ "word": "Three", "startMs": 0, "endMs": 400 },
{ "word": "habits", "startMs": 400, "endMs": 800 },
{ "word": "that", "startMs": 800, "endMs": 1200 }
]
},
{
"index": 1,
"text": "changed my mornings",
"startMs": 1200,
"endMs": 2600,
"words": [
{ "word": "changed", "startMs": 1200, "endMs": 1700 },
{ "word": "my", "startMs": 1700, "endMs": 1900 },
{ "word": "mornings", "startMs": 1900, "endMs": 2600 }
]
}
]
}
}
{
"success": false,
"message": "Project not found"
}
Projects
Get Project Captions
Read a project’s caption lines, to correct them with Edit Project
GET
/
v1
/
project
/
{projectId}
/
captions
curl -X GET "https://api.hooked.so/v1/project/cm4x9k2p10001ab12cd34ef56/captions" \
-H "x-api-key: your_api_key_here"
const projectId = "cm4x9k2p10001ab12cd34ef56";
const response = await fetch(`https://api.hooked.so/v1/project/${projectId}/captions`, {
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const { data } = await response.json();
for (const segment of data.segments) {
console.log(segment.index, `${segment.startMs}ms`, segment.text);
}
import os
import requests
project_id = "cm4x9k2p10001ab12cd34ef56"
response = requests.get(
f"https://api.hooked.so/v1/project/{project_id}/captions",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
for segment in response.json()["data"]["segments"]:
print(segment["index"], segment["startMs"], segment["text"])
{
"success": true,
"message": "Captions fetched successfully",
"data": {
"projectId": "cm4x9k2p10001ab12cd34ef56",
"hasCaptions": true,
"disabled": false,
"preset": "classic",
"alignment": "bottom",
"segments": [
{
"index": 0,
"text": "Three habits that",
"startMs": 0,
"endMs": 1200,
"words": [
{ "word": "Three", "startMs": 0, "endMs": 400 },
{ "word": "habits", "startMs": 400, "endMs": 800 },
{ "word": "that", "startMs": 800, "endMs": 1200 }
]
},
{
"index": 1,
"text": "changed my mornings",
"startMs": 1200,
"endMs": 2600,
"words": [
{ "word": "changed", "startMs": 1200, "endMs": 1700 },
{ "word": "my", "startMs": 1700, "endMs": 1900 },
{ "word": "mornings", "startMs": 1900, "endMs": 2600 }
]
}
]
}
}
{
"success": false,
"message": "Project not found"
}
Overview
Answers the caption lines of a project as they are on its timeline now, with each word and its timing. Use it to find what to correct, then send the fixes to Edit Project incaptionSegments, by index.
indexcounts from0across the whole video. A project made from a template has one caption layer per scene; their lines are numbered one after the other.startMsandendMsare milliseconds from the start of the video, for the line and for each word.textis the line as stored. The caption style may show it in upper case.disabled,presetandalignmentare the captions’ current switch, style and position.- A project without captions answers
hasCaptions: falseand no segments. Captions cannot be added through the API.
A new caption style (
caption.preset) re-cuts the lines to fit its box, so their number and indexes change. Read the captions again after changing the style.curl -X GET "https://api.hooked.so/v1/project/cm4x9k2p10001ab12cd34ef56/captions" \
-H "x-api-key: your_api_key_here"
const projectId = "cm4x9k2p10001ab12cd34ef56";
const response = await fetch(`https://api.hooked.so/v1/project/${projectId}/captions`, {
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const { data } = await response.json();
for (const segment of data.segments) {
console.log(segment.index, `${segment.startMs}ms`, segment.text);
}
import os
import requests
project_id = "cm4x9k2p10001ab12cd34ef56"
response = requests.get(
f"https://api.hooked.so/v1/project/{project_id}/captions",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
for segment in response.json()["data"]["segments"]:
print(segment["index"], segment["startMs"], segment["text"])
{
"success": true,
"message": "Captions fetched successfully",
"data": {
"projectId": "cm4x9k2p10001ab12cd34ef56",
"hasCaptions": true,
"disabled": false,
"preset": "classic",
"alignment": "bottom",
"segments": [
{
"index": 0,
"text": "Three habits that",
"startMs": 0,
"endMs": 1200,
"words": [
{ "word": "Three", "startMs": 0, "endMs": 400 },
{ "word": "habits", "startMs": 400, "endMs": 800 },
{ "word": "that", "startMs": 800, "endMs": 1200 }
]
},
{
"index": 1,
"text": "changed my mornings",
"startMs": 1200,
"endMs": 2600,
"words": [
{ "word": "changed", "startMs": 1200, "endMs": 1700 },
{ "word": "my", "startMs": 1700, "endMs": 1900 },
{ "word": "mornings", "startMs": 1900, "endMs": 2600 }
]
}
]
}
}
{
"success": false,
"message": "Project not found"
}
Errors
| Status | When |
|---|---|
| 401 | Missing or invalid API key (code: "not_authenticated") |
| 403 | The team does not have the Hooked app product (code: "entitlement_required") |
| 404 | No such project. Another team’s project, or an id that is not one, answers the same Project not found |
| 500 | Internal server error. Retry |