Statistical accounts

Statistical accounts are used to track non-financial data, such as employee headcount, number of members, or even the number of rooms in a hotel.

List statistical accounts

get/objects/general-ledger/statistical-account

Returns a collection with a key, ID, and link for each account. This operation is mostly for use in testing; use the query service to find statistical GL accounts that meet certain criteria and to specify the properties that you want in the response.

Permissions and other requirements
SubscriptionCompany
User typeBusiness, Employee, Project Manager, and Warehouse
PermissionsList, View Statistical Accounts
SecurityOAuth2
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "397",
      • "id": "9001",
      • "href": "/objects/general-ledger/statistical-account/397"
      },
    • {
      • "key": "398",
      • "id": "9002",
      • "href": "/objects/general-ledger/statistical-account/398"
      },
    • {
      • "key": "399",
      • "id": "9003",
      • "href": "/objects/general-ledger/statistical-account/399"
      }
    ],
  • "ia::meta": {
    • "totalCount": 3,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}

Create a statistical account

post/objects/general-ledger/statistical-account

Creates a new statistical account. You should assign a completely different account range to statistical accounts so that they are not inadvertently grouped with general ledger accounts. Statistical accounts can be consolidated similarly to general ledger accounts, if you have a consolidated structure of companies with subsidiaries.

Individual statistical accounts are typically rolled up into account groups for use in reports.

Permissions and other requirements
SubscriptionCompany, General Ledger
User typeBusiness user with admin privileges
PermissionsAdd Statistical Accounts
SecurityOAuth2
Request
Request Body schema: application/json
id
required
string

Statistical account ID.

Example: "9001"
name
required
string

Name or title of this statistical account.

Example: "Customer Account"
reportType
string
Default: "forPeriod"

This is a non-functional field, for information purposes only. It does not affect how amounts are calculated for reporting.

Enum: "cumulative" "forPeriod"
Example: "forPeriod"
object

The dimensions that must be included on transactions that post to the account.

class
boolean
Default: false

Set to true to require a value for class.

Example: false
contract
boolean
Default: false

Set to true to require a value for contract.

Example: false
customer
boolean
Default: false

Set to true to require a value for customer.

Example: false
department
boolean
Default: false

Set to true to require a value for department.

Example: true
employee
boolean
Default: false

Set to true to require a value for employee.

Example: false
item
boolean
Default: false

Set to true to require a value for item.

Example: false
location
boolean
Default: false

Set to true to require a value for location.

Example: false
project
boolean
Default: false

Set to true to require a value for project.

Example: false
vendor
boolean
Default: false

Set to true to require a value for vendor.

Example: false
warehouse
boolean
Default: false

Set to true to require a value for warehouse.

Example: false
asset
boolean
Default: false

Set to true to require a value for asset.

Example: false
affiliateEntity
boolean
Default: false

Set to true to require a value for affiliate entity.

Example: false
isTaxable
boolean
Default: false

Set to true to mark the account as taxable.

Example: true
category
string

Account categories are pre-defined groupings that arrange accounts into out-of-the-box reports, graphs, and performance cards. This field is available only for companies that were created with a QuickStart template or chose one later. If enabled, set a category for the account. The available values are tied to the particular QuickStart template used for the company.

Example: "Customers"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
201

Created

400

Bad Request

Request samples
application/json
{
  • "id": "9030",
  • "name": "Customer Account",
  • "reportType": "forPeriod",
  • "status": "active",
  • "requireDimensions": {
    • "department": true,
    • "location": true
    },
  • "isTaxable": false,
  • "category": "Customers"
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "439",
    • "id": "9030",
    • "href": "/objects/general-ledger/statistical-account/439"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Get a statistical account

get/objects/general-ledger/statistical-account/{key}

Returns detailed information for a specified statistical account.

Permissions and other requirements
SubscriptionCompany
User typeBusiness, Employee, Project Manager, and Warehouse
PermissionsList, View Statistical Accounts
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the statistical account.

Example: 439
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "key": "397",
    • "id": "9001",
    • "name": "Customer Account",
    • "reportType": "forPeriod",
    • "status": "active",
    • "audit": {
      • "modifiedDateTime": "2023-10-21T04:55:32Z",
      • "createdDateTime": "2023-09-20T11:29:30Z",
      • "createdBy": "1",
      • "modifiedBy": "1"
      },
    • "requireDimensions": {
      • "department": false,
      • "location": false,
      • "project": false,
      • "customer": false,
      • "vendor": false,
      • "employee": false,
      • "item": false,
      • "class": false
      },
    • "isTaxable": true,
    • "category": "Customers",
    • "href": "/objects/general-ledger/statistical-account/397"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Update a statistical account

patch/objects/general-ledger/statistical-account/{key}

Updates an existing statistical account by setting field values. Any fields not provided remain unchanged.

Permissions and other requirements
SubscriptionCompany
User typeBusiness user with admin privileges
PermissionsEdit Statistical Accounts
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the statistical account.

Example: 439
Request Body schema: application/json
id
string

Statistical account ID.

Example: "9001"
name
string

Name or title of this statistical account.

Example: "Customer Account"
reportType
string
Default: "forPeriod"

This is a non-functional field, for information purposes only. It does not affect how amounts are calculated for reporting.

Enum: "cumulative" "forPeriod"
Example: "forPeriod"
object

The dimensions that must be included on transactions that post to the account.

class
boolean
Default: false

Set to true to require a value for class.

Example: false
contract
boolean
Default: false

Set to true to require a value for contract.

Example: false
customer
boolean
Default: false

Set to true to require a value for customer.

Example: false
department
boolean
Default: false

Set to true to require a value for department.

Example: true
employee
boolean
Default: false

Set to true to require a value for employee.

Example: false
item
boolean
Default: false

Set to true to require a value for item.

Example: false
location
boolean
Default: false

Set to true to require a value for location.

Example: false
project
boolean
Default: false

Set to true to require a value for project.

Example: false
vendor
boolean
Default: false

Set to true to require a value for vendor.

Example: false
warehouse
boolean
Default: false

Set to true to require a value for warehouse.

Example: false
asset
boolean
Default: false

Set to true to require a value for asset.

Example: false
affiliateEntity
boolean
Default: false

Set to true to require a value for affiliate entity.

Example: false
isTaxable
boolean
Default: false

Set to true to mark the account as taxable.

Example: true
category
string

Account categories are pre-defined groupings that arrange accounts into out-of-the-box reports, graphs, and performance cards. This field is available only for companies that were created with a QuickStart template or chose one later. If enabled, set a category for the account. The available values are tied to the particular QuickStart template used for the company.

Example: "Customers"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "name": "Customer Accounts",
  • "isTaxable": true
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "397",
    • "id": "9001",
    • "href": "/objects/general-ledger/statistical-account/397"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Delete a statistical account

delete/objects/general-ledger/statistical-account/{key}

Deletes a statistical account. Accounts used in a book transaction cannot be deleted. Deleted accounts cannot be recovered.

Permissions and other requirements
SubscriptionCompany, General Ledger
User typeBusiness, Employee
PermissionsDelete Statistical Accounts
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the statistical account.

Example: 439
Responses
204

No Content

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "ia::error": {
      • "code": "invalidRequest",
      • "message": "A POST request requires a payload",
      • "errorId": "REST-1028",
      • "additionalInfo": {
        },
      • "supportId": "Kxi78%7EZuyXBDEGVHD2UmO1phYXDQAAAAo"
      }
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 0,
    • "totalError": 1
    }
}

Query statistical accounts

post/services/core/query

Queries an object for filtered data.

SecurityOAuth2
Request
Request Body schema: application/json
object
string

Object type to query, in the form <application-name>/<object name>. For custom objects use platform-apps/nsp::<object-name>.

Example: "general-ledger/statistical-account"
fields
Array of strings

List of fields to include in the response. Can be any combination of these:

  • The name of a field in the object that you are querying, such as id.

  • The name of a field in a related object, using the form relatedObjectName.fieldName, such as vendor.id.

  • The result of an aggregate function run against the values in the returned objects. Use the form function:fieldName, such as min:startDate to return the earliest starting date. Valid function names are:

    • count
    • avg
    • sum
    • min
    • max
  • The result of an aggregate function run against the values in related objects, using the form function:relatedObjectName.fieldName, such as max:vendor.creditLimit. The same functions are supported as for object fields.

Example: ["key","id","max:vendor.creditLimit"]
Array of equal (object) or not equal (object) or less than (object) or (less than or equal (object)) or greater than (object) or (greater than or equal (object)) or in (object) or not in (object) or between (object) or not between (object) or contains (object) or does not contain (object) or starts with (object) or does not start with (object) or ends with (object) or does not end with (object)

Filter conditions to select the objects to return based on their field values. You use operators and conditions to build your filter, such as {"$eq":{"status":"active"}} to select objects in which status is equal to "active".

Example: [{"$eq":{"status":"active"}},{"$gt":{"totalDue":"1000"}},{"$contains":{"name":"Acme"}}]
Array
Any of:

Field value must be equal to this specified value.

For date fields, you can use these macro values that are relative to the current date or the asOfDate in filterParameters, if set:

  • today
  • currentWeek
  • currentMonth
  • currentQuarter
  • currentYear
  • yesterday
  • lastWeek
  • priorMonth
  • priorQuarter
  • priorYear

These are most useful for queries that you want to save and use repeatedly, such as for views or reports. Just change the asOfDate each time to retrieve the same data set for different time periods.

For example, {"eq":{"postingDate":"priorYear"}}.

object

The field name and value to be compared with object values.

Example: {"status":"active"}
filterExpression
string
Default: "and"

Logical operators to apply when there are multiple filter conditions. The conditions in the filters array are implicitly numbered starting at 1. Supports and, or, and grouping with parentheses.

Shortcuts:

  • and by itself means that all conditions must be true.
  • or by itself means that at least one condition must be true.
Example: "(1 and 2) or 3"
object

Pre-defined filter options.

asOfDate
string <date>

The "as of" date to use with any relative date comparisons in filters. For example, if asOfDate is set to "2022-04-01" then priorMonth will be "03".

The current date is used if asOfDate is not set.

Example: "2022-04-01"
includeHierarchyFields
boolean
Default: false

Set to true to include hierarchical structure information with each object in the response.

Example: false
caseSensitiveComparison
boolean
Default: true

Queries are case-sensitive by default. Set to false to ignore case in a query.

Example: true
includePrivate
boolean
Default: false

By default, in a multi-entity company, queries from the top-level entity do not access data in private entities. Set includePrivate to true if you want to query data in private entities.

Example: false
Array of objects

Set the order of the results by specifying field names to sort by and whether they should be in ascending or descending order.

Example: [{"totalDue":"asc"},{"lastPaymentMadeDate":"desc"}]
Array
property name*
additional property
string
Enum: "asc" "desc"
start
integer

First record of the result set to include in the response.

Example: 1
size
integer

Number of records to include in the response.

Example: 100
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "object": "general-ledger/statistical-account",
  • "filters": [
    • {
      • "$eq": {
        }
      }
    ],
  • "fields": [
    • "key",
    • "id",
    • "name",
    • "status",
    • "href"
    ],
  • "orderBy": [
    • {
      • "id": "asc"
      }
    ]
}
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "351",
      • "id": "9088",
      • "name": "Customer count",
      • "status": "active",
      • "href": "/objects/general-ledger/statistical-account/351"
      },
    • {
      • "key": "352",
      • "id": "9100",
      • "name": "Employee headcount",
      • "status": "active",
      • "href": "/objects/general-ledger/statistical-account/352"
      }
    ],
  • "ia::meta": {
    • "totalCount": 2,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}