> ## Documentation Index
> Fetch the complete documentation index at: https://docs.somark.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 异步解析 — 查询结果

> 根据 task_id 查询异步任务状态与解析结果

<Warning>
  路径变更：该接口路径已从 `/extract/async_check` 更改为 `/parse/async_check`。旧路径将于 `2026-12-31` 停用，请在此之前迁移至新路径。
</Warning>

### 任务状态

| `status`     | 含义                 |
| ------------ | ------------------ |
| `QUEUING`    | 排队等待处理             |
| `PROCESSING` | 解析进行中              |
| `SUCCESS`    | 解析成功，`result` 字段有值 |
| `FAILED`     | 解析失败               |

建议每隔 **3\~5 秒**轮询一次，直到 `status` 为 `SUCCESS` 或 `FAILED`。如果你还没提交任务，先看 [异步解析 — 提交任务](/api-reference/endpoint/async-submit)；如果你不想轮询，可以改用 [同步解析](/api-reference/endpoint/sync)；返回异常时继续看[错误码说明](/api-reference/errors)。


## OpenAPI

````yaml POST /parse/async_check
openapi: 3.0.3
info:
  title: SoMark 文档智能 API
  description: >-
    SoMark 文档解析服务 API，支持 PDF、图片、Word、PPT 和 Excel 文件解析，输出 Markdown / JSON / DOCX
    格式。
  version: 1.0.0
servers:
  - url: https://somark.cn/api/v1
security: []
paths:
  /parse/async_check:
    post:
      summary: 异步解析 — 查询结果
      description: 根据 task_id 查询异步任务的执行状态和解析结果。建议每隔 3~5 秒轮询一次。
      operationId: parseAsyncCheck
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - task_id
                - api_key
              properties:
                task_id:
                  type: string
                  description: 提交任务时返回的任务 ID
                api_key:
                  type: string
                  description: API 密钥，格式 sk-***
      responses:
        '200':
          description: 查询成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncCheckResponse'
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            import time
            import requests

            url = "https://somark.cn/api/v1/parse/async_check"
            task_id = "c5e6c983f28a4e6eb5d6c061343a8642"

            while True:
                response = requests.post(url, data={
                    "task_id": task_id,
                    "api_key": "sk-***",
                })
                result = response.json()
                status = result["data"]["status"]

                if status == "SUCCESS":
                    print(result["data"]["result"])
                    break
                elif status == "FAILED":
                    print("解析失败")
                    break

                time.sleep(3)
        - lang: bash
          label: cURL
          source: |-
            curl -X POST https://somark.cn/api/v1/parse/async_check \
              -F "task_id=c5e6c983f28a4e6eb5d6c061343a8642" \
              -F "api_key=sk-***"
components:
  schemas:
    AsyncCheckResponse:
      type: object
      properties:
        code:
          type: integer
          description: 状态码，`0` 为成功，非 `0` 见[错误码](/api-reference/errors)
          example: 0
        message:
          type: string
          example: 查询成功
        data:
          type: object
          properties:
            record_id:
              type: integer
              description: 解析记录 ID
              example: 12345
            task_id:
              type: string
              description: 任务 ID
              example: c5e6c983f28a4e6eb5d6c061343a8642
            status:
              type: string
              description: 任务状态
              enum:
                - QUEUING
                - PROCESSING
                - SUCCESS
                - FAILED
              example: SUCCESS
            file_name:
              type: string
              description: 文件名
              example: document.pdf
            metadata:
              type: object
              properties:
                page_num:
                  type: integer
                  description: 文件总页数
                  example: 5
                file_type:
                  type: string
                  description: 文件类型
                  example: .pdf
            result:
              nullable: true
              description: 解析结果，status 为 SUCCESS 时有值，其余为 null
              type: object
              properties:
                file_name:
                  type: string
                outputs:
                  type: object
                  properties:
                    markdown:
                      type: string
                      description: Markdown 格式全文
                      example: |-
                        # 标题

                        正文内容...
                    json:
                      type: object
                      description: JSON 格式输出
                      properties:
                        pages:
                          type: array
                          description: 逐页结构化解析结果
                          items:
                            type: object
                            properties:
                              page_num:
                                type: integer
                                description: 页码，从 0 开始
                                example: 0
                              blocks:
                                type: array
                                description: 当前页中的内容块，按阅读顺序排列
                                items:
                                  type: object
                                  properties:
                                    idx:
                                      type: integer
                                      description: 块索引
                                      example: 0
                                    type:
                                      type: string
                                      description: 元素类型标识符
                                      example: title
                                    bbox:
                                      type: array
                                      description: 块坐标范围，格式为 [x1, y1, x2, y2]
                                      items:
                                        type: integer
                                      example:
                                        - 72
                                        - 50
                                        - 540
                                        - 80
                                    content:
                                      type: string
                                      description: 块内容
                                      example: 第一章 引言
                                    format:
                                      type: string
                                      description: 块内容格式
                                      example: text
                                    captions:
                                      type: array
                                      description: 关联图注块 idx 列表
                                      items:
                                        type: integer
                                      example:
                                        - 0
                                    img_url:
                                      type: string
                                      description: 图片资源地址
                                      example: ''
                                    title_level:
                                      type: integer
                                      nullable: true
                                      description: >-
                                        标题层级（1=H1, 2=H2, 3=H3...）。仅当 `type` 为
                                        `title` 且开启
                                        `enable_title_level_recognition` 时出现
                                      example: 1
                                    text_cross_page:
                                      type: object
                                      nullable: true
                                      description: >-
                                        跨页文字引用信息。仅当开启 `enable_text_cross_page`
                                        且该块为跨页续接时出现
                                      properties:
                                        page_num:
                                          type: integer
                                          description: 来源页码
                                        block_idx:
                                          type: integer
                                          description: 来源块索引
                                    table_cross_page:
                                      type: object
                                      nullable: true
                                      description: >-
                                        跨页表格引用信息。仅当开启 `enable_table_cross_page`
                                        且该块为跨页续接时出现
                                      properties:
                                        page_num:
                                          type: integer
                                          description: 来源页码
                                        block_idx:
                                          type: integer
                                          description: 来源块索引
                                        target_has_header:
                                          type: boolean
                                          description: 目标表格是否包含表头
                              page_size:
                                type: object
                                properties:
                                  h:
                                    type: integer
                                    description: 页面高度
                                    example: 1684
                                  w:
                                    type: integer
                                    description: 页面宽度
                                    example: 1190
                              merge_content_from_pre_page:
                                type: boolean
                                description: >-
                                  是否将上一页末尾内容合并到当前页开头（需开启
                                  feature_config.enable_text_cross_page）
                                example: true
                      example:
                        pages:
                          - page_num: 0
                            blocks:
                              - idx: 0
                                type: title
                                bbox:
                                  - 72
                                  - 50
                                  - 540
                                  - 80
                                content: 第一章 引言
                                format: text
                                captions: []
                                img_url: ''
                                title_level: 1
                              - idx: 1
                                type: text
                                bbox:
                                  - 72
                                  - 100
                                  - 540
                                  - 200
                                content: 本文档介绍了...
                                format: text
                                captions: []
                                img_url: ''
                            page_size:
                              h: 1684
                              w: 1190
                            merge_content_from_pre_page: false
                    zip:
                      type: string
                      description: ZIP 压缩包下载地址
                      example: https://example.com/result.zip
      example:
        code: 0
        message: 查询成功
        data:
          record_id: 12345
          task_id: c5e6c983f28a4e6eb5d6c061343a8642
          status: SUCCESS
          file_name: document.pdf
          metadata:
            page_num: 5
            file_type: .pdf
          result:
            file_name: document.pdf
            outputs:
              markdown: |-
                # 第一章 引言

                本文档介绍了...
              json:
                pages:
                  - page_num: 0
                    blocks:
                      - idx: 0
                        type: title
                        bbox:
                          - 72
                          - 50
                          - 540
                          - 80
                        content: 第一章 引言
                        format: text
                        captions: []
                        img_url: ''
                        title_level: 1
                      - idx: 1
                        type: text
                        bbox:
                          - 72
                          - 100
                          - 540
                          - 200
                        content: 本文档介绍了...
                        format: text
                        captions: []
                        img_url: ''
                    page_size:
                      h: 1684
                      w: 1190
                    merge_content_from_pre_page: false

````