Job Monitoring¶
After uploading files, monitor the progress of your processing jobs using real-time Server-Sent Events (SSE) or by polling individual job status.
Job States¶
Jobs progress through the following states:
| State | Description |
|---|---|
upload_pending | File upload is in progress |
queued | Job is queued for processing |
processing | Job is actively being processed |
completed | Job finished successfully |
failed | Job encountered an error |
cancelled | Job was cancelled by the user |
SSE Real-Time Events¶
Connect to the SSE endpoint to receive real-time job status updates. This is the recommended approach for monitoring jobs.
Request¶
Authentication
The SSE endpoint uses a token query parameter instead of the Authorization header for compatibility with SSE clients.
Examples¶
const eventSource = new EventSource(
"https://api.aivaportal.com/jobs/events?token=<AIVA_API_KEY>"
);
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Job update:", data);
};
eventSource.onerror = (error) => {
console.error("SSE error:", error);
eventSource.close();
};
SSE Event Format¶
Events are streamed in standard SSE format:
data: {"job_id": "job_abc123", "status": "processing", "progress": 45, "message": "Running variant annotation..."}
data: {"job_id": "job_abc123", "status": "completed", "message": "Job completed successfully."}
Poll Job Status¶
Poll the status of an individual job by its ID.
Request¶
Examples¶
Response¶
{
"job_id": "job_abc123",
"status": "processing",
"progress": 65,
"message": "Running variant annotation...",
"created_at": "2026-03-09T10:30:00Z",
"updated_at": "2026-03-09T10:35:00Z"
}
List Jobs¶
Retrieve a list of all your jobs.
Request¶
Examples¶
Response¶
[
{
"job_id": "job_abc123",
"status": "completed",
"sample_name": "Patient-001",
"created_at": "2026-03-09T10:30:00Z",
"completed_at": "2026-03-09T10:45:00Z"
},
{
"job_id": "job_def456",
"status": "processing",
"sample_name": "Patient-002",
"created_at": "2026-03-09T11:00:00Z"
}
]
Cancel a Job¶
Cancel a job that is in queued or processing state.
Request¶
Examples¶
Response¶
Delete a Job¶
Delete a job and its associated data. Only completed, failed, or cancelled jobs can be deleted.
Request¶
Examples¶
Response¶
Polling Strategy¶
If you cannot use SSE, poll the job status endpoint at a reasonable interval:
- Poll every 5 seconds while the job is in
queuedorprocessingstate. - Stop polling when the job reaches
completed,failed, orcancelled. - Use the
progressfield (when available) to display progress to users.
import requests
import time
headers = {"Authorization": "Bearer <AIVA_API_KEY>"}
job_id = "job_abc123"
while True:
response = requests.get(
f"https://api.aivaportal.com/jobs/{job_id}/status",
headers=headers,
)
data = response.json()
print(f"Status: {data['status']}")
if data["status"] in ("completed", "failed", "cancelled"):
break
time.sleep(5)