Submit a document or audio/video parsing task, with support for online single-file and offline batch manifests; returns task IDs for async queries.
Online tasks submit a single file and return a
The following examples show the two ways of defining processing. When
Offline tasks:
biz_id; offline tasks submit a batch manifest and return a biz_id_list. Parsing is asynchronous: after submitting, use the task ID to call Query the parsing result to get the processing status and result.
Make sure you have obtained an API Key before calling. See Authentication.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_url | string | No | The URL of the online file to parse. Mutually exclusive with 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. |
batch_job_url | string | No | The URL of the offline batch manifest. Mutually exclusive with file_url. A JSON array where each item is a subtask: file_url/file_name/file_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 | The configuration ID, for example config_xxx. When passed together with inline parameters, the inline parameters take precedence. |
processing | object | No | Processing configuration. |
processing.user_prompt | string | No | User-defined prompt. |
processing.doc_processing_config | object | No | Document parsing processing configuration. |
processing.doc_processing_config.page_index | string | No | The page range to parse, for example 1-10. |
processing.doc_processing_config.head_foot | boolean | No | Whether to parse headers and footers. |
processing.doc_processing_config.layout_position | boolean | No | Whether to return coordinates. |
processing.doc_processing_config.image_caption | boolean | No | Whether to generate image descriptions. |
processing.media_processing_config | object | No | Audio/video parsing processing configuration. |
processing.media_processing_config.enable_diarization | boolean | No | Whether to perform speaker diarization. |
processing.media_processing_config.enable_synopsis_parse | boolean | No | Whether to perform synopsis parsing. |
processing.media_processing_config.enable_synopsis_segments | boolean | No | Whether to generate synopsis segments. |
processing.media_processing_config.enable_synopsis_summary | boolean | No | Whether to generate a synopsis summary. |
processing.media_processing_config.frame_extraction | object | No | Frame extraction configuration. |
processing.media_processing_config.frame_extraction.mode | string | No | Frame extraction mode. Valid values: auto, frame_rate |
processing.media_processing_config.frame_extraction.frame_rate | number | No | Frame extraction rate, in the range 0.2–5 |
processing.media_processing_config.frame_extraction.output_image_width | integer | No | Output frame image width. If not specified, the original resolution is used. Value range: [32, 4096] |
processing.media_processing_config.frame_extraction.output_image_height | integer | No | Output frame image height. If not specified, the original resolution is used. Value range: [32, 4096] |
output | object | No | Output configuration. |
output.output_file_format | string[] | No | Array of output format strings. Valid values: markdown |
output.layout_table_format | string | No | Output format of tables in Markdown. Valid values: markdown, html |
output.oss_config | object | No | OSS output configuration. |
output.oss_config.bucket | string | No | Managed OSS bucket name. |
output.oss_config.endpoint | string | No | Managed OSS endpoint. |
output.oss_config.access_key_id | string | No | Managed OSS AccessKey ID. |
output.oss_config.access_key_secret | string | No | Managed OSS AccessKey Secret. |
output.oss_config.security_token | string | No | Managed 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_urlorbatch_job_urlas the file source:- If
file_urlis non-empty,batch_job_urlis ignored and the request is processed online. - If
file_urlis 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.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.
Response
| Field | Type | Description |
|---|---|---|
request_id | string | The request ID. |
data.biz_id | string | The online task ID, used to call /parse/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 /parse/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. |
Document parsing 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
Configure
- Use a saved configuration
- Use inline configuration
Configure
Audio/video parsing code examples
- Use a saved configuration
- Use inline configuration
Configure