Categories

Categories #

Categories are a means of grouping together several accounts of the same type. This is useful for further subividing the Financial Statements beyond the classifications defined by IFRS.

Properties #

Direct Properties #

PropertyTypeDefinition
NameStringA label for the Category
Category TypeStringMust be one of the Account Types described in the API reference here

Indirect Properties #

PropertyTypeDefinition
AccountsListThe Account Resources that belong to the Category

Basics #

The parameters required to create a Category Resource are the name and the category type.

Request #

curl --location --request POST 'api.microbooks.io/books/v1/account' \
--data-raw '{
    "name": "Test Category",
    "category_type": "BANK"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {
    "name": "Test Category",
    "category_type": "BANK"
}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("POST", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://api.microbooks.io/books/v1/account',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{
        "name": "Test Category",
        "category_type": "BANK"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Test Category",
    "category_type": "BANK"
}';
$request = new Request('POST', 'https://api.microbooks.io/books/v1/account', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
    \"name": \"Test Category\",
    \"category_type\": \"BANK\"
}";
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Response #

{
    "status": "success",
    "message": "Bank Category: Test Category created successfully",
    "resource": {
        "name": "Test Category",
        "entity_id": 1,
        "id": 3,
        "type": "Bank"
    }
}
```## Operations
### Category Accounts
The Category Account endpoint retrieves the Accounts that belong to the Category, with their closing Balances and the total Balance of the Category. Optionally, the balances on the Accounts may be filtered by specifying a Start and End date.

#### Request


#### Response
```json
{
    "status": "success",
    "balances": {
        "total": 70,
        "accounts": [
            {
                "uuid": "121b6be5-0e3d-43ae-9a25-e47b46bc856e",
                "id": 1,
                "entity_id": 1,
                "category_id": 1,
                "currency_id": 1,
                "code": 501,
                "name": "Terrell Abbott IV",
                "description": null,
                "closingBalance": 70,
                "type": "Receivable",
                "is_closed": false
            }
        ]
    },
    "category_name": "Category One",
    "account_type": "Receivable"
}

Errors #

Below are the Errors that are returned by the Category Resource.

Detail CodeNameDefinition
100Orphaned ItemsCannot recycle the Category Resource because it has dependent Resources
101Missing EntityThe Category Resource requires an existing Entity because it is a means of Grouping the Balances of Accounts in different Sections of the Financial Statements produced by the platform, which are scoped to an Entity