Developer API Documentation

REST API reference for integration & development

Getting Started

Welcome to the Accounting System REST API. This guide will help you integrate with our platform quickly.

Base URL

All API requests are made to the following base URL. The {tenant} parameter is required for all authenticated endpoints.

https://your-domain.com/api/{tenant}/

Multi-Tenancy

This API uses path-based multitenancy. Every request must include the tenant identifier in the URL path.

Important

You must detect the tenant first using POST /api/detect-tenant before making authenticated requests.

# Examples:
GET /api/acme-corp/invoices
GET /api/acme-corp/products/42
POST /api/acme-corp/customers

Request Format

Headers

Content-Type: application/json
Accept: application/json
Authorization: Bearer {token}

Query Parameters

pagePage number (default: 1)
per_pageItems per page (default: 15)
searchSearch query string

Response Format

Single Resource (200)

{
  "id": 1,
  "name": "Example Resource",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Collection (Paginated)

{
  "data": [ ... ],
  "links": {
    "first": "...?page=1",
    "last": "...?page=5",
    "prev": null,
    "next": "...?page=2"
  },
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 75
  }
}

Error Handling

Validation Error (422)

{
  "message": "The given data was invalid.",
  "errors": {
    "name": ["The name field is required."],
    "email": ["The email must be valid."]
  }
}

Unauthorized (401)

{
  "message": "Unauthenticated."
}

HTTP Status Codes

Code Meaning
200Success
201Created
204No Content (successful delete)
401Unauthenticated — invalid or missing token
403Forbidden — insufficient permissions
404Resource not found
422Validation error
500Server error

Rate Limiting & Pagination

  • Collection endpoints are paginated by default (15 items per page).
  • Maximum 200 items per page for customer/supplier listings.
  • Use ?page=N&per_page=N to control pagination.
  • Use ?search=query for full-text search on supported endpoints.

Authentication

The API uses Laravel Sanctum for token-based authentication. All authenticated endpoints require a Bearer token in the Authorization header.

Authentication Flow

1

Detect Tenant

Send user's email to discover which tenant they belong to.

POST /api/detect-tenant
2

Login

Authenticate with email & password to receive a Bearer token.

POST /api/login
3

Make Requests

Use the token in all subsequent API requests.

Authorization: Bearer {token}

Detect Tenant

POST /api/detect-tenant Public

Detects the tenant associated with a given email address. Call this before login to determine the correct tenant path.

Request

POST /api/detect-tenant
Content-Type: application/json

{
  "email": "user@company.com"
}

Response (200)

{
  "tenant_id": 1,
  "domain": "acme-corp"
}

Login

POST /api/login Public

Authenticates a user and returns a Sanctum bearer token for subsequent API calls.

Request

POST /api/login
Content-Type: application/json

{
  "email": "user@company.com",
  "password": "your-password"
}

Response (200)

{
  "user": {
    "id": 1,
    "name": "John Doe",
    "email": "user@company.com"
  },
  "token": "1|abc123xyz..."
}

Store the returned token securely. Include it in the Authorization header for all authenticated requests: Bearer 1|abc123xyz...

Forgot Password

POST /api/forgot-password Public
POST /api/forgot-password
Content-Type: application/json

{
  "email": "user@company.com"
}

// Response (200):
{
  "message": "Password reset link sent."
}

Get Current User

GET /api/{tenant}/user Authenticated

Returns the currently authenticated user object with permissions.

GET /api/acme-corp/user
Authorization: Bearer 1|abc123xyz...

// Response (200):
{
  "id": 1,
  "name": "John Doe",
  "email": "user@company.com",
  "created_at": "2024-01-15T10:30:00Z"
}

Get User Permissions

GET /api/{tenant}/user/permissions Authenticated

Returns a list of permission names assigned to the current user.

// Response (200):
[
  "view invoices",
  "create invoices",
  "edit invoices",
  "delete invoices",
  "view products",
  "manage users"
]

Customers API

Manage customer records. Customers are linked to accounting via their assigned account.

Endpoints

Method Endpoint Description
GET/api/{tenant}/customersList all customers (paginated)
POST/api/{tenant}/customersCreate a new customer
GET/api/{tenant}/customers/{id}Get a single customer
PUT/api/{tenant}/customers/{id}Update a customer
DELETE/api/{tenant}/customers/{id}Delete a customer

Validation Rules

Field Type Required Rules
namestringrequiredmax: 255
emailstringoptionalvalid email format
phonestringoptionalmax: 255
addressstringoptionalmax: 255
account_idintegerrequiredMust exist in accounts table
status_idintegeroptionalMust exist in statuses table
descriptionstringoptionalmax: 255

Create Customer

Request

POST /api/acme-corp/customers
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "ABC Trading Ltd",
  "email": "info@abctrading.com",
  "phone": "+254700123456",
  "address": "123 Main Street, Nairobi",
  "account_id": 15,
  "status_id": 1,
  "description": "Key wholesale customer"
}

Response (201)

{
  "id": 12,
  "name": "ABC Trading Ltd",
  "email": "info@abctrading.com",
  "phone": "+254700123456",
  "address": "123 Main Street, Nairobi",
  "account_id": 15,
  "status_id": 1,
  "description": "Key wholesale customer",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Customers

Supports search and pagination. Maximum 200 items per page.

GET /api/acme-corp/customers?search=ABC&page=1&per_page=25
Authorization: Bearer {token}

// Response (200):
{
  "data": [
    {
      "id": 12,
      "name": "ABC Trading Ltd",
      "email": "info@abctrading.com",
      "phone": "+254700123456",
      ...
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 25,
    "total": 1
  }
}

Suppliers API

Manage supplier records for purchasing. Suppliers are linked to accounts payable via their assigned account.

Endpoints

Method Endpoint Description
GET/api/{tenant}/suppliersList all suppliers (paginated)
POST/api/{tenant}/suppliersCreate a new supplier
GET/api/{tenant}/suppliers/{id}Get a single supplier
PUT/api/{tenant}/suppliers/{id}Update a supplier
DELETE/api/{tenant}/suppliers/{id}Delete a supplier

Validation Rules

Field Type Required Rules
namestringrequiredmax: 255
emailstringoptionalvalid email format
phonestringoptionalmax: 255
addressstringoptionalmax: 255
account_idintegerrequiredMust exist in accounts table
status_idintegeroptionalMust exist in statuses table
descriptionstringoptionalmax: 255

Create Supplier — Example

Request

POST /api/acme-corp/suppliers
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Global Parts Inc",
  "email": "sales@globalparts.com",
  "phone": "+254711222333",
  "address": "456 Industrial Ave",
  "account_id": 22,
  "status_id": 1,
  "description": "Primary parts supplier"
}

Response (201)

{
  "id": 8,
  "name": "Global Parts Inc",
  "email": "sales@globalparts.com",
  "phone": "+254711222333",
  "address": "456 Industrial Ave",
  "account_id": 22,
  "status_id": 1,
  "description": "Primary parts supplier",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Products API

Manage product catalog, categories, units, and barcode lookups.

Endpoints

Method Endpoint Description
GET/api/{tenant}/productsList all products (paginated)
POST/api/{tenant}/productsCreate a new product
GET/api/{tenant}/products/{id}Get a single product
PUT/api/{tenant}/products/{id}Update a product
DELETE/api/{tenant}/products/{id}Delete a product
GET/api/{tenant}/products/by-code/{code}Get product by barcode

Validation Rules

Field Type Required Rules
namestringrequiredmax: 255
barcodestringrequiredUnique product identifier / SKU
descriptionstringrequiredProduct description
selling_pricenumericoptionalSelling price per unit
buying_pricenumericoptionalPurchase/cost price per unit
discountnumericoptionalDefault discount amount
status_idintegerrequiredMust exist in statuses
category_idintegeroptionalMust exist in categories
unit_idintegeroptionalMust exist in units
account_idintegeroptionalRevenue account
inventory_account_idintegeroptionalInventory asset account
vat_appliedbooleanoptionalWhether VAT applies to this product
sell_typestringoptionalSale classification type

Create Product — Example

Request

POST /api/acme-corp/products
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Office Chair",
  "barcode": "SKU-12345",
  "description": "Ergonomic office chair",
  "buying_price": 150.00,
  "selling_price": 250.00,
  "unit_id": 1,
  "status_id": 1,
  "category_id": 3,
  "discount": 10.00,
  "vat_applied": true
}

Response (201)

{
  "id": 23,
  "name": "Office Chair",
  "barcode": "SKU-12345",
  "description": "Ergonomic office chair",
  "buying_price": 150.00,
  "selling_price": 250.00,
  "unit_id": 1,
  "status_id": 1,
  "category_id": 3,
  "discount": 10.00,
  "vat_applied": true,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Categories & Units

Categories

GET/api/{tenant}/categories
POST/api/{tenant}/categories
GET/api/{tenant}/categories/{id}
PUT/api/{tenant}/categories/{id}
DEL/api/{tenant}/categories/{id}

Also: GET /api/{tenant}/categories/{id}/products

Units

GET/api/{tenant}/units
POST/api/{tenant}/units
GET/api/{tenant}/units/{id}
PUT/api/{tenant}/units/{id}
DEL/api/{tenant}/units/{id}

Barcode Lookup

GET /api/acme-corp/products/by-code/SKU-12345
Authorization: Bearer {token}

// Response (200):
{
  "id": 23,
  "name": "Office Chair",
  "barcode": "SKU-12345",
  "selling_price": 250.00,
  "buying_price": 150.00,
  ...
}

Invoices API

Manage sales invoices. Creating an invoice auto-generates journal entries for Accounts Receivable, Revenue, and VAT.

Endpoints

Method Endpoint Description
GET/api/{tenant}/invoicesList all invoices (paginated)
POST/api/{tenant}/invoicesCreate a new invoice
GET/api/{tenant}/invoices/{id}Get invoice with full details
PUT/api/{tenant}/invoices/{id}Update an invoice
DELETE/api/{tenant}/invoices/{id}Delete an invoice
POST/api/{tenant}/approvals/invoices/{id}/approveApprove an invoice

Validation Rules

Field Type Required Description
customer_idintegeroptionalLinked customer ID
customer_namestringoptionalCustomer display name
date_fromdateoptionalInvoice start date
date_todateoptionalInvoice end / due date
sub_totalnumericoptionalSubtotal before tax & discount
discountnumericoptionalDiscount amount
vatnumericoptionalVAT / tax amount
amount_totalnumericoptionalTotal invoice amount
amount_paidnumericoptionalAmount already paid
descriptionstringoptionalmax: 255

Create Invoice — Example

Request

POST /api/acme-corp/invoices
Authorization: Bearer {token}
Content-Type: application/json

{
  "customer_id": 5,
  "customer_name": "ABC Trading Ltd",
  "date_from": "2024-01-01",
  "date_to": "2024-01-31",
  "sub_total": 1250.00,
  "discount": 100.00,
  "vat": 150.00,
  "amount_total": 1300.00,
  "amount_paid": 500.00,
  "description": "Monthly sales invoice"
}

Response (201)

{
  "id": 42,
  "customer_id": 5,
  "customer_name": "ABC Trading Ltd",
  "date_from": "2024-01-01",
  "date_to": "2024-01-31",
  "sub_total": 1250.00,
  "discount": 100.00,
  "vat": 150.00,
  "amount_total": 1300.00,
  "amount_paid": 500.00,
  "balance": 800.00,
  "status": "pending",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Automatic Journal Entries

When an invoice is created and approved, the system automatically generates the following journal entries via the GL Integration Service.

Account Debit Credit
Accounts Receivable (AR)amount_total
Sales Revenuesub_total
VAT Payablevat

Additionally, if inventory items are included, a COGS entry is created: Debit COGS / Credit Inventory.

Approve Invoice

POST /api/acme-corp/approvals/invoices/42/approve
Authorization: Bearer {token}

// Response (200):
{
  "message": "Invoice approved successfully."
}

Inventory API

Manage stock records including purchases, adjustments, transfers, and expiry tracking.

Endpoints

Method Endpoint Description
GET/api/{tenant}/stocksList all stock records (paginated)
POST/api/{tenant}/stocksCreate a new stock entry
GET/api/{tenant}/stocks/{id}Get stock details
PUT/api/{tenant}/stocks/{id}Update a stock record
DELETE/api/{tenant}/stocks/{id}Delete a stock record

Validation Rules

Field Type Required Rules
product_idintegerrequiredMust exist in products table
quantitynumericrequiredmin: 0
unit_idintegeroptionalMust exist in units table
supplier_idintegeroptionalMust exist in suppliers table
warehouse_idintegeroptionalMust exist in warehouses table
branch_idintegeroptionalMust exist in branches table
buying_pricenumericoptionalmin: 0
selling_pricenumericoptionalmin: 0
discountnumericoptionalmin: 0
vatnumericoptionalmin: 0
expires_atdateoptionalMust be a future date
descriptionstringoptionalmax: 1000
locationstringoptionalmax: 255, shelf/bin location

Stock Types

Each stock record has a type that classifies the movement:

STOCK_PURCHASE SALE_RETURN PURCHASE_RETURN STOCK_TRANSFER_IN STOCK_TRANSFER_OUT STOCK_ADJUSTMENT STOCK_COUNT STOCK_EXPIRY STOCK_WRITE_OFF

Create Stock Entry

Request

POST /api/acme-corp/stocks
Authorization: Bearer {token}
Content-Type: application/json

{
  "product_id": 23,
  "quantity": 100,
  "unit_id": 1,
  "supplier_id": 5,
  "warehouse_id": 2,
  "buying_price": 150.00,
  "selling_price": 250.00,
  "expires_at": "2026-12-31",
  "description": "Q1 bulk purchase",
  "location": "Shelf A-12"
}

Response (201)

{
  "id": 45,
  "product_id": 23,
  "quantity": 100,
  "balance": 100,
  "unit_id": 1,
  "supplier_id": 5,
  "warehouse_id": 2,
  "buying_price": 150.00,
  "selling_price": 250.00,
  "expires_at": "2026-12-31",
  "description": "Q1 bulk purchase",
  "location": "Shelf A-12",
  "type": "STOCK_PURCHASE",
  "status_id": 1,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Stock Records

Supports search and pagination. Maximum 200 items per page.

GET /api/acme-corp/stocks?search=Office+Chair&page=1&per_page=25
Authorization: Bearer {token}

// Response (200):
{
  "data": [
    {
      "id": 45,
      "product_id": 23,
      "quantity": 100,
      "balance": 100,
      "warehouse_id": 2,
      "type": "STOCK_PURCHASE",
      ...
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 3,
    "per_page": 25,
    "total": 68
  }
}

Approvals API

Retrieve pending approval items and approve or reject invoices, credit notes, purchase orders, and stock adjustments.

Endpoints

Method Endpoint Description
GET/api/{tenant}/approvalsList all pending approvals
POST/api/{tenant}/approvals/invoices/{id}/approveApprove an invoice
POST/api/{tenant}/approvals/invoice-returns/{id}/approveApprove a credit note
POST/api/{tenant}/approvals/orders/{id}/approveApprove a purchase order
POST/api/{tenant}/approvals/stock-adjustments/{id}/items/{item}/approveApprove a stock adjustment item

Approval Types

Each approval item includes a type field indicating the document category:

Type Description
invoiceSales invoices pending approval
invoice_returnCredit notes / invoice returns pending approval
orderPurchase orders (typically over a threshold amount)
stock_adjustmentStock adjustment items requiring approval
adjustment_requestGeneral adjustment requests
transferStock transfers between warehouses

List Pending Approvals

Returns all pending approvals filtered by the authenticated user's permissions.

GET /api/acme-corp/approvals
Authorization: Bearer {token}

// Response (200):
{
  "success": true,
  "data": [
    {
      "id": 34,
      "type": "invoice",
      "reference": "INV-2024-0034",
      "title": "Sales Invoice #34",
      "description": "Invoice for ABC Trading Ltd",
      "amount": 15000.00,
      "created_at": "2024-01-15T10:30:00Z",
      "status_id": 2,
      "created_by": "John Doe",
      "approval_url": "/api/acme-corp/approvals/invoices/34/approve",
      "rejection_url": "/api/acme-corp/approvals/invoices/34/reject"
    },
    {
      "id": 12,
      "type": "order",
      "reference": "PO-2024-0012",
      "title": "Purchase Order #12",
      "description": "Office supplies from XYZ Suppliers",
      "amount": 5200.00,
      "created_at": "2024-01-14T09:15:00Z",
      "status_id": 2,
      "created_by": "Jane Smith",
      "approval_url": "/api/acme-corp/approvals/orders/12/approve",
      "rejection_url": "/api/acme-corp/approvals/orders/12/reject"
    }
  ]
}

Approve an Invoice

Request

POST /api/acme-corp/approvals/invoices/34/approve
Authorization: Bearer {token}
Content-Type: application/json

Response (200)

{
  "success": true,
  "message": "Invoice approved successfully",
  "data": {
    "id": 34,
    "status_id": 1,
    "approved_by": 5,
    "approved_at": "2024-01-15T11:00:00Z"
  }
}

Users & Roles API

Manage users, roles, and permissions. Assign roles to users and permissions to roles for access control.

User Endpoints

Method Endpoint Description
GET/api/{tenant}/usersList all users (paginated)
POST/api/{tenant}/usersCreate a new user
GET/api/{tenant}/users/{id}Get user details
PUT/api/{tenant}/users/{id}Update a user
DELETE/api/{tenant}/users/{id}Delete a user
GET/api/{tenant}/user/permissionsGet current user's permissions

Role & Permission Endpoints

Method Endpoint Description
GET/api/{tenant}/rolesList all roles (paginated)
POST/api/{tenant}/rolesCreate a new role
GET/api/{tenant}/roles/{id}Get role details with permissions
PUT/api/{tenant}/roles/{id}Update a role
DELETE/api/{tenant}/roles/{id}Delete a role
GET/api/{tenant}/permissionsList all permissions
POST/api/{tenant}/permissionsCreate a permission
PUT/api/{tenant}/permissions/{id}Update a permission
DELETE/api/{tenant}/permissions/{id}Delete a permission

User Validation Rules

Field Type Required Rules
namestringrequiredmax: 255
emailstringrequiredValid email, unique per tenant
phonestringoptionalmax: 255
passwordstringoptionalStored hashed; required on create
status_idintegeroptionalMust exist in statuses table
branch_idintegeroptionalMust exist in branches table
warehouse_idintegeroptionalMust exist in warehouses table
rolesarrayoptionalArray of role IDs to assign
warehousesarrayoptionalArray of warehouse IDs (many-to-many)

Role Validation Rules

Field Type Required Rules
namestringrequiredmax: 32, unique
permissionsarrayoptionalArray of permission IDs

Create User

Request

POST /api/acme-corp/users
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Jane Smith",
  "email": "jane@acme-corp.com",
  "phone": "+254700987654",
  "password": "securePassword123",
  "branch_id": 1,
  "warehouse_id": 2,
  "roles": [1, 3],
  "warehouses": [2, 5]
}

Response (201)

{
  "id": 8,
  "name": "Jane Smith",
  "email": "jane@acme-corp.com",
  "phone": "+254700987654",
  "branch_id": 1,
  "warehouse_id": 2,
  "status_id": 1,
  "roles": [
    { "id": 1, "name": "admin" },
    { "id": 3, "name": "manager" }
  ],
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Create Role

Request

POST /api/acme-corp/roles
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "warehouse-manager",
  "permissions": [10, 11, 12, 15, 20]
}

Response (201)

{
  "id": 5,
  "name": "warehouse-manager",
  "permissions": [
    { "id": 10, "name": "view-stock" },
    { "id": 11, "name": "create-stock" },
    { "id": 12, "name": "edit-stock" },
    { "id": 15, "name": "view-warehouse" },
    { "id": 20, "name": "approve-transfer" }
  ],
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Users

Supports search and pagination. Maximum 200 items per page.

GET /api/acme-corp/users?search=jane&page=1&per_page=25
Authorization: Bearer {token}

// Response (200):
{
  "data": [
    {
      "id": 8,
      "name": "Jane Smith",
      "email": "jane@acme-corp.com",
      "phone": "+254700987654",
      "branch_id": 1,
      "roles": [
        { "id": 1, "name": "admin" }
      ],
      ...
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 25,
    "total": 1
  }
}

Settings API

Manage tenant-level configuration including company details, currencies, tax types, and email settings.

Endpoints

Method Endpoint Description
GET/api/{tenant}/currenciesList all currencies
POST/api/{tenant}/currenciesCreate a currency
GET/api/{tenant}/currencies/{id}Get currency details
PUT/api/{tenant}/currencies/{id}Update a currency
DELETE/api/{tenant}/currencies/{id}Delete a currency
GET/api/{tenant}/tax-typesList all tax types
POST/api/{tenant}/tax-typesCreate a tax type
PUT/api/{tenant}/tax-types/{id}Update a tax type
DELETE/api/{tenant}/tax-types/{id}Delete a tax type
GET/api/{tenant}/tax-bracketsList tax brackets
POST/api/{tenant}/tax-bracketsCreate a tax bracket
PUT/api/{tenant}/tax-brackets/{id}Update a tax bracket
DELETE/api/{tenant}/tax-brackets/{id}Delete a tax bracket

Currency — Create Example

Request

POST /api/acme-corp/currencies
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "US Dollar",
  "code": "USD",
  "symbol": "$",
  "exchange_rate": 1.00,
  "is_default": false
}

Response (201)

{
  "id": 3,
  "name": "US Dollar",
  "code": "USD",
  "symbol": "$",
  "exchange_rate": 1.00,
  "is_default": false,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Tax Type — Create Example

Request

POST /api/acme-corp/tax-types
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "VAT",
  "rate": 16.5,
  "description": "Value Added Tax"
}

Response (201)

{
  "id": 2,
  "name": "VAT",
  "rate": 16.5,
  "description": "Value Added Tax",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Currencies

Returns all configured currencies for the tenant.

GET /api/acme-corp/currencies
Authorization: Bearer {token}

// Response (200):
{
  "data": [
    {
      "id": 1,
      "name": "Malawi Kwacha",
      "code": "MWK",
      "symbol": "MK",
      "exchange_rate": 1.00,
      "is_default": true
    },
    {
      "id": 3,
      "name": "US Dollar",
      "code": "USD",
      "symbol": "$",
      "exchange_rate": 0.00058,
      "is_default": false
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 25,
    "total": 2
  }
}

Dashboard API

Retrieve aggregated financial statistics for the tenant dashboard, including revenue, expenses, cash position, and recent activity.

Endpoints

Method Endpoint Description
GET/api/{tenant}/dashboardGet dashboard statistics

Response Fields

Field Type Description
totalRevenuenumericSum of all revenue account balances
totalExpensesnumericSum of all expense account balances
netIncomenumerictotalRevenue − totalExpenses
cashnumericCash & bank accounts (code 11xx)
accountsReceivablenumericAccounts receivable balance (code 12xx)
accountsPayablenumericAccounts payable balance (code 21xx)
inventorynumericInventory asset value (code 13xx)
recentInvoicesarrayLast 5 invoices with customer and amount

How Calculations Work

  • Revenue — Aggregated from GL accounts classified as revenue.
  • Expenses — Aggregated from GL accounts classified as expense.
  • Cash — Sum of accounts with code prefix 11* (Cash & Bank).
  • Accounts Receivable — Sum of accounts with code prefix 12*.
  • Accounts Payable — Sum of accounts with code prefix 21*.
  • Inventory — Sum of accounts with code prefix 13*.

Get Dashboard

Request

GET /api/acme-corp/dashboard
Authorization: Bearer {token}

Response (200)

{
  "totalRevenue": 1250000.00,
  "totalExpenses": 870000.00,
  "netIncome": 380000.00,
  "cash": 425000.00,
  "accountsReceivable": 312000.00,
  "accountsPayable": 198000.00,
  "inventory": 567000.00,
  "recentInvoices": [
    {
      "id": 102,
      "customer_name": "ABC Trading Ltd",
      "amount_total": 15000.00,
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": 101,
      "customer_name": "XYZ Corp",
      "amount_total": 8500.00,
      "created_at": "2024-01-14T14:20:00Z"
    }
  ]
}