📋 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
GET
/api/ai/insights
Get AI-powered business insights
GET
/api/sales-ai/dashboard
Get AI-enhanced sales dashboard data
GET
/api/ai/demand-forecast
Get demand forecasting predictions
GET
/api/ai/inventory-optimization
Get inventory optimization recommendations
👥 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
💳 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
🛠️ Utilities
GET
/api/health
Health check endpoint
GET
/api/version
Get API version information
POST
/api/upload/image
Upload image files