Skip to main content
DELETE
https://agentgate.mynewapi.com
/
api
/
v1
/
work-orders
/
{id}
Cancel Work Order
curl --request DELETE \
  --url https://agentgate.mynewapi.com/api/v1/work-orders/{id} \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "data": {
    "id": "<string>",
    "status": "<string>",
    "message": "<string>",
    "wasRunning": true
  }
}

Cancel Work Order

Cancels a work order that is currently queued or running. This endpoint supports graceful cancellation of active work orders.
Cancellation is irreversible. A canceled work order cannot be resumed.

Request

id
string
required
The work order ID to cancel (e.g., wo_abc123)
curl -X DELETE https://agentgate.mynewapi.com/api/v1/work-orders/wo_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Cancellation result

Example Response

Successful Cancellation

{
  "success": true,
  "data": {
    "id": "wo_abc123",
    "status": "canceled",
    "message": "Work order canceled successfully",
    "wasRunning": true
  },
  "requestId": "req_xyz789"
}

Queued Work Order Cancellation

{
  "success": true,
  "data": {
    "id": "wo_def456",
    "status": "canceled",
    "message": "Work order canceled successfully",
    "wasRunning": false
  },
  "requestId": "req_abc123"
}

Error Responses

Work Order Not Found

{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Work order not found: wo_invalid"
  },
  "requestId": "req_xyz789"
}

Already Completed

Returns 409 Conflict if the work order is already in a terminal state.
{
  "success": false,
  "error": {
    "code": "CONFLICT",
    "message": "Cannot cancel work order in status 'succeeded'"
  },
  "requestId": "req_xyz789"
}

Behavior

Original StatusBehavior
queuedImmediately marked as canceled
runningGraceful shutdown initiated, then marked canceled
succeededReturns 409 Conflict
failedReturns 409 Conflict
canceledReturns 409 Conflict
For running work orders, the agent process is given time to clean up before the work order is marked as canceled. Use the Force Kill endpoint if you need immediate termination.