📋 Table of Contents
🔐 Authentication
POST
/api/auth/register
Register a new user account
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| firstName | string | Required | User's first name |
| lastName | string | Required | User's last name |
| string | Required | Valid email address | |
| password | string | Required | Minimum 8 characters with numbers, uppercase, lowercase, and special characters |
| organizationName | string | Required | Name of the organization |
{ "firstName": "John", "lastName": "Doe", "email":
"john.doe@example.com", "password": "SecurePass123!",
"confirmPassword": "SecurePass123!", "organizationName": "My
Business" }
POST
/api/auth/login
Authenticate user and get access token
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Required | User's email address | |
| password | string | Required | User's password |
{ "email": "john.doe@example.com", "password": "SecurePass123!"
}
Response
{ "status": "success", "message": "Login successful", "data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": {
"id": "507f1f77bcf86cd799439011", "firstName": "John",
"lastName": "Doe", "email": "john.doe@example.com",
"organization": { "id": "507f1f77bcf86cd799439012", "name": "My
Business" } } } }
🔑 Authentication Note: Include the JWT token in
the Authorization header for all protected endpoints:
Authorization: Bearer YOUR_TOKEN
📦 Products & Inventory
GET
/api/products/products
Get all products with filtering and pagination
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Page number (default: 1) |
| limit | number | Optional | Items per page (default: 10, max: 100) |
| search | string | Optional | Search by name, SKU, or barcode |
| category | string | Optional | Filter by category ID |
| sortBy | string | Optional | Sort field (name, price, stockQuantity, createdAt) |
| sortOrder | string | Optional | Sort order (asc, desc) |
Status Codes
200
Success - Products retrieved
401
Unauthorized - Invalid or missing token
POST
/api/products/products
Create a new product
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Product name |
| category | string | Required | Category ID |
| cost | number | Required | Product cost |
| price | number | Required | Product selling price |
| stockQuantity | number | Optional | Initial stock quantity |
| description | string | Optional | Product description |
| barcode | string | Optional | Product barcode |
{ "name": "Premium Widget", "category":
"507f1f77bcf86cd799439013", "cost": 15.50, "price": 29.99,
"stockQuantity": 100, "description": "High-quality premium
widget", "barcode": "1234567890123" }
GET
/api/products/low-stock
Get products with low stock levels
GET
/api/products/inventory-value
Get total inventory value
💰 Sales Management
GET
/api/sales
Get all sales with filtering and pagination
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Page number (default: 1) |
| limit | number | Optional | Items per page (default: 10) |
| startDate | string | Optional | Filter sales from this date (YYYY-MM-DD) |
| endDate | string | Optional | Filter sales until this date (YYYY-MM-DD) |
| clientId | string | Optional | Filter by client ID |
POST
/api/sales
Create a new sale
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| items | array | Required | Array of sale items |
| clientId | string | Optional | Client ID |
| paymentMethod | string | Optional | Payment method (cash, card, transfer) |
| discountAmount | number | Optional | Discount amount |
{ "items": [ { "productId": "507f1f77bcf86cd799439014",
"quantity": 2, "price": 29.99 } ], "clientId":
"507f1f77bcf86cd799439015", "paymentMethod": "card",
"discountAmount": 5.00 }
🤖 AI & Analytics
POST
/api/sales-ai/sales/:saleId/insight
Generate AI insight for a sale
POST
/api/sales-ai/clients/:clientId/insight
Generate AI insight for a client
POST
/api/sales-ai/dashboard/insight
Generate AI insight for dashboard
GET
/api/sales-ai/insights
Get all AI insights
GET
/api/sales-ai/insights/:entityType/:entityId
Get AI insights for entity (sales, client, dashboard)
DELETE
/api/sales-ai/insights/:insightId
Delete an AI insight
GET
/api/sales-ai/summary
Get AI insights summary
👥 User Management
GET
/api/users
Get all users in the organization
POST
/api/users
Create a new user
GET
/api/roles
Get all available roles
GET
/api/permissions
Get all available permissions
🏢 Organizations
GET
/api/organization
Get organization details
PUT
/api/organization
Update organization details
GET
/api/departments
Get all departments
GET
/api/branches
Get all branches
POST
/api/branches
Create a branch
GET
/api/branches/hierarchy
Get branches hierarchy
GET
/api/branches/:id
Get branch by ID
PUT
/api/branches/:id
Update branch by ID
DELETE
/api/branches/:id
Delete branch by ID
GET
/api/positions
Get all positions
POST
/api/positions
Create a position
GET
/api/positions/hierarchy
Get organizational hierarchy
GET
/api/positions/:id
Get position by ID
PUT
/api/positions/:id
Update position by ID
DELETE
/api/positions/:id
Delete position by ID
💳 Subscriptions
GET
/api/subscriptions/plans/public
Get all available subscription plans (public)
GET
/api/subscriptions/current
Get current subscription details
🖨️ Printing Services
GET
/api/printer/receipt-data/:saleId
Get receipt data for printing
GET
/api/labels/generate/:productId
Generate product labels
📊 Reports & Analytics
GET
/api/dashboard/overview
Get dashboard overview data
GET
/api/analytics/sales
Get sales analytics
GET
/api/reports/inventory
Generate inventory report
GET
/api/audit-logs
Get audit logs
POST
/api/audit-logs
Create an audit log
GET
/api/audit-logs/entity/:entityType/:entityId
Get logs for an entity
GET
/api/audit-logs/user/:userId
Get logs for a user
GET
/api/audit-logs/stats
Get audit log statistics
GET
/api/audit-logs/recent
Get recent audit logs
🛠️ Utilities
GET
/api/health
Health check endpoint
GET
/api/version
Get API version information
GET
/api/version/check
Check for updates
GET
/api/version/api-version
Get API version string
GET
/api/version/
List versions (auth)
POST
/api/version/
Create version (auth)
PUT
/api/version/:id
Update version (auth)
DELETE
/api/version/:id
Delete version (auth)
POST
/api/version/webhook/render-deploy
Render deploy webhook
POST
/api/upload/image
Upload image files
POST
/api/demo-request
Submit a demo request