> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ndi.nace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Jobs

> Wait, stream, cancel, and usage

Every slow `/v1` call returns a `Job`. `wait_seconds` is a query parameter.
`Idempotency-Key` is minted automatically on document operations unless you
pass `idempotency_key`.

```ts theme={"dark"}
import { NdiClient, isParseResult } from "ndi-sdk";

const client = new NdiClient();
const upload = await client.documents.createUpload("report.pdf");
const queued = await client.documents.parse(upload);
const job = await client.jobs.wait(queued.job_id, { timeout: 600 });
if (isParseResult(job.result)) {
  console.log(job.status, job.result.markdown);
}
```

## Methods

```text theme={"dark"}
get(job_id: string): Promise<Job>
list(opts?: { workspace_id?, kind?, status?, created_after?, cursor?, limit? }): Promise<Page<Job>>
iterAll(opts?: { workspace_id?, kind?, status?, created_after?, limit? }): AsyncGenerator<Job>
wait(job_id: string, opts?: { timeout?: number; raise_on_failure?: boolean }): Promise<Job>
cancel(job_id: string, opts?: { reason?: string }): Promise<Job>
events(job_id: string, opts?: { last_event_id?: string }): AsyncGenerator<JobEvent>
groundCrop(job_id: string, artifact_ref: string, opts?: { byte_range?: string }): Promise<Uint8Array>
usage(opts: { period_start: Date | string; period_end: Date | string; workspace_id?: string; group_by?: "day" | "kind" | "workspace" }): Promise<UsageResponse>
```

`wait` throws `JobFailedError` on `failed`/`cancelled` and `JobTimeoutError`
when the budget runs out (the job keeps running).

```ts theme={"dark"}
import { NdiClient } from "ndi-sdk";

const client = new NdiClient();
const usage = await client.jobs.usage({
  period_start: "2026-08-01",
  period_end: "2026-09-01",
});
console.log(usage);
```

`jobs.request` and `jobs.delete` are not wrapped — call
`GET /v1/jobs/{id}/request` and `DELETE /v1/jobs/{id}`.
`GET /v1/usage/overview` is HTTP-only.

See [Jobs guide](/guides/jobs).
