Query the parsing result

Updated at:

Query the status, result, or chunks of a parsing task

Call this API to query the status, result, or chunks of a parsing task. Keep polling while data.status is init or processing; stop when it becomes success or failed.

NoteMake sure you have obtained an API Key before calling. See Authentication.

Request parameters

ParameterTypeRequiredDescription
biz_idstringYesThe business task ID returned by the /parse/submit endpoint. For online tasks, use data.biz_id; for offline subtasks, use data.biz_id_list[].biz_id.
step_startintegerNoThe chunk start position; default 0. Corresponds to layouts for document results and segments for audio/video results.
step_sizeintegerNoThe chunk step size, i.e. the maximum number of chunks returned in a single query; default 0.
oss_configobjectNoOSS output configuration.
oss_config.access_key_idstringNoManaged OSS AccessKey ID.
oss_config.access_key_secretstringNoManaged OSS AccessKey Secret.
oss_config.security_tokenstringNoManaged OSS Security Token.

Response

FieldTypeDescription
request_idstringThe request ID.
data.statusstringProcessing status: init, processing, success, or failed.
data.processingnumberProcessing progress.
data.successful_parsing_numintegerNumber of layouts or segments processed. After the task succeeds, this equals the total number of chunks and can be passed as step_size to fetch all chunks in a single call.
data.image_countintegerNumber of images.
data.table_countintegerNumber of tables.
data.paragraph_countintegerNumber of paragraphs.
data.page_countintegerNumber of pages.
data.layoutsarrayLayout results for the queried chunk.
data.output_format_resultarrayList of output format results. Returned only when status is success and all results have been retrieved.
data.output_format_result[].output_file_urlstringThe URL corresponding to the output type.
data.output_format_result[].output_typestringThe output type. When the value is markdown, output_file_url is the URL of the parsing result in Markdown format.
data.media_durationnumberFile duration (audio/video).
data.segmentsarrayParsed segment results (audio/video).
data.synopsis_resultstringSynopsis parsing result (audio/video).
data.synopsis_segmentsarraySynopsis segments (audio/video).
data.synopsis_summarystringSynopsis summary (audio/video).

NoteWhile the status is init or processing, keep querying this endpoint; when the status is failed, refer to Error codes to determine the cause of failure.

Fetch the full result

step_start and step_size define the chunk window returned by a single query: chunks are layouts for document results and segments for audio/video results. After the task succeeds, retrieve the full result as follows:

  1. Poll the task status: call this endpoint and keep querying with a capped backoff strategy while data.status is init or processing, until it becomes success; stop polling and troubleshoot with Error codes when it is failed.
  2. Read the total chunk count: once data.status is success, data.successful_parsing_num is the total number of chunks. While the task is processing, this field only reflects the progress already processed and must not be used as the total.
  3. Fetch the chunks using either approach:
    • One-shot fetch: pass 0 for step_start and data.successful_parsing_num for step_size to return all chunks in a single call.
    • Batched fetch: keep step_size fixed as the batch size (for example 100), start step_start at 0, and after each response add the number of chunks actually returned to step_start as the start position of the next batch; stop when a response returns fewer chunks than step_size, which means all chunks have been retrieved.
  4. Read the output files: data.output_format_result is returned only after all chunks have been retrieved. When output_type is markdown, output_file_url is the URL of the parsing result in Markdown format.

NoteFor offline batch tasks, run this flow independently for each subtask using its own biz_id.

Result query code examples

Document parsing result query

curl -X POST 'https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/parse-x/parse/result' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "biz_id": "parseX-xxx",
    "step_start": 0,
    "step_size": 1
  }'
{
  "request_id": "request_xxx",
  "data": {
    "status": "success",
    "processing": 100.0,
    "successful_parsing_num": 10,
    "image_count": 0,
    "table_count": 0,
    "paragraph_count": 10,
    "page_count": 1,
    "layouts": [],
    "output_format_result": [
      {
        "output_file_url": "https://example.com/output/parseX-xxx.md",
        "output_type": "markdown"
      }
    ]
  }
}

Audio/video parsing result query

curl -X POST 'https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v2/apps/parse-x/parse/result' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "biz_id": "parseX-Video-xxx",
    "step_start": 0,
    "step_size": 100
  }'
{
    "request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "data": {
      "status": "success",
      "processing": 100.0,
      "successful_parsing_num": 59,
      "segments": [
        {
          "start_time": 5120.0,
          "file_url": "https://example.com/output/parseX-video-xxx/segments/segment_1_video.mp4",
          "audio_frames": [
            {
              "start_time": 7000.0,
              "file_url": "https://example.com/output/parseX-video-xxx/segments/segment_1_audio.mp3",
              "ASR_info": "来进来有新座吗?",
              "sentences": [
                {
                  "speaker_id": 1,
                  "end_time": 10380.0,
                  "begin_time": 7000.0,
                  "text": "来进来有新座吗?"
                }
              ],
              "end_time": 10380.0
            }
          ],
          "end_time": 10380.0,
          "index": 1,
          "uniqueId": "6a00110588ba0646417aa6b3f8d97f76",
          "video_frames": [
            {
              "start_time": 7500.0,
              "file_url": "https://example.com/output/parseX-video-xxx/frames/frame_4_0.jpg",
              "text_info": "门被打开,一位头戴白色棒球帽、身穿绿色工装马甲的年轻男子满脸笑容地伸手握住敲门者的手,热情地说道“来 进来”",
              "end_time": 7566.666666666666
            },
            {
              "start_time": 8400.0,
              "file_url": "https://example.com/output/parseX-video-xxx/frames/frame_5_0.jpg",
              "text_info": "男子站在采光良好的客厅内,侧身回头并向屋内做出引导的手势,背景中可见书架、玻璃圆桌以及靠窗的蓝色休闲椅",
              "end_time": 9266.666666666668
            },
            {
              "start_time": 9933.333333333334,
              "file_url": "https://example.com/output/parseX-video-xxx/frames/frame_6_0.jpg",
              "text_info": "一个阳光充足的客厅,铺着绿色地毯,左侧有一个装满书的木制书架,角落里放着一把蓝色扶手椅。前景的玻璃咖啡桌上放着一个披萨盒和一本书,墙上挂着一张海报,旁边有一条垂直的绿色装饰带。",
              "end_time": 10600.0
            }
          ]
        },
        ...
      ],
      "synopsis_result": "# 视频剧情内容:### 剧情概要\n\n视频....",
      "synopsis_segments": [
        {
          "start_time": 0,
          "file_url": "https://example.com/output/parseX-video-xxx/segments/segment_0_video.mp4",
          "end_time": 5000,
          "index": 0,
          "text": "渔夫帽男子在狭长走廊里开始这段vlog,镜头先扫到他深橄榄色T恤、米白色裤子和浅色背包,随后他戴着米色渔夫帽,露出黑色卷发,对着镜头微笑。他说:“今天没事,去看看朋友们都在干什么?”随后他来到一扇带猫眼的深棕色木门前,抬手敲门。",
          "uniqueId": "b35998c4077d3e8645e4b198cd920e24"
        },
        ...
      ],
      "synopsis_summary": "视频以一段轻松的朋友探访vlog展开:...."
    }
  }