From 59cafb5493abda238ca086f97044adb57f9a515f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 18 Mar 2026 21:36:45 +0100 Subject: [PATCH] add docs for the scheduler cancel endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../backend-system/core-services/scheduler.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/backend-system/core-services/scheduler.md b/docs/backend-system/core-services/scheduler.md index 55cd23d989..1e56f4903a 100644 --- a/docs/backend-system/core-services/scheduler.md +++ b/docs/backend-system/core-services/scheduler.md @@ -156,6 +156,35 @@ Responds with - `404 Not Found` if there was no such registered task for this plugin - `409 Conflict` if the task was already in a running state +### `POST /.backstage/scheduler/v1/tasks//cancel` + +Cancels the running task with the given task ID. + +For example, to cancel a specific Catalog task: + +```bash +curl -X POST "https:///api/catalog/.backstage/scheduler/v1/tasks/InternalOpenApiDocumentationProvider:refresh/cancel" +``` + +A working example would be: + +```bash +curl -X POST "https://demo.backstage.io/api/catalog/.backstage/scheduler/v1/tasks/InternalOpenApiDocumentationProvider:refresh/cancel" +``` + +Note that there can still be an additional small delay before a worker discovers +that the task is cancelled. This can take up to a few seconds. Note also that it +is up to the task implementation to properly react to the abort signal that was +passed in to it. + +The request has no body. + +Responds with + +- `200 OK` if successful +- `404 Not Found` if there was no such registered task for this plugin +- `409 Conflict` if the task was not in a running state + ## Testing The `@backstage/backend-test-utils` package provides `mockServices.scheduler`, which provides a mocked implementation of the scheduler service that can be used in tests. This mocked implementation is used by default in `startTestBackend`, and it will immediately run any registered tasks on startup as long as they're not configured to run manually or with an initial delay.