Chart of Accounts

Create, update, and find GL account lines for white label programs

Overview

The chart of accounts defines the general ledger (GL) codes your program uses to classify spend. Each line has an accounting code and a display account name. Budgets reference these codes via the category field: see Create budget.

Typical flow:

  1. Import or create GL accounts: POST /md/api/LedgerAccountTypes
  2. Update a GL account: PATCH /md/api/LedgerAccountTypes/{id}
  3. Find GL accounts: GET /md/api/LedgerAccountTypes with a filter.where clause
  4. Reference the code on budgets: set category to the GL code when creating a budget
  5. Map expenses: transactions and expenses resolve to the appropriate GL line based on budget and mapping rules

Authentication: All endpoints require Authorization: Bearer {access_token} and x-appid: {clientId}. The company is resolved from your access token scope: do not send companyId or locale in request bodies. See Authentication.

Code uniqueness: code must be unique within your company for a given locale. Duplicate codes are rejected on create.

Create Chart of Account

POST /md/api/LedgerAccountTypes

Creates a new GL account line for the company associated with your access token. The platform sets id, companyId, locale, and currency (when omitted) automatically.

Request Body: mandatory fields

Parameter Type Required Description
code string Yes GL account code (max 60 characters). Often mirrors an ERP or accounting system code.
account string Yes Display name for the GL line (max 100 characters).

Optional fields

Parameter Type Default Description
default boolean false Whether this is the default GL account for the company. Only one code should be marked default at a time.
status string "active" Lifecycle status. Values: active, archived, deleted.
currency string "USD" ISO currency code for the account.
description string - Additional details about how the GL line is used.
externalId string - Identifier from an external ERP or accounting system.
type string - Account classification (for example Expense). Must match a value in your tenant dictionary when set.
subsidiaryCode string - Subsidiary code when the GL line is scoped to a specific subsidiary.

Example Request

Using cURL:

curl -X POST https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-appid: YOUR_CLIENT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "6204",
    "default": false,
    "account": "Field Equipment",
    "status": "active",
    "description": "Tools and gear issued to employees in the field",
    "externalId": "SAP-472891"
  }'

Using JavaScript (fetch):

const response = await fetch('https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'x-appid': clientId,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    code: '6204',
    default: false,
    account: 'Field Equipment',
    status: 'active',
    description: 'Tools and gear issued to employees in the field',
    externalId: 'SAP-472891'
  })
});

const glAccount = await response.json();

Response

Success Response (200 OK)

{
  "id": "b7c2e891-4d03-4f12-8a6f-3e5d91c04b28",
  "code": "6204",
  "default": false,
  "account": "Field Equipment",
  "locale": "en-US",
  "status": "active",
  "companyId": "2a8f6c14-9e7b-4d32-a816-5b3f0d8e72c1",
  "currency": "USD",
  "description": "Tools and gear issued to employees in the field",
  "externalId": "SAP-472891"
}

Update Chart of Account

PATCH /md/api/LedgerAccountTypes/{id}

Partially updates an existing GL account line. Only include fields you want to change. Do not send companyId, locale, or id: they cannot be changed via this endpoint.

Path Parameters

Parameter Type Required Description
id string Yes UUID of the GL account line to update. Use the id returned from create chart of account.

Request Body

All fields are optional on update. Send only the properties you want to change:

Parameter Type Description
code string GL account code (max 60 characters). Must remain unique within your company for the locale.
account string Display name for the GL line (max 100 characters).
default boolean Whether this is the default GL account for the company.
status string Lifecycle status: active, archived, or deleted.
currency string ISO currency code for the account.
description string Additional details about how the GL line is used.
externalId string Identifier from an external ERP or accounting system.
type string Account classification (for example Expense).
subsidiaryCode string Subsidiary code when the GL line is scoped to a specific subsidiary.

Example Request

Update the display name and description:

Using cURL:

curl -X PATCH https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes/b7c2e891-4d03-4f12-8a6f-3e5d91c04b28 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-appid: YOUR_CLIENT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "Field Equipment and Supplies",
    "description": "Hand tools, PPE, and consumable supplies for field staff"
  }'

Using JavaScript (fetch):

const glAccountId = 'b7c2e891-4d03-4f12-8a6f-3e5d91c04b28';

const response = await fetch(`https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes/${glAccountId}`, {
  method: 'PATCH',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'x-appid': clientId,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    account: 'Field Equipment and Supplies',
    description: 'Hand tools, PPE, and consumable supplies for field staff'
  })
});

const glAccount = await response.json();

Response

Success Response (200 OK)

{
  "id": "b7c2e891-4d03-4f12-8a6f-3e5d91c04b28",
  "code": "6204",
  "default": false,
  "account": "Field Equipment and Supplies",
  "locale": "en-US",
  "status": "active",
  "companyId": "2a8f6c14-9e7b-4d32-a816-5b3f0d8e72c1",
  "currency": "USD",
  "description": "Hand tools, PPE, and consumable supplies for field staff",
  "externalId": "SAP-472891"
}

Find GL Accounts

GET /md/api/LedgerAccountTypes

Retrieves GL account lines for your company. Use the filter query parameter with a where clause to match by code, status, name, and other fields. Results are scoped to the company associated with your access token: do not include companyId in the filter.

Query Parameters

Pass the filter as a URL-encoded JSON object in the filter query parameter.

Parameter Type Description
filter object (JSON) Filter, sorting, and pagination options. See filter options below.

Filter Options

The filter object supports the following properties:

Property Type Description
where object Filter conditions. See where clause examples below.
fields array Array of field names to include in the response (for example ["code", "account", "status"]).
order string Sort order (for example "account ASC" or "code DESC").
limit number Maximum number of results to return.
skip number Number of results to skip (for pagination).

Where Clause Examples

Common filter conditions for the where clause:

Field Example Description
code {"code": "6204"} Match a specific GL account code.
status {"status": "active"} Filter by status: active, archived, or deleted.
default {"default": true} Find the company default GL account.
externalId {"externalId": "SAP-472891"} Match by external ERP identifier.
subsidiaryCode {"subsidiaryCode": "US-EAST"} Filter GL lines for a specific subsidiary.
type {"type": "Expense"} Filter by account classification.
account {"account": {"like": "%Equipment%", "options": "i"}} Search by display name (case-insensitive partial match).
code + status {"code": "6204", "status": "active"} Combine conditions to narrow results.

Example Requests

Find an active GL account by code:

Using cURL:

curl -G https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-appid: YOUR_CLIENT_ID" \
  --data-urlencode 'filter={"where":{"code":"6204","status":"active"}}'

Using JavaScript (fetch):

const filter = {
  where: {
    code: '6204',
    status: 'active'
  },
  order: 'account ASC'
};

const filterParam = encodeURIComponent(JSON.stringify(filter));
const response = await fetch(`https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes?filter=${filterParam}`, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'x-appid': clientId
  }
});

const glAccounts = await response.json();

Search active GL accounts by display name:

Using JavaScript (fetch):

const filter = {
  where: {
    status: 'active',
    account: { like: '%Equipment%', options: 'i' }
  },
  limit: 25
};

const filterParam = encodeURIComponent(JSON.stringify(filter));
const response = await fetch(`https://sandbox.custodia-tech.com/md/api/LedgerAccountTypes?filter=${filterParam}`, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'x-appid': clientId
  }
});

const glAccounts = await response.json();

Response

Success Response (200 OK)

[
  {
    "id": "b7c2e891-4d03-4f12-8a6f-3e5d91c04b28",
    "code": "6204",
    "default": false,
    "account": "Field Equipment and Supplies",
    "locale": "en-US",
    "status": "active",
    "companyId": "2a8f6c14-9e7b-4d32-a816-5b3f0d8e72c1",
    "currency": "USD",
    "description": "Hand tools, PPE, and consumable supplies for field staff",
    "externalId": "SAP-472891"
  }
]

Returns an array of GL account objects. An empty array means no rows matched the filter.

Chart of Account Fields

Field reference for create, update, and find responses:

Parameter Type On create Description
id string Set by platform UUID of the GL account line.
code string Required in request GL account code.
account string Required in request Display name for the GL line.
default boolean Optional (default false) Whether this is the company default GL account.
status string Optional (default active) Lifecycle status: active, archived, or deleted.
description string Optional Additional details about the GL line.
externalId string Optional External system identifier.
type string Optional Account classification (for example Expense).
subsidiaryCode string Optional Subsidiary the GL line belongs to, when applicable.
companyId string Set by platform Company resolved from your access token.
locale string Set by platform Language locale. Defaults to en-US.
currency string Set by platform if omitted ISO currency code. Defaults to USD.

Error Responses

These endpoints may return the following error responses:

Status Code Description Solution
400 Bad Request Missing required field on create (code or account), duplicate code, or invalid field value on update Include mandatory fields on create, use a unique code, and verify update values match allowed formats
401 Unauthorized Invalid or missing access token Verify your access token is valid and included in the Authorization header
403 Forbidden Insufficient permissions Verify your access token has the required scopes and permissions
404 Not Found GL account line not found (for PATCH by ID) Verify the id is correct and belongs to your company