Async Jobs

Three endpoints for managing async solve jobs created by POST /optimize/async.

List jobs

GET /api/v1/jobs

Returns every tracked async job (all statuses) as a list of AsyncJobStatus.

curl https://api.fieldgenius.be/api/v1/jobs \
  -H "X-API-Key: your-adapter-key" \
  -H "X-Client-Key: your-client-key"
import httpx

headers = {"X-API-Key": "your-adapter-key", "X-Client-Key": "your-client-key"}
resp = httpx.get("https://api.fieldgenius.be/api/v1/jobs", headers=headers)
for job in resp.json():
    print(job["job_id"], job["status"])

Get job status/result

GET /api/v1/jobs/{job_id}

Returns the AsyncJobStatus for one job, including the full result (an OptimizationResponse) once completed.

curl https://api.fieldgenius.be/api/v1/jobs/3fa6c1e2-9f0a-4b8d-8e35-1a2b3c4d5e6f \
  -H "X-API-Key: your-adapter-key" \
  -H "X-Client-Key: your-client-key"
import httpx

job_id = "3fa6c1e2-9f0a-4b8d-8e35-1a2b3c4d5e6f"
headers = {"X-API-Key": "your-adapter-key", "X-Client-Key": "your-client-key"}
resp = httpx.get(f"https://api.fieldgenius.be/api/v1/jobs/{job_id}", headers=headers)
status = resp.json()
if status["status"] == "completed":
    print(status["result"]["score"])

Errors

StatusCodeResolution
404JOB_ID_NOT_FOUNDThe job ID does not exist. If the deployment does not have the durable job queue enabled (JOB_PERSISTENCE_ENABLED=false, the default), jobs are kept in memory only and this also happens after any process restart. With persistence enabled, job records survive a restart and are recovered automatically at startup, so a restart alone no longer causes this.

Cancel a running job

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

Attempts to cancel a queued or running job. Returns the updated AsyncJobStatus on success.

curl -X POST https://api.fieldgenius.be/api/v1/jobs/3fa6c1e2-9f0a-4b8d-8e35-1a2b3c4d5e6f/cancel \
  -H "X-API-Key: your-adapter-key" \
  -H "X-Client-Key: your-client-key"
import httpx

job_id = "3fa6c1e2-9f0a-4b8d-8e35-1a2b3c4d5e6f"
headers = {"X-API-Key": "your-adapter-key", "X-Client-Key": "your-client-key"}
resp = httpx.post(f"https://api.fieldgenius.be/api/v1/jobs/{job_id}/cancel", headers=headers)
print(resp.json()["status"])  # "cancelled"

Errors

StatusCodeResolution
404JOB_ID_NOT_FOUNDThe job ID does not exist.
409JOB_ALREADY_TERMINALThe job already completed, failed, or was previously cancelled; check the current status field in the error context.

FieldGenius VRP API documentation. Generated from the engineering source of truth (.tex docs and app/ source).