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

# Async parsing — Check result

> Get the status and parsing result of an async task by task_id

Use the `task_id` from [task submission](https://docs.somark.ai/en/open-source-tools/oxr/async-submit.md) to poll every **3–5 seconds**.

Set a polling deadline that fits your workflow. The Python example uses 120 seconds. If the result is still pending when polling stops, keep the original `task_id` so you can check the same task later.

| `data.status` | Meaning |
| - | - |
| `QUEUING` | Waiting to be processed |
| `PROCESSING` | Parsing in progress |
| `SUCCESS` | Parsing succeeded. Read the result from `data.result.outputs`. |
| `FAILED` | Parsing failed. Check `data.error` for details. |


## OpenAPI

````yaml en/open-source-tools/oxr/openapi.json POST /parse/async_check
openapi: 3.0.3
info:
  title: OXR Free API
  version: 1.0.0
  description: Parse PDFs and images into Markdown and layout JSON.
servers:
  - url: https://free-oxr.somark.ai/api/v1
security: []
paths:
  /parse/async_check:
    post:
      summary: Async parsing — Check result
      operationId: oxrParseAsyncCheck
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - task_id
              properties:
                task_id:
                  type: string
                  description: Task ID returned by the submission endpoint.
                  example: 7536c9d4c01341a3855a7deeb591b5ad
                api_key:
                  type: string
                  description: >-
                    Optional placeholder. The Free API does not validate this
                    field.
                  example: dummy
      responses:
        '200':
          description: Task status and parsing result when available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncCheckResponse'
              examples:
                success:
                  value:
                    code: 0
                    message: 查询成功
                    warnings: []
                    data:
                      task_id: 7536c9d4c01341a3855a7deeb591b5ad
                      status: SUCCESS
                      file_name: example.png
                      result:
                        file_name: example.png
                        outputs:
                          markdown: |
                            # OXR API example

                            This document has one page.
                      metadata:
                        file_type: .png
                        page_num: 1
                        processing_time_ms: 205
                      error: null
                processing:
                  value:
                    code: 0
                    message: 查询成功
                    warnings: []
                    data:
                      task_id: 7536c9d4c01341a3855a7deeb591b5ad
                      status: PROCESSING
                      file_name: example.png
                      result: null
                      metadata: {}
                      error: null
        '404':
          description: Task not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  value:
                    code: 1133
                    message: task not found
                    warnings: []
                    data: null
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl --fail-with-body
            https://free-oxr.somark.ai/api/v1/parse/async_check \
              -F 'task_id=YOUR_TASK_ID'
        - lang: python
          label: Python
          source: |-
            import time
            import requests

            url = "https://free-oxr.somark.ai/api/v1/parse/async_check"
            task_id = "YOUR_TASK_ID"

            deadline = time.monotonic() + 120

            while (remaining := deadline - time.monotonic()) > 0:
                response = requests.post(url, data={"task_id": task_id}, timeout=min(30, remaining))
                response.raise_for_status()
                body = response.json()
                if body["code"] != 0:
                    raise RuntimeError(body["message"])

                task = body["data"]
                if task["status"] == "SUCCESS":
                    print(task["result"]["outputs"])
                    break
                if task["status"] == "FAILED":
                    raise RuntimeError(task["error"])
                time.sleep(min(3, max(0, deadline - time.monotonic())))
            else:
                raise TimeoutError(f"Polling timed out. Keep task_id={task_id} to check again later.")
components:
  schemas:
    AsyncCheckResponse:
      type: object
      properties:
        code:
          type: integer
          example: 0
          description: >-
            0 indicates success. Check this field even if the HTTP status is
            200.
        message:
          type: string
          example: 查询成功
        warnings:
          type: array
          items:
            type: string
          example: []
        data:
          type: object
          properties:
            task_id:
              type: string
              example: 7536c9d4c01341a3855a7deeb591b5ad
            status:
              type: string
              enum:
                - QUEUING
                - PROCESSING
                - SUCCESS
                - FAILED
              example: SUCCESS
            file_name:
              type: string
              example: example.png
              nullable: true
            result:
              $ref: '#/components/schemas/ParseResult'
            metadata:
              $ref: '#/components/schemas/ParseMetadata'
            error:
              type: string
              nullable: true
              description: Error details when parsing fails.
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          example: 1133
        message:
          type: string
          example: task not found
        warnings:
          type: array
          items:
            type: string
          example: []
        data:
          type: object
          nullable: true
          example: null
    ParseResult:
      type: object
      nullable: true
      properties:
        file_name:
          type: string
          example: example.png
        outputs:
          type: object
          properties:
            markdown:
              type: string
              description: Markdown text, returned when requested.
            json:
              type: object
              description: Layout JSON, returned when requested.
              properties:
                pages:
                  type: array
                  items:
                    type: object
                    properties:
                      page_num:
                        type: integer
                        example: 0
                        description: Zero-based page index.
                      page_size:
                        type: object
                        properties:
                          h:
                            type: integer
                            example: 225
                          w:
                            type: integer
                            example: 770
                      merge_content_from_pre_page:
                        type: boolean
                      blocks:
                        type: array
                        items:
                          type: object
                          additionalProperties: true
                          properties:
                            idx:
                              type: integer
                              example: 1
                            type:
                              type: string
                              description: Case-sensitive layout block type.
                              example: Title
                            bbox:
                              type: array
                              items:
                                type: number
                              minItems: 4
                              maxItems: 4
                              description: Bounding box as [x_min, y_min, x_max, y_max].
                              example:
                                - 41.31
                                - 57.67
                                - 389.58
                                - 104.5
                            content:
                              type: string
                              example: OXR API example
                            format:
                              type: string
                              example: text
    ParseMetadata:
      type: object
      properties:
        file_type:
          type: string
          example: .png
        page_num:
          type: integer
          example: 1
          description: Number of pages.
        processing_time_ms:
          type: integer
          example: 205

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.