Elizon Docs
Teams

Run (Async)

POST /api/v1/teams/:teamId/run-async — queue a team run and poll for the result.

Queues a team run and returns immediately with a job ID, instead of blocking for up to 30 seconds like /run-sync. Use this for anything that might run long — plan-execute teams especially, since they can iterate several times before finishing — or when you'd rather not hold a connection open.

POST /api/v1/teams/{teamId}/run-async

Path parameters

ParameterTypeDescription
teamIdstring (UUID)The team to run.

Request body

Identical to /run-sync: message (required), session_id, user_id.

Response

202 Accepted

{
  "jobId": "9c4e2a1b-...",
  "teamId": "3f9c...",
  "status": "queued",
  "createdAt": 1732550123
}

Lifecycle

  1. POST /teams/:teamId/run-async → receive a jobId, status queued.
  2. GET /team-jobs/:jobId (poll) → status moves through queuedrunning → a terminal state.
  3. A terminal state is reached: completed, failed, timeout, or cancelled.
  4. Optionally, POST /team-jobs/:jobId/cancel at any point before it reaches a terminal state.

See Team jobs for the full job response shape and cancellation.

  • Poll every 2 seconds for the first 30 seconds — most jobs finish inside that window.
  • After 30 seconds, back off to every 5 seconds until you see a terminal state.
  • Don't poll more than once per second — it burns your rate limit budget for no benefit.

Python example

import asyncio
import httpx

async def run_and_poll(team_id: str, message: str, api_key: str) -> dict:
    base = "https://api.elizon.com/api/v1"
    headers = {"X-API-Key": api_key, "Content-Type": "application/json"}

    async with httpx.AsyncClient() as client:
        # Submit async job
        r = await client.post(f"{base}/teams/{team_id}/run-async",
                              headers=headers, json={"message": message})
        job_id = r.json()["jobId"]

        # Poll until terminal
        interval, elapsed = 2, 0
        while True:
            await asyncio.sleep(interval)
            elapsed += interval
            if elapsed > 30:
                interval = 5
            r = await client.get(f"{base}/team-jobs/{job_id}", headers=headers)
            job = r.json()
            if job["status"] in ("completed", "failed", "timeout", "cancelled"):
                return job

Errors

StatuserrorWhen
400validation error ({ "errors": [...] })message missing/empty, or another field fails validation
403forbiddenThe team belongs to a different project than your project-scoped key
404team_not_foundNo team with that ID exists in your organization
502enqueue_failedThe job couldn't be queued (transient infrastructure error) — safe to retry

Example

curl -X POST https://api.elizon.com/api/v1/teams/{teamId}/run-async \
  -H "X-API-Key: elz_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"message": "A customer is asking about a refund on order #4821"}'