Skip to main content

Accounts

Manage your chart of accounts.

Accounts define the structure of your ledger. Transactions post amounts into accounts, but accounts themselves are long-lived, mostly immutable objects.

Authentication

All endpoints require a valid API key. See Authentication.

Overview

Accounts are the categories used to organise financial data. SpeyBooks supports hierarchical accounts with parent/child relationships.

When you register, SpeyBooks provisions a UK-standard chart of accounts suitable for sole traders and limited companies.

Account types

Each account has a type which defines its normal balance.

TypeDescriptionNormal balance
assetThings you own (bank, receivables, equipment)Debit
liabilityThings you owe (payables, VAT, loans)Credit
equityOwner's stake (capital, retained earnings)Credit
revenueIncome (sales, interest)Credit
expenseCosts (rent, wages, software)Debit

Normal balance determines how net balances should be interpreted in reports.

The account object

{
"id": "acc_1200",
"code": "1200",
"name": "Bank Account",
"accountType": "asset",
"parentId": "acc_1000",
"description": "Main business current account",
"defaultVatRate": null,
"isActive": true,
"isSystem": true,
"isControlAccount": true,
"controlType": "bank",
"createdAt": "2026-01-01T00:00:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}

Attributes

FieldTypeDescription
idstringUnique identifier (acc_*)
codestringAccount code
namestringAccount name
accountTypestringasset, liability, equity, revenue, expense
parentIdstring | nullParent account ID
descriptionstringAccount description
defaultVatRateinteger | nullDefault VAT rate (0–100)
isActivebooleanWhether account is active
isSystembooleanSystem-created (restricted)
isControlAccountbooleanControl account flag
controlTypestring | nullbank, receivables, payables, vat
createdAtstringCreation timestamp
updatedAtstringLast update timestamp

List accounts

GET /v1/accounts

Returns accounts as a hierarchy by default, or as a flat list with ?flat=true.

curl "https://api.speybooks.com/v1/accounts?type=asset&active=true" \
-H "Authorization: Bearer sk_live_your_api_key"

Query parameters

ParameterTypeDefaultDescription
typestringFilter by account type
activebooleanFilter by active status
flatbooleanfalseReturn flat list instead of hierarchy

Response (hierarchical)

Accounts include nested children.

{
"success": true,
"data": {
"accounts": [
{
"id": "acc_1000",
"code": "1000",
"name": "Current Assets",
"accountType": "asset",
"parentId": null,
"isActive": true,
"children": [
{
"id": "acc_1100",
"code": "1100",
"name": "Accounts Receivable",
"accountType": "asset",
"parentId": "acc_1000",
"isActive": true,
"children": []
},
{
"id": "acc_1200",
"code": "1200",
"name": "Bank Account",
"accountType": "asset",
"parentId": "acc_1000",
"isActive": true,
"children": []
}
]
}
],
"meta": {
"total": 45
}
}
}

Response (flat)

Use ?flat=true to return a flat list.

{
"success": true,
"data": {
"accounts": [
{
"id": "acc_1000",
"code": "1000",
"name": "Current Assets",
"accountType": "asset",
"parentId": null
},
{
"id": "acc_1100",
"code": "1100",
"name": "Accounts Receivable",
"accountType": "asset",
"parentId": "acc_1000"
}
],
"meta": {
"total": 45
}
}
}

Account type summary

GET /v1/accounts/types

Returns counts grouped by account type.

curl https://api.speybooks.com/v1/accounts/types \
-H "Authorization: Bearer sk_live_your_api_key"

Response

{
"success": true,
"data": {
"types": [
{ "type": "asset", "count": 12, "activeCount": 11 },
{ "type": "liability", "count": 8, "activeCount": 8 },
{ "type": "equity", "count": 3, "activeCount": 3 },
{ "type": "revenue", "count": 5, "activeCount": 5 },
{ "type": "expense", "count": 17, "activeCount": 15 }
]
}
}

Retrieve an account

GET /v1/accounts/:id

Returns the full account object.

curl https://api.speybooks.com/v1/accounts/acc_1200 \
-H "Authorization: Bearer sk_live_your_api_key"

Response

{
"success": true,
"data": {
"id": "acc_1200",
"code": "1200",
"name": "Bank Account",
"accountType": "asset",
"parentId": "acc_1000",
"description": "Main business current account",
"defaultVatRate": null,
"isActive": true,
"isSystem": true,
"isControlAccount": true,
"controlType": "bank",
"createdAt": "2026-01-01T00:00:00Z",
"updatedAt": "2026-01-15T10:30:00Z"
}
}

Get account balance

GET /v1/accounts/:id/balance

Returns debit, credit, and net balances for the account.

curl "https://api.speybooks.com/v1/accounts/acc_1200/balance?from=2026-01-01&to=2026-01-31" \
-H "Authorization: Bearer sk_live_your_api_key"

Query parameters

ParameterTypeDefaultDescription
fromstringStart date (YYYY-MM-DD)
tostringEnd date (YYYY-MM-DD)

Response

{
"success": true,
"data": {
"account": {
"id": "acc_1200",
"code": "1200",
"name": "Bank Account",
"accountType": "asset"
},
"balance": {
"debit": 5000000,
"credit": 1250000,
"net": 3750000
},
"period": {
"from": "2026-01-01",
"to": "2026-01-31"
},
"transactionCount": 42
}
}

Balance interpretation

Account typeNormal net
Asset / ExpensePositive (debits exceed credits)
Liability / Equity / RevenueNegative (credits exceed debits)

Create an account

POST /v1/accounts
curl -X POST https://api.speybooks.com/v1/accounts \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"code": "5150",
"name": "Cloud Hosting",
"accountType": "expense",
"parentId": "acc_5100",
"description": "AWS, GCP, and other cloud services",
"defaultVatRate": 20
}'

Parameters

FieldTypeRequiredDescription
codestringYesUnique account code (max 20 chars)
namestringYesAccount name (max 200 chars)
accountTypestringYesasset, liability, equity, revenue, expense
parentIdstringNoParent account ID
descriptionstringNoAccount description (max 500 chars)
defaultVatRateintegerNoDefault VAT rate (0–100)
isControlAccountbooleanNoControl account flag
controlTypestringNoControl type if applicable

Response

{
"success": true,
"data": {
"id": "acc_5150",
"code": "5150",
"name": "Cloud Hosting",
"accountType": "expense",
"parentId": "acc_5100",
"description": "AWS, GCP, and other cloud services",
"defaultVatRate": 20,
"isActive": true,
"isSystem": false,
"isControlAccount": false,
"controlType": null,
"createdAt": "2026-01-31T10:00:00Z",
"updatedAt": "2026-01-31T10:00:00Z"
}
}

Error: Duplicate code

{
"success": false,
"error": {
"code": "conflict",
"message": "Account code already exists"
}
}

Update an account

PUT /v1/accounts/:id
curl -X PUT https://api.speybooks.com/v1/accounts/acc_5150 \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Cloud Infrastructure",
"description": "AWS, GCP, Azure, and other cloud services",
"defaultVatRate": 20
}'

Update rules

Account typeAllowed changes
System accountsOnly isActive
User accountsname, description, defaultVatRate

Response

{
"success": true,
"data": {
"updated": true
}
}

Error: Cannot modify system account

{
"success": false,
"error": {
"code": "unprocessable_entity",
"message": "Cannot modify system account"
}
}

Delete an account

DELETE /v1/accounts/:id
curl -X DELETE https://api.speybooks.com/v1/accounts/acc_5150 \
-H "Authorization: Bearer sk_live_your_api_key"

Deletion rules

ConditionResult
Account has transactionsDeactivated, not deleted
Account has child accountsCannot be deleted
System accountCannot be deleted

Response (deleted)

{
"success": true,
"data": {
"deleted": true
}
}

Response (deactivated)

{
"success": true,
"data": {
"deactivated": true,
"message": "Account deactivated (has transactions)"
}
}

Error: Cannot delete system account

{
"success": false,
"error": {
"code": "unprocessable_entity",
"message": "Cannot delete system account"
}
}

Error: Has child accounts

{
"success": false,
"error": {
"code": "unprocessable_entity",
"message": "Cannot delete account with child accounts"
}
}

Standard UK account codes

SpeyBooks provisions a UK-standard chart of accounts on registration.

Code rangeTypeDescription
1000–1999AssetCurrent and fixed assets
2000–2999LiabilityCurrent and long-term liabilities
3000–3999EquityCapital and reserves
4000–4999RevenueSales and other income
5000–5999ExpenseOperating expenses

Common accounts

CodeNameType
1100Accounts ReceivableAsset
1200Bank AccountAsset
2100Accounts PayableLiability
2200VAT OutputLiability
2201VAT InputLiability
3000Share CapitalEquity
3100Retained EarningsEquity
4000SalesRevenue
5000Cost of SalesExpense
5100Office ExpensesExpense

Key invariants

  • Account codes are unique within an organisation
  • System accounts are protected from modification
  • Accounts with transactions are never removed (only deactivated)
  • Balances are derived from transactions, not stored
  • The chart is structural, not transactional

Error codes

CodeHTTPDescription
validation_error400Invalid account type or missing required field
invalid_id400Malformed account ID (expected acc_*)
not_found404Account does not exist
conflict409Account code already exists
unprocessable_entity422Cannot modify/delete system account
unprocessable_entity422Cannot delete account with transactions
unprocessable_entity422Cannot delete account with child accounts

Amount format

All balance amounts are returned in minor units (pence for GBP):

3750000 = £37,500.00

Divide by 100 for display.