The Griffin Developer Hub

Welcome to the Griffin developer hub. You'll find comprehensive guides and documentation to help you start working with us as quickly as possible, as well as support if you get stuck. Let's jump right in!

Create a Chart of Accounts

📘

This article assumes you have an API key, and have made successful requests to the Griffin API.

If you do not have an API key, you can create one via The Griffin Sandbox tutorial.

Creating a Chart of Accounts is often one of the early accounting concerns for an organisation. It categorises all accounts in to a tree structure depending on type.

Our Concepts documentation gives further detail on what a Chart of Accounts is and the role it plays with respect to the General Ledger.

Locating the Chart of Accounts

The Chart of Accounts belongs to your Griffin Organisation. If you know your user ID, you can list your organisations via: /users/{user-id}/organizations.

curl -H "Authorization: GriffinAPIKey $API_KEY" -H 'Accept: application/json' "https://api.griffin.sh/users/ur.JS9nzGsvVPS9BZXQXDizFQ/organizations"

{
  "organizations": [
    {
      "organization-users-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/users",
      "sovereigns-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/sovereigns",
      "ledgers-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/ledger/accounts",
      "corporations-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/corporations",
      "accounts-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/bank/accounts",
      "display-name": "My Company",
      "transfers-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/bank/transfers",
      "organization-invitations-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/invitations",
      "exports-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/exports",
      "individuals-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/individuals",
      "ledger-entries-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/ledger/transfers",
      "organization-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ",
      "organization-api-keys-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/api-keys",
      "charts-of-accounts-url": "/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/charts-of-accounts"
    }
  ]
}

Within this response there is a "charts-of-accounts-url". This can be called to list all Charts of Accounts assigned to the organization.

🚧

Multiple Charts of Accounts?

You may notice that the Griffin API supports multiple Charts of Accounts. This functionality exists to support workflows not covered in this guide.

It is not expected for an organisation to have multiple Charts of Accounts in practice, and we will continue with a single Chart of Accounts.

curl -H "Authorization: GriffinAPIKey $API_KEY" -H 'Accept: application/json' "https://api.griffin.sh/organizations/og.xUUoNfH4WSiWwNaD-n3nBQ/charts-of-accounts"

{
  "charts-of-accounts": [
    {
      "chart-of-accounts-url": "/charts-of-accounts/ca.kKFovNXOXBe_hEAlfofx9Q",
      "categories-url": "/charts-of-accounts/ca.kKFovNXOXBe_hEAlfofx9Q/ledger-categories",
      "display-name": "Chart of accounts"
    }
  ]
}

Fetching the Chart of Accounts Structure

In the previous request, we were returned one Chart of Accounts entry containing "chart-of-accounts-url" and "categories-url". We will use "categories-url" to fetch the structure of the Chart of Accounts. That is, we want to list all the account categories that compose the Chart of Accounts.

curl -H "Authorization: GriffinAPIKey $API_KEY" -H 'Accept: application/json' "https://api.griffin.sh/charts-of-accounts/ca.kKFovNXOXBe_hEAlfofx9Q/ledger-categories"

{
  "ledger-categories": [
    {
      "ledger-category-url": "/ledger-categories/lc.1so6BlczUu21w5Gr3XDiUg",
      "display-name": "Assets",
      "code": "1"
    },
    {
      "ledger-category-url": "/ledger-categories/lc.AMpyLUi8XUWzVWGBu8VkAw",
      "display-name": "Liabilities",
      "code": "2"
    },
    {
      "ledger-category-url": "/ledger-categories/lc.tC7LTTWNVGGiFeg21p8nzQ",
      "display-name": "Equity",
      "code": "3"
    },
    {
      "ledger-category-url": "/ledger-categories/lc.2And-J4-VRKeLaqXhXctFQ",
      "display-name": "Income",
      "code": "4"
    },
    {
      "ledger-category-url": "/ledger-categories/lc.EZuX5glwWGm7wi8YnQPQSw",
      "display-name": "Expenses",
      "code": "5"
    },
    {
      "ledger-category-url": "/ledger-categories/lc.qaKfibLJVnS8hm5Wfual8Q",
      "display-name": "Off-balance Sheet",
      "code": "6"
    }
  ]
}

These six categories are provided as standard by Griffin and fixed. You have complete freedom to create as many child categories as you like underneath these. For example, our internal Griffin Chart of Accounts contains around 200 categories.

Creating a New Category in the Chart of Accounts

It will be up to you to define the correct structure for you Chart of Accounts. For the purposes of this guide, we are going to create the category "Cash and Cash Equivalents" underneath "Assets".

To do this, we need the "ledger-category-url" from the above response - this will be used as the "parent-ledger-category-url" in the request.

curl -H "Authorization: GriffinAPIKey $API_KEY" -H 'Content-Type: application/json' -H 'Accept: application/json' "https://api.griffin.sh/charts-of-accounts/ca.kKFovNXOXBe_hEAlfofx9Q/ledger-categories" \
     --data '{
       "parent-ledger-category-url": "/ledger-categories/lc.1so6BlczUu21w5Gr3XDiUg",
       "display-name": "Cash and Cash Equivalents"
     }'

{
  "ledger-category-url": "/ledger-categories/lc.cRdM_-yGU96ueWfjr8Wbfg",
  "display-name": "Cash and Cash Equivalents",
  "code": "1.1",
  "parent-ledger-category-url": "/ledger-categories/lc.1so6BlczUu21w5Gr3XDiUg"
}

Our child category has been created. N.B. the code is 1.1 - all categories in a Griffin Chart of Accounts are assigned a code which uniquely identifies it's position in the Chart of Accounts. In this case, the first 1 identifies it as belonging to Assets, and the second 1 means that it is in the first position within Assets. If we were to add another category to Assets, it would be assigned 1.2, and so on.

It is perfectly possible and appropriate to use this ledger category as a parent by using the returned "ledger-category-url". In this case, we will be assigned the code 1.1.1, as below.

{
  "ledger-category-url": "/ledger-categories/lc.6gPquu7VWWiPx34lfy8DhQ",
  "display-name": "Cash",
  "code": "1.1.1",
  "parent-ledger-category-url": "/ledger-categories/lc.cRdM_-yGU96ueWfjr8Wbfg"
}

Creating an Account in a Category

The final step is to add an account to a category we have created. You will need a legal person ID. One was assigned to you on signup and it can be found via /organizations/{organization-id}/ledger/accounts.

curl -v -H "Authorization: GriffinAPIKey $API_KEY" -H 'Content-Type: application/json' -H 'Accept: application/json' "https://api.griffin.sh/charts-of-accounts/ca.kKFovNXOXBe_hEAlfofx9Q/ledger-categories" \
        --data '{
          "display-name": "Foo",
          "ledger-category-url": "/ledger-categories/lc.cRdM_-yGU96ueWfjr8Wbfg",
          "account-controller-url": "/legal-persons/lp.ioYdMyG8UrW2flPpXNhAkA",
          "account-owner-url": "/legal-persons/lp.ioYdMyG8UrW2flPpXNhAkA"
      }'

Updated 24 days ago

Create a Chart of Accounts


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.