Accounts

Step 2: Accounts #

Accounts are the means by which transactions are aggregated according to the double entry rule of Bookkeeping. Each transaction must have at least two accounts (one for each side of the double entry) and sum of the amounts posted to them must always net to 0.

For the purpose of this quickstart, we will require quite a number of differnet accounts for various sections of the Business. We will create each of these accounts in turn, with a short description of what each account is about.

Balance Sheet Accounts #

Balance Sheet Accounts contain amounts representing what the Entity owns, as compared to what it owes at any given point in time.

Capital Account #

This account records the Entity’s owners' interest. It requires a name and must be of type EQUITY.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Capital Account",
    "account_type": "EQUITY"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Capital Account", "account_type": "EQUITY"}
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": "Capital Account",
        "account_type": "EQUITY"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Capital Account",
    "account_type": "EQUITY"
}';
$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/entity");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
    \"name\": \"Capital Account\", 
    \"account_type\": \"EQUITY\"
}";
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": "Equity: Capital Account created successfully",
    "resource": {
        "name": "Capital Account",
        "currency_id": 1,
        "code": 3001,
        "entity_id": 1,
        "id": 1,
        "type": "Equity",
        "is_closed": false,
        "category": null
    }
}

Bank Account #

This account will keep track of the liquid (Cash) assets of the Entity. It requires a name and must be of type BANK.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Bank Account",
    "account_type": "BANK"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Bank Account", "account_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": "Bank Account",
        "account_type": "BANK"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Bank Account",
    "account_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\": \"Bank Account\", 
    \"account_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: Bank Account created successfully",
    "resource": {
        "name": "Bank Account",
        "currency_id": 1,
        "code": 301,
        "entity_id": 1,
        "id": 2,
        "type": "Bank",
        "is_closed": false,
        "category": null
    }
}

Receivable Account #

This account will record sales made on Credit, i.e. it represents a Debtor to the Entity. It requires a name and must be of type RECEIVABLE.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Receivable Account",
    "account_type": "RECEIVABLE"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Receivable Account", "account_type": "RECEIVABLE"}
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": "Receivable Account",
        "account_type": "RECEIVABLE"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Receivable Account",
    "account_type": "RECEIVABLE"
}';
$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\": \"Receivable Account\", 
    \"account_type\": \"RECEIVABLE\"
}";
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": "Receivable: Receivable Account created successfully",
    "resource": {
        "name": "Receivable Account",
        "currency_id": 1,
        "code": 501,
        "entity_id": 1,
        "id": 3,
        "type": "Receivable",
        "is_closed": false,
        "category": null
    }
}

Asset Account #

This account will record purchases the value of Illiquid/Fixed Assets. It requires a name and must be of type NON_CURRENT_ASSET.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Asset Account",
    "account_type": "NON_CURRENT_ASSET"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Asset Account", "account_type": "NON_CURRENT_ASSET"}
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": "Asset Account",
        "account_type": "NON_CURRENT_ASSET"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Asset Account",
    "account_type": "NON_CURRENT_ASSET"
}';
$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\": \"Asset Account\", 
    \"account_type\": \"NON_CURRENT_ASSET\"
}";
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": "Non Current Asset: Asset Account created successfully",
    "resource": {
        "name": "Asset Account",
        "currency_id": 1,
        "code": 1,
        "entity_id": 1,
        "id": 4,
        "type": "Non Current Asset",
        "is_closed": false,
        "category": null
    }
}

Payable Account #

This account will record purchases made on Credit, i.e. it represents a Creditor to the Entity. It requires a name and must be of type PAYABLE.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Payable Account",
    "account_type": "PAYABLE"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Payable Account", "account_type": "PAYABLE"}
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": "Payable Account",
        "account_type": "PAYABLE"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Payable Account",
    "account_type": "PAYABLE"
}';
$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\": \"Payable Account\", 
    \"account_type\": \"PAYABLE\"
}";
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": "Payable: Payable Account created successfully",
    "resource": {
        "name": "Payable Account",
        "currency_id": 1,
        "code": 2401,
        "entity_id": 1,
        "id": 5,
        "type": "Payable",
        "is_closed": false,
        "category": null
    }
}

Output VAT Account #

This account will record VAT charged on sales. It requires a name and must be of type CONTROL.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Output VAT Account",
    "account_type": "CONTROL"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Output VAT Account", "account_type": "CONTROL"}
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": "Output VAT Account",
        "account_type": "CONTROL"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Output VAT Account",
    "account_type": "CONTROL"
}';
$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\": \"Output VAT Account\", 
    \"account_type\": \"CONTROL\"
}";
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": "Control: Output VAT Account created successfully",
    "resource": {
        "name": "Output VAT Account",
        "currency_id": 1,
        "code": 2101,
        "entity_id": 1,
        "id": 6,
        "type": "Control",
        "is_closed": false,
        "category": null
    }
}

Input VAT Account #

This account will record VAT charged on purchases. It requires a name and must be of type CONTROL.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Input VAT Account",
    "account_type": "CONTROL"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Input VAT Account", "account_type": "CONTROL"}
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": "Input VAT Account",
        "account_type": "CONTROL"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Input VAT Account",
    "account_type": "CONTROL"
}';
$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\": \"Input VAT Account\", 
    \"account_type\": \"CONTROL\"
}";
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": "Control: Input VAT Account created successfully",
    "resource": {
        "name": "Input VAT Account",
        "currency_id": 1,
        "code": 2102,
        "entity_id": 1,
        "id": 7,
        "type": "Control",
        "is_closed": false,
        "category": null
    }
}

Income Statement Accounts #

Income Statement Accounts contain amounts relating to the operations of the Entity within the current Reporting Period.

Revenue Account #

Expenses incurred in the course of the normal operations of the Entity are recorded into this account. It requires a name and must be of type OPERATING_EXPENSE.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Revenue Account",
    "account_type": "OPERATING_REVENUE"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Revenue Account", "account_type": "OPERATING_REVENUE"}
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": "Revenue Account",
        "account_type": "OPERATING_REVENUE"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Revenue Account",
    "account_type": "OPERATING_REVENUE"
}';
$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\": \"Revenue Account\", 
    \"account_type\": \"OPERATING_REVENUE\"
}";
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": "Operating Revenue: Revenue Account created successfully",
    "resource": {
        "name": "Revenue Account",
        "currency_id": 1,
        "code": 4001,
        "entity_id": 1,
        "id": 8,
        "type": "Operating Revenue",
        "is_closed": false,
        "category": null
    }
}

COGS Account #

Expenses incurred in the course of the normal operations of the Entity are recorded into this account. It requires a name and must be of type OPERATING_EXPENSE.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "COGS Account",
    "account_type": "OPERATING_EXPENSE"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "COGS Account", "account_type": "OPERATING_EXPENSE"}
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": "COGS Account",
        "account_type": "OPERATING_EXPENSE"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "COGS Account",
    "account_type": "OPERATING_EXPENSE"
}';
$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\": \"COGS Account\", 
    \"account_type\": \"OPERATING_EXPENSE\"
}";
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": "Operating Expense: COGS Account created successfully",
    "resource": {
        "name": "COGS Account",
        "currency_id": 1,
        "code": 5001,
        "entity_id": 1,
        "id": 9,
        "type": "Operating Expense",
        "is_closed": false,
        "category": null
    }
}

Expense Account #

This account will record the expenses that are auxilliary to the operations. It requires a name and could be one of three different types, but we’ll go with DIRECT_EXPENSE for this quickstart.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/account' \
--header "Authorization: Bearer <bearer_token>" \
--data-raw '{
    "name": "Expense Account",
    "account_type": "DIRECT_EXPENSE"
}'
import requests

url = "https://api.microbooks.io/books/v1/account"
body = {"name": "Expense Account", "account_type": "DIRECT_EXPENSE"}
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": "Expense Account",
        "account_type": "DIRECT_EXPENSE"
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "name": "Expense Account",
    "account_type": "DIRECT_EXPENSE"
}';
$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\": \"Expense Account\", 
    \"account_type\": \"DIRECT_EXPENSE\"
}";
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": "Direct Expense: Expense Account created successfully",
    "resource": {
        "name": "Expense Account",
        "currency_id": 1,
        "code": 6001,
        "entity_id": 1,
        "id": 10,
        "type": "Direct Expense",
        "is_closed": false,
        "category": null
    }
}

For more details on the Account endpoint check out the How To Guide page as well as the Postman API Reference.