ExDocApi/ Docs

GET /api/v1/jobs/:id

Check the status of a job. When status is done, the result is included.

Requires authentication.


Endpoint

GET /api/v1/jobs/:job_id
Authorization: Bearer <api_key>
curl "https://exdocapi.cheapehai.shop/api/v1/jobs/a1b2c3d4-..." \
  -H "Authorization: Bearer $EXDOC_API_KEY"

Response

While processing

{
  "id": "a1b2c3d4-...",
  "status": "processing",
  "file_name": "consultation.pdf",
  "page_count": 1,
  "error": null,
  "created_at": "2024-11-15T10:23:00Z",
  "updated_at": "2024-11-15T10:23:04Z"
}

When done

{
  "id": "a1b2c3d4-...",
  "status": "done",
  "file_name": "consultation.pdf",
  "page_count": 1,
  "error": null,
  "created_at": "2024-11-15T10:23:00Z",
  "updated_at": "2024-11-15T10:23:12Z"
}

The result object is not included in this endpoint. Use GET /api/v1/jobs/:id/result to fetch the extracted data.

When failed

{
  "id": "a1b2c3d4-...",
  "status": "failed",
  "file_name": "invoice.pdf",
  "page_count": 1,
  "error": "Could not reach processing worker",
  "created_at": "2024-11-15T10:23:00Z",
  "updated_at": "2024-11-15T10:23:08Z"
}

Status values

| Status | Meaning | |--------|---------| | queued | Waiting in queue | | pending | Assigned to worker, document parsing starting | | processing | Fields being extracted | | done | Complete — fetch result with /result endpoint | | failed | Failed — check error field |


Polling pattern

async function waitForJob(jobId, apiKey) {
  while (true) {
    const res = await fetch(`https://exdocapi.cheapehai.shop/api/v1/jobs/${jobId}`, {
      headers: { Authorization: `Bearer ${apiKey}` }
    })
    const job = await res.json()

    if (job.status === 'done')   return job
    if (job.status === 'failed') throw new Error(job.error)

    await new Promise(r => setTimeout(r, 3000)) // poll every 3s
  }
}

Most documents complete in 5–20 seconds. Poll every 2–5 seconds.


Error responses

| Status | Meaning | |--------|---------| | 401 | Invalid API key | | 404 | Job not found or belongs to a different account |

← PreviousPOST /extractNext →GET /jobs/:id/result