Skip to content

Jobs

Requests sent with background: true return at once with a job_id; the work runs as a job, which you poll here. See Background jobs for how jobs run, resume after a restart and are retried.

Paths are relative to /api/v1. The examples use BASE=http://localhost:8000/api/v1 and an API key in $KEY.

Listing and getting jobs needs a read key; cancelling needs write. A key limited to some projects only reaches their jobs. A key bound to a user gets 403 on every jobs endpoint, because job results name files that user may not be allowed to see.

These requests queue jobs:

Request Job kind
POST /projects/{id}/documents with the form field background=true upload
POST /projects/{id}/documents/text text
POST /projects/{id}/documents/url url
POST /projects/{id}/documents/s3 s3
POST /projects/{id}/sync sync
POST /projects/{id}/reindex reindex
POST /projects/{id}/documents/{doc}/process process
POST /projects/{id}/graph/build (background defaults to true) graph

A project whose graph has auto_build on also gets a graph job queued after ingestion that leaves chunks to extract.

The job object

Field Type
job_id integer
project_id integer
kind string upload, text, url, s3, sync, reindex, process or graph
status string queued, running, succeeded, failed or cancelled. The last three are final
progress object or null While it runs. Ingestion jobs: stage, total, done, indexed, failed. Graph jobs: stage (cleared, extracting), total, done, extracted, failed, input_tokens, output_tokens
error string or null Why it failed
attempts integer Runs started. A run interrupted by a restart is retried, up to JOB_MAX_ATTEMPTS (3) runs
cancel_requested boolean A cancel was asked for and the job has not stopped yet
created_at, started_at, finished_at datetime or null ISO 8601
result object or null When it ends; partial when cancelled. Its shape depends on the kind (see Job results). Not included in the list

Job results

kind result
upload, text, url, s3, sync counts (results per status), results (one per file, page or object: {file_name, status, message, document_id, source_uri, archive, replaces}, with the statuses of the inline response), warnings; imports also have stats (the crawl, listing or sync counters)
reindex counts (documents per status) and results: {document_id, file_name, status, chunk_count, error} per document
process document: {document_id, file_name, status, chunk_count, error}
graph The build result

A job whose documents fail one by one still succeeded: the failures are in its result counts and in each document's error. It is failed only when it could not run at all (the bucket was gone, the LLM was down for a whole batch, ...) or when a process job's document failed.

GET /projects/{project_id}/jobs

The project's jobs, newest first, without their result. Finished jobs are kept for JOB_RETENTION_DAYS (14).

Query:

Parameter Type Allowed values Default
status string queued, running, succeeded, failed, cancelled all
kind string upload, text, url, s3, sync, reindex, process, graph all
page integer 1 or more 1
page_size integer 1 to 200 50

Response: 200 with {"jobs": [...], "total", "page", "page_size"}.

Errors: 403 (bound key, or a project the key can't use), 404 (no project), 422 (an unknown status or kind).

curl "$BASE/projects/1/jobs?status=running&kind=url" -H "Authorization: Bearer $KEY"
{
  "jobs": [
    {"job_id": 42, "project_id": 1, "kind": "url", "status": "running",
     "progress": {"stage": "processing", "total": 30, "done": 12, "indexed": 12, "failed": 0},
     "error": null, "attempts": 1, "cancel_requested": false,
     "created_at": "2026-11-29T10:00:00Z", "started_at": "2026-11-29T10:00:01Z",
     "finished_at": null}
  ],
  "total": 1, "page": 1, "page_size": 50
}

GET /projects/{project_id}/jobs/{job_id}

A job: its status, its progress while it runs, and its result or error when it ends. Poll it every few seconds.

Response: 200 with the job. Errors: 403, 404 (no such job in the project).

curl "$BASE/projects/1/jobs/42" -H "Authorization: Bearer $KEY"
{
  "job_id": 42, "project_id": 1, "kind": "upload", "status": "succeeded",
  "progress": {"stage": "processing", "total": 2, "done": 2, "indexed": 2, "failed": 0},
  "error": null, "attempts": 1, "cancel_requested": false,
  "created_at": "2026-11-29T10:00:00Z", "started_at": "2026-11-29T10:00:01Z",
  "finished_at": "2026-11-29T10:00:19Z",
  "result": {
    "counts": {"indexed": 2},
    "results": [
      {"file_name": "handbook.pdf", "status": "indexed", "message": null, "document_id": 31,
       "source_uri": null, "archive": null, "replaces": []},
      {"file_name": "leave.docx", "status": "indexed", "message": null, "document_id": 32,
       "source_uri": null, "archive": null, "replaces": []}
    ],
    "warnings": []
  }
}

POST /projects/{project_id}/jobs/{job_id}/cancel

Cancel a job. No body.

  • A queued job is cancelled at once; its uploaded files are deleted.
  • A running job finishes the document it is on, then stops; an import still fetching stops before its next page, object or document. It then becomes cancelled, with a partial result. Documents already indexed stay indexed; the ones it never processed are marked failed.
  • A finished job is returned unchanged.

Response: 200 with the job, cancel_requested: true while a running job winds down. Errors: 403, 404.

curl -X POST "$BASE/projects/1/jobs/42/cancel" -H "Authorization: Bearer $KEY"