Elizon Docs
Agents

Agent Jobs

GET /api/v1/jobs/:jobId and POST /api/v1/jobs/:jobId/cancel — poll and cancel an async agent run.

Get a job

Returns the current state of an async job created by POST /run-async.

GET /api/v1/jobs/{jobId}

Path parameters

ParameterTypeDescription
jobIdstring (UUID)The job ID returned by run-async.

Response

200 OK

{
  "jobId": "9c4e2a1b-...",
  "agentId": "3f9c...",
  "status": "completed",
  "createdAt": 1732550123,
  "startedAt": 1732550124,
  "completedAt": 1732550131,
  "result": { "content": "...", "sessionId": "...", "metrics": { "...": "..." } },
  "error": null
}
FieldDescription
statusqueued, running, completed, failed, timeout, or cancelled.
startedAt / completedAtUnix timestamps (seconds), or null until reached.
resultThe run's result — only populated when status is completed. null for every other status, including while it's still running.
errorThe failure message — only populated when status is failed or timeout. null otherwise.

Keep polling while status is queued or running; stop once it's completed, failed, timeout, or cancelled. See Recommended polling interval.

Cancel a job

Cancels an async job before it finishes.

POST /api/v1/jobs/{jobId}/cancel

Path parameters

ParameterTypeDescription
jobIdstring (UUID)The job to cancel.

Behaviour

  • Queued job — removed from the queue before it ever starts running.
  • Running job — the in-flight agent run is cancelled the same way DELETE /agents/:agentId/runs/:runId cancels a synchronous run.
  • Already terminal (completed, failed, timeout, or already cancelled) — this endpoint is idempotent. It returns 200 with the job's actual current status, unchanged. Cancelling a finished job is not an error.

Response

200 OK

{ "jobId": "9c4e2a1b-...", "status": "cancelled" }

Or, if the job had already reached a terminal state before the cancel request arrived:

{ "jobId": "9c4e2a1b-...", "status": "completed" }

Errors

StatuserrorWhen
404job_not_foundNo job with that ID exists for your organization/project — on both endpoints. This includes jobs that exist but belong to a different tenant — Elizon returns 404, not 403, so a job ID never confirms another tenant's job exists.

Example

curl https://api.elizon.com/api/v1/jobs/9c4e2a1b-... \
  -H "X-API-Key: elz_your_key_here"

curl -X POST https://api.elizon.com/api/v1/jobs/9c4e2a1b-.../cancel \
  -H "X-API-Key: elz_your_key_here"