Jobs
Follow a job and the runs it created, and get a job's data.
A job is one start of an agent that can create one or more runs — for example, a large search split across sessions. You get one from start-job — the recommended way to start an agent — and group and pipeline runs create one job per agent they start.
Knowing when a job is done
There's no call that waits for a job. Start it, keep its agentJobHistoryId, and check on it:
curl "$NEXQDATA_API/api/scraper-agents/jobs?jobId=$JOB_ID" \
-H "X-Api-Key: $NEXQDATA_API_KEY"{
"success": true,
"data": {
"items": [
{
"agentJobHistoryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"agentName": "Court records · TX",
"status": 1,
"statusName": "In Progress",
"isTerminal": false,
"completedRunCount": 0,
"totalRunCount": 1,
"totalDataCount": 0,
"errorMessage": null
}
],
"nextCursor": null
}
}The job is finished when isTerminal is true. Then status says how it went:
status | Meaning |
|---|---|
0 | Never run. |
1 | In progress. |
2 | In progress, but at least one of its runs has failed. |
3 | Succeeded — its data is ready to download. |
4, 5 | Failed. errorMessage and the job's runs say why. |
Branch on the numeric status, not on statusName — the name is display text. Check every 5–15 seconds while a job is in progress; reading status isn't rate-limited, but there's nothing to gain from polling faster than the job can progress.
List jobs
/ api/ scraper-agents/ jobsJobs across every agent you can access, newest first, cursor-paged.
| Query parameter | Default | Description |
|---|---|---|
state | all | active, succeeded, or failed. Unlike run history, an unknown value is ignored rather than rejected. |
jobId | — | Return just this job. |
search | — | Matches the agent name or id, the session, or the error message. |
from, to | — | Only jobs in this date range. |
pageSize | 25 | Up to 100. |
cursor | — | The nextCursor from the previous page. |
For one agent's jobs, use:
/ api/ scraper-agents/ {id}/ jobsUses the agent's id (GUID), and takes pageSize and cursor.
Useful fields
| Field | Meaning |
|---|---|
agentJobHistoryId | The job id — the agentJobHistoryId that start-job returned. |
status, statusName, isTerminal | The job's status code, its display name, and whether it has finished. |
completedRunCount, totalRunCount | How many of its runs have finished, out of how many. |
totalDataCount, totalErrors | Data items collected and errors hit, across all its runs. |
inputParameters | The inputs the job started with. |
triggerSource, scheduleId | Manual or Schedule, and which schedule, if any. |
searchGroupRunId, pipelineRunId | The group or pipeline run the job belongs to, if any. |
errorMessage | Why the job failed, when it did. |
To list jobs by outcome, filter with state (failed covers both failure codes) rather than matching on statusName.
A job's runs
/ api/ scraper-agents/ jobs/ {jobId}/ runsEvery run the job created, with the same fields as run history. While any of the job's runs are unfinished, it re-reads them from the execution engine and updates the job's totals before answering — so it's also the way to refresh a job that looks stale. There's no GET for a single job — use this, or GET /api/scraper-agents/jobs?jobId={jobId}.
A job's data
/ api/ scraper-agents/ jobs/ {jobId}/ exportDownloads everything the job collected. For a job with several runs, that's one combined zip.
/ api/ scraper-agents/ jobs/ {jobId}/ datasetReturns the job's datasetId, to preview or query the data before downloading it. It fails the same way a download does — see When data isn't available.
Counts
| Endpoint | data |
|---|---|
GET /api/scraper-agents/jobs/active-count | Jobs still in progress, as a number. |
GET /api/scraper-agents/jobs/status-counts | Jobs by status: all, demo, inProgress, inProgressWithFailure, succeeded, failure, failed. |