Skip to content

Doc2X API v2 Image Interface Documentation

From input to local files

  1. Prepare a readable JPG/PNG and confirm it may be processed by the Open Platform.
  2. Use the synchronous route to wait for one response, or the async route to retain an ID and check later. Both take raw binary, not multipart/form-data.
  3. Save async data.uid, then GET status every 1–3 seconds with a total deadline. Wait for processing; inspect detail for failed; handle a non-success outer code separately. Do not poll by repeating POST.
  4. On success, save data.result, page md, and the optional convert_zip image archive. The archive may be absent; response illustrations below do not contain a fabricated ZIP.
  5. Check text, formulas, tables, and image paths. API results are temporary, approximately 24 hours. A local timeout does not cancel remote processing: query the original ID before resubmitting.

See PDF API authentication and errors. The image API limit is 7 MiB; the CLI's 3 MiB limit is a separate route. HTTP 200 is not a quality check, and image OCR is not the image-translation editor.

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.

Check current account quota and rate limits on the Open Platform before batch work. The historical “30 images/30s” statement is not a guaranteed concurrency allowance for every account. Submit sequentially, preserve task IDs, and control the queue using returned states.

Authorization

Get an API Key from the Open Platform and check quota. YOUR_DOC2X_API_KEY is a placeholder, not a working credential.

Add to HTTP request headers:

text
Authorization: Bearer YOUR_DOC2X_API_KEY

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: <= 7 MiB (7,340,032 bytes)

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

Request Parameters

NameLocationTypeRequiredDescription
bodybodybinaryYesRequest body is img(jpg/png) binary, max 7 MiB (7,340,032 bytes)

Request Example

bash
curl -X POST 'https://v2.doc2x.noedgeai.com/api/v2/parse/img/layout' \
--header 'Authorization: Bearer YOUR_DOC2X_API_KEY' \
--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 YOUR_DOC2X_API_KEY'}

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

print(response.text)

Response Example

json
{
  "code": "success",
  "data": {
    "convert_zip": null,
    "result": {
      "pages": [
        {
          "page_width": 1000,
          "page_height": 1000,
          "md": "123456789"
        }
      ]
    },
    "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: <= 7 MiB (7,340,032 bytes)

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

Asynchronous Image Request Parameters

NameLocationTypeRequiredDescription
bodybodybinaryYesRequest body is img(jpg/png) binary, max 7 MiB (7,340,032 bytes)

Asynchronous Image Request Example

bash
curl -X POST 'https://v2.doc2x.noedgeai.com/api/v2/async/parse/img/layout' \
--header 'Authorization: Bearer YOUR_DOC2X_API_KEY' \
--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 YOUR_DOC2X_API_KEY'}

with open('test.jpg', 'rb') as file:
    response = requests.post(url, headers=headers, data=file, timeout=(10, 90))
    response.raise_for_status() # 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 YOUR_DOC2X_API_KEY

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 YOUR_DOC2X_API_KEY'

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": null
  }
}

Failed Processing

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

Processing

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

Asynchronous Task convert_zip File Structure After Extraction

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

Save Markdown and image resources

Save the successful synchronous response or completed async status response as image-response.json. This Python 3.10+ example reads local files only. Save it as save_image_result.py and run python save_image_result.py.

python
import base64
import io
import json
import zipfile
from pathlib import Path


def save_image_response(body, output_dir):
    if body.get("code") != "success":
        raise ValueError(f"API error: {body.get('code')}")
    data = body["data"]
    if "status" in data and data["status"] != "success":
        raise ValueError(f"Not a completed result: {data['status']}")
    result = data["result"]
    encoded = data.get("convert_zip")
    archive = base64.b64decode(encoded, validate=True) if encoded else None
    if archive is not None and not zipfile.is_zipfile(io.BytesIO(archive)):
        raise ValueError("convert_zip is not a ZIP; retain response and check the service format")
    out = Path(output_dir)
    out.mkdir(exist_ok=False)
    (out / "result.json").write_text(
        json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
    (out / "result.md").write_text("\n\n".join(
        page.get("md", "") for page in result.get("pages", [])), encoding="utf-8")
    if archive is not None:
        (out / "images.zip").write_bytes(archive)
    return out


if __name__ == "__main__":
    body = json.loads(Path("image-response.json").read_text(encoding="utf-8"))
    print(save_image_response(body, "image-output"))

Open image-output/result.md. When present, inspect image-output/images.zip with unzip -l, then extract into a new directory and preserve the paths referenced by Markdown. An archive containing images does not prove every reference is complete. Rendered tables are not XLSX export evidence.

SymptomAction
401/403, quota error, or 429Check Open Platform Key/quota/rate limits and reduce queue concurrency; do not substitute a desktop token.
Invalid image/sizeCheck actual JPG/PNG data and the 7 MiB limit; convert or reduce locally first.
Failed/expired taskRetain uid/detail and check local backups; avoid endless creation retries.
Invalid Base64/ZIPRetain a redacted error and original response; verify the service format before extracting.
Missing Markdown imagesCompare references with extracted files and preserve relative resource paths.