Skip to main content

Text Recognition API

API Description

The text recognition API supports returning text positions.

Request Description

URL

https://openapi.sys303.com/api/cognitive/ocr

Parameters

Header Parameters
ParameterValue
Content-Typemultipart/form-data
X-SecretGet it here
Body Parameters
ParameterRequiredTypePossible ValuesDescription
fileYesstream-Image file, size must not exceed 10MB, shortest side at least 15px, longest side max 8192px.
langYesint[0, 1, 2, 3]Recognition language type, default is Tibetan [0: Tibetan, 1: Chinese, 2: English, 3: Chinese-Tibetan mixed]

Request Example

curl --request POST \
--url https://openapi.sys303.com/api/cognitive/ocr \
--header 'Accept: */*' \
--header 'X-Secret: {X-Secret}' \
--header 'content-type: multipart/form-data' \
--form lang=0 \
--form 'file=@[object Object]'

Return Explanation

Parameter Description

FieldRequiredTypeStatusDescription
traceIdYesString-Unique traceId for troubleshooting
msgIdYesString-Business status code
msgYesStringError description
dataYesdict-Recognition result array
+ linesNostring-Recognition result string
++ textNostring-Text of the current line
++ leftNoint-Left position of the text line
++ topNoint-Top position of the text line
++ widthNoint-Width of the text line
++ heightNoint-Height of the text line

Return Example

Success
{
"traceId": "0HNL06O44AU0U:00000001",
"msgId": "2000000",
"msg": "success",
"data": {
"lines": [
{
"text": "Recognized text 1",
"left": 105,
"top": 45,
"width": 355,
"height": 74
},
{
"text": "Recognized text 2",
"left": 241,
"top": 513,
"width": 81,
"height": 38
}
]
}
}
Failure

Auth Failed:

{
"traceId": "0HNLN3J9DCJSE:00000001",
"msgId": "4011001",
"msg": "AuthFailed",
"data": null
}

Invalid request parameters:

{
"traceId": "0HNL06O44AU14:00000001",
"msgId": "500",
"msg": "Specified argument was out of the range of valid values. (Parameter 'langType')",
"data": null
}

Insufficient quota:

{
"traceId": "0HNL06O44AU1F:00000001",
"msgId": "2001001",
"msg": "InsufficientInventory",
"data": null
}