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
}