Retrieve the current status and results of a submitted evaluation job. Use this endpoint to poll for results if you did not provide a webhook_url when submitting the job.
This endpoint is planned. The job submission endpoint (POST /api/v1/jobs) is live in production. Polling support is coming soon — use webhook_url on job submission for now.
If polling (rather than using webhooks), use exponential backoff:
TypeScript
Copy
Ask AI
async function pollEvaluation(evalId: string, apiKey: string) { const maxAttempts = 10 let delay = 2000 // start at 2 seconds for (let attempt = 0; attempt < maxAttempts; attempt++) { const response = await fetch( `https://api.usenexio.com/api/v1/jobs/${evalId}`, { headers: { "X-API-Key": apiKey } } ) const data = await response.json() if (data.status === "completed" || data.status === "failed") { return data } await new Promise((resolve) => setTimeout(resolve, delay)) delay = Math.min(delay * 1.5, 30000) // cap at 30 seconds } throw new Error("Evaluation timed out")}
For most use cases, webhooks are simpler and more efficient than polling. Consider polling only when you cannot expose a public HTTPS endpoint for webhooks.