For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GuidesAPI ReferenceChangelogModel Versioning
GuidesAPI ReferenceChangelogModel Versioning
    • Getting Started
    • Authentication
    • API Versioning
    • SDKs
    • Deployments
    • Error Codes
    • Async Processing
  • Endpoints
      • POSTRun Workflow
      • POSTBatch Run Workflow
      • GETGet Workflow Run
      • POSTUpdate Workflow Run
      • POSTCancel Workflow Run
      • DELDelete Workflow Run
      • GETList Workflow Runs
      • POSTCreate Workflow
      • GETGet Workflow
      • POSTUpdate Workflow
      • GETList Workflows
      • POSTCreate Workflow Version
      • GETGet Workflow Version
      • GETList Workflow Versions
  • Webhook Events
LogoLogo
EndpointsWorkflows

Cancel Workflow Run

POST
/workflow_runs/:id/cancel
POST
/workflow_runs/:id/cancel
1import { ExtendClient } from "extend-ai";
2
3const client = new ExtendClient({ token: "YOUR_TOKEN" });
4await client.workflowRuns.cancel("workflow_run_id_here");
1{
2 "object": "workflow_run",
3 "id": "workflow_run_xKm9pNv3qWsY_jL2tR5Dh",
4 "workflow": {
5 "object": "workflow",
6 "id": "workflow_BMlfq_yWM3sT-ZzvCnA3f",
7 "name": "Invoice Processing",
8 "createdAt": "2024-03-21T16:45:00Z",
9 "updatedAt": "2024-03-21T16:45:00Z"
10 },
11 "workflowVersion": {
12 "object": "workflow_version",
13 "id": "workflow_version_Zk9mNP12Qw4-yTv8BdR3H",
14 "version": "1",
15 "name": "Production v1",
16 "createdAt": "2024-03-21T16:45:00Z"
17 },
18 "dashboardUrl": "https://dashboard.extend.ai/workflows/workflow_run_xKm9pNv3qWsY_jL2tR5Dh",
19 "status": "PENDING",
20 "metadata": {},
21 "batchId": "batch_7Ws31-F5",
22 "files": [
23 {
24 "object": "file",
25 "id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
26 "name": "Invoices.pdf",
27 "type": "PDF",
28 "parentFileId": "file_Zk9mNP12Qw4yTv8BdR3H",
29 "metadata": {
30 "pageCount": 30,
31 "parentSplit": {
32 "id": "string",
33 "type": "Invoice",
34 "identifier": "other_2_9",
35 "startPage": 1,
36 "endPage": 10
37 }
38 },
39 "createdAt": "2024-03-21T16:45:00Z",
40 "updatedAt": "2024-03-21T16:45:00Z"
41 }
42 ],
43 "failureReason": "string",
44 "failureMessage": "string",
45 "initialRunAt": "2025-04-28T17:01:39.285Z",
46 "reviewedByUser": "jane.doe@example.com",
47 "reviewed": true,
48 "rejectionNote": "string",
49 "reviewedAt": "2024-03-21T16:45:00Z",
50 "startTime": "2024-03-21T15:30:00Z",
51 "endTime": "2024-03-21T15:35:00Z",
52 "stepRuns": [
53 {
54 "object": "workflow_step_run",
55 "id": "workflow_step_run_xK9mLPqRtN3vS8wF5hB2cQ",
56 "workflowRunId": "workflow_run_xKm9pNv3qWsY_jL2tR5Dh",
57 "stepType": "PARSE",
58 "status": "PROCESSED",
59 "files": [
60 {
61 "object": "file",
62 "id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
63 "name": "Invoices.pdf",
64 "type": "PDF",
65 "parentFileId": "file_Zk9mNP12Qw4yTv8BdR3H",
66 "metadata": {
67 "pageCount": 30,
68 "parentSplit": {
69 "id": "string",
70 "type": "Invoice",
71 "identifier": "other_2_9",
72 "startPage": 1,
73 "endPage": 10
74 }
75 },
76 "createdAt": "2024-03-21T16:45:00Z",
77 "updatedAt": "2024-03-21T16:45:00Z"
78 }
79 ],
80 "step": {
81 "object": "workflow_step",
82 "id": "step_xK9mLPqRtN3vS8wF5hB2cQ",
83 "name": "Validate Invoice Total",
84 "type": "PARSE"
85 },
86 "result": {
87 "parseRun": {
88 "object": "parse_run",
89 "id": "pr_xK9mLPqRtN3vS8wF5hB2cQ",
90 "batchId": "bpar_Xj8mK2pL9nR4vT7qY5wZ",
91 "file": {
92 "object": "file",
93 "id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
94 "name": "Invoices.pdf",
95 "type": "PDF",
96 "parentFileId": "file_Zk9mNP12Qw4yTv8BdR3H",
97 "metadata": {
98 "pageCount": 30,
99 "parentSplit": {
100 "id": "string",
101 "type": "Invoice",
102 "identifier": "other_2_9",
103 "startPage": 1,
104 "endPage": 10
105 }
106 },
107 "createdAt": "2024-03-21T16:45:00Z",
108 "updatedAt": "2024-03-21T16:45:00Z"
109 },
110 "status": "PENDING",
111 "failureReason": "FILE_TYPE_NOT_SUPPORTED",
112 "failureMessage": "File type not supported for parsing.",
113 "output": {
114 "chunks": [
115 {
116 "object": "chunk",
117 "type": "page",
118 "content": "This is the content of the chunk.",
119 "metadata": {
120 "pageRange": {
121 "start": 1,
122 "end": 1
123 },
124 "minOcrConfidence": 1.1,
125 "avgOcrConfidence": 1.1
126 },
127 "blocks": [
128 {
129 "object": "block",
130 "id": "string",
131 "parentBlockId": "string",
132 "type": "text",
133 "content": "string",
134 "details": {},
135 "metadata": {
136 "page": {
137 "number": 1,
138 "width": 1.1,
139 "height": 1.1
140 },
141 "textDirection": "ltr",
142 "minOcrConfidence": 1.1,
143 "avgOcrConfidence": 1.1
144 },
145 "polygon": [
146 {
147 "x": 10,
148 "y": 20
149 }
150 ],
151 "boundingBox": {
152 "left": 10,
153 "top": 10,
154 "right": 20,
155 "bottom": 20
156 },
157 "children": [
158 null
159 ]
160 }
161 ]
162 }
163 ],
164 "ocr": {
165 "words": [
166 {
167 "content": "string",
168 "boundingBox": {
169 "left": 10,
170 "top": 10,
171 "right": 20,
172 "bottom": 20
173 },
174 "confidence": 1.1,
175 "pageNumber": 1.1
176 }
177 ]
178 }
179 },
180 "outputUrl": "https://...",
181 "metrics": {
182 "processingTimeMs": 1234,
183 "pageCount": 5
184 },
185 "config": {
186 "target": "markdown",
187 "chunkingStrategy": {
188 "type": "page",
189 "options": {
190 "minCharacters": 500,
191 "maxCharacters": 10000
192 }
193 },
194 "engine": "parse_performance",
195 "engineVersion": "latest",
196 "blockOptions": {
197 "figures": {
198 "enabled": true,
199 "figureImageClippingEnabled": true,
200 "advancedChartExtractionEnabled": false
201 },
202 "tables": {
203 "enabled": true,
204 "targetFormat": "html",
205 "tableHeaderContinuationEnabled": false,
206 "cellBlocksEnabled": false,
207 "agentic": {
208 "enabled": false,
209 "customInstructions": "string"
210 }
211 },
212 "text": {
213 "signatureDetectionEnabled": false,
214 "agentic": {
215 "enabled": false,
216 "customInstructions": "string"
217 }
218 },
219 "keyValue": {
220 "blankFieldFormattingEnabled": false
221 },
222 "barcodes": {
223 "imageClippingEnabled": false,
224 "readingEnabled": false
225 },
226 "formulas": {
227 "enabled": false
228 }
229 },
230 "advancedOptions": {
231 "pageRotationEnabled": true,
232 "pageRanges": [
233 {
234 "start": 1,
235 "end": 10
236 },
237 {
238 "start": 20,
239 "end": 30
240 }
241 ],
242 "excelParsingMode": "basic",
243 "excelSkipHiddenContent": false,
244 "excelUseRawCellValues": false,
245 "excelSkipCalculation": true,
246 "verticalGroupingThreshold": 1,
247 "returnOcr": {
248 "words": false
249 },
250 "alwaysConvertToPdf": false,
251 "enrichmentFormat": "xml",
252 "imageConversionQuality": "medium",
253 "formattingDetection": [
254 {
255 "type": "change_tracking"
256 }
257 ]
258 }
259 },
260 "usage": {
261 "credits": 9,
262 "totalCredits": 15,
263 "breakdown": [
264 {
265 "object": "parse_run",
266 "id": "pr_3UZSj69pYZDKHFuuX57ic",
267 "credits": 6
268 }
269 ]
270 }
271 }
272 }
273 }
274 ],
275 "usage": {
276 "credits": 9,
277 "totalCredits": 15,
278 "breakdown": [
279 {
280 "object": "parse_run",
281 "id": "pr_3UZSj69pYZDKHFuuX57ic",
282 "credits": 6
283 }
284 ]
285 }
286}

Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress.

Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

Was this page helpful?
Previous

Delete Workflow Run

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

idstringRequired

The ID of the workflow run.

Example: "workflow_run_xKm9pNv3qWsY_jL2tR5Dh"

Headers

x-extend-api-version"2026-02-09"Optional
API version to use for the request. If you're using an SDK, you can ignore this parameter. If you are not using an SDK and do not specify a version, you will either receive a `400 Bad Request` or be set to a previous legacy version. See [API Versioning](https://docs.extend.ai/2026-02-09/developers/api-versioning) for more details.
x-extend-workspace-idstringOptional
The workspace ID to target. **Required** when using an organization-scoped API key; optional for workspace-scoped keys (the key is already tied to a workspace). See [Authentication](https://docs.extend.ai/2026-02-09/developers/authentication) for details on API key scopes.

Response

Successfully cancelled workflow run
objectenum

The type of object. In this case, it will always be "workflow_run".

Allowed values:
idstring

The ID of the workflow run.

Example: "workflow_run_xKm9pNv3qWsY_jL2tR5Dh"

workflowobject
A summary representation of a workflow.
workflowVersionobject

A summary representation of a workflow version (without steps).

dashboardUrlstring

A URL to view this workflow run in the Extend dashboard.

Example: "https://dashboard.extend.ai/workflows/workflow_run_xKm9pNv3qWsY_jL2tR5Dh"

statusenum

The status of a workflow run:

  • "PENDING" - The workflow run is waiting to be processed
  • "PROCESSING" - The workflow run is currently processing
  • "NEEDS_REVIEW" - The workflow run requires manual review
  • "REJECTED" - The workflow run was rejected during review
  • "PROCESSED" - The workflow run completed successfully
  • "FAILED" - The workflow run encountered an error
  • "CANCELLED" - The workflow run was cancelled
  • "CANCELLING" - The workflow run is being cancelled
metadatamap from strings to any
The metadata that was passed in when running the Workflow.
batchIdstring or null

The batch ID of the WorkflowRun. If this WorkflowRun was created as part of a batch of files, all runs in that batch will have the same batch ID.

Example: "batch_7Ws31-F5"

fileslist of objects
failureReasonstring or null
The reason why the workflow run failed. Will only be included if the workflow run status is "FAILED".
failureMessagestring or null
A more detailed message about the failure. Will only be included if the workflow run status is "FAILED".
initialRunAtstring or nullformat: "date-time"

The time (in UTC) at which the workflow run was created. Will follow the RFC 3339 format. Will be null if the run hasn’t started yet.

Example: "2025-04-28T17:01:39.285Z"

reviewedByUserstring or null

The email address of the person who reviewed the workflow run. Will be null if the workflow run has not been reviewed.

Example: "jane.doe@example.com"

reviewedboolean
Whether the workflow run has been reviewed.
rejectionNotestring or null

A note that is added if a workflow run is rejected.

Example: "Invalid invoice format"

reviewedAtstring or nullformat: "date-time"

The time (in UTC) at which the workflow run was reviewed. Will follow the RFC 3339 format. Will be null if the workflow run has not been reviewed.

Example: "2024-03-21T16:45:00Z"

startTimestring or nullformat: "date-time"

The time (in UTC) at which the workflow run started executing. This will always be after the initialRunAt time. Will follow the RFC 3339 format. Will be null if the workflow run has not started executing.

Example: "2024-03-21T15:30:00Z"

endTimestring or nullformat: "date-time"

The time (in UTC) that the workflow finished executing. Will follow the RFC 3339 format. Will be null if the workflow run has not finished executing.

Example: "2024-03-21T15:35:00Z"

stepRunslist of objects
An array of WorkflowStepRun objects. Each WorkflowStepRun represents a single run of a WorkflowStep and contains details about the step's execution and result.
usageobject or null

Usage credits consumed by this workflow run, including a breakdown of every contributing child run.

Availability: Will not be returned for runs created before October 7, 2025 or for customers on legacy billing systems.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error

API version to use for the request. If you’re using an SDK, you can ignore this parameter. If you are not using an SDK and do not specify a version, you will either receive a 400 Bad Request or be set to a previous legacy version. See API Versioning for more details.

The workspace ID to target. Required when using an organization-scoped API key; optional for workspace-scoped keys (the key is already tied to a workspace). See Authentication for details on API key scopes.