DocumentAI API
Variants to scan documents
One step document scanning (Answer direct in upload response)
- Post document to
/api/uploadWait
- Wait for response
- Get result
- Jump back to step 1 for each document to scan
Two step document scanning (Ask for yourself for a result)
- Post document to
/api/upload save {uuid}
- Check
/api/results/{uuid} to get result
- Repeat step 2 until result is received
- Repeat step 1 for each document to scan
Upload a document
POST /api/upload (Upload a document)
Headers
| name |
type |
description |
| token |
string |
API access token |
Body
| name |
type |
content-type |
description |
| file |
form-data |
image/jpg, image/png, application/pdf |
document as jpg, png or pdf(only first page will be processed) |
| description |
form-data |
application/text (as string) |
(optional) description to the data e.g. employee number by the person who shoot the image |
Responses
| http code |
content-type |
response |
201 |
application/json |
{"id": <uuid>, "resultUrl": <url to results>}, "description": <url to description>} |
400 |
application/text |
There is something wrong with the image parameter |
403 |
application/json |
{"timestamp": "2022-08-01T11:26:28.096+00:00", "status": 403, "error": "Forbidden", "message": "Access Denied", "path": "/api/upload"} |
415 |
text/html;charset=utf-8 |
None |
Example cURL
curl -k -X POST -H "Content-Type: multipart/form-data" -H "token: {token}" -F "file=@image.jpg" https://api.detection-x.de/api/upload
POST /api/uploadWait (Upload an document to the API and immediately return links to the results)
Headers
| name |
type |
description |
| token |
string |
API access token |
Body
| name |
type |
content-type |
description |
| file |
form-data |
image/jpg, image/png, application/pdf |
document as jpg, png or pdf(only first page will be processed) |
| description |
form-data |
application/text (as string) |
(optional) description to the data e.g. employee number by the person who shoot the image |
Responses
| http code |
content-type |
response |
201 |
application/json |
{"id": <uuid>, "resultUrl": <url to results>, "description": <url to description>} |
400 |
application/text |
There is something wrong with the image parameter |
403 |
application/json |
{"timestamp": "2022-08-01T11:26:28.096+00:00", "status": 403, "error": "Forbidden", "message": "Access Denied", "path": "/api/upload"} |
415 |
text/html;charset=utf-8 |
None |
Example cURL
curl -k -X POST -H "Content-Type: multipart/form-data" -H "token: {token}" -F "file=@image.jpg" https://api.detection-x.de/api/uploadWait
Get image, label or predicted label
GET /api/images (Get the latest document uuids from the API)
Headers
| name |
type |
description |
| token |
string |
API access token |
Path parameters
| name |
type |
default |
description |
| count |
int |
10 |
Number of tire UUIDs |
Body
| name |
type |
content-type |
description |
| None |
None |
None |
None |
Responses
| http code |
content-type |
response |
200 |
application/json |
json string with the latest image uuids and timestamps |
401 |
application/json |
{"timestamp": <timestamp>,"status": 401,"error": "unauthorized","message": <error_hint>,"path": "/api/images"} |
404 |
None |
None |
Example cURL
curl -i -k -X GET -H "token: {token}" https://api.detection-x.de/api/images?count={number}
GET /api/images/{uuid} (Get the image of the document from the API)
Headers
| name |
type |
description |
| token |
string |
API access token |
Body
| name |
type |
content-type |
description |
| None |
None |
None |
None |
Responses
| http code |
content-type |
response |
200 |
application/jpg |
Image data |
401 |
None |
None |
404 |
None |
None |
Example cURL
curl -i -k -X GET -H "token: {token}" https://api.detection-x.de/api/images/{uuid}
GET /api/results/{uuid} (Get the result from the API)
Headers
| name |
type |
description |
| token |
string |
API access token |
Body
| name |
type |
content-type |
description |
| None |
None |
None |
None |
Responses
| http code |
content-type |
response |
200 |
application/json |
json string |
204 |
None |
None |
403 |
application/json |
{"timestamp": "2022-08-01T11:26:28.096+00:00", "status": 403, "error": "Forbidden", "message": "Access Denied", "path": "/api/results"} |
Example cURL
curl -i -k -X GET -H "token: {token}" https://api.detection-x.de/api/results/{uuid}
GET /api/description/{uuid} (Get the description of an document)
Headers
| name |
type |
description |
| token |
string |
API access token |
Body
| name |
type |
content-type |
description |
| None |
None |
None |
None |
Responses
| http code |
content-type |
response |
200 |
application/text |
description text |
204 |
None |
None |
403 |
application/json |
{"timestamp": "2022-08-01T11:26:28.096+00:00", "status": 403, "error": "Forbidden", "message": "Access Denied", "path": "/api/allresults"} |
Example cURL
curl -i -k -X GET -H "token: {token}" https://api.detection-x.de/api/description/{uuid}
Variables
| name |
description |
| uuid |
image uuid |
| token |
API access token |
This API is under continuous development, any advisement's and ideas are welcome. Contact at lukas.berner@detection-x.de