WEMS Accounting API Guide

External systems can read accounting summary, chart of accounts, vouchers, journals, ledgers, and financial reports through the production domain. Login, logout, and permissions are handled by the centralized member API.

Quick Start

1. Get an API keyAccounting data APIs are protected by X-Api-Key. Store keys in a server-side secret store.
2. Call health checkVerify network, TLS, Host, and header configuration before business calls.
3. Query tenant dataUse firmId and companyId to read the accounting data you need.
curl -sS "https://accounting.sun-bd.com/api/v1/accounting/health" \
  -H "X-Api-Key: YOUR_API_KEY"

Centralized Member Integration

The local member system has been removed from this project. The web app signs in through same-origin /api/central-member/login, which relays to the centralized member API. The backend validates RS256 JWTs through JWKS and loads effective permissions from the member API.

For login, logout, refresh, permissions, and JWKS details, read the central member API integration guide.

Response Shape

{
  "success": true,
  "data": { "...": "..." },
  "error": null,
  "timestamp": "2026-05-30T00:00:00Z",
  "traceId": "0H..."
}

On failures, use error.code and HTTP status for program logic, not localized error text.

Main Endpoints

FeatureMethodPath
HealthGET/api/v1/accounting/health
SummaryGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/summary
Chart of accountsGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/chart-of-accounts
VouchersGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/vouchers
JournalGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/journal
LedgerGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/ledger
Trial balanceGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/trial-balance
Balance sheetGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/reports/balance-sheet
Income statementGET/api/v1/accounting/firms/{firmId}/companies/{companyId}/reports/income-statement

Examples

Accounting summary

curl -sS "https://accounting.sun-bd.com/api/v1/accounting/firms/FIRM001/companies/COMP001/summary?dateFrom=2026-01-01&dateTo=2026-12-31" \
  -H "X-Api-Key: YOUR_API_KEY"

Node.js

const response = await fetch(
  "https://accounting.sun-bd.com/api/v1/accounting/firms/FIRM001/companies/COMP001/trial-balance",
  { headers: { "X-Api-Key": process.env.WEMS_ACCOUNTING_API_KEY } }
);
const payload = await response.json();

.NET

using var client = new HttpClient { BaseAddress = new Uri("https://accounting.sun-bd.com") };
client.DefaultRequestHeaders.Add("X-Api-Key", apiKeyFromSecretStore);
var payload = await client.GetFromJsonAsync<object>(
    "/api/v1/accounting/firms/FIRM001/companies/COMP001/chart-of-accounts");

Error Handling

HTTPCommon causeAction
401Missing or invalid API key, or invalid member tokenCheck headers and sign in again if needed.
400Invalid date, paging, or query formatFix query parameters and retry.
404Resource or tenant data does not existCheck firmId/companyId and data permission.
503Service or configuration is not readyKeep traceId and notify the administrator.