Skip to main content
POST
/
parse
/
async_check
Python
import time
import requests

url = "https://somark.tech/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)
{
  "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": "# 第一章 引言\n\n本文档介绍了...",
        "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
            }
          ]
        }
      }
    }
  }
}
Path change: This endpoint path has been changed from /extract/async_check to /parse/async_check. The old path will be discontinued on December 31, 2026. Please migrate to the new path before then.

Task Status

statusMeaning
queuingWaiting in queue
processingParsing in progress
successParsing succeeded; result field is populated
failedParsing failed
Poll every 3~5 seconds until status is success or failed.

Body

multipart/form-data
task_id
string
required

提交任务时返回的任务 ID

api_key
string
required

API 密钥,格式 sk-***

Response

200 - application/json

查询成功

code
integer

状态码,0 为成功,非 0错误码

Example:

0

message
string
Example:

"查询成功"

data
object