JSON API: Account Queries

Account queries retrieve information on one or more ledger accounts. The API paginates responses. The default page size is a configuration setting. Applications can reduce the number of results per page by passing the limit property. It is not possible to increase the page size past the configured default.

The after property is used to identify the page position on second and subsequent requests. This property is returned with the result set. Applications should pass this back on the next request to get the next page of data.

Accounts are retrieved by code. There are two ways to select results: the range and rangeEnding properties specify the first and last code to retrieve, respectively. Alternatively, the codes array can be used to select or exclude specific codes and code ranges. See Range Selectors for more information on ranges with examples.

Refer to the account request schema for a formal definition of the request, and the account response schema for the response.

Route: account/query

A query for all accounts in the default domain has no properties:

{}

This will return accounts up to the default value of limit, starting with the root account (which has no code property):

{
  "accounts":[
    {
      "uuid":"e04a4796-7daa-4f31-9e0d-e0ed700336b6",
      "names":[
        {
          "name":"General Ledger Test",
          "language":"en-CA",
          "createdAt":"2021-12-19T19:28:25.542281Z",
          "updatedAt":"2021-12-19T19:28:25.542281Z"},
        {
          "name":"Tester le grand livre",
          "language":"fr-CA",
          "createdAt":"2021-12-19T19:28:25.544215Z",
          "updatedAt":"2021-12-19T19:28:25.544215Z"}],
      "category":true,
      "debit":false,
      "credit":false,
      "closed":false,
      "revision":"8feb05d654284b6d004f3a63ad423322571e3dc8b2f45a32c74895fe21a6544b",
      "createdAt":"2021-12-19T19:28:25.536820Z",
      "updatedAt":"2021-12-19T19:28:25.536820Z"},
    {
      "uuid":"63b0c2cb-3951-4ce3-893b-cd5701286bec",
      "code":"1000",
      "parentUuid":"e04a4796-7daa-4f31-9e0d-e0ed700336b6",
      "names": [
        {
          "name":"Assets",
          "language":"en",
          "createdAt":"2021-12-19T19:28:25.550171Z",
          "updatedAt":"2021-12-19T19:28:25.550171Z"
        }
      ],
      "category":true,
      "debit":true,
      "credit":false,
      "closed":false,
      "revision":"d558768d9e1180c8634afc6d3940d5e6bb531a100249f3a88e93f1d918c26107",
      "createdAt":"2021-12-19T19:28:25.546522Z",
      "updatedAt":"2021-12-19T19:28:25.546522Z"
    }
  ],
  "time":"2021-12-19T19:28:34.742175Z"
}

The query for the next page of accounts will pass the ID of last record in the first result as the after property:

A query for all accounts in the default domain has no properties:

{
  "after": {
    "uuid": "63b0c2cb-3951-4ce3-893b-cd5701286bec"
  }
}

The result is another set of account details.