# OCR Invoice Job API

API for managing individual OCR invoice jobs

**Version:** 1.0.0

## Overview

### Base URLs

- **Production server**: `https://sv.api.repzo.me`

- **Staging server**: `https://staging.sv.api.repzo.me`

### API Categories

- **OCR Invoice Job**: Operations related to individual OCR invoice job management

## Authentication

This API uses the following authentication methods:

- **ApiKeyAuth**

## Endpoints

### `/ocr-invoice-job`

#### GET /ocr-invoice-job

**Summary:** Get all OCR invoice jobs

**Description:** Retrieve a list of all OCR invoice jobs with optional filtering and pagination

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `limit` | query | integer | No | Maximum number of records to return |

| `offset` | query | integer | No | Number of records to skip for pagination |

| `sort` | query | string | No | Field to sort by |

| `order` | query | string | No | Sort order (asc or desc) |

| `filter` | query | string | No | Filter conditions in JSON format |

| `search` | query | string | No | Search term for text fields |

##### Responses

**200** - List of OCR invoice jobs retrieved successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

#### POST /ocr-invoice-job

**Summary:** Create a new OCR invoice job

**Description:** Create a new OCR invoice job with the provided data

**Tags:** OCR Invoice Job

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**201** - OCR invoice job created successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

### `/ocr-invoice-job/{id}`

#### GET /ocr-invoice-job/{id}

**Summary:** Get OCR invoice job by ID

**Description:** Retrieve a specific OCR invoice job by its ID

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | OCR invoice job ID |

##### Responses

**200** - OCR invoice job retrieved successfully

Content-Type: `application/json`

**404** - OCR invoice job not found

**401** - Unauthorized

**500** - Internal server error

---

#### PUT /ocr-invoice-job/{id}

**Summary:** Update OCR invoice job

**Description:** Update an existing OCR invoice job with new data

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | OCR invoice job ID |

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**200** - OCR invoice job updated successfully

Content-Type: `application/json`

**400** - Bad request

**404** - OCR invoice job not found

**401** - Unauthorized

**500** - Internal server error

---

#### DELETE /ocr-invoice-job/{id}

**Summary:** Delete OCR invoice job

**Description:** Delete an existing OCR invoice job

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | OCR invoice job ID |

##### Responses

**200** - OCR invoice job deleted successfully

Content-Type: `application/json`

**404** - OCR invoice job not found

**401** - Unauthorized

**500** - Internal server error

---

### `/ocr-invoice-job/{id}/process`

#### POST /ocr-invoice-job/{id}/process

**Summary:** Process OCR invoice job

**Description:** Start processing an OCR invoice job

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | OCR invoice job ID |

##### Responses

**200** - OCR invoice job processing started

Content-Type: `application/json`

**404** - OCR invoice job not found

**401** - Unauthorized

**500** - Internal server error

---

### `/ocr-invoice-job/{id}/results`

#### GET /ocr-invoice-job/{id}/results

**Summary:** Get OCR results

**Description:** Retrieve the OCR processing results for a job

**Tags:** OCR Invoice Job

##### Parameters

| Name | Location | Type | Required | Description |
| ---- | -------- | ---- | -------- | ----------- |

| `id` | path | string | Yes | OCR invoice job ID |

##### Responses

**200** - OCR results retrieved successfully

Content-Type: `application/json`

**404** - OCR invoice job not found

**401** - Unauthorized

**500** - Internal server error

---

## Data Models

### OcrInvoiceJob

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `_id` | string | No | Unique identifier for the OCR invoice job |

| `jobNumber` | string | Yes | Unique job number |

| `documentName` | string | Yes | Name of the document being processed |

| `documentUrl` | string | Yes | URL of the document to process |

| `documentType` | string | No | Type of document |

| `template` | string | Yes | OCR template ID to use |

| `group` | string | No | OCR job group ID if part of a batch |

| `status` | string | No | Processing status |

| `priority` | string | No | Processing priority |

| `progress` | object | No | No description |

| `startedAt` | string | No | When processing started |

| `completedAt` | string | No | When processing completed |

| `processingTime` | number | No | Processing time in seconds |

| `documentInfo` | object | No | No description |

| `extractedData` | object | No | No description |

| `confidence` | object | No | No description |

| `validationResults` | object | No | No description |

| `cost` | number | No | Processing cost |

| `currency` | string | No | Currency code |

| `errorLog` | string | No | Error log if processing failed |

| `retryCount` | integer | No | Number of retry attempts |

| `createdBy` | string | No | User who created the job |

| `metadata` | object | No | Additional metadata |

| `createdAt` | string | No | Record creation timestamp |

| `updatedAt` | string | No | Record last update timestamp |

### OcrInvoiceJobInput

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `jobNumber` | string | Yes | Unique job number |

| `documentName` | string | Yes | Name of the document being processed |

| `documentUrl` | string | Yes | URL of the document to process |

| `documentType` | string | No | Type of document |

| `template` | string | Yes | OCR template ID to use |

| `group` | string | No | OCR job group ID if part of a batch |

| `priority` | string | No | Processing priority |

| `createdBy` | string | No | User who created the job |

| `metadata` | object | No | Additional metadata |

### OcrResults

| Property | Type | Required | Description |
| -------- | ---- | -------- | ----------- |

| `extractedData` | object | No | All extracted data from the document |

| `confidence` | object | No | Confidence scores for extracted data |

| `validationResults` | object | No | Validation results |

| `processingTime` | number | No | Total processing time |

## TypeScript Usage

See [ocr-invoice-job-examples.md](./ocr-invoice-job-examples.md) for detailed TypeScript usage examples.
