generate_feature
Dispatch AI test generation for a feature. Returns immediately with a requestId; the pipeline runs in a cloud sandbox for several minutes.
Generation consumes account credits. One generation per feature at a time — a second dispatch while one is in flight returns 409 conflict.
Request
POST /api/v1/ops/projects/{project}/features/{feature}/generate
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
project | path | string | yes | The project's public id. |
feature | path | string | yes | Feature id or name. |
siteUrl | body | string | no | Test site URL override (defaults to the project's configured URL). |
- cURL
- CLI
- MCP
curl -X POST -H "Authorization: Bearer $TESTVIBE_API_KEY" \
-H "Content-Type: application/json" -d '{}' \
"$TESTVIBE_SERVER/api/v1/ops/projects/$PROJECT/features/12/generate"
testvibe generate "Login Functionality" --watch --timeout 3600
Tool generate_feature — { "feature": "Login Functionality" }. Follow with wait_for_generation.
Response
202 Accepted
{ "requestId": "a1b2c3d4-…", "featureId": 12 }
The feature's status flips to generating; track progress via get_generation_status and branch on isTerminal, terminalReason, or awaitingInput.
--watch follows it to the end and exits 0 only when the generation actually succeeded — 1 if it failed or was cancelled, 2 if it parked to ask you a question, 3 if --timeout (default 5400 s) elapsed first. See the CLI wait contract.
Errors
| HTTP | When |
|---|---|
404 not_found | No such feature in this project. |
409 conflict | Already generating, or the dispatch was rejected. |
Additional dispatch options
| Body field | Type | Behavior |
|---|---|---|
model | string | Exact id from GET …/projects/{project}/models / list_models / testvibe models; omit for the project default, or use auto for model selection. Applies only to this generation. |
gherkinChanges | string | ask (default), accept, deny, or stop. Unknown values fall back to ask. |
notify | boolean | Default false; opt into normal completion notifications. CLI: --notify. |
preflight | boolean | REST/MCP: return the target, mutation risk, references, and confirmation information without starting generation or choosing a model. Returns 200. |
confirm | string | REST/MCP: echo the preflight token when the deployment's transactional confirmation gate requires it. A source edit invalidates the token. |
Generation drives the target application live. Its steps can change target data during generation, before a separately dispatched test run. A required confirmation returns 409 confirmation_required; unknown models return 400 invalid_model. Do not hard-code the model catalog: inspect ids and configured on the current installation. Model selection responses can add model, modelSource, and modelReason.
Answer a paused generation
Poll generation status. If awaitingInput is true, send exactly one answer shape to:
POST /api/v1/ops/projects/{project}/features/{feature}/generation/answer
The body is {requestId?, option}, {requestId?, message}, or {requestId?, fields:[{name,value}]}. Prefer the question's pendingInput.requestId when present. Do not substitute an unrelated workflow request id. The response is 202 with ok, requestId, featureId, applied, and decision; resumed work can have a newRequestId.
testvibe generate answer 12 --option "<exact option from pendingInput>" --watch
MCP uses answer_generation with feature, optional requestId, and option, message, or fieldsJson (a JSON-encoded array). An already answered/cancelled question returns 409. Inspect a resume_unavailable or resume_failed response before deciding whether fresh generation is required.