POST /v2/evals/experiments/{experiment_id}/jobs
Start a job on the experiment. With mode generate the job produces outputs for the experiment's rows and scores them in the same job when evaluator IDs are passed; with mode score it scores the existing outputs with the selected evaluators, at least one, and regenerates nothing. The job is queued: the response is 202 with the job URL in Location and status_url. Poll that URL until the job's status is completed, completed_with_failures, failed or cancelled. One job runs per experiment at a time; starting another while one is active returns 409. When the active job is known, Location and meta.status_url point to it, with its IDs in meta.job_id and meta.experiment_id.
How to use
Use generate for new outputs (and optional evaluation), score for existing outputs with at least one evaluator. Persist the returned job ID/status_url. Only one active job is allowed; follow the existing job on 409 instead of starting duplicates.
Authentication and permissions
Required permissions: evals.run. Resource and owner access checks also apply.
Prepare request.json
Save the example body below as request.json for the curl sample. Replace example IDs, node keys, and dynamic configuration with values for your organization; these are illustrative, not pre-existing resources.
{
"mode": "generate",
"evaluator_ids": [
"00000000-0000-4000-8000-000000000001"
]
}Personal API key (sk_...) or supported user access JWT. See Authentication and authorization for endpoint restrictions and scopes. Use exactly one Authorization header.
What a job does.
generate: produce outputs for the experiment's rows, and score them when evaluators were selected. score: score existing outputs only; nothing is regenerated.
Successful Response
Invalid request or pagination cursor
Missing or invalid credentials
Denied permission, project folder access, or API-key scope (meta.required_scope)
Resource not found in the caller's organization
The experiment already has an active job. When its identity is known, the error envelope includes meta.job_id, meta.experiment_id, meta.status_url and a matching Location header. Poll that job until it reaches a final status, then retry. Other conflicts omit this metadata and Location.
Invalid evaluation contract, row shape, evaluator configuration, or filter combination
Job launch was rejected or job state is temporarily unavailable
Client error returned in the public API envelope
curl --fail-with-body -sS \
"$STACKAI_BASE_URL/v2/evals/experiments/${EXPERIMENT_ID}/jobs" \
-H "Authorization: Bearer $STACKAI_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @request.json{
"response_code": "text",
"meta": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"data": {
"status": "accepted",
"job_id": "123e4567-e89b-12d3-a456-426614174000",
"experiment_id": "123e4567-e89b-12d3-a456-426614174000",
"status_url": "text"
}
}Last updated
Was this helpful?

