layout-document-async
Endpoint
Extract Beta REST API exposes:
- A resource to start an asynchronous recognition task.
- A resource for each running recognition task by which you can determine the status of the task or, if the task is finished, obtain task results.
The entire API is formally described in the OpenAPI specification.
The resource to start a layout recognition task has this endpoint:
https://extract.expert.ai/beta/layout-document-async
It must be requested with the POST
verb.
Request
The request contains the document to analyze.
The request body must be a JSON object with this format:
{
"document": {
"name" : "file name",
"data": "Base64 encoding of file bytes"
}
}
The object must be UTF-8 encoded and the Content-Type
header of the request must be set to:
application/json; charset=utf-8
The Authorization
header must be set as described in the developer's how-to.
The maximun size of the request is 14MB and the maximum number of pages contained in the PDF document is 500.
Response
The response is a JSON object containing the new detection task ID. The format of the response object is:
{
"taskId": "task ID"
}
where task ID
is the identification code of the task. This value is needed to request the resource that returns the status of the task.
HTTP status codes
Here are the possible HTTP status code that Extract Beta can return when requiring the layout-document-async
resource:
202 Accepted
The request has been accepted and processed. The response contains the JSON object described above.
400 Bad Request
The server cannot process the request due to something that is perceived to be a client error, for example malformed request syntax.
It can happen when the JSON object posted with the request is invalid.
401 Unauthorized
The reasons for this state can be:
- invalid credentials were specified when requesting the authorization token
- the authorization token is missing
- the authorization token is not valid
- the authorization token has expired
403 Forbidden
This code is returned if the user does not have an active subscription.
404 Not Found
The server cannot find the requested resource, the URL is wrong.
405 Method not Allowed
The request method is known by the server but is not supported by the target resource. For example, you requested the resource with GET
instead of POST
.
413 Request Entity Too Large
The request is larger than the maximum allowed (see above).
500 Internal Server Error
The server has encountered a situation it doesn't know how to handle.