GL accounts
name holds the account number and description holds the label. That is backwards from most expectations and it is the single most important thing to know about this resource. Scoped per company, on the companyid column.
The object#
| Field | Type | Description |
|---|---|---|
| idread-only | integer | NolaPro id. |
| name | string(20) | The code this resource is keyed by. Matching is case insensitive. |
| description | string(255) | The account label, despite the column name. |
| accounttypeid | integer | Account type. See glaccounttypes - read-only. |
| block_journal | boolean | When true this account refuses direct journal entries, and gltransactions writes against it are rejected. |
| cancel | boolean | True once cancelled. Cancelled rows stay referenced by history. |
| externalid | string(100) | Your own key for this gl accounts. Scoped to your company. |
| lastchangedateread-only | string | Last modification (lastchangedate). Drives modifiedsince. |
Endpoints#
Period totals for one GL account.
The per-period balances NolaPro maintains for the account - the series a trial balance or a comparative statement is built from.
/glaccounts/{id}/balance answers for a single date. This answers for every period, split into posted, unposted, and the year-end entries that close the books.
Do not recompute these by summing gltransaction. NolaPro maintains them through period close, so a recomputed figure will disagree with the books after any adjustment or closing entry - and the books are the version the accountant already signed.
Requires scope glaccounts:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The GL account id. |
| Status | Code | Meaning |
|---|---|---|
| 422 | unknown_value | No such parent record in this company. The same answer whether it does not exist or belongs to someone else, so a caller cannot probe another company's ids. |
curl \ 'https://acme.nolapro.com/!/api/v2/glaccounts/104/periods' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/glaccounts/104/periods'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/glaccounts/104/periods", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/glaccounts/104/periods', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/glaccounts/104/periods"); res.EnsureSuccessStatusCode();
List gl accounts.
Requires scope glaccounts:read.
| Name | In | Type | Notes |
|---|---|---|---|
| description | query | string | description. Partial match, case-insensitive. |
| name | query | string | Partial match, case insensitive. |
| cancel | query | string | Defaults to false. Pass true for cancelled only, or any. |
| modifiedsince | query | string | RFC 3339 UTC timestamp. Returns only records changed since then, including cancelled ones - so cancel defaults to any rather than false when this is used. The response carries _meta.synced_through; store it and send it back next time. |
| externalid | query | string | Exact match on your own key. Scoped to your company. |
| include | query | string | Comma-separated extras to embed. Only custom_fields is available: the extra fields this install has defined on the record. Off by default, and an unrecognised value is refused rather than ignored. See Conventions. |
| Status | Code | Meaning |
|---|---|---|
| 403 | insufficient_scope | Token lacks glaccounts:read. |
curl \ 'https://acme.nolapro.com/!/api/v2/glaccounts' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/glaccounts'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/glaccounts", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/glaccounts', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/glaccounts"); res.EnsureSuccessStatusCode();
Retrieve one record.
Requires scope glaccounts:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The record id. |
| include | query | string | Comma-separated extras to embed. Only custom_fields is available: the extra fields this install has defined on the record. Off by default, and an unrecognised value is refused rather than ignored. See Conventions. |
| Status | Code | Meaning |
|---|---|---|
| 404 | not_found | No record with that id. |
curl \ 'https://acme.nolapro.com/!/api/v2/glaccounts/104' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/glaccounts/104'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/glaccounts/104", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/glaccounts/104', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/glaccounts/104"); res.EnsureSuccessStatusCode();
{
"id": 2376,
"name": "4000",
"description": "Sales - Retail",
"accounttypeid": 4,
"block_journal": false,
"cancel": false
}
Account balance, per currency.
Replaces v1's account-balance action. Computed by Glaccount_model::getBalance() - the same code the Trial Balance uses, so the number here and the number on the report cannot disagree.
Optional asofdate picks a different point in time; it defaults to the end of the current GL period.
Requires scope glaccounts:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The GL account id. |
| asofdate | query | string | Defaults to the end of the current GL period. |
| Status | Code | Meaning |
|---|---|---|
| 404 | not_found | No account with that id. |
curl \ 'https://acme.nolapro.com/!/api/v2/glaccounts/104/balance' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/glaccounts/104/balance'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/glaccounts/104/balance", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/glaccounts/104/balance', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/glaccounts/104/balance"); res.EnsureSuccessStatusCode();
{
"balances": [
{
"currency": "Example currency",
"balance": "125.0000",
"period": "125.0000"
}
]
}
Posted transactions against this account.
The detail lines behind /glaccounts/{id}/balance, newest first.
Posted lines only. An unposted voucher is not part of the balance, so including it here would give you an activity list that does not add up to the balance on the same page - which is the one thing this endpoint has to get right.
Dates filter on the GL period the voucher posted to (post2date), not the day it was keyed, for the same reason: that is what the balance is measured against.
Amounts are signed - debits positive, credits negative - and the lines of any one voucher sum to zero.
Requires scope glaccounts:read.
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | integer | The GL account id. |
| fromdate | query | string | Only lines posted to this period or later. |
| todate | query | string | Only lines posted to this period or earlier. |
| page | query | integer | Page number, 1-based. |
| perpage | query | integer | Rows per page. |
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A date that is not a date, or page 0. |
| 404 | not_found | No account with that id. |
curl \ 'https://acme.nolapro.com/!/api/v2/glaccounts/104/activity' \ -H 'Authorization: Bearer $NP_TOKEN'
$ch = curl_init('https://acme.nolapro.com/!/api/v2/glaccounts/104/activity'); curl_setopt_array($ch, [ CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('NP_TOKEN')], CURLOPT_RETURNTRANSFER => true, ]); $res = json_decode(curl_exec($ch), true);
import os, requests r = requests.get( "https://acme.nolapro.com/!/api/v2/glaccounts/104/activity", headers={"Authorization": f"Bearer {os.environ['NP_TOKEN']}"}, ) r.raise_for_status()
const res = await fetch( 'https://acme.nolapro.com/!/api/v2/glaccounts/104/activity', { method: 'GET', headers: { Authorization: `Bearer ${process.env.NP_TOKEN}` }, } ); const data = await res.json();
using System.Net.Http.Json; var token = Environment.GetEnvironmentVariable("NP_TOKEN"); using var http = new HttpClient(); http.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var res = await http.GetAsync( "https://acme.nolapro.com/!/api/v2/glaccounts/104/activity"); res.EnsureSuccessStatusCode();
{
"data": [
[]
]
}