Balaka Developer: API Guide

Authentication

Balaka uses OAuth 2.0 Device Authorization Flow (RFC 8628) for API authentication. This flow is designed for devices and CLI tools that cannot open a browser-based login form directly.

Authentication Flow

CLI/Device                    Balaka API                     Browser
    |                             |                             |
    |-- POST /api/device/code --->|                             |
    |<-- deviceCode, userCode ----|                             |
    |                             |                             |
    |  (display userCode to user)                               |
    |                             |                             |
    |                             |<-- user visits /device ----->|
    |                             |    enters userCode           |
    |                             |    clicks Authorize          |
    |                             |                             |
    |-- POST /api/device/token -->|                             |
    |<-- accessToken, Bearer -----|                             |
    |                             |                             |
    |-- GET /api/analysis/...  -->|                             |
    |   Authorization: Bearer XXX |                             |

Step 1: Request Device Code

POST /api/device/code
Content-Type: application/json

{
  "clientId": "my-integration"
}

Response:

{
  "deviceCode": "abc123...",
  "userCode": "ABCD-EFGH",
  "verificationUri": "https://balaka.example.com/device",
  "verificationUriComplete": "https://balaka.example.com/device?code=ABCD-EFGH",
  "expiresIn": 900,
  "interval": 5
}
  • deviceCode -- opaque string used to poll for the token (do not show to user).
  • userCode -- short code the user enters in their browser.
  • verificationUri -- URL where the user authorizes the device.
  • expiresIn -- device code validity in seconds (15 minutes).
  • interval -- minimum polling interval in seconds.

Step 2: User Authorization

The user opens verificationUriComplete in their browser (or navigates to verificationUri and enters the userCode manually). They must be logged in to Balaka. After entering the code, they click "Authorize" to grant access.

Step 3: Poll for Token

While the user authorizes, the client polls for an access token:

POST /api/device/token
Content-Type: application/json

{
  "deviceCode": "abc123..."
}

Pending response (HTTP 400):

{
  "error": "authorization_pending",
  "errorDescription": "The authorization request is still pending"
}

Success response (HTTP 200):

{
  "accessToken": "bk_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "tokenType": "Bearer",
  "expiresIn": 2592000,
  "scope": "drafts:read,drafts:create,drafts:approve,analysis:read,analysis:write,transactions:post,templates:read,templates:write,data:import,bills:read,bills:create,bills:approve,tax-export:read,tax-export:write,payroll:write,accounts:read,accounts:write,assets:read,assets:write,tax-filings:read,tax-filings:write,bank-recon:read,bank-recon:write"
}

Error responses (HTTP 400):

errormeaning
authorization_pendingUser has not yet authorized. Keep polling.
expired_tokenDevice code expired (15 min). Restart from Step 1.
access_deniedUser denied authorization.
invalid_requestInvalid or missing device code.

Step 4: Use the Token

Include the token in the Authorization header for all API requests:

GET /api/analysis/trial-balance?asOfDate=2025-12-31
Authorization: Bearer bk_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Client Credentials Grant (Service-to-Service)

Unattended backend callers (schedulers, outbox dispatchers) cannot complete the interactive device flow. For these, register an API client under Pengaturan → API Klien (requires SETTINGS_EDIT). The client_id and client_secret are shown once at creation.

Exchange the credentials for a short-lived bearer token (RFC 6749 §4.4):

POST /api/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=ar-outbox-1a2b3c4d&client_secret=...

HTTP Basic authentication is accepted as an alternative to body parameters.

Response:

{
  "access_token": "opaque-token",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "transactions:post"
}
  • Tokens are restricted to the client's registered scopes (intersected with the service user's role permissions, see below) and expire after app.api-client.token-expiry-minutes (default 60). Cache the token and request a new one on expiry.
  • Postings authenticate as the client's configured service user (audit trail).
  • Errors follow RFC 6749: 401 {"error":"invalid_client"} for unknown/inactive clients or wrong secrets, 400 {"error":"unsupported_grant_type"} otherwise.

Scopes and Authorization

A request is allowed only when both hold:

  1. The token carries the scope the endpoint requires, and the token's user currently holds at least one of the scope's granting permissions (below). Scopes whose permissions the user's roles lack are not effective.
  2. The user's roles hold the specific permission of the operation, where a scope covers several operations with different permissions (e.g. transactions:post covers create, post, void, delete and purge; void needs TRANSACTION_VOID).

Both checks use the user's roles at request time. Changing a user's roles changes what their existing tokens can do on the next request; deactivating the user makes their tokens return 401. The effective API permissions therefore never exceed what the same user can do in the web UI.

Device-flow tokens carry every scope listed below. Client-credentials tokens carry the scopes chosen when the API client was registered, evaluated against the client's service user. Browser session cookies are not accepted on /api/** endpoints (403); a request with a Bearer header is authenticated by the token only, and an invalid token returns 401 even if a session cookie is sent.

ScopeGrants access toEffective when the user holds any of
drafts:readRead draft transactionsDRAFT_VIEW
drafts:createCreate drafts (direct, from receipt, from text), update draftsTRANSACTION_CREATE
drafts:approveApprove (DRAFT_APPROVE) / reject (DRAFT_REJECT) draftsDRAFT_APPROVE, DRAFT_REJECT
analysis:readFinancial reports, snapshots, ledgers, transactions, analysis reportsREPORT_VIEW
analysis:writePublish AI analysis reportsANALYSIS_REPORT_CREATE
transactions:postCreate (TRANSACTION_CREATE + TRANSACTION_POST for direct posting), update (TRANSACTION_EDIT), post / bulk-post (TRANSACTION_POST), void (TRANSACTION_VOID), delete (TRANSACTION_DELETE), purge (TRANSACTION_PURGE); free-form journal entries (TRANSACTION_CREATE); transaction documents; tax details (TAX_EXPORT, writes also TRANSACTION_EDIT)any TRANSACTION_* write permission
templates:readList/read journal templates (/api/templates, /api/drafts/templates)TEMPLATE_VIEW
templates:writeCreate (TEMPLATE_CREATE), update (TEMPLATE_EDIT), delete (TEMPLATE_DELETE) templatesTEMPLATE_CREATE, TEMPLATE_EDIT, TEMPLATE_DELETE
data:importImport industry seed dataDATA_IMPORT
bills:readRead vendor billsBILL_VIEW
bills:createCreate vendor billsBILL_CREATE
bills:approveApprove (BILL_APPROVE), mark paid (BILL_MARK_PAID)BILL_APPROVE, BILL_MARK_PAID
tax-export:readTax exports, SPT data; reads of payroll (PAYROLL_VIEW), employees (EMPLOYEE_VIEW), salary components (SALARY_COMPONENT_VIEW), fiscal adjustmentsTAX_EXPORT
tax-export:writeCreate/update/delete fiscal adjustments and loss carryforwardsFISCAL_PERIOD_MANAGE
payroll:writePayroll runs: create/calculate/delete (PAYROLL_CREATE), approve (PAYROLL_APPROVE), post (PAYROLL_POST), schedule (PAYROLL_CREATE + PAYROLL_APPROVE); employees create (EMPLOYEE_CREATE) / update and salary assignments (EMPLOYEE_EDIT); salary components (SALARY_COMPONENT_MANAGE)PAYROLL_CREATE, PAYROLL_APPROVE, PAYROLL_POST, EMPLOYEE_CREATE, EMPLOYEE_EDIT, SALARY_COMPONENT_MANAGE
accounts:readRead chart of accounts (/api/accounts, /api/drafts/accounts)ACCOUNT_VIEW
accounts:writeCreate (ACCOUNT_CREATE), update (ACCOUNT_EDIT), delete (ACCOUNT_DELETE) accountsACCOUNT_CREATE, ACCOUNT_EDIT, ACCOUNT_DELETE
assets:readRead fixed assets, categories, depreciation entriesASSET_VIEW
assets:writeRegister (ASSET_CREATE), update (ASSET_EDIT), delete (ASSET_DELETE) assets; generate/post/skip depreciation (ASSET_DEPRECIATE)ASSET_CREATE, ASSET_EDIT, ASSET_DELETE, ASSET_DEPRECIATE
tax-filings:readRead the tax filing register and documentsTAX_CALENDAR_VIEW
tax-filings:writeRegister tax filings, attach documentsTAX_CALENDAR_MANAGE
withholding:readRead payees, withheld payments, deposits and withholding reportsTAX_REPORT_VIEW
withholding:writePayees (VENDOR_CREATE, VENDOR_EDIT); create (TRANSACTION_CREATE), post (TRANSACTION_POST), cancel (TRANSACTION_DELETE) payments and depositsVENDOR_CREATE, VENDOR_EDIT, TRANSACTION_CREATE, TRANSACTION_POST, TRANSACTION_DELETE
sales-tax-chain:readRead the invoice to faktur, receipt and bupot chain, its exceptions and the monthly reconciliationTAX_REPORT_VIEW
sales-tax-chain:writeRecord a faktur on an invoice; record a customer's bupot as a draft transactionTAX_EXPORT, INVOICE_EDIT, TRANSACTION_CREATE
evidence:readRead evidence requirements, per-transaction evidence and gaps, the contract register and missing bank statementsEVIDENCE_VIEW
close-checks:readRead the period close checklist, each close check and the shareholder current account statementFISCAL_PERIOD_VIEW
self-test:readRead the tax-office self-test of a year with explanations, and the rows behind each figureTAX_REPORT_VIEW
bank-recon:readRead parser configs, statements, reconciliationsBANK_RECONCILIATION_VIEW
bank-recon:writeParser configs (BANK_RECONCILIATION_CONFIG), statement import (BANK_RECONCILIATION_IMPORT), matching / create transaction (BANK_RECONCILIATION_MATCH), complete (BANK_RECONCILIATION_COMPLETE)any BANK_RECONCILIATION_* write permission

The same list, with the granting permissions, is published in the OpenAPI spec under x-authentication.scopes (GET /v3/api-docs, which requires a Bearer token or a logged-in session).

A 403 response means the token lacks the scope or the user's role lacks the permission.

Token Properties

  • Validity: 30 days from issuance.
  • Storage: tokens are hashed (BCrypt) before storage. The plaintext token is returned only once during issuance.
  • Revocation: tokens can be revoked from the web UI at /settings/devices.

Token Management UI

Administrators can manage device tokens at Settings > Perangkat Terhubung (/settings/devices):

  • View all active tokens (device name, client ID, last used, scopes).
  • Revoke individual tokens.
  • See when tokens were last used and from which IP.

No Authentication Required

The device code and token endpoints (/api/device/code and /api/device/token) do not require a Bearer token. They are the entry point for obtaining one.


Next: Quickstart

Quickstart

Complete working example from zero to first API call using curl. Replace https://balaka.example.com with your Balaka instance URL.

Prerequisites

  • A running Balaka instance with at least one user account.
  • curl and jq installed.

1. Obtain an Access Token

# Step 1: Request a device code
RESPONSE=$(curl -s -X POST https://balaka.example.com/api/device/code \
  -H "Content-Type: application/json" \
  -d '{"clientId": "my-script"}')

DEVICE_CODE=$(echo $RESPONSE | jq -r '.deviceCode')
USER_CODE=$(echo $RESPONSE | jq -r '.userCode')
VERIFY_URL=$(echo $RESPONSE | jq -r '.verificationUriComplete')

echo "Open this URL in your browser: $VERIFY_URL"
echo "Or go to $(echo $RESPONSE | jq -r '.verificationUri') and enter code: $USER_CODE"

Open the URL in your browser, log in if needed, and click "Authorize".

# Step 2: Poll for the token (run after authorizing in browser)
TOKEN_RESPONSE=$(curl -s -X POST https://balaka.example.com/api/device/token \
  -H "Content-Type: application/json" \
  -d "{\"deviceCode\": \"$DEVICE_CODE\"}")

TOKEN=$(echo $TOKEN_RESPONSE | jq -r '.accessToken')
echo "Access token: $TOKEN"

If you get authorization_pending, wait 5 seconds and try again.

2. Get Trial Balance

curl -s https://balaka.example.com/api/analysis/trial-balance?asOfDate=2025-12-31 \
  -H "Authorization: Bearer $TOKEN" | jq .

Response:

{
  "reportType": "trial-balance",
  "generatedAt": "2025-12-31T10:00:00",
  "parameters": {
    "asOfDate": "2025-12-31"
  },
  "data": {
    "items": [
      {
        "accountCode": "1-1100",
        "accountName": "Kas",
        "debit": 50000000.00,
        "credit": 0.00
      }
    ],
    "totalDebit": 150000000.00,
    "totalCredit": 150000000.00
  },
  "metadata": {
    "currency": "IDR",
    "accountingBasis": "accrual",
    "description": "Trial balance as of 2025-12-31..."
  }
}

3. Create a Draft Transaction

First, find a template ID. Use the Swagger UI at /swagger-ui.html to browse available templates, or query the templates API.

# Create a draft transaction
curl -s -X POST https://balaka.example.com/api/drafts \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "e0000000-0000-0000-0000-000000000001",
    "description": "Office supplies purchase",
    "amount": 500000,
    "transactionDate": "2025-12-15"
  }' | jq .

Response:

{
  "transactionId": "a1b2c3d4-...",
  "transactionNumber": null,
  "status": "DRAFT",
  "merchant": null,
  "amount": 500000,
  "transactionDate": "2025-12-15",
  "description": "Office supplies purchase",
  "journalEntries": [
    {
      "journalNumber": null,
      "accountCode": "5-1200",
      "accountName": "Beban Perlengkapan Kantor",
      "debitAmount": 500000.00,
      "creditAmount": 0.00
    },
    {
      "journalNumber": null,
      "accountCode": "1-1100",
      "accountName": "Kas",
      "debitAmount": 0.00,
      "creditAmount": 500000.00
    }
  ]
}

4. Post the Transaction

TX_ID="a1b2c3d4-..."  # from the response above

curl -s -X POST "https://balaka.example.com/api/transactions/$TX_ID/post" \
  -H "Authorization: Bearer $TOKEN" | jq .

Response:

{
  "transactionId": "a1b2c3d4-...",
  "transactionNumber": "JU-202512-0001",
  "status": "POSTED",
  "merchant": null,
  "amount": 500000,
  "transactionDate": "2025-12-15",
  "description": "Office supplies purchase",
  "journalEntries": [...]
}

5. Verify in Trial Balance

curl -s https://balaka.example.com/api/analysis/trial-balance?asOfDate=2025-12-31 \
  -H "Authorization: Bearer $TOKEN" | jq '.data.items[] | select(.accountCode == "5-1200")'

Full API Reference

Browse the interactive API documentation at /swagger-ui.html on your Balaka instance (log in to the application first; anonymous visitors are sent to the login page). All endpoints under /api/** are documented with request/response schemas and examples.


Next: Transactions

Transactions API

All transaction endpoints require Authorization: Bearer <token> with the transactions:post scope, and the token user's role must hold the operation's permission (see Authentication):

EndpointPermission
POST /api/transactions (create and post)TRANSACTION_CREATE and TRANSACTION_POST
POST /api/transactions/journal-entryTRANSACTION_CREATE
PUT /api/transactions/{id}TRANSACTION_EDIT
POST /api/transactions/{id}/post, POST /api/transactions/bulk-postTRANSACTION_POST
POST /api/transactions/{id}/voidTRANSACTION_VOID
DELETE /api/transactions/{id}TRANSACTION_DELETE
DELETE /api/transactions/purge-voidedTRANSACTION_PURGE

Draft endpoints (/api/drafts) use the drafts:create, drafts:read and drafts:approve scopes; GET /api/drafts/templates needs templates:read and GET /api/drafts/accounts needs accounts:read.

Base URL: /api/transactions

Transaction Lifecycle

DRAFT ──POST──> POSTED ──VOID──> VOID
  │                                
  └──DELETE──> (removed)          
  • DRAFT: created but not yet affecting the ledger. Can be edited or deleted.
  • POSTED: affects the ledger. Journal entries are generated and numbered. Can only be voided.
  • VOID: reversed. A reversal journal entry is created. Cannot be modified further.

Create Transaction (Direct Post)

Creates and immediately posts a transaction. Used by AI assistants after user approval.

POST /api/transactions
Content-Type: application/json
Authorization: Bearer <token>
{
  "templateId": "e0000000-0000-0000-0000-000000000001",
  "merchant": "Toko Bangunan",
  "amount": 1500000,
  "transactionDate": "2025-12-15",
  "description": "Office renovation materials",
  "category": "office-supplies",
  "source": "claude-code",
  "userApproved": true,
  "accountSlots": {
    "BANK": "648eaabb-1234-5678-9abc-def012345678"
  },
  "variables": {
    "assetCost": 1500000
  }
}
FieldTypeRequiredDescription
templateIdUUIDyesJournal template to use
merchantstringyesMerchant/vendor name
amountdecimalyesTransaction amount (> 0)
transactionDatedateyesFormat: yyyy-MM-dd
descriptionstringyesTransaction description
categorystringnoOptional category
itemsstring[]noLine item descriptions
sourcestringnoSource identifier (e.g., claude-code)
userApprovedbooleannoWhether user approved the transaction
accountSlotsmapnoAccount overrides for template lines with accountHint. Key = hint or line order number, value = account UUID
variablesmapnoFormula variables for DETAILED templates. Key = variable name, value = amount

Response: 201 Created with TransactionResponse.

Idempotent Posting (Retry Safety)

POST /api/transactions accepts an optional Idempotency-Key header (max 100 chars, caller-generated, unique per logical posting). The key is persisted with the transaction in the same database commit as the posting, so a dispatcher retry after a lost response cannot double-post:

POST /api/transactions
Authorization: Bearer <token>
Idempotency-Key: journal-posting-42
Content-Type: application/json
  • First request: 201 Created with the TransactionResponse.
  • Repeat with the same key: 200 OK with the original transaction (id, number, journal entries) — nothing new is created, whatever the payload.
  • Concurrent duplicates race on a unique index; the loser returns the winner's transaction with 200 OK.

Outbox dispatchers should use a stable identifier of their own posting row as the key, so every logical event maps to exactly one GL transaction across retries.

Create Draft Transaction

Creates a DRAFT transaction via the draft workflow.

POST /api/drafts
Content-Type: application/json
Authorization: Bearer <token>
{
  "templateId": "e0000000-0000-0000-0000-000000000001",
  "description": "Monthly electricity bill",
  "amount": 750000,
  "transactionDate": "2025-12-01",
  "accountSlots": {
    "BANK": "648eaabb-1234-5678-9abc-def012345678"
  }
}

Response: 201 Created with TransactionResponse (status = DRAFT).

Create Free-Form Journal Entry

Creates a DRAFT transaction with arbitrary debit/credit lines. No template required. Use for closing journals, adjusting entries, or opening balances.

POST /api/transactions/journal-entry
Content-Type: application/json
Authorization: Bearer <token>
{
  "transactionDate": "2025-12-31",
  "description": "Closing journal - accrued expenses",
  "category": "CLOSING",
  "lines": [
    {
      "accountId": "a1b2c3d4-...",
      "debit": 1000000,
      "credit": 0
    },
    {
      "accountId": "e5f6a7b8-...",
      "debit": 0,
      "credit": 1000000
    }
  ]
}
FieldTypeRequiredDescription
transactionDatedateyesFormat: yyyy-MM-dd
descriptionstringyesJournal entry description (max 500 chars)
categorystringnoOptional category stored in transaction notes
linesarrayyesMinimum 2 lines. Total debits must equal total credits
lines[].accountIdUUIDyesChart of account UUID (must be a leaf account, not a header)
lines[].debitdecimalyesDebit amount (>= 0)
lines[].creditdecimalyesCredit amount (>= 0)

Response: 201 Created with TransactionResponse (status = DRAFT). Post via POST /api/transactions/{id}/post.

Validation errors (400 Bad Request):

  • Unbalanced debits and credits.
  • Less than 2 lines.
  • Header account used (only leaf accounts allowed).
  • A line has both debit and credit as zero or both non-zero.

Salary Journal Warning

TransactionResponse has warnings (array of strings), on POST /api/transactions, POST /api/transactions/journal-entry, PUT /api/transactions/{id} and POST /api/transactions/{id}/post. bulk-post results and DraftResponse carry the same field. It is non-empty when the transaction debits a payroll salary account in a period with a non-cancelled payroll run. It does not block the request.

Update Draft Transaction

Updates a DRAFT transaction. All fields are optional; only provided fields are updated.

PUT /api/transactions/{id}
Content-Type: application/json
Authorization: Bearer <token>
{
  "templateId": "e0000000-0000-0000-0000-000000000002",
  "description": "Updated description",
  "amount": 800000,
  "transactionDate": "2025-12-02",
  "accountSlots": {
    "BANK": "new-account-uuid"
  }
}

Response: 200 OK with updated TransactionResponse.

Returns 409 Conflict if the transaction was modified concurrently (optimistic locking via row_version).

Post a Draft Transaction

POST /api/transactions/{id}/post
Authorization: Bearer <token>

Response: 200 OK with TransactionResponse (status = POSTED, transactionNumber assigned).

Delete a Draft Transaction

DELETE /api/transactions/{id}
Authorization: Bearer <token>

Response: 204 No Content. Only DRAFT transactions can be deleted.

Void a Posted Transaction

POST /api/transactions/{id}/void
Content-Type: application/json
Authorization: Bearer <token>
{
  "reason": "DUPLICATE",
  "notes": "Already recorded in transaction JU-202512-0001"
}
Void ReasonDescription
INPUT_ERRORData entry mistake
DUPLICATEDuplicate transaction
CANCELLEDTransaction was cancelled
OTHEROther reason (explain in notes)

Response: 200 OK with TransactionResponse (status = VOID).

Journal Preview

Preview the journal entries that will be generated when posting a DRAFT transaction.

GET /api/transactions/{id}/journal-preview
Authorization: Bearer <token>

Response:

{
  "valid": true,
  "errors": [],
  "entries": [
    {
      "accountCode": "5-1200",
      "accountName": "Beban Perlengkapan Kantor",
      "debitAmount": 500000.00,
      "creditAmount": 0.00
    },
    {
      "accountCode": "1-1100",
      "accountName": "Kas",
      "debitAmount": 0.00,
      "creditAmount": 500000.00
    }
  ],
  "totalDebit": 500000.00,
  "totalCredit": 500000.00
}

Bulk Post

Post multiple DRAFT transactions in a single request.

POST /api/transactions/bulk-post
Content-Type: application/json
Authorization: Bearer <token>
{
  "transactionIds": [
    "uuid-1",
    "uuid-2",
    "uuid-3"
  ]
}

Response:

{
  "results": [
    { "transactionId": "uuid-1", "success": true, "transactionNumber": "JU-202512-0001", "error": null },
    { "transactionId": "uuid-2", "success": true, "transactionNumber": "JU-202512-0002", "error": null },
    { "transactionId": "uuid-3", "success": false, "transactionNumber": null, "error": "Transaction is not in DRAFT status" }
  ],
  "successCount": 2,
  "failureCount": 1
}

Individual failures do not roll back successful posts.

Purge Voided Transactions

Permanently delete all voided transactions (optionally before a cutoff date).

DELETE /api/transactions/purge-voided?before=2025-01-01
Authorization: Bearer <token>

Response: 200 OK with count of purged transactions.

Response Structure

All transaction endpoints return TransactionResponse:

{
  "transactionId": "uuid",
  "transactionNumber": "JU-202512-0001",
  "status": "POSTED",
  "merchant": "Toko Bangunan",
  "amount": 1500000,
  "transactionDate": "2025-12-15",
  "description": "Office renovation materials",
  "journalEntries": [
    {
      "journalNumber": "JE-202512-0001",
      "accountCode": "5-1200",
      "accountName": "Beban Perlengkapan Kantor",
      "debitAmount": 1500000.00,
      "creditAmount": 0.00
    }
  ]
}

Next: Reports

Reports API

Financial report endpoints for reading accounting data. All endpoints require Authorization: Bearer <token> with the analysis:read scope.

Base URL: /api/analysis

Response Envelope

All report endpoints return an AnalysisResponse<T> wrapper:

{
  "reportType": "trial-balance",
  "generatedAt": "2025-12-31T10:00:00",
  "parameters": {
    "asOfDate": "2025-12-31"
  },
  "data": { ... },
  "metadata": {
    "currency": "IDR",
    "accountingBasis": "accrual",
    "description": "..."
  }
}
FieldDescription
reportTypeReport identifier string
generatedAtISO 8601 timestamp when the report was generated
parametersEcho of the request parameters
dataReport-specific payload (varies per endpoint)
metadataAdditional context (currency, descriptions)

Company Info

GET /api/analysis/company

Returns company configuration: name, industry, currency, fiscal year start month, PKP status, NPWP.

Monthly Snapshot

GET /api/analysis/snapshot?month=2025-12&year=2025

Returns KPI dashboard data: revenue, expenses, net profit, profit margin, cash balance, receivables, payables, transaction count, and month-over-month change percentages.

Trial Balance

GET /api/analysis/trial-balance?asOfDate=2025-12-31
ParameterTypeRequiredDescription
asOfDatedateyesBalance date (yyyy-MM-dd)

Response data:

{
  "items": [
    {
      "accountCode": "1-1100",
      "accountName": "Kas",
      "debit": 50000000.00,
      "credit": 0.00
    }
  ],
  "totalDebit": 150000000.00,
  "totalCredit": 150000000.00
}

Income Statement

GET /api/analysis/income-statement?startDate=2025-01-01&endDate=2025-12-31&excludeClosing=true
ParameterTypeRequiredDescription
startDatedateyesPeriod start (yyyy-MM-dd)
endDatedateyesPeriod end (yyyy-MM-dd)
excludeClosingbooleannoExclude closing journal entries (default: false)

Response data:

{
  "revenueItems": [
    { "accountCode": "4-1100", "accountName": "Pendapatan Jasa", "amount": 120000000.00 }
  ],
  "expenseItems": [
    { "accountCode": "5-1100", "accountName": "Beban Gaji", "amount": 60000000.00 }
  ],
  "totalRevenue": 120000000.00,
  "totalExpense": 80000000.00,
  "netIncome": 40000000.00
}

Balance Sheet

GET /api/analysis/balance-sheet?asOfDate=2025-12-31
ParameterTypeRequiredDescription
asOfDatedateyesBalance date (yyyy-MM-dd)

Response data:

{
  "assetItems": [
    { "accountCode": "1-1100", "accountName": "Kas", "amount": 50000000.00 }
  ],
  "liabilityItems": [
    { "accountCode": "2-1100", "accountName": "Hutang Usaha", "amount": 10000000.00 }
  ],
  "equityItems": [
    { "accountCode": "3-1100", "accountName": "Modal Disetor", "amount": 100000000.00 }
  ],
  "totalAssets": 150000000.00,
  "totalLiabilities": 10000000.00,
  "totalEquity": 100000000.00,
  "currentYearEarnings": 40000000.00
}

The accounting equation holds: totalAssets = totalLiabilities + totalEquity + currentYearEarnings.

Cash Flow Statement

GET /api/analysis/cash-flow?startDate=2025-01-01&endDate=2025-12-31
ParameterTypeRequiredDescription
startDatedateyesPeriod start (yyyy-MM-dd)
endDatedateyesPeriod end (yyyy-MM-dd)

Response data:

{
  "operatingItems": [
    { "description": "Pendapatan Jasa", "amount": 120000000.00 }
  ],
  "investingItems": [
    { "description": "Pembelian Aset Tetap", "amount": -15000000.00 }
  ],
  "financingItems": [],
  "operatingTotal": 40000000.00,
  "investingTotal": -15000000.00,
  "financingTotal": 0.00,
  "netCashChange": 25000000.00,
  "beginningCashBalance": 25000000.00,
  "endingCashBalance": 50000000.00,
  "cashAccountBalances": [
    { "accountName": "Bank BCA", "balance": 45000000.00 },
    { "accountName": "Kas", "balance": 5000000.00 }
  ]
}

Positive amounts represent cash inflows, negative amounts represent cash outflows. Cash flow categories are determined by the cashFlowCategory field on journal templates (OPERATING, INVESTING, FINANCING, NON_CASH).

Tax Summary

GET /api/analysis/tax-summary?startDate=2025-01-01&endDate=2025-12-31

Returns aggregated tax data for the period: PPN, PPh 21, PPh 23, PPh 4(2), PPh 25.

Additional Endpoints

EndpointDescription
GET /api/analysis/accountsChart of accounts with balances
GET /api/analysis/transactions/{id}Single transaction with full journal entries
GET /api/analysis/ledgerGeneral ledger entries for a date range

For the full list of available endpoints and their schemas, see the Swagger UI at /swagger-ui.html.


Next: Payroll

Payroll API

Payroll management, PPh 21 calculation, and 1721-A1 generation. All endpoints require Authorization: Bearer <token>. Read endpoints need the tax-export:read scope; write endpoints need payroll:write. The token user's role must also hold the permission (see Authentication):

EndpointScopePermission
GET /api/payroll/**tax-export:readPAYROLL_VIEW
POST /api/payroll, POST /api/payroll/{id}/calculate, DELETE /api/payroll/{id}payroll:writePAYROLL_CREATE
POST /api/payroll/{id}/approvepayroll:writePAYROLL_APPROVE
POST /api/payroll/{id}/postpayroll:writePAYROLL_POST
POST /api/payroll/schedule, DELETE /api/payroll/schedulepayroll:writePAYROLL_CREATE and PAYROLL_APPROVE
GET /api/employees/**tax-export:readEMPLOYEE_VIEW
POST /api/employeespayroll:writeEMPLOYEE_CREATE
PUT /api/employees/{id}, POST/PUT /api/employees/{id}/salary-components/**payroll:writeEMPLOYEE_EDIT
GET /api/salary-componentstax-export:readSALARY_COMPONENT_VIEW
POST/PUT/DELETE /api/salary-components/**payroll:writeSALARY_COMPONENT_MANAGE

Base URL: /api/payroll

Payroll Run Lifecycle

DRAFT ──calculate──> CALCULATED ──approve──> APPROVED ──post──> POSTED
  │                       │
  └──delete               └──recalculate (back to CALCULATED)
  • DRAFT: payroll run created, no calculations yet.
  • CALCULATED: BPJS and PPh 21 computed for all active employees.
  • APPROVED: reviewed and approved, ready for posting.
  • POSTED: journal entry created. Payment is recorded. Payroll data appears in summary and 1721-A1 endpoints.

List Payroll Runs

GET /api/payroll?year=2025&status=POSTED&page=0&size=20
ParameterTypeRequiredDescription
yearintnoFilter by year
statusenumnoFilter by status: DRAFT, CALCULATED, APPROVED, POSTED
pageintnoPage number (0-based)
sizeintnoPage size

Response: paginated PayrollRunResponse list.

Create Payroll Run

POST /api/payroll
Content-Type: application/json
{
  "payrollPeriod": "2025-12",
  "notes": "December 2025 payroll"
}

Response: 201 Created

{
  "id": "uuid",
  "payrollPeriod": "2025-12",
  "status": "DRAFT",
  "employeeCount": 0,
  "totalGross": 0,
  "totalDeductions": 0,
  "totalNet": 0,
  "totalPph21": 0,
  "notes": "December 2025 payroll"
}

Only one payroll run per period is allowed. Returns 400 if a run already exists for that period.

Get Payroll Run Detail

GET /api/payroll/{id}

Returns the payroll run with all employee payroll details (gross salary, deductions, PPh 21, net salary per employee).

Bonus and THR

GET    /api/payroll/{id}/additions
POST   /api/payroll/{id}/additions
DELETE /api/payroll/{id}/additions/{additionId}

Writes need scope payroll:write and PAYROLL_CREATE; reads need tax-export:read and PAYROLL_VIEW.

{ "employeeId": "uuid", "type": "BONUS", "amount": 5000000, "description": "Kinerja" }

type is BONUS or THR. The run must be DRAFT or CALCULATED (otherwise 409); a CALCULATED run is recalculated at once with its base salary and JKK class. The employee must be active (otherwise 400). A calculation fails with 409 if a row belongs to an employee who has since become inactive.

On the detail: grossSalary = baseSalary + bonus + thr. The TER rate and base use grossSalary + benefitInKind; BPJS uses baseSalary. December pph21 is negative when the year was over-withheld, and adds to netPay.

Calculate Payroll

POST /api/payroll/{id}/calculate
Content-Type: application/json
{
  "baseSalary": 5000000,
  "jkkRiskClass": 2
}
FieldTypeRequiredDescription
baseSalarydecimalyesBase salary for calculation
jkkRiskClassintnoJKK risk class 1-5 (default: 1)

Calculates BPJS contributions and PPh 21 for all active employees. PPh 21 uses TER method (PMK 168/2023) for January--November. December uses annual reconciliation with progressive tax brackets (PP 58/2023).

Transitions status to CALCULATED. Returns 400 if no active employees exist.

Approve Payroll

POST /api/payroll/{id}/approve

Transitions from CALCULATED to APPROVED. Returns 400 if not in CALCULATED status.

Post Payroll

POST /api/payroll/{id}/post

Creates a journal entry using the payroll template (configured via app.payroll.template-id). Template lines with zero amounts are skipped (e.g., PPh 21 = 0 for low-salary employees). Transitions to POSTED.

Returns 500 if the payroll template is not found.

Delete Payroll Run

DELETE /api/payroll/{id}

Only DRAFT payroll runs can be deleted. Response: 204 No Content.

Reconciliation

GET /api/payroll/reconciliation?year=2026
GET /api/payroll/reconciliation/2026-03

Scope tax-export:read and PAYROLL_VIEW. Salary accounts are the debit lines of the payroll template with formula grossSalary, bonus or thr. Ledger figures are net debits from POSTED journals, closing entries excluded.

FieldMeaning
runId, runStatusRun of the period, null when none or cancelled
runSalary, runBonus, runThrParts of runCashGross
runBenefitInKindNatura counted in the run; not on salary accounts
runTaxableIncome, runPph21PPh 21 base and tax of the masa, posted or not; see runStatus
ledgerSalaryExpenseledgerFromRun + ledgerOutsideRun
ledgerPph21FromRunNet credit on the PPh 21 account from the run's journal
differenceledgerSalaryExpense - runCashGross when POSTED, else ledgerSalaryExpense
statusMATCHED, DIFFERENCE, RUN_NOT_POSTED, LEDGER_WITHOUT_RUN, NO_ACTIVITY
journalsOutsideRunJournals outside the run debiting a salary account, including DRAFT

The year response has periods (12 rows) and ledgerSalaryExpense, postedCashGross, postedTaxableIncome, postedPph21, difference.

Java callers use PayrollReconciliationService.reconcile(YearMonth) and reconcileYear(int).

warnings on POST /api/payroll, /calculate, /approve, /post and GET /api/payroll/{id} lists salary journals outside the run. The field is absent on list rows.

1721-A1 (Employee Tax Proof)

GET /api/payroll/employees/{employeeId}/1721-a1?year=2025

Generates annual PPh 21 tax proof (bukti potong) data for a single employee. Only includes data from POSTED payroll runs.

Response:

{
  "year": 2025,
  "employee": {
    "name": "John Doe",
    "npwp": "12.345.678.9-012.000",
    "nikKtp": "1234567890123456",
    "ptkpStatus": "TK_0",
    "hireDate": "2024-01-15",
    "resignDate": null,
    "monthCount": 12
  },
  "calculation": {
    "penghasilanBruto": 72000000,
    "biayaJabatan": 3600000,
    "iuranPensiun": 2160000,
    "penghasilanNeto": 66240000,
    "ptkp": 54000000,
    "pkp": 12240000,
    "pph21Terutang": 612000,
    "pph21Dipotong": 612000,
    "pph21KurangBayar": 0
  },
  "monthlyBreakdown": [
    { "period": "2025-01", "grossSalary": 6000000, "pph21": 60000 },
    { "period": "2025-02", "grossSalary": 6000000, "pph21": 60000 }
  ]
}

penghasilanNeto = penghasilanBruto - biayaJabatan (5%, max 6,000,000) - iuranPensiun (employee-paid JHT and JP). The employee's BPJS Kesehatan contribution is not deducted. pkp is rounded down to the thousand. The December payroll run, this endpoint, the 1721-A1 PDF and the annual e-Bupot export use the same computation.

Returns 404 if the employee has no POSTED payroll data for the given year.

Benefit in Kind (Natura)

GET    /api/benefits-in-kind?year=2025        # tax-export:read + PAYROLL_VIEW
POST   /api/benefits-in-kind                  # payroll:write + PAYROLL_CREATE
DELETE /api/benefits-in-kind/{id}             # payroll:write + PAYROLL_CREATE
{"transactionId": "...", "employeeId": "...", "amount": 2000000, "description": "Fasilitas mobil"}

The transaction must be POSTED (409 otherwise) and the recipients' total cannot exceed its expense debit (400). The first recipient adds the system tag NATURA. POST /api/payroll/{id}/calculate adds rows dated from 1 January to the period end, not yet counted by a run, to the recipient's PPh 21 base; cash grossSalary is unchanged. payrollPeriod in the response shows the counting run; such a row cannot be deleted (409) and its transaction cannot be voided until the run is recalculated or cancelled.

penghasilanBruto on 1721-A1, totalGross on the PPh 21 annual summary, and the annual e-Bupot export include natura from POSTED runs.

PPh 21 Annual Summary

GET /api/payroll/pph21/summary?year=2025

Aggregates PPh 21 data across all employees from POSTED payroll runs. Returns total gross, total PPh 21, and per-employee breakdown.

Payroll Schedule (Automated Runs)

Get Schedule

GET /api/payroll/schedule

Returns the current payroll schedule configuration, or 404 if not configured.

Create/Update Schedule

POST /api/payroll/schedule
Content-Type: application/json
{
  "dayOfMonth": 25,
  "baseSalary": 5000000,
  "jkkRiskClass": 2,
  "autoCalculate": true,
  "autoApprove": false,
  "active": true
}
FieldTypeRequiredDescription
dayOfMonthintyesDay of month to create payroll (1-28)
baseSalarydecimalyesBase salary for auto-calculation
jkkRiskClassintyesJKK risk class (1-5)
autoCalculatebooleanyesAutomatically calculate after creation
autoApprovebooleannoAutomatically approve after calculation
activebooleannoEnable/disable the schedule (default: true)

Only one schedule exists at a time. POST replaces the existing configuration. The scheduler runs daily at 6:30 AM and creates a DRAFT payroll run if the day matches dayOfMonth. Posting is always manual -- it signifies actual payment.

Delete Schedule

DELETE /api/payroll/schedule

Response: 204 No Content.


Next: Tax Export

Tax Export API

Endpoints for exporting tax data for SPT preparation. Supports both JSON and Excel (XLSX) output formats. All endpoints require Authorization: Bearer <token> with the tax-export:read scope.

Fiscal adjustments (/api/fiscal-adjustments) and loss carryforwards (/api/fiscal-adjustments/loss-carryforward) are read with tax-export:read; creating, updating and deleting them needs tax-export:write, effective only when the token user holds FISCAL_PERIOD_MANAGE (see Authentication).

Generated fiscal adjustment drafts

POST /api/fiscal-adjustments/generate?year=2025
POST /api/fiscal-adjustments/{id}/confirm
GET  /api/fiscal-adjustments?year=2025&status=DRAFT

generate reads fiscalTreatment on expense accounts (GET/PUT /api/accounts) and replaces the generated DRAFT rows of the year. Amount per account: NON_DEDUCTIBLE = year balance minus confirmed net adjustments on that accountCode; CONDITIONAL = the same minus benefit-in-kind recipients booked on that account. DEDUCTIBLE produces nothing. Response:

{
  "year": 2025,
  "drafts": [{"id": "...", "accountCode": "5.8.04", "amount": 1000000.00, "adjustmentCategory": "PERMANENT",
              "adjustmentDirection": "POSITIVE", "pasal": "Pasal 9 ayat (1) UU PPh", "status": "DRAFT", "source": "GENERATED"}],
  "unclassifiedAccounts": ["5.1.99 Beban Operasional Lainnya"],
  "taggedTransactionsWithoutRecipient": ["TRX-2025-0001"]
}

Rows carry status (DRAFT, CONFIRMED) and source (MANUAL, GENERATED). POST /api/fiscal-adjustments creates CONFIRMED/MANUAL. Edit a draft with PUT, reject it with DELETE. confirm returns 409 on a confirmed row. Only CONFIRMED rows enter rekonsiliasi-fiskal, L1 and SPT exports; rekonsiliasi-fiskal reports the remainder as pendingDraftAdjustments.

Base URL: /api/tax-export

Coretax Excel Exports

These endpoints produce Coretax-compatible Excel files for direct import.

e-Faktur Keluaran (Output VAT)

GET /api/tax-export/efaktur-keluaran?startMonth=2025-01&endMonth=2025-12

e-Faktur Masukan (Input VAT)

GET /api/tax-export/efaktur-masukan?startMonth=2025-01&endMonth=2025-12

e-Bupot Unifikasi (PPh Withholding)

GET /api/tax-export/bupot-unifikasi?startMonth=2025-01&endMonth=2025-12

All three accept startMonth and endMonth in yyyy-MM format. Response is an Excel file download (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).

JSON / Excel Dual-Format Endpoints

These endpoints return JSON by default. Add ?format=excel to download an XLSX file instead.

PPN Detail Report

GET /api/tax-export/ppn-detail?startDate=2025-01-01&endDate=2025-12-31
GET /api/tax-export/ppn-detail?startDate=2025-01-01&endDate=2025-12-31&format=excel

PPN detail with Faktur Keluaran/Masukan breakdown, DPP and PPN totals.

PPh 23 Detail Report

GET /api/tax-export/pph23-detail?startDate=2025-01-01&endDate=2025-12-31
GET /api/tax-export/pph23-detail?startDate=2025-01-01&endDate=2025-12-31&format=excel

Fiscal Reconciliation

GET /api/tax-export/rekonsiliasi-fiskal?year=2025
GET /api/tax-export/rekonsiliasi-fiskal?year=2025&format=excel

Commercial income to taxable income (PKP) reconciliation with positive/negative fiscal adjustments. pkp is the net fiscal income before loss compensation; lossCompensation is the fiscal loss of the previous five years compensated this year (UU PPh Pasal 6 ayat 2, capped at pkp); pkpAfterLoss is the PKP that pphBadan is computed on.

PPh Badan (Corporate Income Tax)

GET /api/tax-export/pph-badan?year=2025

JSON only. Returns PKP (after fiscal loss compensation), PPh terutang, kredit pajak (PPh 23/25), and PPh 29 calculation including Pasal 31E facility.

SPT Tahunan Badan Exports

Annual corporate tax return data in Coretax format. All accept year parameter and optional format=excel.

Lampiran I -- Fiscal Reconciliation

GET /api/tax-export/spt-tahunan/l1?year=2025
GET /api/tax-export/spt-tahunan/l1?year=2025&format=excel

Lampiran IV -- Final Income (PPh 4(2))

GET /api/tax-export/spt-tahunan/l4?year=2025
GET /api/tax-export/spt-tahunan/l4?year=2025&format=excel

Transkrip 8A -- Financial Statements

GET /api/tax-export/spt-tahunan/transkrip-8a?year=2025
GET /api/tax-export/spt-tahunan/transkrip-8a?year=2025&format=excel

Balance sheet + income statement in Coretax 8A layout.

Lampiran 9 -- Depreciation & Amortization

GET /api/tax-export/spt-tahunan/l9?year=2025
GET /api/tax-export/spt-tahunan/l9?year=2025&format=excel

Fixed asset depreciation in DJP converter format.

e-Bupot PPh 21 Annual (1721-A1)

GET /api/tax-export/ebupot-pph21?year=2025
GET /api/tax-export/ebupot-pph21?year=2025&format=excel

Annual PPh 21 reconciliation for all employees. Excel output uses DJP BPA1 converter format.

Consolidated Lampiran

GET /api/tax-export/spt-tahunan/lampiran?year=2025

JSON only. Returns all lampiran data (L1, L4, L9, Transkrip 8A, BPA1) mapped to Coretax field numbers in a single response (SptLampiranReport).

Financial Statements PDF

GET /api/tax-export/financial-statements/pdf?year=2025

Combined Balance Sheet and Income Statement as a PDF file for Coretax SPT upload. Response content type: application/pdf.

Coretax SPT Badan Export

GET /api/tax-export/coretax/spt-badan?year=2025

Structured JSON matching Coretax form fields. All values are plain numbers for direct entry into the Coretax web form (CoretaxSptBadanExport).

Response:

{
  "reportType": "coretax-spt-badan",
  "generatedAt": "2025-12-31T10:00:00",
  "parameters": { "year": "2025" },
  "data": {
    ...
  },
  "metadata": {
    "description": "Coretax-compatible SPT Badan export...",
    "currency": "IDR"
  }
}

Date Format Reference

ParameterFormatExample
startMonth, endMonthyyyy-MM2025-01
startDate, endDateyyyy-MM-dd2025-01-01
yearinteger2025

Next: Pagination

Pagination

List endpoints that return collections use Spring Data's standard pagination. This applies to payroll runs, transactions, and other list APIs.

Request Parameters

ParameterTypeDefaultDescription
pageint0Page number (0-based)
sizeint20Items per page
sortstringvariesSort field and direction (e.g., transactionDate,desc)

Sort Syntax

The sort parameter accepts a property name and optional direction:

sort=propertyName,asc    (ascending)
sort=propertyName,desc   (descending)
sort=propertyName        (ascending by default)

Multiple sort fields can be specified by repeating the parameter:

GET /api/payroll?sort=payrollPeriod,desc&sort=status,asc

Response Envelope

Paginated responses use Spring Data's Page structure:

{
  "content": [
    { "id": "uuid-1", "payrollPeriod": "2025-12", "status": "POSTED", ... },
    { "id": "uuid-2", "payrollPeriod": "2025-11", "status": "POSTED", ... }
  ],
  "pageable": {
    "pageNumber": 0,
    "pageSize": 20,
    "sort": {
      "sorted": true,
      "unsorted": false,
      "empty": false
    },
    "offset": 0,
    "paged": true,
    "unpaged": false
  },
  "totalElements": 42,
  "totalPages": 3,
  "size": 20,
  "number": 0,
  "numberOfElements": 20,
  "first": true,
  "last": false,
  "empty": false,
  "sort": {
    "sorted": true,
    "unsorted": false,
    "empty": false
  }
}
FieldDescription
contentArray of items for the current page
totalElementsTotal number of items across all pages
totalPagesTotal number of pages
numberCurrent page number (0-based)
sizeRequested page size
numberOfElementsActual number of items in this page
firsttrue if this is the first page
lasttrue if this is the last page
emptytrue if the page has no content

Example: Iterate All Pages

PAGE=0
TOTAL_PAGES=1

while [ $PAGE -lt $TOTAL_PAGES ]; do
  RESPONSE=$(curl -s "https://balaka.example.com/api/payroll?page=$PAGE&size=10&sort=payrollPeriod,desc" \
    -H "Authorization: Bearer $TOKEN")

  echo "$RESPONSE" | jq '.content[]'

  TOTAL_PAGES=$(echo "$RESPONSE" | jq '.totalPages')
  PAGE=$((PAGE + 1))
done

Endpoints Using Pagination

EndpointDefault Sort
GET /api/payrollby payroll period
GET /api/analysis/accountsby account code
GET /api/billsby bill date

Non-paginated endpoints (reports, single-entity lookups) return their data directly without the Page wrapper.


Previous: Tax Export

Fixed Assets API

Register and manage depreciable fixed assets. Registered assets are picked up by the monthly depreciation scheduler, so purchases registered through this API get auto-generated depreciation entries (PENDING by default, posted automatically when autoPost is true).

All endpoints require Authorization: Bearer <token>. Read endpoints need the assets:read scope; write endpoints need assets:write. The token user's role must also hold the operation's permission: register ASSET_CREATE, update ASSET_EDIT, delete ASSET_DELETE, depreciation generate/post/skip/post-all ASSET_DEPRECIATE (see Authentication).

Base URL: /api/fixed-assets

Acquisition Sources

POST /api/fixed-assets requires exactly one acquisition source:

SourceFieldsEffect
Funding accountfundingAccountId or fundingAccountCodeComposes an acquisition DRAFT journal (Dr asset account / Cr funding account) via the template engine
Existing transactionpurchaseTransactionIdLinks an already-recorded purchase journal to the asset. No new journal is created — use this when the purchase was posted before registration

Providing both, or neither, returns 400.

List Asset Categories

GET /api/fixed-assets/categories

Returns active categories (kelompok). Each category supplies the default depreciation method, useful life, rate, and the asset / accumulated-depreciation / expense accounts.

[
  {
    "id": "…",
    "code": "KOMPUTER",
    "name": "Peralatan Komputer",
    "depreciationMethod": "STRAIGHT_LINE",
    "usefulLifeMonths": 48,
    "depreciationRate": null,
    "assetAccountCode": "1.2.01",
    "accumulatedDepreciationAccountCode": "1.2.02",
    "depreciationExpenseAccountCode": "5.1.12"
  }
]

List Fixed Assets

GET /api/fixed-assets?year=2026&categoryId=<uuid>&status=ACTIVE&page=0&size=20
ParameterTypeRequiredDescription
yearintnoFilter by purchase year
categoryIdUUIDnoFilter by asset category
statusenumnoACTIVE, FULLY_DEPRECIATED, DISPOSED
page, sizeintnoPagination (default size 20)

Get Asset Detail

GET /api/fixed-assets/{id}

Returns full asset data including account codes, monthlyDepreciation, accumulatedDepreciation, bookValue, depreciationPeriodsCompleted, and purchaseTransactionId (when linked).

Register Asset

POST /api/fixed-assets
{
  "assetCode": "AST-2026-001",
  "name": "MacBook Air 13 M5 16GB/1TB",
  "categoryCode": "KOMPUTER",
  "purchaseDate": "2026-06-10",
  "purchaseCost": 24000000,
  "supplier": "iBox",
  "invoiceNumber": "SX1752606000155",
  "serialNumber": "SJL9L0MVNCJ",
  "purchaseTransactionId": "…"
}
FieldRequiredDescription
assetCodeyesUnique, max 30 chars
nameyesMax 255 chars
categoryId or categoryCodeyes (exactly one)Asset category (kelompok)
purchaseDateyesISO date
purchaseCostyesPositive amount
fundingAccountId / fundingAccountCode / purchaseTransactionIdyes (see Acquisition Sources)
depreciationMethodnoSTRAIGHT_LINE or DECLINING_BALANCE; defaults from category
usefulLifeMonthsno1–600; defaults from category
depreciationRatenoAnnual % for declining balance; defaults from category
residualValuenoDefaults to 0
depreciationStartDatenoDefaults to the first day of the purchase month
autoPostnoWhen true, the scheduler posts generated depreciation entries directly; default false (entries stay PENDING for review)
description, supplier, invoiceNumber, serialNumber, location, notesnoMetadata

Response 201 with the asset detail (same shape as GET detail).

Update Asset

PUT /api/fixed-assets/{id}

Same body as register (acquisition-source fields are ignored — funding/purchase linkage is immutable). Assets with recorded depreciation only accept name, description, notes, and identity changes; other fields are ignored in that state. Disposed assets and assets with a draft disposal return 409.

Identity fields, on register and update: brand, model, serialNumber, custodian, location, condition (GOOD, MINOR_DAMAGE, MAJOR_DAMAGE). All optional; on update an absent one clears it. A change of custodian, location or condition writes a register movement. The detail response adds these plus lastVerifiedDate, hasPhoto, disposalDate, disposalType, disposalProceeds, gainLossOnDisposal. Photo upload is web only.

Delete Asset

DELETE /api/fixed-assets/{id}

Returns 204. For a registration that never reached the ledger: no depreciation history, no linked purchase transaction, no posted acquisition journal, no disposal record. Its acquisition DRAFT is removed too. Otherwise 409; use the disposal endpoints below.

Disposal

Reads need assets:read; writes need assets:write and ASSET_DISPOSE.

EndpointDescription
GET /{id}/disposal/preview?type=&proceeds=Tax effect, nothing stored. 400 for SOLD without proceeds or proceeds on another type
POST /{id}/disposalCreate the record and its DRAFT journal (201). 409 when the asset state does not allow it
POST /disposals/{disposalId}/cancelRemove the DRAFT journal, record becomes CANCELLED. 409 unless DRAFT
GET /disposals/{disposalId}One record
GET /disposals?year=&status=Records dated in the year; status optional
{
  "type": "SOLD",
  "date": "2026-03-31",
  "proceeds": 13000000,
  "proceedsAccountId": "…",
  "counterparty": "PT Pembeli",
  "reason": "Diganti unit baru"
}

type: SOLD, GIFTED, WRITTEN_OFF, TRANSFERRED. proceeds and proceedsAccountId are required on SOLD and refused on the others. counterparty is required except on WRITTEN_OFF. proceeds excludes PPN; the journal records none.

Status: the asset stays as it is while the record is DRAFT, and edits and depreciation are refused. Posting transactionId through POST /api/transactions/{id}/post sets the record POSTED and the asset DISPOSED. Voiding that transaction sets the record VOIDED and returns the asset to ACTIVE or FULLY_DEPRECIATED. Generic edit and delete of the draft answer 409.

Preconditions (409): acquisition journal posted, no PENDING depreciation entry, an entry of any status for every month before the disposal month, exactly one account named Laba Penjualan Aset, Rugi Penjualan Aset, Beban Tidak Dapat Dikurangkan.

taxEffect in the response: gainLoss (proceeds minus book value), taxableIncomeEffect, fiscalCorrection, estimatedPpn, note. Fiscal treatment is unverified and note says so. taxableIncomeEffect and fiscalCorrection are null on TRANSFERRED; estimatedPpn is null except on SOLD.

Verification

EndpointScopeDescription
POST /{id}/verificationassets:write, ASSET_EDITRecord the year's check. FOUND requires condition, location, custodian and writes them to the register; NOT_FOUND leaves it. A second call in the same year replaces the result
GET /verification?year=assets:readEvery asset bought by year end and not disposed by year end, with the result and exceptions
GET /verification/exceptions?year=assets:readRows with at least one exception
{ "year": 2026, "date": "2026-12-15", "result": "FOUND", "condition": "GOOD", "location": "Gudang", "custodian": "Siti", "notes": null }

exceptions: NOT_VERIFIED, NOT_FOUND, MAJOR_DAMAGE, MISSING_BRAND_MODEL, MISSING_SERIAL, MISSING_CUSTODIAN, MISSING_LOCATION, MISSING_CONDITION, MISSING_PHOTO.

Movement

Scope assets:read.

EndpointDescription
GET /movement?year=Roll-forward per category and total: openingCost, additions, disposals, closingCost, openingAccumulated, depreciation, disposedAccumulated, closingAccumulated. Disposals count once posted. Accumulated figures sum POSTED entries
GET /register-movements?year=Custodian, location and condition changes dated in the year

Internal read API: AssetRegisterQueryService (findDisposals, findDisposalsOfAsset, findMovements, findMovementsOfAsset, costMovement).

Depreciation Endpoints

All under /api/fixed-assets/depreciation; listing needs assets:read, mutations assets:write.

EndpointDescription
GET /depreciation?period=YYYY-MM&status=List entries. Both filters optional; status is PENDING/POSTED/SKIPPED
POST /depreciation/generate?period=YYYY-MMGenerate entries for one month; without period, catch-up generates every owed month up to the previous month (idempotent per asset+month). Returns the PENDING entries
POST /depreciation/{entryId}/postPost a PENDING entry to the journal (409 otherwise)
POST /depreciation/{entryId}/skipMark a PENDING entry SKIPPED (204)
POST /depreciation/post-all?period=YYYY-MMPost every PENDING entry with period end ≤ the given month; returns {"postedCount": n}

Depreciation Behavior

  • The monthly scheduler (1st, 07:00) generates all owed months up to the previous month — an asset registered after its purchase month's run self-heals on the next run. POST /depreciation/generate (no period) triggers the same catch-up on demand.
  • Entry periodNumber is derived from the schedule (months between depreciationStartDate and the period, + 1), so consecutive months can be generated while earlier entries are still PENDING.
  • Entries are created as PENDING and reviewed in the web UI (/assets/depreciation) or via the endpoints above; assets with autoPost: true are posted by the scheduler directly.
  • Straight line: (purchaseCost - residualValue) / usefulLifeMonths. Declining balance: bookValue × (depreciationRate / 12 / 100).

Tax Filings API

Register of tax records that belong to a tax period rather than to a journal entry.

Coretax paperwork splits in two. Transaction-linked documents — faktur pajak keluaran, bukti potong PPh 23, the kode billing for a setoran that was booked — already have a home on POST /api/transactions/{id}/documents and POST /api/transactions/{id}/tax-details. Period-linked documents have none: an SPT Masa PPN, its BPE, an STP, a surat teguran, or an SP2DK attaches to a masa pajak, and a masa has no journal entry to hang on. This API is that home.

All endpoints require Authorization: Bearer <token>. Read endpoints need the tax-filings:read scope (effective with TAX_CALENDAR_VIEW); write endpoints need tax-filings:write (effective with TAX_CALENDAR_MANAGE). See Authentication.

Base URL: /api/tax-filings

The Period Key

A filing is identified by (taxType, period, pembetulanNo). Registering the same key twice returns 409.

taxTypeFiledperiod format
PPNper masaYYYY-MM
PPH21per masaYYYY-MM
PPH23_UNIFIKASIper masaYYYY-MM
PPH_BADANper yearYYYY

Using the wrong shape for the type — PPN with 2026, or PPH_BADAN with 2026-04 — returns 400.

pembetulanNo defaults to 0 (SPT normal). A pembetulan is a separate record: register it with pembetulanNo: 1 and set the original's status to CORRECTED.

Status

status is supplied by the caller — the register records what happened at DJP, it does not infer it from deadlines.

StatusMeaning
NOT_FILEDPeriod is known, SPT not yet submitted
FILEDSubmitted on time
LATESubmitted after the deadline
CORRECTEDSuperseded by a pembetulan

List Filings

GET /api/tax-filings?taxType=PPN&year=2026
ParameterTypeRequiredDescription
taxTypeenumnoPPN, PPH21, PPH23_UNIFIKASI, PPH_BADAN
yearintnoTax year

Newest period first. Returns an array of filing objects (no documents).

Get Filing Detail

GET /api/tax-filings/{id}
{
  "filing": {
    "id": "…",
    "taxType": "PPN",
    "period": "2025-04",
    "pembetulanNo": 0,
    "status": "LATE",
    "filedDate": "2025-06-12",
    "bpeNumber": "BPE-25040012345",
    "bpeDate": "2025-06-12",
    "kurangBayar": 1250000,
    "lebihBayar": null,
    "nihil": false,
    "billingCode": "820250612001234",
    "ntpn": "0912B4C7D1E2F3A4",
    "paidDate": "2025-06-11",
    "paymentTransactionId": "…",
    "paymentTransactionNumber": "TRX-2025-0431",
    "notes": null
  },
  "documents": [ … ]
}

Register a Filing

POST /api/tax-filings
{
  "taxType": "PPN",
  "period": "2025-04",
  "pembetulanNo": 0,
  "status": "LATE",
  "filedDate": "2025-06-12",
  "bpeNumber": "BPE-25040012345",
  "bpeDate": "2025-06-12",
  "kurangBayar": 1250000,
  "billingCode": "820250612001234",
  "ntpn": "0912B4C7D1E2F3A4",
  "paidDate": "2025-06-11",
  "paymentTransactionId": "…",
  "notes": "Terlambat karena menunggu faktur pengganti"
}
FieldRequiredNotes
taxType, period, statusyesSee above
pembetulanNonoDefaults to 0
filedDate, bpeNumber, bpeDatenoFilled once the SPT is submitted
kurangBayar, lebihBayarnoMutually exclusive; both positive returns 400
nihilnotrue with a positive kurangBayar/lebihBayar returns 400
billingCode, ntpn, paidDatenoSetoran trail
paymentTransactionIdnoLinks the booked setoran; unknown id returns 404

paymentTransactionId is deliberately optional: a nihil masa has nothing to pay, and an FP-03 (BUMN pemungut) masa is report-only — the BUMN remits the PPN, so no setoran exists in the ledger.

Returns 201 with the same shape as the detail endpoint.

Update a Filing

PUT /api/tax-filings/{id}

Full replacement of the filing fields — omitting paymentTransactionId unlinks the setoran. Moving a filing onto a period key another record already holds returns 409.

Delete a Filing

DELETE /api/tax-filings/{id}

Returns 204. Returns 409 while documents are still attached: SPT/BPE/STP scans carry a 10-year retention obligation (see DATA-RETENTION-POLICY.md), so they are removed one at a time rather than swept away with the parent record.

Attach a Document

POST /api/tax-filings/{id}/documents
Content-Type: multipart/form-data
FieldRequiredDescription
fileyesPDF, JPEG, PNG, or GIF, max 10 MB
docTypeyesSee table below
docNumbernoDocument number as printed
docDatenoIssue date (YYYY-MM-DD)
dueDatenoPayment or response deadline
amountnoValue stated on the document
referenceNumbernoNumber of the document this one answers
notesnoFree text
docTypeDocument
SPTSurat Pemberitahuan
BPEBukti Penerimaan Elektronik
STPSurat Tagihan Pajak
TEGURANSurat Teguran
SP2DKSurat Permintaan Penjelasan atas Data dan/atau Keterangan
SKPLBSurat Ketetapan Pajak Lebih Bayar
SKPKPPSurat Keputusan Pengembalian Kelebihan Pembayaran Pajak
KODE_BILLINGKode billing
BPNBukti Penerimaan Negara
SURATSurat lainnya

The file goes into the same encrypted store as transaction attachments, with the same SHA-256 checksum and retention handling. The response nests the stored file under file:

{
  "id": "…",
  "docType": "TEGURAN",
  "docNumber": "TEG-00112",
  "docDate": "2026-07-14",
  "dueDate": null,
  "amount": null,
  "referenceNumber": "STP-07643",
  "notes": null,
  "file": {
    "id": "…",
    "originalFilename": "teguran-00112.pdf",
    "contentType": "application/pdf",
    "fileSize": 84213,
    "fileSizeFormatted": "82.2 KB",
    "checksumSha256": "…",
    "uploadedAt": "2026-07-15T09:12:44",
    "uploadedBy": "hq-bot"
  }
}

Document Chains

referenceNumber records what a document answers, which is what makes an escalation readable after the fact:

SPT PPN 2025-04  ──▶  STP-07643        (kurang bayar tagihan)
                       └──▶ TEG-00112  referenceNumber: "STP-07643"
                              └──▶ kode billing ──▶ BPN

A duplicate STP for a masa already settled shows up as two STP documents on the same filing — one with a BPN, one without.

List, Download, Remove Documents

GET    /api/tax-filings/{id}/documents
GET    /api/tax-filings/{id}/documents/{taxDocumentId}/download
DELETE /api/tax-filings/{id}/documents/{taxDocumentId}

DELETE removes the metadata and the stored file together, and returns 204.

The generic DELETE /api/documents/{docId} returns 409 for a file owned by this register. Documents are soft-deleted, and a soft-deleted row is invisible to the tax metadata that points at it, so the generic endpoint refuses rather than leaving an unresolvable link.

Filing Status in the Tax Summary

GET /api/analysis/tax-summary?startDate=&endDate= (scope analysis:read) now carries a filings array alongside the tax account balances, listing every registered filing whose period overlaps the requested range:

{
  "data": {
    "items": [ … ],
    "totalBalance": 4820000,
    "filings": [
      {
        "taxType": "PPN",
        "period": "2025-04",
        "pembetulanNo": 0,
        "status": "LATE",
        "filedDate": "2025-06-12",
        "bpeNumber": "BPE-25040012345",
        "kurangBayar": 1250000,
        "lebihBayar": null,
        "nihil": false,
        "paidDate": "2025-06-11"
      }
    ]
  }
}

Only registered filings appear. A masa missing from the array has no record at all — which is the signal that it still needs one.

Error Responses

StatusCause
400Period shape wrong for the tax type, malformed period, nihil with an amount, or kurang bayar and lebih bayar both positive
404Filing, document, or paymentTransactionId not found
409Period key already registered, or filing still has attached documents

Withholding API

Payees, payments with PPh 21 bukan pegawai / PPh 23 / PPh 26 withheld, deposits per masa, and the report of service payments without a PPh tax detail.

All endpoints require Authorization: Bearer <token>. Read endpoints need the withholding:read scope (effective with TAX_REPORT_VIEW). Write endpoints need withholding:write plus the permission listed below. See Authentication.

Base URL: /api/withholding

Rules

TreatmentPayee typeBaseRateWithout NPWP/NIKCredits
PPH_21_BUKAN_PEGAWAIORANG_PRIBADI50% of gross per paymentPasal 1720% higherHutang PPh 21
PPH_23BADAN, ORANG_PRIBADIgross2% (unverified)100% higher (unverified)Hutang PPh 23
PPH_26LUAR_NEGERIgross20%, or the payee's treaty rate with a valid DGT form (unverified)no effectHutang PPh 26
  • PPh 21 brackets apply to each payment alone (PMK 168/2023); payments to one payee are not accumulated within the masa or the year. PTKP does not apply.
  • Hutang accounts are resolved by exact name because codes differ between seed packs. Zero or more than one match returns 409.
  • Rates are set in application.properties (app.withholding.*). A missing key fails startup.

Payees

MethodPathPermissionResult
GET/payeesread scopeVendors with a payeeType. NPWP and NIK are returned masked (npwpMasked, nikMasked)
POST/payeesVENDOR_CREATE201
PUT/payees/{id}VENDOR_EDIT200. Replaces the listed fields

Body: code, name, payeeType (required), address, email, defaultWithholding, defaultTaxObjectCode, npwp, nik, countryCode (required for LUAR_NEGERI), foreignTin, treatyRate, dgtFormNumber, dgtValidUntil.

A payee is a row in vendors; the same record serves bills.

Payments

MethodPathPermissionResult
GET/payments?year=&month=[&treatment=][&vendorId=]read scopeEvery transaction status
GET/payments/{id}read scope
POST/paymentsTRANSACTION_CREATE201, DRAFT transaction with its tax detail. No journal yet
POST/payments/{id}/postTRANSACTION_POST200, journal posted
DELETE/payments/{id}TRANSACTION_DELETE204, DRAFT only. Later PPh 21 drafts in the masa are recomputed
{
  "vendorId": "…",
  "paymentDate": "2026-03-10",
  "grossAmount": 10000000,
  "expenseAccountId": "…",
  "bankAccountId": "…",
  "description": "Honor desain",
  "treatment": "PPH_21_BUKAN_PEGAWAI",
  "taxObjectCode": "21-100-20"
}

treatment and taxObjectCode take the payee's default when omitted; both absent returns 400.

To settle an approved bill, send billId, settledAmount (includes PPN) and paymentMethod, and omit expenseAccountId. grossAmount stays the withholding base. The journal debits the company's Hutang Usaha. The BillPayment is recorded when the transaction is posted and removed when it is voided.

Response fields: grossAmount, dppAmount, taxRate (effective rate on DPP, rounded), taxAmount, settledAmount, netAmount, hasTaxId, rateBasis, transactionId, transactionStatus, billId.

rateBasis PPH26_TREATY_DGT_INVALID means the payee has a treaty rate but no DGT form valid on the payment date; the general rate was applied.

The transaction API refuses PUT/DELETE on these drafts (409). POST /api/transactions/{id}/post works and has the same effect as /payments/{id}/post. Void through POST /api/transactions/{id}/void; a PPh 21 payment with a later non-void payment to the same payee in the masa cannot be voided (409).

Deposits

MethodPathPermissionResult
GET/deposits?year=&month=read scope
POST/depositsTRANSACTION_CREATE201, DRAFT. 400 when the amount exceeds posted tax minus non-void deposits
POST/deposits/{id}/postTRANSACTION_POST200
DELETE/deposits/{id}TRANSACTION_DELETE204, DRAFT only

Body: treatment, year, month, amount, depositDate, bankAccountId, billingCode, ntpn.

These rows cover tax withheld through this API. PPh 21 on payroll has its own deposit template.

Reports

GET /masa-status?year=&month=[&asOf=] returns one row per treatment: gross, withheld, draftWithheld, deposited, outstanding, dueDate, lastDepositDate, status. asOf is the date overdue is judged against and defaults to today. A deadline that is missing or inactive in the tax calendar returns 409.

statusMeaning
NOTHING_DUENothing withheld or deposited
OPENOutstanding, due date not passed
OVERDUEOutstanding, due date passed
ON_TIMEFully deposited, last deposit on or before the due date
LATEFully deposited, last deposit after the due date
OVERDEPOSITEDDeposits exceed posted tax, for example after a void

GET /undocumented-service-payments?year=&month= returns rows (posted net debits on accounts with serviceExpense = true on transactions with no PPh 21/23/26/4(2) tax detail), total, and unclassifiedAccounts (expense accounts with activity in the masa and serviceExpense = null, which the report cannot judge). A PPN detail does not count. A bill's accrual is excluded once the bill has a non-void withholding payment.

Set serviceExpense through POST/PUT /api/accounts.

Exports

PathContent
GET /api/tax-export/bp21?startMonth=&endMonth=PPH_21 tax details on posted transactions. Scope tax-export:read
GET /api/tax-export/bupot-unifikasi?startMonth=&endMonth=PPH_23, PPH_26, PPH_42. Sheet PPH26 adds country, foreign TIN and DGT number. PPh 21 moved to BP21

Column layouts are not verified against the current Coretax converter.

Service Use

Later features read this data through WithholdingQueryService: findPayees(), findPayment(id), findPayments(year, month, treatment, vendorId), findDeposit(id), findDeposits(year, month), getMasaStatus(year, month, asOf), findUndocumentedServicePayments(year, month).

Evidence API

Read-only access to evidence requirements, per-transaction evidence and gaps, the contract register and missing bank statements. Rules, contracts and statement archives are maintained in the web UI.

All endpoints require Authorization: Bearer <token> and the evidence:read scope (effective with EVIDENCE_VIEW). See Authentication. V013 adds evidence:read to existing device-flow tokens that hold analysis:read; API clients get no new scope.

Base URL: /api/evidence

Endpoints

MethodPathResult
GET/requirementsEvery rule: id, evidenceType, accountId/accountCode/accountName or templateId/templateName, minAmount (null: every amount), notes, label
GET/transactions/{id}Evidence of one transaction, any status. 404 if unknown
GET/gaps?from=&to=Posted, non-closing transactions in the period with at least one required type missing, by date then number. 400 if to is before from
GET/index?from=&to=Every posted, non-closing transaction in the period, complete or not. The audit pack's evidence index
GET/contracts[?clientId=][&vendorId=]Contract register, newest start date first
GET/bank-statements/missing?asOf=&graceDays=Months without an ACTIVE archive, per active bank account. A month is due when asOf is later than its end plus graceDays. 400 on negative graceDays

Rule evaluation

A rule applies when the transaction amount is at least minAmount and either a journal line is on the rule's account or one of its sub-accounts, or the transaction's template is in the rule's template family (the first version and every later version). Evidence types: CONTRACT, INVOICE, PROOF_OF_PAYMENT, BUPOT. OTHER classifies a file and cannot be required.

Transaction evidence

FieldContent
required[]evidenceType and rules[] (labels of the rules asking for it)
evidence[]evidenceType, source, reference, documentId (null when no file backs it)
missing[]Required types with no evidence, in enum order
files[]Files on the transaction, its journal lines and its invoice: documentId, filename, evidenceType (null: unclassified), fileSize, checksumSha256
notes[]Contract linked without a file; unclassified files while something is missing
sourceSatisfiesWhen
ATTACHMENTIts evidenceTypeClassified file on the transaction, a journal line or the linked invoice
INVOICEINVOICEInvoice with id_transaction = the transaction, or the transaction's source_document_type = 'INVOICE'
CONTRACTCONTRACTContract linked to the transaction or its invoice, with a file
BUPOTBUPOTNon-blank bupot_number on the transaction's tax detail
BANK_MATCHPROOF_OF_PAYMENTBank statement line with status MATCHED to the transaction

Missing statement

bankAccountId, bankName, accountName, month (yyyy-MM). Expected months start at the earlier of the first posted journal line on the account's GL account and the first archived month. An account with neither has no expected month.

Service API

EvidenceQueryService exposes the same data in-process: requirements(), evidenceFor(transactionId), index(from, to), gaps(from, to), contracts(clientId, vendorId), contractsActiveOn(date). Missing statements: BankStatementArchiveService.missingStatements(asOf, graceDays).

Close Checks API

Read-only period close checks and the shareholder/director current account statement (issue #50). Account roles are set on the chart of accounts (closeCheckRole on /api/accounts: TAX_CREDIT, CLEARING, SHAREHOLDER_CURRENT).

All endpoints require Authorization: Bearer <token> and the close-checks:read scope (effective with FISCAL_PERIOD_VIEW). See Authentication. V014 adds close-checks:read to existing device-flow tokens that hold analysis:read; API clients get no new scope.

Base URL: /api/close-checks

Endpoints

MethodPathResult
GET?from=&to=Checklist: from, to, checks[] in fixed order. 400 if a date is missing or to is before from
GET/tax-credits?returnYear=&asOf=returnYear, asOf, filedDate, uncleared[] (accountId, accountCode, accountName, balanceAtYearEnd, clearedAfterYearEnd, uncleared). filedDate null and uncleared empty when no reported PPh Badan return of returnYear is filed on or before asOf
GET/clearing?from=&to=CLEARING accounts with a balance at to and no reducing movement in the period: balance (debit minus credit), lastMovement
GET/unmoved-liabilities?asOf=asOf, months (LIABILITY_UNMOVED alert threshold), accounts[] with balance (credit minus debit) and lastMovement
GET/invoices-outside-receivables?from=&to=Issued invoices dated in the period: invoiceTotal, postedToReceivable. 409 when the receivable account is not configured
GET/cut-off?from=&to=Posted journals dated after to for documents dated in the period: source (INVOICE, BILL, FAKTUR), documentNumber, documentDate, transactionNumber, transactionDate, amount
GET/asset-proceeds?from=&to=Disposals with proceeds to a non-company account: issue (SHAREHOLDER_ACCOUNT, NOT_COMPANY_BANK_ACCOUNT), accountCode, proceeds
GET/shareholder-statement?accountId=&from=&to=openingBalance, lines[] (date, transactionId, transactionNumber, description, debit, credit, balance), totalDebit, totalCredit, closingBalance. Balance is credit minus debit. 400 if the account is not SHAREHOLDER_CURRENT

Checklist

Each checks[] entry: code, title, status, message, findings[] (reference, date, description, amount, transactionId). Status PASS, WARNING, NOT_APPLICABLE or ERROR; ERROR names the missing configuration in message.

CodeRule
TAX_CREDIT_UNCLEAREDReturn year is the year before from. NOT_APPLICABLE until that PPh Badan return is FILED, LATE or CORRECTED with a filed date on or before to; ERROR without a TAX_CREDIT account
CLEARING_NOT_CREDITEDNOT_APPLICABLE without a CLEARING account
LIABILITY_UNMOVEDEvery LIABILITY account; last posted line on or before to minus N months. ERROR when the alert rule is missing or its threshold is not a whole number of at least 1
INVOICE_NOT_IN_RECEIVABLESSENT, PARTIAL, PAID, OVERDUE invoices; debits to the configured receivable account from posted journals with the invoice as source document, dated up to to
CUT_OFFInvoice date, bill date or faktur date in the period, posted journal after to
ASSET_PROCEEDS_PERSONALNon-cancelled disposals in the period with proceeds; company accounts are the GL accounts of active company bank accounts

Only posted journals count.

Tax Self-Test API

Read-only tax-office self-test (issue #45): yearly cross-checks with book figure, tax figure, difference and the user's explanation per line, and the rows behind each figure. Explanations are written on the web page /reports/self-test.

All endpoints require Authorization: Bearer <token> and the self-test:read scope (effective with TAX_REPORT_VIEW). See Authentication. V015 adds self-test:read to existing device-flow tokens that hold tax-export:read; API clients get no new scope.

Base URL: /api/self-test

Endpoints

MethodPathResult
GET?year=year, unitemisedThreshold, lines[]. 400 without year
GET/trace?year=&line=&month=year, line, month, bookFigure, taxFigure, bookRows[], taxRows[]. bookRows add up to bookFigure, taxRows to taxFigure. 400 for a month not valid for the line or an unknown line; 409 when the line is NOT_CONFIGURED

lines[] entry: line, month (0 = whole year), title, bookBasis, taxBasis, bookFigure, taxFigure, difference, status, message, explanation, explainedBy, explainedAt. difference = bookFigure - taxFigure, or bookFigure when the line has no tax figure. Per-masa lines come as the month 0 total followed by months 1-12.

status: MATCHED, DIFFERENCE, MOVEMENT (no tax figure, nonzero movement), NO_ACTIVITY, NOT_CONFIGURED (no account carries the role; figures null, message names the role).

Trace row: source, referenceId, transactionId, transactionNumber, date, accountCode, reference, description, amount.

sourcereferenceIdNotes
JOURNAL_LINEjournal entry idreference is the journal number
REVENUE_TRANSACTIONtransaction idRevenue of one transaction (credit minus debit on REVENUE accounts)
FAKTURtax detail idreference faktur number, amount DPP
BUPOTtax detail idreference bupot number, amount gross
PAYROLL_DETAILpayroll detail idreference employee id, amount taxable gross
ASSETfixed asset idreference asset code, amount cost

Lines

Ledger figures count POSTED, non-closing journal lines dated in the period.

linePer masaBook figureTax figure
REVENUE_VS_PPN_DPPyesSalesTaxChainService reconciliation bookedRevenuesptDpp: numbered PPN Keluaran details on POSTED transactions by faktur date
SALARY_VS_PPH21_DPPyesPayrollReconciliationService ledgerSalaryExpenserunTaxableIncome of a POSTED run, else 0 with message
SERVICE_VS_PPH23_DPPnoDebit minus credit on SERVICE_PPH23 accountsGross of PPh 23 details in the e-Bupot Unifikasi export (customer bupot on invoices excluded)
RENT_VS_PPH42_DPPnoDebit minus credit on RENT_PPH42 accountsGross of PPh 4(2) details in the same export
FIXED_ASSET_ADDITIONSnoDebits on register cost accounts (category or asset assetAccount)AssetRegisterQueryService.costMovement additions
FIXED_ASSET_DISPOSALSnoCredits on the same accountscostMovement disposals
CAPITAL_MOVEMENTnoCredit minus debit on every EQUITY accountnull
NON_OPERATING_ASSET_MOVEMENTnoDebit minus credit on NON_OPERATING_ASSET accountsnull
UNITEMISED_OTHER_EXPENSEnoDebit minus credit on OTHER_EXPENSE accountsBook figure less unitemised lines: debit lines of at least unitemisedThreshold whose transaction has a blank description or no evidence item (EvidenceQueryService)

Account roles are set on the chart of accounts (selfTestRole on /api/accounts: SERVICE_PPH23, RENT_PPH42, OTHER_EXPENSE on expense accounts; NON_OPERATING_ASSET on asset accounts).