POST /api/v1/cloud/environments/{environment_id}/work/{work_id}/stop
Stops a work item. The request body is optional; an empty body or {} sends the default force=false request, also called a graceful stop.
For starting or active items, force=false moves the item to stopping. The worker should drain the in-flight work, then call this endpoint again to confirm completion and move the item to stopped. force=true moves any live item directly to stopped.
Path parameters
| Parameter | Type | Description |
|---|---|---|
environment_id | string | Environment ID with the env_ prefix |
work_id | string | Work item ID with the work_ prefix |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $QODER_PAT |
Content-Type | No | application/json when a body is sent |
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
force | boolean | No | false | If true, force the item to stopped without graceful drain |
Example request: force=false
Example request: force=true
Example response
HTTP 200 OKResponse fields
Returns the updated Work item object.Errors
| HTTP | Type | Trigger |
|---|---|---|
| 400 | invalid_request_error | Request body is not valid JSON |
| 400 | invalid_request_error | The Environment is not self_hosted |
| 401 | authentication_error | PAT invalid or expired |
| 403 | permission_error | Not authorized for this operation |
| 404 | not_found_error | Environment or work item not found |
State transitions
force=false means an empty body, {}, or {"force": false}. force=true means {"force": true}.
force | Current state | Result |
|---|---|---|
false | queued | stopped |
false | starting or active | stopping |
false | stopping | stopped |
false | stopped | Returns the existing stopped item |
true | Any live state | stopped |
Related
Cloud environment setup
Choose the container, network, and dependencies your agent runs in.