extend-ai 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseClient.js +2 -2
- package/Client.d.ts +4 -2
- package/Client.js +6 -4
- package/api/client/requests/ExtractRequest.d.ts +14 -4
- package/api/resources/extractRuns/client/Client.d.ts +15 -1
- package/api/resources/extractRuns/client/Client.js +17 -3
- package/api/resources/extractRuns/client/requests/ExtractRunsCreateRequest.d.ts +28 -4
- package/api/resources/extractRuns/types/ExtractRunsCreateRequestExtractor.d.ts +1 -1
- package/api/resources/extractRuns/types/ExtractRunsCreateRequestFile.d.ts +3 -1
- package/api/resources/parseRuns/client/Client.d.ts +25 -0
- package/api/resources/parseRuns/client/Client.js +78 -0
- package/api/resources/parseRuns/client/requests/ParseRunsCancelRequest.d.ts +8 -0
- package/api/resources/parseRuns/client/requests/ParseRunsCancelRequest.js +3 -0
- package/api/resources/parseRuns/client/requests/index.d.ts +1 -0
- package/api/resources/parseRuns/types/ParseRunsListResponse.d.ts +1 -1
- package/api/resources/workflowRuns/client/Client.d.ts +1 -1
- package/api/resources/workflowRuns/client/Client.js +1 -1
- package/api/resources/workflowRuns/client/requests/WorkflowRunsCreateBatchRequest.d.ts +2 -0
- package/api/types/ExtractConfigJson.d.ts +7 -3
- package/api/types/ExtractRequestExtractor.d.ts +1 -1
- package/api/types/ExtractRequestFile.d.ts +3 -1
- package/api/types/ExtractRun.d.ts +8 -1
- package/api/types/ExtractRunSummary.d.ts +21 -1
- package/api/types/MultiFileRunPackage.d.ts +10 -0
- package/api/types/MultiFileRunPackage.js +3 -0
- package/api/types/MultiFileRunPackageFilesItem.d.ts +2 -0
- package/api/types/MultiFileRunPackageFilesItem.js +3 -0
- package/api/types/ParseConfigBlockOptionsFigures.d.ts +2 -0
- package/api/types/ParseRun.d.ts +6 -0
- package/api/types/ParseRunSummary.d.ts +81 -0
- package/api/types/ParseRunSummary.js +3 -0
- package/api/types/ParseRunSummaryMetrics.d.ts +11 -0
- package/api/types/ParseRunSummaryMetrics.js +3 -0
- package/api/types/ParseRunSummaryStatus.d.ts +14 -0
- package/api/types/ParseRunSummaryStatus.js +17 -0
- package/api/types/RunUsageBreakdownCharge.d.ts +15 -0
- package/api/types/RunUsageBreakdownCharge.js +3 -0
- package/api/types/RunUsageBreakdownEntry.d.ts +7 -1
- package/api/types/index.d.ts +6 -0
- package/api/types/index.js +6 -0
- package/package.json +1 -1
- package/reference.md +81 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/resources/extractRuns/ExtractRunsWrapper.test.js +1 -1
- package/wrapper/resources/parseRuns/ParseRunsWrapper.test.js +1 -1
- package/wrapper/webhooks/Webhooks.test.js +1 -0
package/BaseClient.js
CHANGED
|
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
|
|
|
44
44
|
const headers = (0, headers_1.mergeHeaders)({
|
|
45
45
|
"X-Fern-Language": "JavaScript",
|
|
46
46
|
"X-Fern-SDK-Name": "extend-ai",
|
|
47
|
-
"X-Fern-SDK-Version": "1.
|
|
48
|
-
"User-Agent": "extend-ai/1.
|
|
47
|
+
"X-Fern-SDK-Version": "1.15.0",
|
|
48
|
+
"User-Agent": "extend-ai/1.15.0",
|
|
49
49
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
50
50
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
51
51
|
"x-extend-api-version": (_a = options === null || options === void 0 ? void 0 : options.extendApiVersion) !== null && _a !== void 0 ? _a : "2026-02-09",
|
package/Client.d.ts
CHANGED
|
@@ -163,7 +163,9 @@ export declare class ExtendClient {
|
|
|
163
163
|
*
|
|
164
164
|
* **Note:** This endpoint is intended for onboarding and testing only. For production workloads, use `POST /extract_runs` with [polling or webhooks](https://docs.extend.ai/2026-02-09/general/async-processing) instead, as it provides better reliability for large files and avoids timeout issues.
|
|
165
165
|
*
|
|
166
|
-
* The Extract endpoint allows you to extract structured data from files using an existing extractor
|
|
166
|
+
* The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
167
|
+
*
|
|
168
|
+
* Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
167
169
|
*
|
|
168
170
|
* For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
169
171
|
*
|
|
@@ -224,7 +226,7 @@ export declare class ExtendClient {
|
|
|
224
226
|
* }
|
|
225
227
|
* })
|
|
226
228
|
*/
|
|
227
|
-
extract(request
|
|
229
|
+
extract(request?: Extend.ExtractRequest, requestOptions?: ExtendClient.RequestOptions): core.HttpResponsePromise<Extend.ExtractRun>;
|
|
228
230
|
private __extract;
|
|
229
231
|
/**
|
|
230
232
|
* Classify a document synchronously, waiting for the result before returning. This endpoint has a **5-minute timeout** — if processing takes longer, the request will fail.
|
package/Client.js
CHANGED
|
@@ -384,7 +384,9 @@ class ExtendClient {
|
|
|
384
384
|
*
|
|
385
385
|
* **Note:** This endpoint is intended for onboarding and testing only. For production workloads, use `POST /extract_runs` with [polling or webhooks](https://docs.extend.ai/2026-02-09/general/async-processing) instead, as it provides better reliability for large files and avoids timeout issues.
|
|
386
386
|
*
|
|
387
|
-
* The Extract endpoint allows you to extract structured data from files using an existing extractor
|
|
387
|
+
* The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
388
|
+
*
|
|
389
|
+
* Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
388
390
|
*
|
|
389
391
|
* For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
390
392
|
*
|
|
@@ -445,11 +447,11 @@ class ExtendClient {
|
|
|
445
447
|
* }
|
|
446
448
|
* })
|
|
447
449
|
*/
|
|
448
|
-
extract(request, requestOptions) {
|
|
450
|
+
extract(request = {}, requestOptions) {
|
|
449
451
|
return core.HttpResponsePromise.fromPromise(this.__extract(request, requestOptions));
|
|
450
452
|
}
|
|
451
|
-
__extract(
|
|
452
|
-
return __awaiter(this,
|
|
453
|
+
__extract() {
|
|
454
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
453
455
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
454
456
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
455
457
|
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -46,11 +46,21 @@ import type * as Extend from "../../index";
|
|
|
46
46
|
* }
|
|
47
47
|
*/
|
|
48
48
|
export interface ExtractRequest {
|
|
49
|
-
/** Reference to an existing extractor.
|
|
49
|
+
/** Reference to an existing extractor. Mutually exclusive with `config` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
50
50
|
extractor?: Extend.ExtractRequestExtractor;
|
|
51
|
-
/** Inline extract configuration.
|
|
51
|
+
/** Inline extract configuration. Mutually exclusive with `extractor` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
52
52
|
config?: Extend.ExtractConfigJson;
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
55
|
+
*
|
|
56
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
57
|
+
*/
|
|
58
|
+
file?: Extend.ExtractRequestFile;
|
|
59
|
+
/**
|
|
60
|
+
* A collection of files to extract from together in a single run. Mutually exclusive with `file` — provide one or the other.
|
|
61
|
+
*
|
|
62
|
+
* See [Multifile Extraction](https://docs.extend.ai/2026-02-09/extraction/multifile) for details.
|
|
63
|
+
*/
|
|
64
|
+
package?: Extend.MultiFileRunPackage;
|
|
55
65
|
metadata?: Extend.RunMetadata;
|
|
56
66
|
}
|
|
@@ -60,8 +60,22 @@ export declare class ExtractRunsClient {
|
|
|
60
60
|
* url: "https://example.com/invoice.pdf"
|
|
61
61
|
* }
|
|
62
62
|
* })
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* await client.extractRuns.create({
|
|
66
|
+
* extractor: {
|
|
67
|
+
* id: "ex_1234567890"
|
|
68
|
+
* },
|
|
69
|
+
* "package": {
|
|
70
|
+
* files: [{
|
|
71
|
+
* url: "https://example.com/invoice1.pdf"
|
|
72
|
+
* }, {
|
|
73
|
+
* url: "https://example.com/invoice2.pdf"
|
|
74
|
+
* }]
|
|
75
|
+
* }
|
|
76
|
+
* })
|
|
63
77
|
*/
|
|
64
|
-
create(request
|
|
78
|
+
create(request?: Extend.ExtractRunsCreateRequest, requestOptions?: ExtractRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ExtractRun>;
|
|
65
79
|
private __create;
|
|
66
80
|
/**
|
|
67
81
|
* Retrieve details about a specific extract run, including its status, outputs, and any edits made during review.
|
|
@@ -170,12 +170,26 @@ class ExtractRunsClient {
|
|
|
170
170
|
* url: "https://example.com/invoice.pdf"
|
|
171
171
|
* }
|
|
172
172
|
* })
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* await client.extractRuns.create({
|
|
176
|
+
* extractor: {
|
|
177
|
+
* id: "ex_1234567890"
|
|
178
|
+
* },
|
|
179
|
+
* "package": {
|
|
180
|
+
* files: [{
|
|
181
|
+
* url: "https://example.com/invoice1.pdf"
|
|
182
|
+
* }, {
|
|
183
|
+
* url: "https://example.com/invoice2.pdf"
|
|
184
|
+
* }]
|
|
185
|
+
* }
|
|
186
|
+
* })
|
|
173
187
|
*/
|
|
174
|
-
create(request, requestOptions) {
|
|
188
|
+
create(request = {}, requestOptions) {
|
|
175
189
|
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
176
190
|
}
|
|
177
|
-
__create(
|
|
178
|
-
return __awaiter(this,
|
|
191
|
+
__create() {
|
|
192
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
179
193
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
180
194
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
181
195
|
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -9,14 +9,38 @@ import type * as Extend from "../../../../index";
|
|
|
9
9
|
* url: "https://example.com/invoice.pdf"
|
|
10
10
|
* }
|
|
11
11
|
* }
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* {
|
|
15
|
+
* extractor: {
|
|
16
|
+
* id: "ex_1234567890"
|
|
17
|
+
* },
|
|
18
|
+
* "package": {
|
|
19
|
+
* files: [{
|
|
20
|
+
* url: "https://example.com/invoice1.pdf"
|
|
21
|
+
* }, {
|
|
22
|
+
* url: "https://example.com/invoice2.pdf"
|
|
23
|
+
* }]
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
12
26
|
*/
|
|
13
27
|
export interface ExtractRunsCreateRequest {
|
|
14
|
-
/** Reference to an existing extractor.
|
|
28
|
+
/** Reference to an existing extractor. Mutually exclusive with `config` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
15
29
|
extractor?: Extend.ExtractRunsCreateRequestExtractor;
|
|
16
|
-
/** Inline extract configuration.
|
|
30
|
+
/** Inline extract configuration. Mutually exclusive with `extractor` — provide one or the other, or omit both to have Extend infer a schema from the document. */
|
|
17
31
|
config?: Extend.ExtractConfigJson;
|
|
18
|
-
/**
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
34
|
+
*
|
|
35
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
36
|
+
*/
|
|
37
|
+
file?: Extend.ExtractRunsCreateRequestFile;
|
|
38
|
+
/**
|
|
39
|
+
* A collection of files to extract from together in a single run. Mutually exclusive with `file` — provide one or the other.
|
|
40
|
+
*
|
|
41
|
+
* See [Multifile Extraction](https://docs.extend.ai/2026-02-09/extraction/multifile) for details.
|
|
42
|
+
*/
|
|
43
|
+
package?: Extend.MultiFileRunPackage;
|
|
20
44
|
priority?: Extend.RunPriority;
|
|
21
45
|
metadata?: Extend.RunMetadata;
|
|
22
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Extend from "../../../index";
|
|
2
2
|
/**
|
|
3
|
-
* Reference to an existing extractor.
|
|
3
|
+
* Reference to an existing extractor. Mutually exclusive with `config` — provide one or the other, or omit both to have Extend infer a schema from the document.
|
|
4
4
|
*/
|
|
5
5
|
export interface ExtractRunsCreateRequestExtractor {
|
|
6
6
|
/** The ID of the extractor to use. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as Extend from "../../../index";
|
|
2
2
|
/**
|
|
3
|
-
* The file to be extracted from.
|
|
3
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
4
|
+
*
|
|
5
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
4
6
|
*/
|
|
5
7
|
export type ExtractRunsCreateRequestFile = Extend.FileFromUrl | Extend.FileFromId | Extend.FileFromText;
|
|
@@ -113,6 +113,31 @@ export declare class ParseRunsClient {
|
|
|
113
113
|
*/
|
|
114
114
|
delete(id: string, request?: Extend.ParseRunsDeleteRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRunsDeleteResponse>;
|
|
115
115
|
private __delete;
|
|
116
|
+
/**
|
|
117
|
+
* Cancel an in-progress parse run.
|
|
118
|
+
*
|
|
119
|
+
* Note: Only parse runs with a status of `"PROCESSING"` can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} id - The ID of the parse run to cancel.
|
|
122
|
+
*
|
|
123
|
+
* Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
124
|
+
* @param {Extend.ParseRunsCancelRequest} request
|
|
125
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
|
+
*
|
|
127
|
+
* @throws {@link Extend.BadRequestError}
|
|
128
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
129
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
130
|
+
* @throws {@link Extend.ForbiddenError}
|
|
131
|
+
* @throws {@link Extend.NotFoundError}
|
|
132
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
133
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
134
|
+
* @throws {@link Extend.InternalServerError}
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* await client.parseRuns.cancel("parse_run_id_here")
|
|
138
|
+
*/
|
|
139
|
+
cancel(id: string, request?: Extend.ParseRunsCancelRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRun>;
|
|
140
|
+
private __cancel;
|
|
116
141
|
/**
|
|
117
142
|
* Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
|
|
118
143
|
*
|
|
@@ -381,6 +381,84 @@ class ParseRunsClient {
|
|
|
381
381
|
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/parse_runs/{id}");
|
|
382
382
|
});
|
|
383
383
|
}
|
|
384
|
+
/**
|
|
385
|
+
* Cancel an in-progress parse run.
|
|
386
|
+
*
|
|
387
|
+
* Note: Only parse runs with a status of `"PROCESSING"` can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.
|
|
388
|
+
*
|
|
389
|
+
* @param {string} id - The ID of the parse run to cancel.
|
|
390
|
+
*
|
|
391
|
+
* Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
392
|
+
* @param {Extend.ParseRunsCancelRequest} request
|
|
393
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
394
|
+
*
|
|
395
|
+
* @throws {@link Extend.BadRequestError}
|
|
396
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
397
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
398
|
+
* @throws {@link Extend.ForbiddenError}
|
|
399
|
+
* @throws {@link Extend.NotFoundError}
|
|
400
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
401
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
402
|
+
* @throws {@link Extend.InternalServerError}
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* await client.parseRuns.cancel("parse_run_id_here")
|
|
406
|
+
*/
|
|
407
|
+
cancel(id, request = {}, requestOptions) {
|
|
408
|
+
return core.HttpResponsePromise.fromPromise(this.__cancel(id, request, requestOptions));
|
|
409
|
+
}
|
|
410
|
+
__cancel(id_1) {
|
|
411
|
+
return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
|
|
412
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
413
|
+
const { "x-extend-workspace-id": extendWorkspaceId } = request;
|
|
414
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
415
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
416
|
+
"x-extend-workspace-id": extendWorkspaceId,
|
|
417
|
+
"x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09",
|
|
418
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
419
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
420
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, `parse_runs/${core.url.encodePathParam(id)}/cancel`),
|
|
421
|
+
method: "POST",
|
|
422
|
+
headers: _headers,
|
|
423
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
424
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
425
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
426
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
427
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
428
|
+
logging: this._options.logging,
|
|
429
|
+
});
|
|
430
|
+
if (_response.ok) {
|
|
431
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
432
|
+
}
|
|
433
|
+
if (_response.error.reason === "status-code") {
|
|
434
|
+
switch (_response.error.statusCode) {
|
|
435
|
+
case 400:
|
|
436
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
437
|
+
case 401:
|
|
438
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
439
|
+
case 402:
|
|
440
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
441
|
+
case 403:
|
|
442
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
443
|
+
case 404:
|
|
444
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
445
|
+
case 422:
|
|
446
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
447
|
+
case 429:
|
|
448
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
449
|
+
case 500:
|
|
450
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
451
|
+
default:
|
|
452
|
+
throw new errors.ExtendError({
|
|
453
|
+
statusCode: _response.error.statusCode,
|
|
454
|
+
body: _response.error.body,
|
|
455
|
+
rawResponse: _response.rawResponse,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/parse_runs/{id}/cancel");
|
|
460
|
+
});
|
|
461
|
+
}
|
|
384
462
|
/**
|
|
385
463
|
* Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
|
|
386
464
|
*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {}
|
|
4
|
+
*/
|
|
5
|
+
export interface ParseRunsCancelRequest {
|
|
6
|
+
/** 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/api-reference/authentication) for details on API key scopes. */
|
|
7
|
+
"x-extend-workspace-id"?: string;
|
|
8
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { ParseRunsCancelRequest } from "./ParseRunsCancelRequest";
|
|
1
2
|
export type { ParseRunsCreateBatchRequest } from "./ParseRunsCreateBatchRequest";
|
|
2
3
|
export type { ParseRunsCreateRequest } from "./ParseRunsCreateRequest";
|
|
3
4
|
export type { ParseRunsDeleteRequest } from "./ParseRunsDeleteRequest";
|
|
@@ -170,7 +170,7 @@ export declare class WorkflowRunsClient {
|
|
|
170
170
|
*
|
|
171
171
|
* Our recommended usage pattern is to integrate with [Webhooks](https://docs.extend.ai/2026-02-09/webhooks/configuration) for consuming results, using the `metadata` and `batchId` to match up results to the original inputs in your downstream systems. However, you can integrate in a polling mechanism by using a combination of the [List Workflow Runs](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/list-workflow-runs) endpoint to fetch all runs via a batch, and then [Get Workflow Run](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/get-workflow-run) to fetch the full outputs each run.
|
|
172
172
|
*
|
|
173
|
-
* **Priority:**
|
|
173
|
+
* **Priority:** By default, workflow runs created through this batch endpoint are assigned a priority of 90. You can override this by passing an optional `priority` value (1–100) in the request body — lower values run first.
|
|
174
174
|
*
|
|
175
175
|
* **Processing and Monitoring:**
|
|
176
176
|
* Upon successful submission, the endpoint returns a `batchId`. The individual workflow runs are then queued for processing.
|
|
@@ -556,7 +556,7 @@ class WorkflowRunsClient {
|
|
|
556
556
|
*
|
|
557
557
|
* Our recommended usage pattern is to integrate with [Webhooks](https://docs.extend.ai/2026-02-09/webhooks/configuration) for consuming results, using the `metadata` and `batchId` to match up results to the original inputs in your downstream systems. However, you can integrate in a polling mechanism by using a combination of the [List Workflow Runs](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/list-workflow-runs) endpoint to fetch all runs via a batch, and then [Get Workflow Run](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/get-workflow-run) to fetch the full outputs each run.
|
|
558
558
|
*
|
|
559
|
-
* **Priority:**
|
|
559
|
+
* **Priority:** By default, workflow runs created through this batch endpoint are assigned a priority of 90. You can override this by passing an optional `priority` value (1–100) in the request body — lower values run first.
|
|
560
560
|
*
|
|
561
561
|
* **Processing and Monitoring:**
|
|
562
562
|
* Upon successful submission, the endpoint returns a `batchId`. The individual workflow runs are then queued for processing.
|
|
@@ -26,4 +26,6 @@ export interface WorkflowRunsCreateBatchRequest {
|
|
|
26
26
|
workflow: Extend.WorkflowReference;
|
|
27
27
|
/** An array of input objects to be processed by the workflow. Each object represents a single workflow run to be created. The array must contain at least 1 input and at most 1000 inputs. */
|
|
28
28
|
inputs: Extend.WorkflowRunsCreateBatchRequestInputsItem[];
|
|
29
|
+
/** An optional value used to determine the relative order of runs when rate limiting is in effect. Lower values will be prioritized before higher values. Defaults to 90 if not specified. */
|
|
30
|
+
priority?: number;
|
|
29
31
|
}
|
|
@@ -3,14 +3,18 @@ export interface ExtractConfigJson {
|
|
|
3
3
|
baseProcessor?: Extend.ExtractBaseProcessor;
|
|
4
4
|
/** The version of the `"extraction_performance"` or `"extraction_light"` processor to use. If not provided, the latest stable version for the selected `baseProcessor` will be used automatically. See [Extraction Changelog](https://docs.extend.ai/2026-02-09/model-versioning/extraction/extraction-performance) for more details. */
|
|
5
5
|
baseVersion?: string;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Custom rules to guide the extraction process in natural language.
|
|
8
|
+
*
|
|
9
|
+
* When `schema` is omitted, `extractionRules` also serves as schema generation instructions — for example, `"Invoice with vendor name, line items, and total due"`. Providing focused instructions produces a more targeted inferred schema.
|
|
10
|
+
*/
|
|
7
11
|
extractionRules?: string;
|
|
8
12
|
/**
|
|
9
|
-
* JSON Schema definition of the data to extract.
|
|
13
|
+
* JSON Schema definition of the data to extract. **Optional** — if omitted, Extend automatically infers a schema from the document before running extraction. No extractor is required.
|
|
10
14
|
*
|
|
11
15
|
* See the [JSON Schema guide](https://docs.extend.ai/2026-02-09/extraction/schema) for details and examples of schema configuration.
|
|
12
16
|
*/
|
|
13
|
-
schema
|
|
17
|
+
schema?: Extend.JsonObject;
|
|
14
18
|
/** Advanced configuration options. */
|
|
15
19
|
advancedOptions?: Extend.ExtractAdvancedOptions;
|
|
16
20
|
/** Configuration options for the parsing process. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Extend from "../index";
|
|
2
2
|
/**
|
|
3
|
-
* Reference to an existing extractor.
|
|
3
|
+
* Reference to an existing extractor. Mutually exclusive with `config` — provide one or the other, or omit both to have Extend infer a schema from the document.
|
|
4
4
|
*/
|
|
5
5
|
export interface ExtractRequestExtractor {
|
|
6
6
|
/** The ID of the extractor to use. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as Extend from "../index";
|
|
2
2
|
/**
|
|
3
|
-
* The file to be extracted from.
|
|
3
|
+
* The file to be extracted from. Mutually exclusive with `package` — provide one or the other.
|
|
4
|
+
*
|
|
5
|
+
* Files can be provided as a URL, Extend file ID, or raw text.
|
|
4
6
|
*/
|
|
5
7
|
export type ExtractRequestFile = Extend.FileFromUrl | Extend.FileFromId | Extend.FileFromText;
|
|
@@ -48,6 +48,7 @@ export interface ExtractRun {
|
|
|
48
48
|
* * `PRE_PROCESSING_FAILURE` - An error occurred during preprocessing (e.g., chunking)
|
|
49
49
|
* * `POST_PROCESSING_FAILURE` - An error occurred during postprocessing
|
|
50
50
|
* * `OUT_OF_CREDITS` - Insufficient credits to run the extraction
|
|
51
|
+
* * `SCHEMA_GENERATION_FAILED` - Automatic schema inference failed (only applies when `schema` is omitted). The file could not be parsed or a schema could not be generated from it.
|
|
51
52
|
*
|
|
52
53
|
* **Note:** Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
|
|
53
54
|
*/
|
|
@@ -93,8 +94,14 @@ export interface ExtractRun {
|
|
|
93
94
|
* **Availability:** Present when an extractor reference was provided. Not present when using inline `config`.
|
|
94
95
|
*/
|
|
95
96
|
extractorVersion: Extend.ExtractorVersionSummary | null;
|
|
96
|
-
/** The file that was processed. `null` when the file could not be accessed or processed (for example a run that failed during file ingestion
|
|
97
|
+
/** The file that was processed. `null` for multifile runs (use `files` instead), and `null` when the file could not be accessed or processed (for example, a run that failed during file ingestion). */
|
|
97
98
|
file: Extend.FileSummary | null;
|
|
99
|
+
/**
|
|
100
|
+
* The files that were processed, in the order they were submitted. Only populated for multifile runs (created with `package`).
|
|
101
|
+
*
|
|
102
|
+
* For single-file runs, this is `null` — use `file` instead.
|
|
103
|
+
*/
|
|
104
|
+
files: Extend.FileSummary[] | null;
|
|
98
105
|
/**
|
|
99
106
|
* The ID of the parse run that was used for this extract run.
|
|
100
107
|
*
|
|
@@ -24,6 +24,20 @@ export interface ExtractRunSummary {
|
|
|
24
24
|
* The reason for failure.
|
|
25
25
|
*
|
|
26
26
|
* **Availability:** Present when `status` is `"FAILED"`.
|
|
27
|
+
*
|
|
28
|
+
* Possible values include:
|
|
29
|
+
* * `ABORTED` - The run was aborted by the user
|
|
30
|
+
* * `INTERNAL_ERROR` - An unexpected internal error occurred
|
|
31
|
+
* * `FAILED_TO_PROCESS_FILE` - Failed to process the file (e.g., OCR failure, file access issues)
|
|
32
|
+
* * `INVALID_PROCESSOR` - The processor configuration is invalid
|
|
33
|
+
* * `INVALID_CONFIGURATION` - The provided configuration is incompatible with the selected model
|
|
34
|
+
* * `PARSING_ERROR` - Failed to parse the extraction output
|
|
35
|
+
* * `PRE_PROCESSING_FAILURE` - An error occurred during preprocessing (e.g., chunking)
|
|
36
|
+
* * `POST_PROCESSING_FAILURE` - An error occurred during postprocessing
|
|
37
|
+
* * `OUT_OF_CREDITS` - Insufficient credits to run the extraction
|
|
38
|
+
* * `SCHEMA_GENERATION_FAILED` - Automatic schema inference failed (only applies when `schema` is omitted). The file could not be parsed or a schema could not be generated from it.
|
|
39
|
+
*
|
|
40
|
+
* **Note:** Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
|
|
27
41
|
*/
|
|
28
42
|
failureReason: string | null;
|
|
29
43
|
/**
|
|
@@ -42,8 +56,14 @@ export interface ExtractRunSummary {
|
|
|
42
56
|
reviewed: boolean;
|
|
43
57
|
/** Indicates whether the run results have been edited during review. */
|
|
44
58
|
edited: boolean;
|
|
45
|
-
/** The file that was processed. `null` when the file could not be accessed or processed (for example a run that failed during file ingestion
|
|
59
|
+
/** The file that was processed. `null` for multifile runs (use `files` instead), and `null` when the file could not be accessed or processed (for example, a run that failed during file ingestion). */
|
|
46
60
|
file: Extend.FileSummary | null;
|
|
61
|
+
/**
|
|
62
|
+
* The files that were processed, in the order they were submitted. Only populated for multifile runs (created with `package`).
|
|
63
|
+
*
|
|
64
|
+
* For single-file runs, this is `null` — use `file` instead.
|
|
65
|
+
*/
|
|
66
|
+
files: Extend.FileSummary[] | null;
|
|
47
67
|
/**
|
|
48
68
|
* The ID of the parse run that was used for this extract run.
|
|
49
69
|
*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Extend from "../index";
|
|
2
|
+
/**
|
|
3
|
+
* An ordered collection of files to extract from together in a single run. Use this instead of `file` when you want to run extraction across multiple documents at once.
|
|
4
|
+
*
|
|
5
|
+
* Exactly one of `file` or `package` must be provided on a request — they are mutually exclusive.
|
|
6
|
+
*/
|
|
7
|
+
export interface MultiFileRunPackage {
|
|
8
|
+
/** The files to extract from. Each entry can be a URL or an existing Extend file ID. */
|
|
9
|
+
files: Extend.MultiFileRunPackageFilesItem[];
|
|
10
|
+
}
|
|
@@ -8,4 +8,6 @@ export interface ParseConfigBlockOptionsFigures {
|
|
|
8
8
|
figureImageClippingEnabled?: boolean;
|
|
9
9
|
/** Whether to enable advanced chart extraction using vision models for improved data extraction from charts. */
|
|
10
10
|
advancedChartExtractionEnabled?: boolean;
|
|
11
|
+
/** Custom instructions injected into the vision model prompt used to analyze and summarize figures. Use to steer figure descriptions toward your use case (e.g. domain terminology, details to always capture). Requires `enabled: true`. Available on `parse_performance` >= `2.0.0` and `parse_light` >= `1.0.0`. */
|
|
12
|
+
customInstructions?: string;
|
|
11
13
|
}
|
package/api/types/ParseRun.d.ts
CHANGED
|
@@ -58,6 +58,12 @@ export interface ParseRun {
|
|
|
58
58
|
* **Availability:** Present when `status` is `"FAILED"`.
|
|
59
59
|
*/
|
|
60
60
|
failureMessage: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Any metadata that was provided when creating the parse run.
|
|
63
|
+
*
|
|
64
|
+
* **Availability:** Present when metadata was provided during creation.
|
|
65
|
+
*/
|
|
66
|
+
metadata: Extend.RunMetadata | null;
|
|
61
67
|
/**
|
|
62
68
|
* The parse run output.
|
|
63
69
|
*
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type * as Extend from "../index";
|
|
2
|
+
/**
|
|
3
|
+
* Summary representation of a parse run.
|
|
4
|
+
*/
|
|
5
|
+
export interface ParseRunSummary {
|
|
6
|
+
/** The type of object. Will always be `"parse_run"`. */
|
|
7
|
+
object: "parse_run";
|
|
8
|
+
/**
|
|
9
|
+
* A unique identifier for the parse run.
|
|
10
|
+
*
|
|
11
|
+
* Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The ID of the batch this run belongs to, if created via `POST /parse_runs/batch`.
|
|
16
|
+
*
|
|
17
|
+
* **Availability:** Present when the run was submitted as part of a batch.
|
|
18
|
+
*
|
|
19
|
+
* Example: `"bpar_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
20
|
+
*/
|
|
21
|
+
batchId: string | null;
|
|
22
|
+
/** The file that was parsed. This file can be used as a parameter for other Extend endpoints, such as `POST /workflow_runs`. May be `null` for batch parse runs where file ingestion failed. */
|
|
23
|
+
file: Extend.FileSummary;
|
|
24
|
+
/**
|
|
25
|
+
* The status of the parse run:
|
|
26
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
27
|
+
* * `"PROCESSING"` - The file is still being processed
|
|
28
|
+
* * `"PROCESSED"` - The file was successfully processed
|
|
29
|
+
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
30
|
+
*/
|
|
31
|
+
status: Extend.ParseRunSummaryStatus;
|
|
32
|
+
/**
|
|
33
|
+
* The reason for failure.
|
|
34
|
+
*
|
|
35
|
+
* **Availability:** Present when `status` is `"FAILED"`.
|
|
36
|
+
*
|
|
37
|
+
* Possible values include:
|
|
38
|
+
* * `UNABLE_TO_DOWNLOAD_FILE` - The file could not be downloaded from the provided URL
|
|
39
|
+
* * `FILE_TYPE_NOT_SUPPORTED` - The file type is not supported for parsing
|
|
40
|
+
* * `FILE_SIZE_TOO_LARGE` - The file exceeds the maximum allowed size
|
|
41
|
+
* * `CORRUPT_FILE` - The file appears to be corrupted or malformed
|
|
42
|
+
* * `OCR_ERROR` - An error occurred during optical character recognition
|
|
43
|
+
* * `PASSWORD_PROTECTED_FILE` - The file is password protected and cannot be processed
|
|
44
|
+
* * `FAILED_TO_CONVERT_TO_PDF` - The file could not be converted to PDF for processing
|
|
45
|
+
* * `FAILED_TO_CONVERT_TO_JPEG` - The file could not be converted to JPEG for processing
|
|
46
|
+
* * `FAILED_TO_GENERATE_TARGET_FORMAT` - The output could not be generated in the requested format
|
|
47
|
+
* * `CHUNKING_ERROR` - An error occurred while chunking the document
|
|
48
|
+
* * `INTERNAL_ERROR` - An unexpected internal error occurred
|
|
49
|
+
* * `INVALID_CONFIG_OPTIONS` - The provided configuration options are invalid
|
|
50
|
+
* * `OUT_OF_CREDITS` - Insufficient credits to process the file
|
|
51
|
+
*
|
|
52
|
+
* **Note:** Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.
|
|
53
|
+
*/
|
|
54
|
+
failureReason: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* A human-readable description of the failure.
|
|
57
|
+
*
|
|
58
|
+
* **Availability:** Present when `status` is `"FAILED"`.
|
|
59
|
+
*/
|
|
60
|
+
failureMessage: string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Any metadata that was provided when creating the parse run.
|
|
63
|
+
*
|
|
64
|
+
* **Availability:** Present when metadata was provided during creation.
|
|
65
|
+
*/
|
|
66
|
+
metadata: Extend.RunMetadata | null;
|
|
67
|
+
/**
|
|
68
|
+
* Metrics about the parsing process.
|
|
69
|
+
*
|
|
70
|
+
* **Availability:** Present when `status` is `"PROCESSED"`.
|
|
71
|
+
*/
|
|
72
|
+
metrics: Extend.ParseRunSummaryMetrics | null;
|
|
73
|
+
/**
|
|
74
|
+
* Usage credits consumed by this parse run. Omits `breakdown` — fetch the full parse run by id to see the per-line items.
|
|
75
|
+
*
|
|
76
|
+
* **Availability:** Present when `status` is `"PROCESSED"`, the run was created after October 7, 2025, and the customer is on the current billing system.
|
|
77
|
+
*/
|
|
78
|
+
usage: Extend.RunUsageSummary | null;
|
|
79
|
+
createdAt: Extend.CreatedAt;
|
|
80
|
+
updatedAt: Extend.UpdatedAt;
|
|
81
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics about the parsing process.
|
|
3
|
+
*
|
|
4
|
+
* **Availability:** Present when `status` is `"PROCESSED"`.
|
|
5
|
+
*/
|
|
6
|
+
export interface ParseRunSummaryMetrics {
|
|
7
|
+
/** The time taken to process the document in milliseconds. */
|
|
8
|
+
processingTimeMs: number;
|
|
9
|
+
/** The number of pages from the document that were parsed. For PDF and image files, this is the actual page count. For spreadsheet files (Excel, CSV), this is an estimated page count based on content volume (~1000 tokens per page). */
|
|
10
|
+
pageCount: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The status of the parse run:
|
|
3
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
4
|
+
* * `"PROCESSING"` - The file is still being processed
|
|
5
|
+
* * `"PROCESSED"` - The file was successfully processed
|
|
6
|
+
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
7
|
+
*/
|
|
8
|
+
export declare const ParseRunSummaryStatus: {
|
|
9
|
+
readonly Pending: "PENDING";
|
|
10
|
+
readonly Processing: "PROCESSING";
|
|
11
|
+
readonly Processed: "PROCESSED";
|
|
12
|
+
readonly Failed: "FAILED";
|
|
13
|
+
};
|
|
14
|
+
export type ParseRunSummaryStatus = (typeof ParseRunSummaryStatus)[keyof typeof ParseRunSummaryStatus] | string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ParseRunSummaryStatus = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* The status of the parse run:
|
|
7
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
8
|
+
* * `"PROCESSING"` - The file is still being processed
|
|
9
|
+
* * `"PROCESSED"` - The file was successfully processed
|
|
10
|
+
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
11
|
+
*/
|
|
12
|
+
exports.ParseRunSummaryStatus = {
|
|
13
|
+
Pending: "PENDING",
|
|
14
|
+
Processing: "PROCESSING",
|
|
15
|
+
Processed: "PROCESSED",
|
|
16
|
+
Failed: "FAILED",
|
|
17
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single cost driver within a breakdown entry's credit total. The per-unit rate is `credits / quantity`.
|
|
3
|
+
*/
|
|
4
|
+
export interface RunUsageBreakdownCharge {
|
|
5
|
+
/** Identifier for the billable cost driver. */
|
|
6
|
+
product: string;
|
|
7
|
+
/** The unit `quantity` is measured in. */
|
|
8
|
+
unit: string;
|
|
9
|
+
/** How many units this charge was billed for. */
|
|
10
|
+
quantity: number;
|
|
11
|
+
/** Credits consumed by this charge. */
|
|
12
|
+
credits: number;
|
|
13
|
+
/** 1-indexed page numbers that incurred this charge. Present on usage-based add-ons that are only billed for the pages where they actually applied (e.g. `agentic_text_correction`, `agentic_table_correction`). */
|
|
14
|
+
pages?: number[];
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Extend from "../index";
|
|
2
2
|
/**
|
|
3
|
-
* One line item in a run's `usage.breakdown`. Each entry corresponds to a concrete chargeable resource that contributed credits to the parent operation.
|
|
3
|
+
* One line item in a run's `usage.breakdown`. Each entry corresponds to a concrete chargeable resource that contributed credits to the parent operation. When `charges` is present, it itemizes the cost drivers behind this entry's `credits`.
|
|
4
4
|
*/
|
|
5
5
|
export interface RunUsageBreakdownEntry {
|
|
6
6
|
/** The public object type of the contributing resource. Mirrors the top-level `object` field on the corresponding endpoint so callers can fetch the underlying resource by id if they want more detail. */
|
|
@@ -9,4 +9,10 @@ export interface RunUsageBreakdownEntry {
|
|
|
9
9
|
id: string;
|
|
10
10
|
/** Credits charged to the contributing resource. */
|
|
11
11
|
credits: number;
|
|
12
|
+
/**
|
|
13
|
+
* Itemized cost drivers that make up this entry's `credits`. When present, `sum(charges[].credits) === credits`.
|
|
14
|
+
*
|
|
15
|
+
* **Availability:** Present on runs persisted on or after June 10, 2026. Runs persisted before that date will omit this field.
|
|
16
|
+
*/
|
|
17
|
+
charges?: Extend.RunUsageBreakdownCharge[];
|
|
12
18
|
}
|
package/api/types/index.d.ts
CHANGED
|
@@ -266,6 +266,8 @@ export * from "./MergeExtractStepDefinitionConfig";
|
|
|
266
266
|
export * from "./MergeExtractStepDefinitionConfigMergeOrder";
|
|
267
267
|
export * from "./MergeExtractStepRun";
|
|
268
268
|
export * from "./MergeExtractStepRunStep";
|
|
269
|
+
export * from "./MultiFileRunPackage";
|
|
270
|
+
export * from "./MultiFileRunPackageFilesItem";
|
|
269
271
|
export * from "./NextPageToken";
|
|
270
272
|
export * from "./PageRanges";
|
|
271
273
|
export * from "./PageRangesItem";
|
|
@@ -306,6 +308,9 @@ export * from "./ParseRunSource";
|
|
|
306
308
|
export * from "./ParseRunStatus";
|
|
307
309
|
export * from "./ParseRunStatusEnum";
|
|
308
310
|
export * from "./ParseRunStatusStatus";
|
|
311
|
+
export * from "./ParseRunSummary";
|
|
312
|
+
export * from "./ParseRunSummaryMetrics";
|
|
313
|
+
export * from "./ParseRunSummaryStatus";
|
|
309
314
|
export * from "./ParseStepDefinition";
|
|
310
315
|
export * from "./ParseStepDefinitionConfig";
|
|
311
316
|
export * from "./ParseStepRun";
|
|
@@ -335,6 +340,7 @@ export * from "./RunSecrets";
|
|
|
335
340
|
export * from "./RunSource";
|
|
336
341
|
export * from "./RunSourceId";
|
|
337
342
|
export * from "./RunUsage";
|
|
343
|
+
export * from "./RunUsageBreakdownCharge";
|
|
338
344
|
export * from "./RunUsageBreakdownEntry";
|
|
339
345
|
export * from "./RunUsageBreakdownEntryObject";
|
|
340
346
|
export * from "./RunUsageSummary";
|
package/api/types/index.js
CHANGED
|
@@ -282,6 +282,8 @@ __exportStar(require("./MergeExtractStepDefinitionConfig"), exports);
|
|
|
282
282
|
__exportStar(require("./MergeExtractStepDefinitionConfigMergeOrder"), exports);
|
|
283
283
|
__exportStar(require("./MergeExtractStepRun"), exports);
|
|
284
284
|
__exportStar(require("./MergeExtractStepRunStep"), exports);
|
|
285
|
+
__exportStar(require("./MultiFileRunPackage"), exports);
|
|
286
|
+
__exportStar(require("./MultiFileRunPackageFilesItem"), exports);
|
|
285
287
|
__exportStar(require("./NextPageToken"), exports);
|
|
286
288
|
__exportStar(require("./PageRanges"), exports);
|
|
287
289
|
__exportStar(require("./PageRangesItem"), exports);
|
|
@@ -322,6 +324,9 @@ __exportStar(require("./ParseRunSource"), exports);
|
|
|
322
324
|
__exportStar(require("./ParseRunStatus"), exports);
|
|
323
325
|
__exportStar(require("./ParseRunStatusEnum"), exports);
|
|
324
326
|
__exportStar(require("./ParseRunStatusStatus"), exports);
|
|
327
|
+
__exportStar(require("./ParseRunSummary"), exports);
|
|
328
|
+
__exportStar(require("./ParseRunSummaryMetrics"), exports);
|
|
329
|
+
__exportStar(require("./ParseRunSummaryStatus"), exports);
|
|
325
330
|
__exportStar(require("./ParseStepDefinition"), exports);
|
|
326
331
|
__exportStar(require("./ParseStepDefinitionConfig"), exports);
|
|
327
332
|
__exportStar(require("./ParseStepRun"), exports);
|
|
@@ -351,6 +356,7 @@ __exportStar(require("./RunSecrets"), exports);
|
|
|
351
356
|
__exportStar(require("./RunSource"), exports);
|
|
352
357
|
__exportStar(require("./RunSourceId"), exports);
|
|
353
358
|
__exportStar(require("./RunUsage"), exports);
|
|
359
|
+
__exportStar(require("./RunUsageBreakdownCharge"), exports);
|
|
354
360
|
__exportStar(require("./RunUsageBreakdownEntry"), exports);
|
|
355
361
|
__exportStar(require("./RunUsageBreakdownEntryObject"), exports);
|
|
356
362
|
__exportStar(require("./RunUsageSummary"), exports);
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -168,7 +168,9 @@ Extract structured data from a file synchronously, waiting for the result before
|
|
|
168
168
|
|
|
169
169
|
**Note:** This endpoint is intended for onboarding and testing only. For production workloads, use `POST /extract_runs` with [polling or webhooks](https://docs.extend.ai/2026-02-09/general/async-processing) instead, as it provides better reliability for large files and avoids timeout issues.
|
|
170
170
|
|
|
171
|
-
The Extract endpoint allows you to extract structured data from files using an existing extractor
|
|
171
|
+
The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.
|
|
172
|
+
|
|
173
|
+
Pass `file` for a single document, or `package` to extract from multiple files in a single run. Exactly one of `file` or `package` must be provided.
|
|
172
174
|
|
|
173
175
|
For more details, see the [Extract File guide](https://docs.extend.ai/2026-02-09/extraction/overview).
|
|
174
176
|
</dd>
|
|
@@ -1028,6 +1030,83 @@ Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
|
1028
1030
|
</dl>
|
|
1029
1031
|
|
|
1030
1032
|
|
|
1033
|
+
</dd>
|
|
1034
|
+
</dl>
|
|
1035
|
+
</details>
|
|
1036
|
+
|
|
1037
|
+
<details><summary><code>client.parseRuns.<a href="/src/api/resources/parseRuns/client/Client.ts">cancel</a>(id, { ...params }) -> Extend.ParseRun</code></summary>
|
|
1038
|
+
<dl>
|
|
1039
|
+
<dd>
|
|
1040
|
+
|
|
1041
|
+
#### 📝 Description
|
|
1042
|
+
|
|
1043
|
+
<dl>
|
|
1044
|
+
<dd>
|
|
1045
|
+
|
|
1046
|
+
<dl>
|
|
1047
|
+
<dd>
|
|
1048
|
+
|
|
1049
|
+
Cancel an in-progress parse run.
|
|
1050
|
+
|
|
1051
|
+
Note: Only parse runs with a status of `"PROCESSING"` can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.
|
|
1052
|
+
</dd>
|
|
1053
|
+
</dl>
|
|
1054
|
+
</dd>
|
|
1055
|
+
</dl>
|
|
1056
|
+
|
|
1057
|
+
#### 🔌 Usage
|
|
1058
|
+
|
|
1059
|
+
<dl>
|
|
1060
|
+
<dd>
|
|
1061
|
+
|
|
1062
|
+
<dl>
|
|
1063
|
+
<dd>
|
|
1064
|
+
|
|
1065
|
+
```typescript
|
|
1066
|
+
await client.parseRuns.cancel("parse_run_id_here");
|
|
1067
|
+
|
|
1068
|
+
```
|
|
1069
|
+
</dd>
|
|
1070
|
+
</dl>
|
|
1071
|
+
</dd>
|
|
1072
|
+
</dl>
|
|
1073
|
+
|
|
1074
|
+
#### ⚙️ Parameters
|
|
1075
|
+
|
|
1076
|
+
<dl>
|
|
1077
|
+
<dd>
|
|
1078
|
+
|
|
1079
|
+
<dl>
|
|
1080
|
+
<dd>
|
|
1081
|
+
|
|
1082
|
+
**id:** `string`
|
|
1083
|
+
|
|
1084
|
+
The ID of the parse run to cancel.
|
|
1085
|
+
|
|
1086
|
+
Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
1087
|
+
|
|
1088
|
+
</dd>
|
|
1089
|
+
</dl>
|
|
1090
|
+
|
|
1091
|
+
<dl>
|
|
1092
|
+
<dd>
|
|
1093
|
+
|
|
1094
|
+
**request:** `Extend.ParseRunsCancelRequest`
|
|
1095
|
+
|
|
1096
|
+
</dd>
|
|
1097
|
+
</dl>
|
|
1098
|
+
|
|
1099
|
+
<dl>
|
|
1100
|
+
<dd>
|
|
1101
|
+
|
|
1102
|
+
**requestOptions:** `ParseRunsClient.RequestOptions`
|
|
1103
|
+
|
|
1104
|
+
</dd>
|
|
1105
|
+
</dl>
|
|
1106
|
+
</dd>
|
|
1107
|
+
</dl>
|
|
1108
|
+
|
|
1109
|
+
|
|
1031
1110
|
</dd>
|
|
1032
1111
|
</dl>
|
|
1033
1112
|
</details>
|
|
@@ -5567,7 +5646,7 @@ Unlike the single [Run Workflow](https://docs.extend.ai/2026-02-09/api-reference
|
|
|
5567
5646
|
|
|
5568
5647
|
Our recommended usage pattern is to integrate with [Webhooks](https://docs.extend.ai/2026-02-09/webhooks/configuration) for consuming results, using the `metadata` and `batchId` to match up results to the original inputs in your downstream systems. However, you can integrate in a polling mechanism by using a combination of the [List Workflow Runs](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/list-workflow-runs) endpoint to fetch all runs via a batch, and then [Get Workflow Run](https://docs.extend.ai/2026-02-09/api-reference/endpoints/workflow/get-workflow-run) to fetch the full outputs each run.
|
|
5569
5648
|
|
|
5570
|
-
**Priority:**
|
|
5649
|
+
**Priority:** By default, workflow runs created through this batch endpoint are assigned a priority of 90. You can override this by passing an optional `priority` value (1–100) in the request body — lower values run first.
|
|
5571
5650
|
|
|
5572
5651
|
**Processing and Monitoring:**
|
|
5573
5652
|
Upon successful submission, the endpoint returns a `batchId`. The individual workflow runs are then queued for processing.
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.15.0";
|
package/version.js
CHANGED
|
@@ -51,7 +51,7 @@ function createMockExtractRun(overrides = {}) {
|
|
|
51
51
|
metadata: {},
|
|
52
52
|
createdAt: "2024-01-01T00:00:00Z",
|
|
53
53
|
updatedAt: "2024-01-01T00:00:00Z",
|
|
54
|
-
}, dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_test123", edits: {}, usage: { credits: 1 }, failureReason: null, failureMessage: null, parseRunId: null, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z" }, overrides);
|
|
54
|
+
}, files: null, dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_test123", edits: {}, usage: { credits: 1 }, failureReason: null, failureMessage: null, parseRunId: null, createdAt: "2024-01-01T00:00:00Z", updatedAt: "2024-01-01T00:00:00Z" }, overrides);
|
|
55
55
|
}
|
|
56
56
|
// ============================================================================
|
|
57
57
|
// Tests
|
|
@@ -34,7 +34,7 @@ function createMockParseRun(overrides = {}) {
|
|
|
34
34
|
metadata: {},
|
|
35
35
|
createdAt: "2024-01-01T00:00:00Z",
|
|
36
36
|
updatedAt: "2024-01-01T00:00:00Z",
|
|
37
|
-
}, failureReason: null, failureMessage: null, output: null, outputUrl: null, metrics: null, usage: null }, overrides);
|
|
37
|
+
}, failureReason: null, failureMessage: null, metadata: null, output: null, outputUrl: null, metrics: null, usage: null }, overrides);
|
|
38
38
|
}
|
|
39
39
|
// ============================================================================
|
|
40
40
|
// Tests
|
|
@@ -145,6 +145,7 @@ const sampleExtractRunPayload = {
|
|
|
145
145
|
createdAt: "2024-01-01T00:00:00Z",
|
|
146
146
|
updatedAt: "2024-01-01T00:00:00Z",
|
|
147
147
|
},
|
|
148
|
+
files: null,
|
|
148
149
|
dashboardUrl: "https://dashboard.extend.ai/extract-runs/extract_run_def456",
|
|
149
150
|
edits: {},
|
|
150
151
|
usage: { credits: 1 },
|