Skip to main content

Welcome to POS Kasir API

The POS Kasir API is a comprehensive RESTful API for managing point-of-sale operations. This API provides endpoints for managing products, orders, payments, users, inventory, and more.

Base URL

All API requests should be made to:
https://api-pos.agprastyo.me/api/v1
All endpoints in this documentation are relative to the base URL above.

API Documentation

You can explore the complete API specification using Swagger UI:

Interactive API Documentation

View and test all API endpoints in the interactive Swagger interface

API Features

The POS Kasir API provides the following capabilities:

Core Operations

  • Authentication & Authorization - JWT-based authentication with role-based access control
  • Product Management - CRUD operations for products, categories, and product options
  • Order Management - Create, update, and track orders with various statuses
  • Payment Processing - Support for manual payments and Midtrans integration (QRIS/GoPay)
  • Inventory Control - Stock tracking with history and change management

Business Features

  • Promotions - Flexible promotion system with rules and targets
  • Reports & Analytics - Sales reports, profit analysis, and performance metrics
  • Shift Management - Cash drawer management with shift-based tracking
  • Activity Logs - Comprehensive audit trail for all system activities
  • User Management - Multi-role user system (admin, manager, cashier)

Request Format

All API requests should include:
  • Content-Type: application/json for POST/PUT requests
  • Authorization: Bearer token in the header (for authenticated endpoints)
{
  "Content-Type": "application/json",
  "Authorization": "Bearer YOUR_ACCESS_TOKEN"
}

Response Format

All API responses follow a consistent structure:

Success Response

{
  "message": "Success message",
  "data": {
    // Response data object or array
  }
}

Error Response

{
  "message": "Error message",
  "error": {
    // Error details (optional)
  },
  "data": null
}

Pagination

Endpoints that return lists support pagination with the following parameters:
  • page - Page number (default: 1)
  • limit - Items per page (default: 10)
  • offset - Skip items (alternative to page)
Paginated responses include:
{
  "data": {
    "items": [...],
    "pagination": {
      "current_page": 1,
      "per_page": 10,
      "total_data": 100,
      "total_page": 10
    }
  }
}

Rate Limiting

The API currently does not enforce rate limits, but this may change in production environments. We recommend implementing client-side throttling for optimal performance.

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid request parameters
401Unauthorized - Authentication required or failed
403Forbidden - Insufficient permissions
404Not Found - Resource does not exist
409Conflict - Resource conflict (e.g., duplicate)
500Internal Server Error - Server-side error

API Versioning

The current API version is v1, indicated in the base URL path /api/v1. Future versions will maintain backward compatibility or provide migration guides.

Getting Started

To start using the API:
  1. Authenticate - Obtain an access token via the /auth/login endpoint
  2. Include Token - Add the token to the Authorization header in subsequent requests
  3. Make Requests - Call the desired endpoints with proper roles and permissions

Authentication Guide

Learn how to authenticate and manage JWT tokens

Error Handling

Understand error responses and common error codes

Next Steps

Explore the API endpoints:

Authentication

User login, registration, and session management

Products

Product catalog and inventory management

Orders

Order creation and management

Reports

Sales analytics and business insights

Build docs developers (and LLMs) love