Skip to content

Cancel an operation
Stable

Request

Cancels an existing Dispatch operation. User-initiated updates support only the CANCELLED state.

Use this endpoint to request cancellation while the operation is in a cancellable state. Internal states such as FAILURE, TIMEOUT, DISPATCHING, and PROCESSING are managed by Esper services and cannot be set through this public API.

About Update Operation

Cancellation is allowed only when the operation's current state permits a transition to CANCELLED. For operations that have already dispatched work, cancellation is asynchronous and some devices may complete before downstream cancellation is processed.

Key Fields / Request Body

state — the new operation state, CANCELLED

reason — free text explaining the state change

Common Use Cases

Cancelling an operation that was created in error or is no longer needed

Best Practices

Check the operation's current state with GET /v0/operations/{operationId}/ before attempting to cancel it

Always include a reason so the cancellation is auditable alongside the operation's activity history

Workflow

Call GET /v0/operations/{operationId}/ to confirm the operation is still in a cancellable state

PUT state CANCELLED and a reason to this endpoint

Re-check the operation to confirm the update took effect

Security
device_apiKey
Path
operationIdstringrequired

The ID of the operation to update (Put created operationId here)

Example:5743470f-7dcc-4a92-8a4b-f41b1cea69ed
Bodyapplication/jsonrequired
statestringrequired

The new status of the operation. Only CANCELLED is supported for user-initiated updates.

Value:"CANCELLED"
reasonstringrequired

Free text explaining the state change. Required.

cURL
curl -i -X PUT \
  https://api.esper.io/_mock/openapi/v0/operations/5743470f-7dcc-4a92-8a4b-f41b1cea69ed/ \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "state": "CANCELLED",
    "reason": "User requested"
  }'

Responses

Operation status updated successfully

Bodyapplication/json
operationIdstring

The ID of the updated operation

statusstring

The updated status of the operation

Response
{ "operationId": "12345", "status": "SUCCEEDED" }