curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/categories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/categories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "Category_List",
"categories": [
{
"type": "AccountNested",
"id": "e95c8640-f87b-43bf-a9c6-cabc7ebfdec6",
"stable_name": "EXPENSES",
"display_name": "Expenses",
"subCategories": "<array>"
}
]
}
}Fetch transaction categories
Retrieves the list of usable transaction categories based on the business’ chart of accounts. This endpoint is used by Layer’s <BankTransactions> embedded component, and can be used to build your own transaction categorization user interface.
curl --request GET \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/categories \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/categories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/categories"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.layerfi.com/v1/businesses/{businessId}/categories")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/categories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "Category_List",
"categories": [
{
"type": "AccountNested",
"id": "e95c8640-f87b-43bf-a9c6-cabc7ebfdec6",
"stable_name": "EXPENSES",
"display_name": "Expenses",
"subCategories": "<array>"
}
]
}
}Filtering by mode
Use the mode query parameter to control which subset of categories is returned:| Mode | Categories returned |
|---|---|
DEFAULT | The business’s configured category list (see category_list_type on the accounting configuration). This is the default when mode is omitted. |
ALL | All accounts and optional categories from the chart of accounts. |
EXPENSES | Expense categories only. |
REVENUE | Revenue categories only. |
Types
There are three types of categories you’ll find in the category list:AccountNested, OptionalAccountNested, and ExclusionNested.
AccountNested
AccountNested represents a required template account in the business’s chart of accounts.
OptionalAccountNested
OptionalAccountNested represents an optional template account in the business’s chart of accounts.
ExclusionNested
ExclusionNested represents an exclusion type that can be used to exclude a transaction from the business’s accounting.
Interpreting the category list
In all cases, usedisplay_name to present the category to the user. Use the columns below to choose a stable identifier.
| Category type | AccountId | StableName | Identify with | Notes |
|---|---|---|---|---|
| Optional template account | After instantiation | Yes | StableName (always); AccountId once instantiated | Optional accounts only have an AccountId after first use. Use StableName to reference them before instantiation. |
| User-defined custom account | Yes | No | AccountId only | A new AccountId is created when the account is added; no stable name is assigned. |
| Required template account | Yes | Yes | AccountId or StableName | The stable name is the same as the account name. |
| Exclusion | No | Yes | StableName | The exclusion type acts as the stable name; exclusions have no AccountId. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Content-Type must be set to application/json.
Path Parameters
The UUID of the business to fetch the tree of available categories for.
Query Parameters
Controls which subset of categories is returned. DEFAULT uses the business's configured category list (see category_list_type on the accounting configuration). ALL returns all accounts and optional categories. EXPENSES returns expense categories only. REVENUE returns revenue categories only.
DEFAULT, ALL, EXPENSES, REVENUE Response
List of the categories available for a business.
Show child attributes
Show child attributes