# Asset Part Unit API

API for managing asset part units (individual instances of parts)

**Version:** 1.0.0

## Overview

### Base URLs

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

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

### API Categories

- **Asset Part Unit**: Operations related to asset part unit management

## Authentication

This API uses the following authentication methods:

- **ApiKeyAuth**

## Endpoints

### `/asset-part-unit`

#### GET /asset-part-unit

**Summary:** Get all asset part units

**Description:** Retrieve a list of all asset part units with optional filtering and pagination

**Tags:** Asset Part Unit

##### 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 asset part units retrieved successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

#### POST /asset-part-unit

**Summary:** Create a new asset part unit

**Description:** Create a new asset part unit with the provided data

**Tags:** Asset Part Unit

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**201** - Asset part unit created successfully

Content-Type: `application/json`

**400** - Bad request

**401** - Unauthorized

**500** - Internal server error

---

### `/asset-part-unit/{id}`

#### GET /asset-part-unit/{id}

**Summary:** Get asset part unit by ID

**Description:** Retrieve a specific asset part unit by its ID

**Tags:** Asset Part Unit

##### Parameters

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

| `id` | path | string | Yes | Asset part unit ID |

##### Responses

**200** - Asset part unit retrieved successfully

Content-Type: `application/json`

**404** - Asset part unit not found

**401** - Unauthorized

**500** - Internal server error

---

#### PUT /asset-part-unit/{id}

**Summary:** Update asset part unit

**Description:** Update an existing asset part unit with new data

**Tags:** Asset Part Unit

##### Parameters

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

| `id` | path | string | Yes | Asset part unit ID |

##### Request Body

**Content Types:**

- `application/json`

##### Responses

**200** - Asset part unit updated successfully

Content-Type: `application/json`

**400** - Bad request

**404** - Asset part unit not found

**401** - Unauthorized

**500** - Internal server error

---

#### DELETE /asset-part-unit/{id}

**Summary:** Delete asset part unit

**Description:** Delete an existing asset part unit

**Tags:** Asset Part Unit

##### Parameters

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

| `id` | path | string | Yes | Asset part unit ID |

##### Responses

**200** - Asset part unit deleted successfully

Content-Type: `application/json`

**404** - Asset part unit not found

**401** - Unauthorized

**500** - Internal server error

---

## Data Models

### AssetPartUnit

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

| `_id` | string | No | Unique identifier for the asset part unit |

| `serialNumber` | string | Yes | Serial number of the part unit |

| `assetPart` | string | Yes | Asset part ID this unit belongs to |

| `batchNumber` | string | No | Batch number |

| `lotNumber` | string | No | Lot number |

| `manufactureDate` | string | No | Manufacturing date |

| `expiryDate` | string | No | Expiry date (if applicable) |

| `receiptDate` | string | No | Date when the unit was received |

| `status` | string | Yes | Current status of the part unit |

| `condition` | string | No | Physical condition of the part unit |

| `location` | object | No | No description |

| `assignedTo` | object | No | No description |

| `installationDate` | string | No | Date when the unit was installed |

| `lastMaintenanceDate` | string | No | Last maintenance date |

| `nextMaintenanceDate` | string | No | Next scheduled maintenance date |

| `warrantyExpiry` | string | No | Warranty expiry date |

| `cost` | number | No | Cost of this specific unit |

| `supplier` | string | No | Supplier ID |

| `purchaseOrder` | string | No | Purchase order reference |

| `invoice` | string | No | Invoice reference |

| `notes` | string | No | Additional notes |

| `maintenanceHistory` | array | No | No description |

| `customFields` | object | No | Custom fields |

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

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

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

### AssetPartUnitInput

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

| `serialNumber` | string | Yes | Serial number of the part unit |

| `assetPart` | string | Yes | Asset part ID this unit belongs to |

| `batchNumber` | string | No | Batch number |

| `lotNumber` | string | No | Lot number |

| `manufactureDate` | string | No | Manufacturing date |

| `expiryDate` | string | No | Expiry date (if applicable) |

| `receiptDate` | string | No | Date when the unit was received |

| `status` | string | Yes | Current status of the part unit |

| `condition` | string | No | Physical condition of the part unit |

| `location` | object | No | No description |

| `assignedTo` | object | No | No description |

| `installationDate` | string | No | Date when the unit was installed |

| `lastMaintenanceDate` | string | No | Last maintenance date |

| `nextMaintenanceDate` | string | No | Next scheduled maintenance date |

| `warrantyExpiry` | string | No | Warranty expiry date |

| `cost` | number | No | Cost of this specific unit |

| `supplier` | string | No | Supplier ID |

| `purchaseOrder` | string | No | Purchase order reference |

| `invoice` | string | No | Invoice reference |

| `notes` | string | No | Additional notes |

| `customFields` | object | No | Custom fields |

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

## TypeScript Usage

See [asset-part-unit-examples.md](./asset-part-unit-examples.md) for detailed TypeScript usage examples.
