API Base Information
Quick Start Guide
1. Start the Laravel Server
php artisan serve --port=8001
2. Test API Connection
curl -X GET https://mpos.processsmaart.com/api/health
3. Authentication (Example)
curl -X POST https://mpos.processsmaart.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"identifier":"admin@processsmaart.com","password":"123456"}'
4. Make Authenticated Request
curl -X GET https://mpos.processsmaart.com/api/items \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Role-Based Access Control (RBAC)
Authentication Required
All API endpoints (except login and health check) require authentication using Laravel Sanctum Bearer tokens. Users can only access endpoints they have permission for based on their assigned role.
Admin
Full Access - 26 Permissions
- All Dashboard features
- Full CRUD on Items, Transactions, Customers
- Employee & Role Management
- Approve/Reject Cancel Requests
- View & Export Reports
- Print Barcodes
Sales Manager
Management Access - 16 Permissions
- Dashboard access
- View/Create/Edit Items & Transactions
- View/Create/Edit Customers
- View Employees (no create/delete)
- Approve/Reject Cancel Requests
- View & Export Reports
- Print Barcodes
Sales Executive
Basic POS Access - 8 Permissions
- Dashboard (own data only)
- View Items
- View/Create Transactions
- View Cancel Requests (own only)
- View/Create/Edit Customers
Test Credentials
All demo accounts use the same password: 123456
Authentication
/api/auth/login
Authenticate user and get access token
{
"email": "admin@example.com",
"password": "password"
}
/api/auth/logout
Logout and revoke access token
/api/auth/profile
Get authenticated user profile
Employee Management
/api/employees
List all employees
/api/employees
Create new employee
/api/employees/{id}
Get employee by ID
/api/employees/{id}
Update employee
/api/employees/{id}
Delete employee
Customer Management
/api/customers
List customers with filtering & pagination
?search=&type=&location=&active=&paginate=true/api/customers
Create new customer with shop details
/api/customers/{id}
Get customer by ID
/api/customers/{id}
Update customer information
/api/customers/{id}
Smart delete customer
/api/customers/mobile/{mobile}
Find customer by mobile number
/api/customers/location/{location}
Find customers by location
/api/customers-outlets
Get company outlets only
/api/customers-stats
Customer statistics & analytics
/api/customers/bulk-update
Bulk activate/deactivate customers
/api/customers/{id}/status
Update customer status
/api/customers/import
Import customers from CSV
/api/customers/export
Export customers to CSV
Item Management
/api/items
List all items
/api/items
Create new item
/api/items/{id}
Get item by ID
/api/items/{id}
Update item
/api/items/{id}
Delete item
/api/items/barcode/{barcode}
Find item by barcode
Transaction Processing
/api/transactions
List all transactions
/api/transactions
Create new transaction
/api/transactions/{id}
Get transaction by ID
/api/transactions/{id}
Update transaction
/api/transactions/{id}/cancel
Cancel transaction (requires authorization)
Note: Use cancel requests insteadCancel Request Management
/api/cancel-requests
List all cancel requests
?status=pending|approved|rejected/api/cancel-requests
Create cancel request for transaction
Body: {transaction_id, reason}/api/cancel-requests/{id}
Get cancel request details
/api/cancel-requests/{id}/approve
Approve cancel request (admin/manager only)
Body: {admin_notes?}/api/cancel-requests/{id}/reject
Reject cancel request (admin/manager only)
Body: {admin_notes}Synchronization
/api/sync/status
Get current sync status
/api/sync
Trigger data synchronization
/api/health
System health check
Enhanced Customer Features (Shop/Bakery Support)
New Customer System
The customer system has been enhanced to support bakery and shop customers with comprehensive business information, credit management, and location-based filtering.
Customer Fields
- name - Customer/Owner name
- shop_name - Shop/Business name
- mobile - Mobile number (10-15 digits)
- customer_type - company_outlet or customer
- location - Area/Location
- nearby_location - Nearby landmark
- address - Full address
- contact_person - Contact person name
- email - Email address
- gst_number - GST number (validated)
- credit_limit - Credit limit amount
- credit_balance - Outstanding credit
- notes - Additional notes
- is_active - Active status
Query Parameters
| Parameter | Description | Example |
|---|---|---|
search |
Search across multiple fields | ?search=bakery |
type |
Filter by customer type | ?type=company_outlet |
location |
Filter by location | ?location=downtown |
active |
Filter by active status | ?active=true |
paginate |
Enable pagination | ?paginate=true |
per_page |
Items per page | ?per_page=20 |
Validation Rules
- mobile: 10-15 digits, unique
- email: Valid email format, unique
- gst_number: Indian GST format
- customer_type: company_outlet or customer
- credit_limit: Numeric, min: 0
Sample Requests & Responses
Create Item Request
POST /api/items
Content-Type: application/json
Authorization: Bearer {your-token}
{
"barcode": "1234567890",
"name": "Sample Product",
"price": "29.99",
"category": "Electronics",
"stock_quantity": 100,
"description": "Sample product description"
}
Create Shop Customer Request
POST /api/customers
Content-Type: application/json
Authorization: Bearer {your-token}
{
"name": "Sweet Dreams Bakery Owner",
"shop_name": "Sweet Dreams Bakery",
"mobile": "9999000111",
"address": "123 Main Street, City",
"location": "Downtown",
"nearby_location": "Near City Mall",
"customer_type": "company_outlet",
"contact_person": "Store Manager",
"email": "contact@sweetdreams.com",
"gst_number": "29ABCDE1234F1Z5",
"credit_limit": 50000,
"notes": "Premium bakery outlet"
}
Customer Search & Filter
GET /api/customers?search=bakery&type=company_outlet&location=downtown&paginate=true&per_page=10
Authorization: Bearer {your-token}
Response includes:
- Filtered customer list
- Pagination metadata
- Total count
- Search/filter applied
Customer Statistics Response
{
"total_customers": 22,
"active_customers": 22,
"company_outlets": 2,
"regular_customers": 20,
"total_credit_outstanding": "917.00",
"locations": [
"Gandhi Nagar",
"Downtown",
"Uptown"
]
}
Bulk Update Request
POST /api/customers/bulk-update
Content-Type: application/json
Authorization: Bearer {your-token}
{
"customer_ids": [
"uuid1", "uuid2", "uuid3"
],
"action": "activate",
"customer_type": "company_outlet"
}
Enhanced Customer Response
{
"message": "Customer created successfully",
"customer": {
"id": "uuid-here",
"name": "Sweet Dreams Bakery Owner",
"shop_name": "Sweet Dreams Bakery",
"mobile": "9999000111",
"customer_type": "company_outlet",
"location": "Downtown",
"credit_limit": "50000.00",
"credit_balance": "0.00",
"is_active": true,
"created_at": "2024-01-01T00:00:00.000Z"
}
}
Error Response
{
"success": false,
"message": "Validation failed",
"errors": {
"name": ["The name field is required."],
"price": ["The price must be a number."]
}
}