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

# Get Job

> Retrieves the status and result of a background job.

Poll this endpoint to check an async job. The `status` field can be
`processing`, `completed`, or `failed`.

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.chatgrid.ai/v1/jobs/ccdd1122-3344-5566-7788-99aabbccddee" \
    -H "Authorization: Bearer cgk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
  ```

  ```typescript Node.js (polling) theme={null}
  async function waitForJob(jobId: string, apiKey: string): Promise<any> {
    while (true) {
      const resp = await fetch(`https://api.chatgrid.ai/v1/jobs/${jobId}`, {
        headers: { Authorization: `Bearer ${apiKey}` },
      });
      const { data } = await resp.json();

      if (data.status === "completed") return data.result;
      if (data.status === "failed") throw new Error(data.error);

      await new Promise((r) => setTimeout(r, 2000));
    }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 (processing) theme={null}
  {
    "object": "job",
    "data": {
      "id": "ccdd1122-3344-5566-7788-99aabbccddee",
      "type": "document_process",
      "status": "processing",
      "result": null,
      "error": null,
      "created_at": "2026-03-15T11:00:00.000Z",
      "updated_at": "2026-03-15T11:00:00.000Z"
    }
  }
  ```

  ```json 200 (completed) theme={null}
  {
    "object": "job",
    "data": {
      "id": "ccdd1122-3344-5566-7788-99aabbccddee",
      "type": "document_process",
      "status": "completed",
      "result": { "chunks": 12 },
      "error": null,
      "created_at": "2026-03-15T11:00:00.000Z",
      "updated_at": "2026-03-15T11:02:30.000Z"
    }
  }
  ```

  ```json 200 (failed) theme={null}
  {
    "object": "job",
    "data": {
      "id": "ccdd1122-3344-5566-7788-99aabbccddee",
      "type": "document_process",
      "status": "failed",
      "result": null,
      "error": "Failed to parse document: unsupported format",
      "created_at": "2026-03-15T11:00:00.000Z",
      "updated_at": "2026-03-15T11:00:05.000Z"
    }
  }
  ```
</ResponseExample>
