Concepts

Background jobs

AI images and videos, brand learning and clipping run in the background: wait for them, or follow them.

Some actions take longer than a request should: generating an image (about 40 seconds) or a video (one to three minutes), learning a brand from its website, clipping a long video, making an AI actor ad.

These endpoints start the job and wait for it a while before answering:

  • Done in time: 200 with the result ("status": "done", and the media_id).
  • Still running: 202 with "status": "running", the job's id and next, which names the endpoint to follow it with.
{
  "generation_id": "6f1c…",
  "status": "running",
  "progress": 40,
  "next": "Still being made. Call GET /api/v1/media/generations/{generation_id} generation_id=6f1c… to wait for it."
}

How long to wait

Endpoints marked with a wait parameter take ?wait=<seconds>, from 0 to 290. The default is 50. wait=0 answers at once; a long wait saves you a loop.

tracee media generate-image --prompt "A clean product shot, warm light" --platform linkedin --wait 120
tracee media generation <generation_id>        # follow it

In the CLI, a job that's still running prints the command that follows it.

JobStartFollow
AI imagePOST /media/imagesGET /media/generations/{generation_id}
AI videoPOST /media/videosGET /media/generations/{generation_id}
Brand learningPOST /brand/learnGET /brand/learn/{run_id}
ClippingPOST /clipsGET /clips/{job_id} (waits up to about 45 seconds)
AI actor adPOST /ai-actor-videosGET /ai-actor-videos/{job_id}
Radar check, competitor discovery, inbox syncPOST /radar/refresh, /radar/discover, /inbox/syncRead the results a minute later