Cancel a scheduled request
Cancel a single scheduled request with POST /scheduler/requests/{scheduled_request_id}/cancel. Cancellation is final: the request's status becomes CANCELLED, it will not be called, and it cannot be un-cancelled.
Cancellation is final. A cancelled request will not be called and cannot be un-cancelled. To run the same call again, submit a new call job; that creates a new scheduled request.
Before you start
You need an API key and the scheduled_request_id of the request you want to cancel. The submission response returns one scheduled_request_id per row in scheduled_requests[], and the polling and query endpoints return it too. See the Call Jobs API reference for details.
Cancel the request
The endpoint takes the request id in the path. There is no request body, and the endpoint cancels one request per call.
Send the cancel request with your API key:
API_KEY="$API_KEY"
SCHEDULED_REQUEST_ID="8f2a1b3c-4d5e-4f6a-9b8c-7d6e5f4a3b2c"
URL="https://stage-agent-api.evergrovelabs.com/scheduler/requests/${SCHEDULED_REQUEST_ID}/cancel"
curl -X POST "$URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Accept: application/json"Check the response.
204 No Contentwith an empty body means the request was cancelled successfully.
After a successful cancellation
The request's status becomes CANCELLED and any recommended callback time on it is cleared. The next time you poll GET /scheduler/call-jobs/{call_job_id} or query with POST /scheduler/call-jobs/query, the request shows CANCELLED.
When a scheduled request cannot be cancelled
The API returns 409 Conflict with a detail reason when the request is not cancellable. There are three reasons:
| Reason | What you can do |
|---|---|---|
| A call is in progress right now. | Wait for the call to finish. If the request then sits in |
| The request already finished with an outcome ( | Nothing. The outcome is final. |
| The request was already cancelled. | Nothing. Cancellation is final. |
Cancellation by status
ENQUEUED means the request is waiting to start, so it can be cancelled. ACTIVE means a call is in progress, so cancellation is refused. ERROR is also cancellable, unless a retry call is in progress.
ENQUEUED (waiting to start)
β
βββ cancel βββΆ 204 βββΆ CANCELLED
βΌ
call starts
βΌ
ACTIVE (call in progress)
β
βββ cancel βββΆ 409 "still calling"
βΌ
call ends
βΌ
βββββββββββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββββββββ
βΌ βΌ βΌ
COMPLETE DO_NOT_CALL_BACK ERROR
β β β
β cancel: 409 β cancel: 409 βββ cancel βββΆ 204* βββΆ CANCELLED
β "already called β "already called β
β with outcome" β with outcome" βββ if a retry call is
β β in progress: 409
β β "still calling"
βΌ βΌ
(final) (final)
CANCELLED
β
βββ cancel βββΆ 409 "already cancelled" (the request does not change)
* A retry call in progress still returns 409 "still calling".Status | Meaning | Cancel result |
|---|---|---|
| Waiting to start. |
|
| A call is in progress. |
|
| A previous call failed. |
|
| Finished with an outcome. |
|
| Marked as do-not-call. |
|
| Already cancelled. |
|
A request in ERROR can still be cancelled, even though polling reports ERROR as a terminal status.
Error responses
Status | Meaning | Action |
|---|---|---|
| Missing or invalid bearer token. | Check your |
| Authorization failed. | Check that your key has access to this tenant. |
|
| Check the id and the tenant your key is scoped to. |
| The request cannot be cancelled. See the reasons above. | Follow the action for the returned |
|
| Retry later. |