Get started

Long-running jobs

Start work that takes minutes, track it, and collect the result.

Dubbing a video, translating a batch of documents or analyzing an image takes longer than an HTTP request should stay open. These endpoints start a job and return its ID straight away. You then poll the job until it finishes.

The pattern

Start the job

The response comes back immediately with a job ID and its first status. Credits are checked at this point; if there aren't enough, you get a 402 and nothing starts.

POST /v1/galaxy/translate-video/process-log/run
Response
{
  "jobId": "9b1f6c2e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
  "status": "SCHEDULED",
  "processType": "VIDEO_TO_SPEECH_TRANSLATION"
}

Poll until it finishes

GET /v1/galaxy/translate-video/process-log/run/{id}
Response (while running)
{
  "jobId": "9b1f6c2e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
  "status": "RUNNING",
  "stage": "TRANSCREATION-ENGINE",
  "progress": 55,
  "result": null,
  "error": null
}

Read the result

When status is COMPLETED, read the output in result and the cost in credits. For FAILED, read error for details.

Job statuses

Video Dubbing jobs use these statuses:

StatusMeaning
DRAFTSaved and waiting to be submitted.
SCHEDULEDAccepted and waiting to start.
RUNNINGIn progress. Read stage and progress.
PAUSEDWaiting for a review or approval.
COMPLETEDFinished. Collect the result.
COMPLETED_WITH_ERRORSFinished with some items in error.
FAILEDStopped with an error. Read error for details.
TIMED_OUTStopped after reaching the time limit.
TERMINATEDStopped before completion.

Polling well

poll.ts
async function waitForJob(jobId: string) {
  const url = `{{API_BASE_URL}}/v1/galaxy/translate-video/process-log/run/${jobId}`;
  let delay = 5_000;
  for (;;) {
    const res = await fetch(url, { headers: { 'x-api-key': process.env.ACCLARO_API_KEY! } });
    if (res.status === 429) {
      await sleep(Number(res.headers.get('retry-after') ?? 60) * 1000);
      continue;
    }
    if (!res.ok) throw new Error(`Job request failed: ${res.status}`);
    const job = await res.json();
    if (['COMPLETED', 'COMPLETED_WITH_ERRORS', 'FAILED', 'TIMED_OUT', 'TERMINATED'].includes(job.status)) return job;
    await sleep(delay);
    delay = Math.min(delay * 1.5, 30_000);
  }
}

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
  • Start at about 5 seconds between polls and slow down to around 30 seconds for long jobs.
  • Respect 429 and Retry-After. Polls count toward the key's rate limit.
  • Store the job ID as soon as you get it, so a restart of your system can pick the job up again.

Each product's job endpoints

Every product that runs jobs follows this shape, but the paths and status fields are its own:

Webhooks

Only the Blog API sends webhooks so far: register one to be told when a post, a translation, a recording or an Autopilot run finishes. The other products don't send webhooks yet, and the app's live-progress websockets don't accept API keys, so polling is the supported way to track their jobs.

On this page