| Region | Endpoint |
|---|---|
| Korea (Pangyo) Region | https://api-ocr.nhncloudservice.com |
Document AI uses User Access Key tokens for authentication and authorization when making API calls. The User Access Key token is a temporary, Bearer-type access token issued from a User Access Key. For more information on issuing and using User Access Key tokens, see the User Access Key Token.
All API requests return HTTP 200 OK. The success or failure of an API request can be determined by referring to the header field in the Response Body.
HTTP/1.1 200 OK
Content-Type: application/json
{
"header": {
"resultCode": 0,
"resultMessage": "SUCCESS",
"isSuccessful": true
},
"result": {
"llmResponse": ...
},
...
}
{
"header": {
"isSuccessful": false,
"resultCode": -1,
"resultMessage": "Unknown error."
}
}
| Name | Type | Description |
|---|---|---|
| resultCode | int | Response code Returns 0 on success, error code on failure |
| resultMessage | String | Response message |
| isSuccessful | boolean | Success or not |
| Error Code | Error Message | Description |
|---|---|---|
| -1 | Unknown error. | Unknown error |
| 4000001 | Invalid parameter. | Invalid parameter |
| 4000002 | Invalid file. | Invalid file |
| 4000003 | Invalid file type. | Invalid file type |
| 4000004 | Uploaded file is empty. | Uploaded file is empty |
| 4000005 | Required headers are missing. | Required headers missing |
| 4000006 | Api call limit exceeded. If you need to adjust the limit, please contact customer service. | API call limit exceeded |
| 4010006 | Invalid token. | Invalid token |
| 4010007 | Permission denied. | Permission denied |
| 4131000 | Request size is larger than permissible limit. | Request size exceeds limit |
[URI]
| Method | URI |
|---|---|
| POST | /v1.1/appkeys/{appKey}/document-ai |
[Request Header]
| Name | Value | Description |
|---|---|---|
| X-NHN-Authorization | Bearer | User Access Key token |
| Content-Type | multipart/form-data | Content type |
[Request Body]
curl -X POST 'https://api-ocr.nhncloudservice.com/v1.1/appkeys/{appKey}/document-ai' \
-H 'X-NHN-Authorization: Bearer ${User Access Key Token}' \
-F 'image=@sample.png' \
-F 'prompt="Give me a quick summary"' \
-F 'documentTypeCode="GENERAL"'
[Field]
| Name | Type | Required | Default | Valid Range | Description |
|---|---|---|---|---|---|
| image | file | O | Image file | ||
| documentTypeCode | text | X | GENERAL | GENERAL, BUSINESS_REGISTRATION, BUSINESS_CARD | Document type General: GENERAL Business registration: BUSINESS_REGISTRATION Business card: BUSINESS_CARD |
| prompt | text | O | Question content Up to 1,000 characters |
[Response Body]
{
"header": {
"isSuccessful": true,
"resultCode": 0,
"resultMessage": "SUCCESS"
},
"result": {
"llmResponse": "This document appears to have been written using 'lorem ipsum', a meaningless text, to create a sentence that has letters but is difficult and illegible to read."
}
}
[Field]
| Name | Type | Description |
|---|---|---|
| llmResponse | String | LLM analysis answer |