Skip to main content

Tracking async work

Audience

Integrators waiting on document extraction or risk assessment completion.

What you'll accomplish

Know which resources to poll, what status values mean, and how often to poll.

Long-running operations return immediately with a resource id. Poll that resource until it reaches a terminal state.

Webhooks are not available. Polling is the supported pattern.

Poll intervals

WorkloadInitial intervalBackoffStop when
Document extraction2–5 seconds×1.5 up to ~10 sstatus is terminal
Risk assessment5–10 secondsSamecompleted or failed

Example: poll at 3 s, then 5 s, then 8 s, then 10 s until done. Integrator routes are not rate-limited — see Errors — Rate limits.

Document extraction

After POST /projects/:projectPid/documents/upload-complete, save sourcePid.

Status flow

processing → connected (success)
processing → error (failed)

How to poll

  1. GET /projects/:projectPid/documents
  2. Find the row where pid matches sourcePid
  3. Read status:
    • processing — poll again
    • connected — list artifacts at GET /projects/:projectPid/artifacts
    • error — read lastError
curl -sS 'https://api.air.thalus.ai/projects/<projectPid>/documents' \
-H 'Authorization: Bearer <rawKey>'

While processing, optional fields: progress (0–100), currentStage.

Worked example

TimestatusAction
T+0 sprocessingUpload complete just returned
T+3 sprocessingprogress: 20 — keep polling
T+8 sprocessingprogress: 65 — keep polling
T+15 sconnectedList artifacts; start assessment

Risk assessments

After POST /assessments/projects/:projectPid (202), save assessmentPid.

Status flow

queued → running → completed
queued → running → failed
draft (not started via pipeline)

How to poll

  1. GET /assessments/:assessmentPid
  2. When status is completed or reportAvailable is true → GET /assessments/:assessmentPid/report
  3. On failedGET /assessments/:assessmentPid/stages
curl -sS 'https://api.air.thalus.ai/assessments/<assessmentPid>' \
-H 'Authorization: Bearer <rawKey>'

List runs: GET /assessments/projects/:projectPid.

End-to-end reminder

Upload → poll documents until connected
→ list artifacts
→ POST assessment
→ poll assessment until completed
→ GET report

See Integration flow for curl commands.