← Back to Home

📡 API Documentation

Complete reference for POS Backend RESTful API

Authentication

Most endpoints require authentication. Include the JWT token in the Authorization header:

Authorization: Bearer <your_jwt_token>
POST /api/accounts/login/
Authenticate and receive JWT tokens. Required fields: username, password
POST /api/accounts/refresh/
Refresh your access token using a refresh token.

Inventory Management

Products

GET /api/inventory/products/ 🔒 Auth Required
List all products with filtering options. Supports pagination, search, and filtering by category, business, and more.
POST /api/inventory/products/ 🔒 Auth Required
Create a new product. Required fields include name, price, category, and business.
GET /api/inventory/products/{id}/ 🔒 Auth Required
Retrieve details of a specific product.
PUT /api/inventory/products/{id}/ 🔒 Auth Required
Update an existing product.
DELETE /api/inventory/products/{id}/ 🔒 Auth Required
Delete a product.

Warehouses & Storefronts

GET /api/inventory/warehouses/ 🔒 Auth Required
List all warehouses for the current business.
GET /api/inventory/storefronts/ 🔒 Auth Required
List all storefronts for the current business.
GET /api/inventory/employee/workspace/ 🔒 Auth Required
Get the current employee's assigned workspace (warehouse or storefront).

Stock Management

GET /api/inventory/stock/ 🔒 Auth Required
List stock levels across all locations. Supports filtering by product, location, and business.
POST /api/inventory/transfers/ 🔒 Auth Required
Create a stock transfer request between locations.
GET /api/inventory/transfers/ 🔒 Auth Required
List all transfer requests with filtering options.

Sales Management

GET /api/sales/sales/ 🔒 Auth Required
List all sales transactions with filtering by date, location, payment type, and more.
POST /api/sales/sales/ 🔒 Auth Required
Create a new sale transaction with line items.
GET /api/sales/sales/{id}/ 🔒 Auth Required
Retrieve details of a specific sale including all line items.
GET /api/sales/cart/ 🔒 Auth Required
Get the current user's shopping cart.
POST /api/sales/cart/add/ 🔒 Auth Required
Add an item to the cart. Required fields: product_id, quantity

Reports & Analytics

GET /api/reports/sales-summary/ 🔒 Auth Required
Get sales summary with filters for date range, location, and grouping options.
GET /api/reports/inventory-summary/ 🔒 Auth Required
Get inventory summary showing stock levels, valuation, and turnover.
GET /api/reports/reconciliation/ 🔒 Auth Required
Get reconciliation reports for cash and inventory.

Business Settings

GET /api/settings/business-settings/ 🔒 Auth Required
Get current business settings and configurations.
PATCH /api/settings/business-settings/ 🔒 Auth Required
Update business settings (partial update supported).

Common Query Parameters

Parameter Type Description
page integer Page number for pagination
page_size integer Number of items per page (default: 20)
search string Search query (searches multiple fields)
ordering string Field to order by (prefix with - for descending)
business UUID Filter by business ID
start_date date Start date for date range filters (YYYY-MM-DD)
end_date date End date for date range filters (YYYY-MM-DD)

Response Format

All API responses are in JSON format. List endpoints return paginated results with the following structure:
{ "count": 150, "next": "http://api.example.com/endpoint/?page=2", "previous": null, "results": [...] }

Error Responses

Status Code Description
400 Bad Request - Invalid input data
401 Unauthorized - Authentication required or token invalid
403 Forbidden - Insufficient permissions
404 Not Found - Resource doesn't exist
500 Internal Server Error - Server-side error