Skip to content

Polling & Result Retrieval

Seek-api job processing is asynchronous. Upon task submission, the API returns a job_uuid used to poll for progress until a terminal state is reached.

The execution flow follows a strictly defined state progression:

ACCEPTED → QUEUED → STARTING → RUNNING → SUCCEEDED
→ FAILED
→ TIMED_OUT
→ CANCELED
StateDescription
ACCEPTEDRequest received and validated by the API
QUEUEDTask awaiting resource allocation
STARTINGInitializing the execution environment
RUNNINGWorker currently processing the task
SUCCEEDEDSuccessful execution — data available in output
FAILEDExecution failure — details available in error
TIMED_OUTMaximum execution time exceeded
CANCELEDTask canceled manually or by the system

States SUCCEEDED, FAILED, TIMED_OUT, and CANCELED are terminal: no further state transitions are possible.


Use the job_uuid returned by the POST /v1/workers/{worker_id}/jobs call:

GET https://api.seek-api.com/v1/jobs/{job_uuid}
x-api-key: YOUR_API_KEY

The job_uuid value corresponds to the job_id field in the JSON response.

To maximize performance and facilitate parsing, the response uses a compact format:

{
"job_id": "job_01jabcdef123456789",
"worker_id": "text-summarizer",
"status": "SUCCEEDED",
"timestamps": {
"submitted_at": "2026-01-15T10:30:00.000Z",
"started_at": "2026-01-15T10:30:02.150Z",
"finished_at": "2026-01-15T10:30:03.390Z",
"duration_ms": 1240
},
"output": {
"kind": "object",
"data": { "message": "generated summary" },
"items": [],
"meta": {}
},
"files": [],
"cost": {
"total_usd": 0.01,
"run_usd": 0.01,
"infra_usd": 0.0,
"billing_mode": "per_run"
},
"error": null
}
FieldDescription
output.kindDefines the result structure: object (data in data), list (data in items), or empty.
output.metaComplementary metadata provided by the worker (e.g., warnings, stats).
filesList of generated files with presigned download URLs.
costFinancial details of the execution and the applied billing mode.
errorContains code and message in case of failure; otherwise null.

For a robust integration, we recommend implementing a polling mechanism with a timeout.

async function waitForJob(jobUuid, apiKey, { intervalMs = 2000, timeoutMs = 60000 } = {}) {
const TERMINAL_STATES = new Set(['SUCCEEDED', 'FAILED', 'TIMED_OUT', 'CANCELED']);
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
const res = await fetch(`https://api.seek-api.com/v1/jobs/${jobUuid}`, {
headers: { 'x-api-key': apiKey },
});
if (!res.ok) throw new Error(`HTTP Error: ${res.status}`);
const job = await res.json();
if (TERMINAL_STATES.has(job.status)) return job;
await new Promise((resolve) => setTimeout(resolve, intervalMs));
}
throw new Error(`Timeout: Job ${jobUuid} did not reach terminal state after ${timeoutMs}ms`);
}
const job = await waitForJob('job_01jabcdef123456789', 'YOUR_API_KEY');
if (job.status === 'SUCCEEDED') {
console.log('Result:', job.output);
} else {
console.error('Job failed:', job.error);
}

Generated binary files (exports, images, etc.) are listed in the files array. Each entry contains a secure, temporary URL.

{
"files": [
{
"id": "export_123",
"name": "export.csv",
"content_type": "text/csv",
"size_bytes": 1024,
"url": "https://storage.seek-api.com/..."
}
]
}

The polling interval should be adjusted based on the estimated processing time to optimize responsiveness while limiting network overhead.

Estimated DurationRecommended Interval
< 5 seconds1 second
5 – 30 seconds2 seconds
30s – 5 minutes5 seconds
> 5 minutes10 – 30 seconds