Skip to content

Doc2X API v2 Image Interface Documentation

Basic Information

URL: https://v2.doc2x.noedgeai.com

Please access the API interface directly. Regions outside mainland China may experience significant network fluctuations, leading to severe file upload interruptions.

Currently defaults to 30 images/30s concurrency, temporarily does not support increasing concurrency. For large-scale image processing, please convert to PDF processing (if images have consistent aspect ratios, please convert to multi-page PDF to accelerate processing throughput).

Authorization

First, you need to obtain an API Key (similar to sk-xxx)

Add to HTTP request headers:

bash
Authorization: Bearer sk-xxx

POST /api/v2/parse/img/layout Image Layout

Image OCR interface with layout recognition, effects consistent with /parse/pdf, supports parsing and extraction of text, formulas, multi-column, tables, and images (mainly applicable to document images and document-like images).

This interface is a synchronous call interface.

Image size requirement: <= 7M

Pricing method: 1 image = 1 PDF page parsing (1:1), will consume PDF parsing pages equally

Request Parameters

NameLocationTypeRequiredDescription
bodybodybinaryYesRequest body is img(jpg/png) binary, max 7M

Request Example

bash
curl -X POST 'https://v2.doc2x.noedgeai.com/api/v2/parse/img/layout' \
--header 'Authorization: Bearer sk-xxx' \
--data-binary '@test.jpg'

Note: --data-binary is not formdata, but written in binary form to the body. Python code example:

python
import requests

url = 'https://v2.doc2x.noedgeai.com/api/v2/parse/img/layout'
headers = {'Authorization': 'Bearer sk-xxx'}

with open('test.jpg', 'rb') as file:
    response = requests.post(url, headers=headers, data=file) # use data

print(response.text)

Response Example

json
{
  "code": "success",
  "data": {
    "convert_zip": null, // If the uploaded image contains diagram content
    // convert_zip contains the base64 of a zip package with all image files from the page
    "result": {
      "pages": [
        {
          "page_width": 1000,
          "page_height": 1000,
          "md": "123456789" // Extracted markdown for the entire page
        }
      ]
    },
    "uid": "01940000-0000-0000-0000-111111111"
  }
}

File Structure After convert_zip Extraction

text
.
|--images # Image resource files
    |--example1.jpg
    |--example2.jpg

POST /api/v2/async/parse/img/layout Asynchronous Image Layout Task Submission

Image OCR interface with layout recognition, effects consistent with /parse/pdf, supports parsing and extraction of text, formulas, multi-column, tables, and images (mainly applicable to document images and document-like images).

This interface is an asynchronous call interface.

Image size requirement: <= 7M

Pricing method: 1 image = 1 PDF page parsing (1:1), will consume PDF parsing pages equally

Asynchronous Image Request Parameters

NameLocationTypeRequiredDescription
bodybodybinaryYesRequest body is img(jpg/png) binary, max 7M

Asynchronous Image Request Example

bash
curl -X POST 'https://v2.doc2x.noedgeai.com/api/v2/async/parse/img/layout' \
--header 'Authorization: Bearer sk-xxx' \
--data-binary '@test.jpg'

Note: --data-binary is not formdata, but written in binary form to the body. Python code example:

python
import requests

url = 'https://v2.doc2x.noedgeai.com/api/v2/async/parse/img/layout'
headers = {'Authorization': 'Bearer sk-xxx'}

with open('test.jpg', 'rb') as file:
    response = requests.post(url, headers=headers, data=file) # use data

print(response.text)

Asynchronous Image Response Example

json
{
  "code": "success",
  "data": {
    "uid": "01940000-0000-0000-0000-111111111"
  }
}

GET /api/v2/parse/img/layout/status Asynchronous Image Layout Processing Status

Asynchronous Image Processing Status Request Parameters

Request Headers

NameDescriptionExample Value
AuthorizationApi keyBearer sk-usui9lodl89p7r51suvo0awdawd

Request Body

NameLocationTypeRequiredDescription
uidquerystringYesAsynchronous task id

Asynchronous Image Processing Status Request Example

bash
curl --request GET 'https://v2.doc2x.noedgeai.com/api/v2/parse/img/layout/status?uid=01920000-0000-0000-0000-000000000000' \
--header 'Authorization: Bearer sk-xxx'

Asynchronous Image Processing Status Response Examples

Processing Completed

json
{
  "code": "success",
  "data": {
    "status": "success",
    "result": {
      "pages": [
        {
          "url": "01952205-b26f-7930-93c1-103c88156729_0.jpg",
          "page_idx": 0,
          "page_width": 1080,
          "page_height": 4322,
          "md": "<!-- Media -->\n\n<img src=\"01952205-b26f-7930-93c1-103c88156729_0_0_59_1080_4221_0.jpg\"/>\n\n<!-- Media -->"
        }
      ]
    },
    "convert_zip": "EpwBCiowMTk1MjIwNS1iMjZmLTc5MzAtOTNjMS0xMDNjODgxNTY3MjlfMC5qcGcYuAgg4iEqaDwhLS0gTWVkaWEgLS0+Cgo8aW1nIHNyYz0iMDE5NTIyMDUtYjI2Zi03OTMwLTkzYzEtMTAzYzg4MTU2NzI5XzBfMF81OV8xMDgwXzQyMjFfMC5qcGciLz4KCjwhLS0gTWVkaWEgLS0+"
  }
}

Failed Processing

json
{
  "code": "parse_error",
  "msg": "Parse error"
}

Processing in Queue

json
{
  "code": "success",
  "data": {
    "status": "processing"
  }
}

Asynchronous Task convert_zip File Structure After Extraction

text
.
|--images # Image resource files
    |--example1.jpg
    |--example2.jpg