# Nanonets Integration via LowCodeAPI

## Overview

Document processing and OCR platform for extracting data from documents and images

## Base Endpoint

```
https://api.lowcodeapi.com/nanonets/
```

## Authentication

LowCodeAPI handles authentication automatically. You only need to:

1. **Sign up** at [Nanonets](https://nanonets.com/)
2. **Get your credentials** from [credential page](https://app.nanonets.com/#/keys)
3. **Connect your account** in LowCodeAPI dashboard
4. **Use your `api_token`** in all requests

**Auth Type**: TOKEN

## API Categories

- **Get Full Text** - 1 endpoints
- **Image Classification Model** - 3 endpoints
- **Image Classification Model Predict** - 2 endpoints
- **Image Classification Model Train** - 1 endpoints
- **Image Classification Model Upload** - 2 endpoints
- **OCR Model** - 2 endpoints
- **OCR Predict** - 5 endpoints
- **OCR Train** - 1 endpoints
- **OCR Upload** - 2 endpoints

## Common Endpoints

### Category: Get Full Text

#### Get Full Text

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/ocr/fulltext`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/fulltext?file={file}&urls={urls}&api_token={api_token}
```

**Description**: Get Full Text

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`file` | file | Yes | Comma separated page numbers which needs to be processed from the list of Files uploaded. ex: '1,2' |
|`urls` | string | No | language hints eg: en, vi (not specifying generally gives best results) |

---

### Category: Image Classification Model

#### Get Model by Id

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/imagecategorization/model`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/model?id={id}&api_token={api_token}
```

**Description**: Get Model by Id

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`id` | string | Yes | ID |

---

#### Create New Model

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/model`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/model?api_token={api_token}
```

**Description**: Create New Model

**Request Body**:
```json
{
  "categories": "<string>"
}
```

---

#### Get All Models

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/imagecategorization/models`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/models?api_token={api_token}
```

**Description**: Get All Models

---

### Category: Image Classification Model Predict

#### Prediction for image URLs

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/labelurls`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/labelurls?api_token={api_token}
```

**Description**: Prediction for image URLs

**Request Body**:
```json
{
  "url": "<string>",
  "modelId": "<string>"
}
```

---

#### Prediction for image File

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/labelfile`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/labelfile?api_token={api_token}
```

**Description**: Prediction for image File

**Request Body**:
```json
{
  "file": "<file>",
  "modelId": "<string>"
}
```

---

### Category: Image Classification Model Train

#### Train Model

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/train`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/train?api_token={api_token}
```

**Description**: Train Model

**Request Body**:
```json
{
  "modelId": "<string>"
}
```

---

### Category: Image Classification Model Upload

#### Upload training images by File

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/uploadfile`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/uploadfile?api_token={api_token}
```

**Description**: Upload training images by File

**Request Body**:
```json
{
  "file": "<file>",
  "modelId": "<string>",
  "categories": "<string>"
}
```

---

#### Upload training images by Url

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/imagecategorization/uploadurls`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/imagecategorization/uploadurls?api_token={api_token}
```

**Description**: Upload training images by Url

**Request Body**:
```json
{
  "url": "<string>",
  "modelId": "<string>",
  "categories": "<string>"
}
```

---

### Category: OCR Model

#### Create New Model

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model?api_token={api_token}
```

**Description**: Create New Model

**Request Body**:
```json
{
  "categories": "<array>"
}
```

---

#### Get Model by Id

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id?model_id={model_id}&api_token={api_token}
```

**Description**: Get Model by Id

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

---

### Category: OCR Predict

#### Async Prediction for image url

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id/labelurls`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id/labelurls?model_id={model_id}&api_token={api_token}
```

**Description**: Async Prediction for image url

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`async` | boolean | Yes | This parameter specifies whether you'd like to upload the file for processing and then query the results with a unique id at a later point in time |
|`model_id` | string | Yes | Model ID |

**Request Body**:
```json
{
  "urls": "<string>"
}
```

---

#### Get Prediction File By Page ID

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/inferences/model/model_id/imagelevelinferences/id`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/inferences/model/model_id/imagelevelinferences/id?model_id={model_id}&id={id}&api_token={api_token}
```

**Description**: Get Prediction File By Page ID

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`id` | string | Yes | The ID of the page that was received from the async prediction endpoin |
|`model_id` | string | Yes | Model ID |

---

#### Get Prediction File By File ID

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/inferences/model/model_id/inferencerequestfiles/getpredictions/request_file_id`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/inferences/model/model_id/inferencerequestfiles/getpredictions/request_file_id?model_id={model_id}&request_file_id={request_file_id}&api_token={api_token}
```

**Description**: Get Prediction File By File ID

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`request_file_id` | string | Yes | The ID of the file that was received from the async prediction endpoint |
|`start_day_interval` | string | Yes | The number of days since 1st Jan 1970 GMT which represents the start of the period |

---

#### Async Prediction for image file

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id/labelfile`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id/labelfile?model_id={model_id}&async={async}&api_token={api_token}
```

**Description**: Async Prediction for image file

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`async` | boolean | Yes | This parameter specifies whether you'd like to upload the file for processing and then query the results with a unique id at a later point in time |

**Request Body**:
```json
{
  "file": "<file>",
  "base64_data": "<string>",
  "request_metadata": "<string>"
}
```

---

#### Get All Prediction Files

**Method**: `GET` | **LowCodeAPI Path**: `/api/v2/inferences/model/model_id/imagelevelinferences`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/inferences/model/model_id/imagelevelinferences?model_id={model_id}&current_batch_day={current_batch_day}&start_day_interval={start_day_interval}&api_token={api_token}
```

**Description**: Get All Prediction Files

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`current_batch_day` | number | Yes | The number of days since 1st Jan 1970 GMT which represents the end of the period |
|`start_day_interval` | number | Yes | The number of days since 1st Jan 1970 GMT which represents the start of the period |

---

### Category: OCR Train

#### Train Model

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id/train`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id/train?model_id={model_id}&api_token={api_token}
```

**Description**: Train Model

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

---

### Category: OCR Upload

#### Upload Training Images by Urls

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id/uploadurls`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id/uploadurls?model_id={model_id}&api_token={api_token}
```

**Description**: Upload Training Images by Urls

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

**Request Body**:
```json
{
  "data": "<array>",
  "urls": "<array>"
}
```

---

#### Upload Training Images by File

**Method**: `POST` | **LowCodeAPI Path**: `/api/v2/ocr/model/model_id/uploadfile`

**Full URL**:
```
https://api.lowcodeapi.com/nanonets/api/v2/ocr/model/model_id/uploadfile?model_id={model_id}&api_token={api_token}
```

**Description**: Upload Training Images by File

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`model_id` | string | Yes | Model ID |

**Request Body**:
```json
{
  "data": "<string>",
  "file": "<file>"
}
```

---

## Complete Endpoint Reference

For a complete list of all 19 endpoints, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/nanonets/definition`
- **Official Provider Documentation**: https://nanonets.com/documentation