OCR text recognition assistant

Open API Interface Development Guide

Get API credits

Welcome to OCR Text Recognition Assistant Open Platform!
We provide stable, high-speed, out-of-the-box text extraction and table recognition services.

1. Global Authentication Mechanism (Auth)

All interface requests must include the following authentication parameters in the URL:

Parameter name Required Description
app is Fixed value api
token is You can find it in Personal center Get your own token
2. Identify the core interface (op = code)

Request URL: /Code.ashx?op=code&app=api&token=YOUR_TOKEN&type=0

Call method: POST

The parameters are uniformly spelled in the URL, and the image data is passed through the POST body (multipart is supported file flow, form field, or plain text).

2.1 Enter the image to be recognized (choose one of three)

Parameter name Type Description
(Document) File Standard multipart upload file flow.
url String The public network of the picture can access the direct link address.
code String Base64 string of the image (no need to include a header formatting declaration).

2.2 Core mode and engine control

Parameter name Required Description
type Nope Identify patterns:
0: Text recognition (Default)
1: Vertical identification
2: Table recognition
3: Formula recognition (Such as MathPix)

2.3 Formatting and Layout Rules (Optional)

The following parameters pass values 1 Turn on the corresponding processing, value 0 Not on.
If there is no specific need, it is recommended not to pass it on, and leave it to the system to decide:

Parameter name Required Description
left Nope Biography 1 Force left-to-right sort stitching.
top Nope Biography 1 Force sorting from top to bottom.
autodirection Nope Biography 1 Automatically determines the orientation of the image and rotates it to align.
half Nope Biography 1 Automatic full-width punctuation to regular half-width.
space Nope Biography 1 Automatically handles word spaces between English and Chinese, Japanese, and Korean characters.
symbol Nope Biography 1 Automatically correct weird punctuation.
duplicate Nope Biography 1 Automatically de-repeat hyphens.

2.4 Return Value Description (JSON)

The recognition interface returns a standard JSON format. The value is null field is automatically omitted.

top-level fields

field Type Description
id String The unique batch ID (UUID format) of this request can be used to query the results asynchronously.
ocrType Int Identify the type, with the request parameters type correspondence.
processId Int The ID of the engine node that handled the request.
processName String Process engine names. When empty indicates that the recognition timed out or was not assigned to a node.
state Int Handle status codes (see enumeration table below).
message String Additional message/error description, which is returned only in exceptional cases.
result Object Core identification result objects (see the subfields table below for details).
desc String Additional descriptive information attached to the engine, if any.

result Sub-object – Text result

field Type Description
autoText String Recommended use。 Complete text with intelligent paragraph merging and layout optimization.
spiltText String Text split by original paragraph (between paragraphs \t Indent + \n line break). In tabular mode, the data is JSON columns.
transText String Translate the resulting text (only in type=Translation mode returns, structure with spiltText correspondence).
lang String The image language identifier automatically detected by the engine (e.g chi_sim, eng, jpn)。
resultType Int Result format type.0= plain text, 1= web page (with formula rendering), 2= Table.

result Sub-object - coordinate positioning data 🗺️

The following fields contain the precise position of each text block on the original image, suitable for scenarios such as highlighting overlays, area extraction, etc.

field Type Description
spiltLocText String Original segmented text with coordinate information (result of smart paragraph merge, including location information).
transLocText String Translated segmented text with coordinate information.
verticalText String (JSON) ⭐ A JSON string of a complete text block coordinate array. One for each element TextCellInfo object (see structure below).

verticalText TextCellInfo object structure

[
  {
    "words": "The text content that is recognized",
    "trans": "Translation results (if any)",
    "pageIndex": 0,
    "location": {
      "left": 120.0,
      "top": 45.0,
      "width": 230.0,
      "height": 28.0
    }
  },
  ...
]
field Type Description
words String The text recognized by this text block.
trans String Translation results (valued only in translation mode).
pageIndex Int Page number index (valid in multi-page document scenarios, starting from 0).
location.left Double X coordinates (pixels) in the upper left corner of the text block.
location.top Double The Y coordinate (pixels) in the upper left corner of the text block.
location.width Double Text block width (in pixels).
location.height Double Text block height (in pixels).

result Sub-object - File download

field Type Description
viewUrl String When resultType=1 (webpage/formula), the online preview page address returned.
downloadHtml String HTML snippet with download links.
files Array A list of result files available for download, each of which is: DownLoadInfo object (see structure below).

files The DownLoadInfo object structure in the DownLoadInfo object structure

field Type Description
url String The file download address.
param String Download the additional parameters you need.
fileType Int File Type Enumeration:1=PDF, 2=Word, 3=PPT, 4=Excel, 5=TXT, 6=Markdown
desc String Document description.

state State enumeration

value Meaning Description
0 Pending The request has been received and the engine has not been assigned.
2 Successful processing Return recognition results normally.
3 Processing failed The engine handles an exception and can be retried.
4 Processing timeout The engine did not return within the validity period.
6 Concurrency limit There are too many concurrent requests, so please reduce the frequency.
7 types are not supported The current recognition type or file format is not supported.

Back example

✅ Successful response (with coordinate data):

{
  "ocrType": 0,
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "processId": 3,
  "processName": "OCR-Node-01",
  "state": 2,
  "result": {
    "autoText": "Complete text after smart merge",
    "spiltText": "Original text divided by paragraphs",
    "verticalText": "[{\"words\":\"Hello\",\"location\":{\"left\":10,\"top\":20,\"width\":80,\"height\":22}}]",
    "resultType": 0,
    "lang": "chi_sim"
  }
}

❌ Error/Limit Response:

{
  "ocrType": 0,
  "processName": "Tips",
  "result": {
    "spiltText": "Today's API quota has been exhausted, please recharge and continue to use it!",
    "autoText": "Today's API quota has been exhausted, please recharge and continue to use it!"
  },
  "id": 1
}
3. Asynchronous result query (op = idcode)

Request URL: /Code.ashx?op=idcode&app=api&token=YOUR_TOKEN

Call method: POST

Function: Returned according to the recognition interface id Query the results of asynchronous processing. When the recognition interface returns state=0(pending), you can use this interface to poll to get the final result.

Parameter name Required Type Description
id is String Identify the batch request ID returned by the interface and pass it through the POST body.

Back example

✅ Successful Response:

[
  {
    "ocrType": 0,
    "id": "a1b2c3d4-...",
    "processName": "OCR-Node-01",
    "state": 2,
    "result": {
      "autoText": "Identify the resulting text",
      "spiltText": "Segmented text",
      "resultType": 0
    }
  }
]

❌ Failed response (ID does not exist or result has expired):

no

Returns plain text no Indicates that no result was found for that ID, which may be an ID The error or result has expired and is cleared.

4. Image Upload Bed (op = imgUpload)

Request URL: /Code.ashx?op=imgUpload&app=api&token=YOUR_TOKEN

Call method: POST (multipart/form-data)

Function: Upload an image to the free image bed and return a direct link URL that is accessible on the public network. It is suitable for scenarios where you need to upload an image first and then use the URL to call the recognition interface.

Parameter name Required Type Description
(Document) is File Image files uploaded in multipart fashion.

Back example

✅ Successful Response:

https://cdn.example.com/uploads/abc123.jpg

❌ Failed response (file not uploaded or upload exception):

no

Returns plain text no Indicates that the file was not received or an exception occurred during the upload process.

5. Balance Inquiry Interface (API Quota)

Request URL: /Code.aspx?op=count&app=api&token=YOUR_TOKEN

Call method: GET

Through this interface, you can view the number of times the token has been used today and the remaining quota.

Back example

✅ Successful Response:

{
  "Account": "api",
  "TodayCount": 52, // Used today"LimitCount": 9948       // The total number of current remains
}

❌ Failure response (invalid or untransmitted token):

{
  "Account": "api",
  "TodayCount": 0,
  "LimitCount": 0
}

Note: If the token is invalid, no error will be reported, but will return JSON with all values of 0, depending on whether the LimitCount is yes or not 0 to judge the validity of the token.

💻 Online commissioning & Access code
// Wait for the request to be sent...
📋 Quick access code (Follow the options above to automatically generate)
Code Snippet
After selecting the interface and parameters, it will be automatically generated...
OCR assistant QQ online customer service
QQ customer service(365833440)
OCR assistant QQ user communication group
QQgroup(100029010)
OCR assistant contact customer service by email
Mailbox:net10010@qq.com

Thank you for your comments and suggestions!