Downloads and jobs
Start a download
POST /v1/downloads returns 202 right away with a jobId.
curl -X POST "https://postkea.com/api/v1/downloads" \
-H "Authorization: Bearer $POSTKEA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.tiktok.com/@studiolumen/video/7301234567890",
"quality": "1080p",
"format": "mp4"
}'const res = await fetch("https://postkea.com/api/v1/downloads", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.POSTKEA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://www.tiktok.com/@studiolumen/video/7301234567890",
quality: "1080p",
format: "mp4",
}),
});
const { data: job } = await res.json();
console.log(job);import os, requests
r = requests.post(
"https://postkea.com/api/v1/downloads",
headers={"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"},
json={
"url": "https://www.tiktok.com/@studiolumen/video/7301234567890",
"quality": "1080p",
"format": "mp4",
},
)
job = r.json()["data"]
print(job){
"success": true,
"data": {
"jobId": "job_Qm3x8d1vT0aZ",
"type": "download",
"status": "queued",
"progress": 0,
"statusUrl": "/v1/jobs/job_Qm3x8d1vT0aZ"
}
}Poll for the result
GET /v1/downloads/{id} (or GET /v1/jobs/{id}) is free. Poll every few seconds until status is ready or failed; progress goes from 0 to 100 while it runs. Or skip polling and subscribe to the job.completed and job.failed webhook events.
curl https://postkea.com/api/v1/downloads/job_Qm3x8d1vT0aZ \
-H "Authorization: Bearer $POSTKEA_API_KEY"const headers = { Authorization: `Bearer ${process.env.POSTKEA_API_KEY}` };
async function waitForDownload(jobId: string) {
for (;;) {
const res = await fetch(`https://postkea.com/api/v1/downloads/${jobId}`, { headers });
const { data: job } = await res.json();
if (job.status === "ready") return job.result.downloadUrl;
if (job.status === "failed") throw new Error(`${job.errorCode}: ${job.error}`);
await new Promise((r) => setTimeout(r, 3000));
}
}import os, time, requests
headers = {"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"}
def wait_for_download(job_id):
while True:
job = requests.get(f"https://postkea.com/api/v1/downloads/{job_id}", headers=headers).json()["data"]
if job["status"] == "ready":
return job["result"]["downloadUrl"]
if job["status"] == "failed":
raise RuntimeError(f"{job['errorCode']}: {job['error']}")
time.sleep(3){
"success": true,
"data": {
"jobId": "job_Qm3x8d1vT0aZ",
"type": "download",
"platform": "tiktok",
"status": "ready",
"progress": 100,
"creditsCost": 3,
"billed": true,
"error": null,
"errorCode": null,
"retryable": false,
"createdAt": "2026-10-20T09:14:02.000Z",
"finishedAt": "2026-10-20T09:14:19.000Z",
"statusUrl": "/v1/jobs/job_Qm3x8d1vT0aZ",
"result": {
"title": "How we fire a kiln",
"thumbnail": "https://p16-sign.tiktokcdn.com/...",
"durationSec": 32,
"platform": "TikTok",
"author": "Studio Lumen",
"authorHandle": "studiolumen",
"quality": "1080p",
"format": "mp4",
"fileSize": 14680064,
"fileSizeMB": "14.00 MB",
"filename": "How we fire a kiln.mp4",
"media": null,
"downloadUrl": "https://postkea.com/files/downloads/...?expires=...",
"expiresIn": 3600
}
}
}downloadUrlis a signed link that works for one hour (expiresInseconds). Polling again returns a fresh link at no cost.- The file itself is kept for 24 hours. After that
downloadUrlisnullandexpiredistrue. Files saved to the library stay there. GET /v1/downloadslists recent downloads, optionally filtered bystatus.
Quality and formats
- If the source has no version at the quality you asked for, the best one below it is used, and
result.qualitytells you what you got. mp4andwebmare merged video and audio.aviis re-encoded, which takes longer.m4a,mp3,ogg,wav,opusandflacextract the audio.- Files can be up to 2 GB. Live streams can be downloaded after they end.
Costs
Downloads are charged per started minute of the video: 1 credit for audio or video up to 480p, 3 credits for 720p and above. The balance is checked before the download starts, and failed downloads are free.
maxDuration when you take URLs from users, so a three hour video does not eat your credits.Jobs
Downloads, batch scrapes, pipelines and repurposing all run as jobs with the same shape: jobId, type, status, progress, result, creditsCost, error, errorCode, retryable and timestamps.
Batch and pipeline jobs also list their children, one per URL, each with its own status, result and cost. List jobs with GET /v1/jobs, filtered by type (scrape, download, batch, pipeline, repurpose, export) and status.
curl "https://postkea.com/api/v1/jobs?type=download&status=failed&limit=20" \
-H "Authorization: Bearer $POSTKEA_API_KEY"const res = await fetch("https://postkea.com/api/v1/jobs?type=download&status=failed&limit=20", {
headers: { Authorization: `Bearer ${process.env.POSTKEA_API_KEY}` },
});
const { data: jobs } = await res.json();
console.log(jobs);import os, requests
r = requests.get(
"https://postkea.com/api/v1/jobs",
headers={"Authorization": f"Bearer {os.environ['POSTKEA_API_KEY']}"},
params={
"type": "download",
"status": "failed",
"limit": 20,
},
)
jobs = r.json()["data"]
print(jobs)Job errors
A failed job has a human readable error, a stable errorCode and retryable. When retryable is true, starting the same job again later may work.