How to use
Access keys
To use the API, you need to authenticate using Access Keys. Follow these steps to get your Access Keys:
- Visit your Access Keys page to retrieve the Access keys you'll use in your requests.
- Enter your username (registered email) and password to log in to the system.
Authentication
Important: Your Access key is a secret. Do not share it with others or expose it in any client-side code (browsers, apps). Production requests should be routed through your backend server, where your Access key can be securely loaded from an environment variable or a key management service. All API requests should include your API key in an Authorization HTTP header as follows:
Authorization: Bearer DOCAI_API_KEY
Response body
Name | Type | Mandatory | Description |
---|---|---|---|
code | integer | true | Request response code. A return of 200 indicates a successful request. Refer to the "Response Code" section for more details |
message | string | false | The reason for a failed request. This field will have a value only when the code is not equal to 200 |
requestId | string | true | Request serial number |
currentTimeMillis | long | true | Request timestamp in the number of milliseconds since 1970-01-01 |
data | object or array | false | The corresponding result of the request, which may be an object or an array of objects |
Making requests
To make your first API request, you can use the following command in your terminal. Make sure to replace $DOCAI_API_KEY with your secret API key.
curl -i -X GET https://api.docai.pro/api/model/info/v2/listCreateByMeModels \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DOCAI_API_KEY"
This request queries the products you have permission to call. You should get a response back that resembles the following:
{
"code": 200,
"message": null,
"costTime": null,
"data": [
{
"modelId": "e15f9f3adf3b421ab6d91fabe4ac3d65",
"modelName": "Invoice Model",
"description": "description",
"createTime": 1692792479000,
"updateTime": 1695069965000
}
],
"requestId": "a3d513902f554e2d842321d71b9102b6",
"currentTimeMillis": 1695280438196
}