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!

Navigating the API

The API is designed to be navigable. That is, responses contain URLs as well as IDs in many cases. If you have successfully created an API key for the sandbox, you will have seen an example of this by calling /index.

The primary method of navigating our API is through following URLs you find in responses. For exploration purposes, you should never need to construct URLs yourself using IDs.

The consequence of this design choice is that you can explore our API by making a single initial request and following links from one resource to another.

Of course, if you know the ID of a resource, you can use our API Reference to construct a direct URL to it.

📘

This pattern is often known as 'Hypertext As The Engine Of Application State' (HATEOAS).
You can think of navigating the API in the same way as clicking links within
your web browser.

Example

In this example, you will be able to walk the API from your user, to querying the transactions for a bank account.

Once you have your API key ($API_KEY) and user ID ($USER_ID), you can request a list of all organisations your user has access to (typically one):

curl "https://api.griffin.sh/v0/users/$USER_ID/organizations" \
  -H "Authorization: GriffinAPIKey $API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

The response will look something like the below - the organisation ID starting with og. will be unique to you. The definition of each URL is available in the API Reference.

{
  "organizations": [
    {
      "organization-users-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/users",
      "organization-individuals-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/individuals",
      "ledgers-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/ledger/accounts",
      "organization-sovereigns-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/sovereigns",
      "accounts-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/bank/accounts",
      "display-name": "My Organisation",
      "transfers-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/bank/transfers",
      "own-legal-person-url": "/v0/corporations/lp.aDBVsDJYVyaPeU2V6PqkmQ",
      "organization-trial-balance-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/ledger/trial-balance",
      "organization-corporations-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/corporations",
      "organization-invitations-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/invitations",
      "exports-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/exports",
      "ledger-entries-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/ledger/transfers",
      "organization-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ",
      "organization-api-keys-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/api-keys",
      "journal-entries-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/ledger/journal-entries",
      "charts-of-accounts-url": "/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/charts-of-accounts"
    }
  ]
}

You might then be interested in a listing of all bank accounts. To do so, you look up accounts-url in the data structure above, and request the URL. In the example, the URL is /v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/bank/accounts; appending that to https://api.griffin.sh will return the list of bank accounts.

curl "https://api.griffin.sh/v0/organizations/og.3Uh8Vu6J7XmUbje_NC_2LQ/bank/accounts" \
  -H "Authorization: GriffinAPIKey $API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json'

The response will look similar to the below, if you have a single account defined:

{
  "accounts": [
    {
      "account-url": "/v0/bank/accounts/ac.yGeZn1SrXX6z4wsylawrHA",
      "display-name": "My Account",
      "beneficiary-url": "/v0/corporations/lp.aDBVscJYVya5eU2V6PqkmQ",
      "account-balance": {
        "currency": "GBP",
        "value": "100.00"
      },
      "account-transactions-url": "/v0/bank/accounts/ac.yGeZn1SrXX6z4wsylawrHA/transactions",
      "bank-product-type": "business-demand-account",
      "owner-url": "/v0/corporations/lp.aDBVscJYVya5eU2V6PqkmQ",
      "controller-url": "/v0/corporations/lp.aDBVsDJYXyaAeU2V6PqkmQ"
    }
  ]
}

Fetching the URL found under account-transactions-url will now return a list of transactions for the account.

In this way, you can navigate the API in its entirety, starting from your user ID.

Updated about a month ago

Navigating the API


Suggested Edits are limited on API Reference Pages

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