# AI Document Data Extraction API

Starting from 500 atoms

## About

This Utility API focuses on AI-based data extraction from documents, identifying essential information within documents of textual content.

This API is invaluable for data entry automation, document summarization, and content categorization, providing a streamlined solution for extracting relevant information from various documents accurately and quickly.

The atoms cost is subjected to change depending on the size of the input file and the provider selected. The list of providers and the atoms cost for each provider is given below:

| Provider (requested_service) | Atoms |
| --- | --- |
| Azure | 500 |
| ApyHub | 2000 |

_**Note**: In order to test the API on API Playground, just click on "Show optional inputs" and enter the Authentication token for the provider before clicking on Send request. The output response structure and the result of the AI utility APIs depend on the service provider and it may vary depending on which service provider is selected._

## API Documentation

**Method:** `POST`

**Content Type:** `multipart/form-data`

**Request Body**

| Attribute            | Type   | Mandatory | Description                                                   |
|---------------------|--------|-----------|---------------------------------------------------------------|
| file                | file   | Yes       | Provide the source document file.                             |
| requested_service    | String | Yes       | Provide the name of service provider. Supported providers are `azure`, `apyhub`. Defaults to `apyhub`. |
| azure_key          | String | Yes (if `azure` is selected in requested_service) | Input service key provided by azure.                         |
| azure_endpoint      | String | Yes (if `azure` is selected in requested_service) | Enter the endpoint provided by azure.                        |

**Size And Limits**

| requested_service | Support matrix and limitations                                                                                   |
|------------------|-----------------------------------------------------------------------------------------------------------------|
| Apyhub           | \* Supported formats (`jpeg`, `jpg`, `png`, `tiff`, `heif`, `bmp`, `pdf`, `html`). <br> \* Max document size 500 MB. <br> \* Max number of pages (Analysis) 2000. |
| Azure            | \* Supported formats (`jpeg`, `jpg`, `png`, `tiff`, `heif`, `bmp`, `pdf`, `html`). <br> \* Max document size 500 MB. <br> \* Max number of pages (Analysis) 2000. |

### HTTP Response Codes

The method may return one of the following HTTP status codes:

| Status Code | Description                                                   |
|-------------|---------------------------------------------------------------|
| 200         | The request was successful.                                   |
| 400         | Invalid input - the file is corrupt or the supported inputs are not provided.                               |
| 401         | Required authentication information is either missing or not valid for the resource.                       |
| 500         | If any unexpected error occurs while processing the request. |

## Error codes

```json
{
  "error": {
    "code": 105,
    "message": "Invalid URL"
  }
}
```

##### 101 - Missing parameters
This code is returned when mandatory parameters are missing from the request.

##### 102 - Invalid JSON
This code is returned when invalid JSON is passed in the request body.

##### 103 - Invalid input
This code is returned when an invalid input is provided.

##### 104 - Invalid file
This code is returned when there is an issue with a file.

##### 105 - Invalid URL
This code is returned when there is an issue with a URL.

##### 109 - Invalid input format
This code is returned when input is not provided in the required format.

##### 110 - Server error
This code is returned when an unexpected error occurs while processing a request.
