Submit a structured field extraction task, with support for online single files, reusable parse results, and offline batch manifests; returns task IDs for async queries.
Submit a structured field extraction task. The input can be a file URL, the
The following examples show the two ways of defining processing. When
Offline tasks:
parsed_file_biz_id returned by a previous parsing task, or an offline batch manifest URL. Online tasks return a biz_id; offline tasks return a biz_id_list. After submitting, use the task ID to call Query the extraction result to get the processing status and structured result.
Make sure you have obtained an API Key before calling. See Authentication.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_url | string | No | An accessible URL of the document to extract from. Mutually exclusive with parsed_file_biz_id and batch_job_url. A single document supports PDF, Word, and similar files up to 15,000 pages and 1 GB, and single images up to 20 MB. |
parsed_file_biz_id | string | No | The business task ID of a completed parsing task. Mutually exclusive with file_url and batch_job_url. |
batch_job_url | string | No | The URL of the offline batch manifest. Mutually exclusive with file_url and parsed_file_biz_id. A JSON array where each item is a subtask: file_url/file_name/file_id/parsed_file_biz_id, etc. An offline request supports up to 200 subtasks; requests with more than 200 subtasks are not processed. A single document supports PDF, Word, and similar files up to 15,000 pages and 1 GB, and single images up to 20 MB. |
file_name | string | No | The online task file name. The protocol also provides file_name_extension; choose one of the two based on how you provide the file information. |
file_name_extension | string | No | The online task file type. Mutually exclusive with file_name. |
config_id | string | No | A saved Extract configuration ID, for example config_xxx. |
processing | object | No | Inline processing configuration; takes precedence over config_id. |
processing.user_prompt | string | No | User prompt. |
processing.extract_processing_config | object | No | Inline extraction processing configuration. Required when using processing. |
processing.extract_processing_config.citation_required | boolean | No | Whether to return citation information; default true. |
processing.extract_processing_config.allow_inference | boolean | No | Whether to allow inference; default false. |
processing.extract_processing_config.extract_schema | object | No | The extraction schema, as a JSON object. Required when using inline processing configuration. |
output | object | No | Output configuration. |
output.oss_config | object | No | OSS output configuration. |
output.oss_config.bucket | string | No | OSS bucket name. |
output.oss_config.endpoint | string | No | OSS endpoint. |
output.oss_config.access_key_id | string | No | OSS AccessKey ID. |
output.oss_config.access_key_secret | string | No | OSS AccessKey Secret. |
output.oss_config.security_token | string | No | OSS Security Token. |
- Online and offline tasks:
- Online tasks: real-time parsing and task return, suitable for fast-response scenarios.
- Offline tasks: submit multiple subtasks at once, suitable for scenarios that can tolerate longer waits. Offline tasks are promised to complete within 7×24 hours after submission.
- A single offline request supports up to 200 subtasks; each subtask is billed independently.
- Online and offline tasks use different billing logic. See Billing.
- Choose
file_url,parsed_file_biz_id, orbatch_job_urlas the file source:- If
file_urlorparsed_file_biz_idis non-empty,batch_job_urlis ignored and the request is processed online. - If both
file_urlandparsed_file_biz_idare empty andbatch_job_urlis non-empty,batch_job_urltakes effect and the request is processed as an offline batch.
- If
batch_job_urlpoints to a manifest in JSON array format. Each item is a subtask containing:file_url: the subtask file URL. Mutually exclusive withparsed_file_biz_id.parsed_file_biz_id: the ID of a completed online or offline parsing task. Mutually exclusive withfile_url.file_name: the subtask file name.file_id: a custom subtask ID.
- The processing definition uses
config_idor inlineprocessing. All subtasks in an offline request share one configuration; per-subtask configuration within a single request is not supported. - When reusing a parsing result, the result must still be within the 7-day retention period, and the input type must support reuse.
Response
| Field | Type | Description |
|---|---|---|
request_id | string | The request ID. |
data.biz_id | string | The online task ID, used to call /extract/result. |
data.biz_id_list | array | The list of offline task IDs. |
data.biz_id_list[].biz_id | string | The offline subtask ID, used to call /extract/result. Not returned if recognition fails. |
data.biz_id_list[].file_id | string | The custom offline subtask ID. |
data.biz_id_list[].code | string | The offline subtask error code. Not returned if recognition succeeds. |
data.biz_id_list[].message | string | The offline subtask error message. Not returned if recognition succeeds. |
data.biz_id_list[].status | string | The offline subtask status: success / fail, indicating whether the subtask was submitted successfully. |
Code examples
The following examples show the two ways of defining processing. When config_id and processing are both present, processing takes precedence. The URLs, task IDs, and configuration IDs in the examples are desensitized placeholder values.
Online tasks:
- Use a saved configuration
- Use inline configuration
Submit
Extraction
- Use a saved configuration
- Use inline configuration
Submit
Offline