Jobs
Poll background work and collect every page of results.
GET https://www.ninjabuy.com/api/v1/jobs/{id} requires the same account's bearer token. Missing, unknown and other accounts' jobs return 404.
Lifecycle
job.status | Meaning |
|---|---|
queued | Waiting to start. |
running | Work is in progress; more results may arrive. |
done | Processing finished. Check each result's status. |
failed | The job failed. Read job.error when present. |
job includes id, kind, status and startedAt, plus optional progress (done, total), finishedAt, result and error. Timestamps are milliseconds since the Unix epoch. While queued or running, poll_after_seconds and the Retry-After header tell you how long to wait; the initial suggestion is 5 seconds.
Link batches have kind: "link_mints". Their final result reports total, converted, failed and optional campaign and label. Here failed counts inputs answered without conversion; it does not mean the whole job's status is failed. Sheet conversions have kind: "sheet_conversion"; their final job.result contains counts and a signed XLSX download URL. The job schema also covers sheet_read, picture_copy and resolution_run.
Cursor paging
The response contains job, results, cursor, has_more and request_id. Each page contains up to 50 results in input order.
- Omit
cursorfor the first page (offset 0). - Consume
resultsand retain any non-null returnedcursor. - When
has_moreis true, request the next page with?cursor=RETURNED_CURSOR. - If
has_moreis false while queued or running, waitpoll_after_seconds, then poll with the retained cursor. More results can arrive later. - Finish only when the job is
doneorfailedand all result pages have been read (cursoris null).
A cursor must be a single query parameter of 1 to 6 digits (0 to 999999). Invalid or repeated cursor parameters return 400. Do not treat has_more: false alone as completion. See the curl examples.