> For the complete documentation index, see [llms.txt](https://synap.ac/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://synap.ac/docs/api/reference/automation/cancel-or-retry-automation-runs.md). Agents can also search and read this documentation through its [MCP server](https://synap.ac/docs/~gitbook/mcp).

# Cancel or retry Automation Runs

JSON:API Atomic Operations extension. Each `update` operation names a run and carries exactly one of `status: "cancelled"` (cancel) or `requestedRetryOfStepId` (retry from that failed step). Malformed operations reject the whole batch before anything is written, each reported with a `source.pointer` of `/atomic:operations/{index}`. Well-formed operations are applied in order and independently; one that cannot be applied (for example a run that is no longer cancellable) stops the batch at that index, and the runs before it stay changed. Use the media type `application/vnd.api+json; ext="https://jsonapi.org/ext/atomic"`.

```json
{"openapi":"3.0.1","info":{"title":"Synap API","version":"3.0.0"},"tags":[{"name":"Automation","description":"Endpoints for building and running automations: the block catalogue the workflow builder and the automations engine work from."}],"servers":[{"url":"https://api.synap.ac/v3","description":"Production"},{"url":"https://api-stage.synap.ac/v3","description":"Staging"}],"security":[{"SessionAuth":[]},{"PATAuth":[]},{"AutomationAuth":[]},{"LegacySessionAuth":[]}],"components":{"securitySchemes":{"SessionAuth":{"type":"http","scheme":"bearer","description":"Authorize the request using a Session Token.","bearerFormat":"r:<token>"},"PATAuth":{"type":"http","scheme":"bearer","description":"Authorise the request using a personal access token.","bearerFormat":"p:"},"AutomationAuth":{"type":"http","scheme":"bearer","description":"Authorise the request with a short-lived token signed by the automations engine on behalf of a workflow owner.","bearerFormat":"a:<token>"},"LegacySessionAuth":{"type":"apiKey","description":"[Legacy] Authorize the request using a Session Token.","in":"header","name":"X-Syn-Session-Token"}},"schemas":{"ObjectId":{"type":"string","description":"The primary key for each resource."},"AutomationRun":{"type":"object","required":["id","type"],"properties":{"id":{"$ref":"#/components/schemas/ObjectId"},"type":{"type":"string","description":"Identifies the Resource.","enum":["AutomationRun"]},"attributes":{"type":"object","properties":{"automationVersion":{"type":"integer","minimum":1,"readOnly":true},"upgradedFromVersion":{"type":"integer","minimum":1,"readOnly":true,"nullable":true},"mode":{"type":"string","enum":["live","dryRun"],"readOnly":true},"triggerEventId":{"type":"string","readOnly":true},"status":{"type":"string","enum":["pending","running","waiting","paused","completed","skipped","failed","exhausted","cancelled"],"readOnly":true},"pausedAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"cancelledReason":{"type":"string","enum":["manual","disabled","discarded",null],"readOnly":true,"nullable":true},"depth":{"type":"integer","minimum":0,"readOnly":true},"targetId":{"type":"string","readOnly":true,"nullable":true},"startedAt":{"type":"string","format":"date-time","readOnly":true},"finishedAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"resumeAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"nextAttemptAt":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"attemptCount":{"type":"integer","minimum":0,"readOnly":true},"currentStepId":{"type":"string","readOnly":true,"nullable":true},"requestedRetryOfStepId":{"type":"string","readOnly":true,"nullable":true},"definition":{"type":"object","description":"The workflow definition snapshot the run executes. Present on a single run, absent from run listings.","additionalProperties":true,"readOnly":true},"steps":{"type":"array","description":"The step log. Present on a single run, absent from run listings.","readOnly":true,"items":{"type":"object","required":["stepId","status","attemptCount"],"properties":{"stepId":{"type":"string"},"status":{"type":"string","enum":["pending","running","succeeded","failed","skipped","waiting"]},"attemptCount":{"type":"integer","minimum":0},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"opId":{"type":"string"},"request":{"type":"object","required":["method","path"],"properties":{"method":{"type":"string"},"path":{"type":"string"},"body":{}}},"response":{"type":"object","required":["status"],"properties":{"status":{"type":"integer"},"body":{}}},"output":{},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string","enum":["http4xx","http5xx","timeout","network","blockRetired","bindingUnresolved","invalidDefinition"]},"message":{"type":"string"}}}}}},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true}}},"relationships":{"type":"object","properties":{"automation":{"type":"object","description":"This is a resource linkage for a to-one relationship. It is like a Parse Pointer.","readOnly":true,"properties":{"data":{"type":"object","required":["id","type"],"nullable":false,"properties":{"id":{"$ref":"#/components/schemas/ObjectId"},"type":{"type":"string","description":"Identifies the Resource.","enum":["Automation"]}}}}}}}}},"BadRequestApiError":{"type":"object","description":"The request was invalid.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"UnauthorizedApiError":{"type":"object","description":"Unauthorized request.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"ForbiddenApiError":{"type":"object","description":"Forbidden request.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}},"NotFoundApiError":{"type":"object","description":"The request resource could not be found.","properties":{"id":{"type":"string","description":"Unique ID of this error occurrence."},"status":{"type":"string","description":"HTTP status code."},"code":{"type":"string","description":"Synap internal error code."},"title":{"type":"string"},"detail":{"type":"string"},"source":{"type":"object","properties":{"pointer":{"type":"string"},"parameter":{"type":"string"}}}}}}},"paths":{"/automation-runs/operations":{"post":{"summary":"Cancel or retry Automation Runs","description":"JSON:API Atomic Operations extension. Each `update` operation names a run and carries exactly one of `status: \"cancelled\"` (cancel) or `requestedRetryOfStepId` (retry from that failed step). Malformed operations reject the whole batch before anything is written, each reported with a `source.pointer` of `/atomic:operations/{index}`. Well-formed operations are applied in order and independently; one that cannot be applied (for example a run that is no longer cancellable) stops the batch at that index, and the runs before it stay changed. Use the media type `application/vnd.api+json; ext=\"https://jsonapi.org/ext/atomic\"`.","tags":["Automation"],"requestBody":{"required":true,"content":{"application/vnd.api+json":{"schema":{"type":"object","required":["atomic:operations"],"additionalProperties":false,"properties":{"atomic:operations":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["op","data"],"additionalProperties":false,"properties":{"op":{"type":"string","enum":["update"]},"data":{"type":"object","required":["type","id","attributes"],"additionalProperties":false,"properties":{"type":{"type":"string","description":"Identifies the Resource.","enum":["AutomationRun"]},"id":{"$ref":"#/components/schemas/ObjectId"},"attributes":{"type":"object","additionalProperties":false,"properties":{"status":{"type":"string","enum":["cancelled"],"description":"Cancel the run (`cancelledReason: manual`). Pending, waiting, paused and failed runs can be cancelled."},"requestedRetryOfStepId":{"type":"string","minLength":1,"description":"Retry a failed or exhausted run from this failed step: the run goes back to `pending` and the engine resumes at the step."}}}}}}}}}}},"application/vnd.api+json; ext=\"https://jsonapi.org/ext/atomic\"":{"schema":{"type":"object","required":["atomic:operations"],"additionalProperties":false,"properties":{"atomic:operations":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["op","data"],"additionalProperties":false,"properties":{"op":{"type":"string","enum":["update"]},"data":{"type":"object","required":["type","id","attributes"],"additionalProperties":false,"properties":{"type":{"type":"string","description":"Identifies the Resource.","enum":["AutomationRun"]},"id":{"$ref":"#/components/schemas/ObjectId"},"attributes":{"type":"object","additionalProperties":false,"properties":{"status":{"type":"string","enum":["cancelled"],"description":"Cancel the run (`cancelledReason: manual`). Pending, waiting, paused and failed runs can be cancelled."},"requestedRetryOfStepId":{"type":"string","minLength":1,"description":"Retry a failed or exhausted run from this failed step: the run goes back to `pending` and the engine resumes at the step."}}}}}}}}}}}}},"responses":{"200":{"description":"Operations applied","content":{"application/vnd.api+json":{"schema":{"type":"object","required":["atomic:results"],"properties":{"atomic:results":{"type":"array","items":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/AutomationRun"}}}}}}},"application/vnd.api+json; ext=\"https://jsonapi.org/ext/atomic\"":{"schema":{"type":"object","required":["atomic:results"],"properties":{"atomic:results":{"type":"array","items":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/AutomationRun"}}}}}}}}},"400":{"description":"Bad Request","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/BadRequestApiError"}}}}}}},"401":{"description":"Unauthorized","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/UnauthorizedApiError"}}}}}}},"403":{"description":"Forbidden","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/ForbiddenApiError"}}}}}}},"404":{"description":"Not Found","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/NotFoundApiError"}}}}}}}},"operationId":"automationRunOperations.applyAutomationRunOperations"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://synap.ac/docs/api/reference/automation/cancel-or-retry-automation-runs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
