Product Categories
Part of the Accounts API. Base URL https://your-domain.com/admin/api/v1 — replace the host with your own installation and the token placeholder with a real Bearer token (see Authentication).
List categories
GET/admin/api/v1/accounts/categoriesRetrieve a paginated list of product categories with filtering and sorting
🔒 Requires a valid Bearer token.
Query parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
include | string | No | Comma-separated list of relationships to include. Available options: parent, children, creator, propertyAccountIncome, propertyAccountExpense, propertyAccountDownPayment | parent,propertyAccountIncome |
filter[id] | string | No | Comma-separated list of IDs to filter by | |
filter[name] | string | No | Filter by category name (partial match) | |
filter[parent_id] | string | No | Comma-separated list of parent IDs to filter by | |
sort | string | Yes | Sort field | name |
page | integer | Yes | Page number | 1 |
curl -X GET "https://your-domain.com/admin/api/v1/accounts/categories?include=parent%2CpropertyAccountIncome&sort=name&page=1" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/accounts/categories?include=parent%2CpropertyAccountIncome&sort=name&page=1", {
method: "GET",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/accounts/categories?include=parent%2CpropertyAccountIncome&sort=name&page=1', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/accounts/categories?include=parent%2CpropertyAccountIncome&sort=name&page=1"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"data": [
{
"id": 1,
"name": "All",
"full_name": "All",
"parent_path": "/",
"parent_id": null,
"creator_id": 1,
"created_at": "2025-01-28T10:49:51.000000Z",
"updated_at": "2025-01-28T10:49:51.000000Z",
"property_account_income_id": null,
"property_account_expense_id": null,
"property_account_down_payment_id": null
},
{
"id": 1,
"name": "All",
"full_name": "All",
"parent_path": "/",
"parent_id": null,
"creator_id": 1,
"created_at": "2025-01-28T10:49:51.000000Z",
"updated_at": "2025-01-28T10:49:51.000000Z",
"property_account_income_id": null,
"property_account_expense_id": null,
"property_account_down_payment_id": null
}
],
"links": {
"first": "/?page=1",
"last": "/?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "/?page=1",
"label": "1",
"page": 1,
"active": true
},
{
"url": null,
"label": "Next »",
"page": null,
"active": false
}
],
"path": "/",
"per_page": 10,
"to": 2,
"total": 2
}
}Error response — 401
{
"message": "Unauthenticated."
}Create category
POST/admin/api/v1/accounts/categoriesCreate a new product category with accounting properties
🔒 Requires a valid Bearer token.
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Category name (max 255 characters). Must not be greater than 255 characters. |
parent_id | integer | No | Parent category ID for nested categories. Must match an existing stored value. |
property_account_income_id | integer | No | Income account ID for this category. Must match an existing stored value. |
property_account_expense_id | integer | No | Expense account ID for this category. Must match an existing stored value. |
property_account_down_payment_id | integer | No | Down payment account ID for this category. Must match an existing stored value. |
curl -X POST "https://your-domain.com/admin/api/v1/accounts/categories" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3
}'const response = await fetch("https://your-domain.com/admin/api/v1/accounts/categories", {
method: "POST",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3
}),
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/accounts/categories', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Electronics',
'parent_id' => 1,
'property_account_income_id' => 1,
'property_account_expense_id' => 2,
'property_account_down_payment_id' => 3,
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/accounts/categories"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = {
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3,
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)Example response 201
{
"data": {
"id": 1,
"name": "All",
"full_name": "All",
"parent_path": "/",
"parent_id": null,
"creator_id": 1,
"created_at": "2025-01-28T10:49:51.000000Z",
"updated_at": "2025-01-28T10:49:51.000000Z",
"property_account_income_id": null,
"property_account_expense_id": null,
"property_account_down_payment_id": null
},
"message": "Category created successfully."
}Error response — 401
{
"message": "Unauthenticated."
}Show category
GET/admin/api/v1/accounts/categories/{id}Retrieve a specific product category by its ID
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | The category ID |
Query parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
include | string | No | Comma-separated list of relationships to include. Available options: parent, children, creator, propertyAccountIncome, propertyAccountExpense, propertyAccountDownPayment | parent,propertyAccountIncome |
curl -X GET "https://your-domain.com/admin/api/v1/accounts/categories/{id}?include=parent%2CpropertyAccountIncome" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/accounts/categories/{id}?include=parent%2CpropertyAccountIncome", {
method: "GET",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/accounts/categories/{id}?include=parent%2CpropertyAccountIncome', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/accounts/categories/{id}?include=parent%2CpropertyAccountIncome"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"data": {
"id": 1,
"name": "All",
"full_name": "All",
"parent_path": "/",
"parent_id": null,
"creator_id": 1,
"created_at": "2025-01-28T10:49:51.000000Z",
"updated_at": "2025-01-28T10:49:51.000000Z",
"property_account_income_id": null,
"property_account_expense_id": null,
"property_account_down_payment_id": null
}
}Error response — 401
{
"message": "Unauthenticated."
}Update category
PUT/admin/api/v1/accounts/categories/{id}Update an existing product category
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | The category ID |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Category name (max 255 characters). Must not be greater than 255 characters. |
parent_id | integer | No | Parent category ID for nested categories. Must match an existing stored value. |
property_account_income_id | integer | No | Income account ID for this category. Must match an existing stored value. |
property_account_expense_id | integer | No | Expense account ID for this category. Must match an existing stored value. |
property_account_down_payment_id | integer | No | Down payment account ID for this category. Must match an existing stored value. |
curl -X PUT "https://your-domain.com/admin/api/v1/accounts/categories/{id}" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3
}'const response = await fetch("https://your-domain.com/admin/api/v1/accounts/categories/{id}", {
method: "PUT",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3
}),
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-domain.com/admin/api/v1/accounts/categories/{id}', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'name' => 'Electronics',
'parent_id' => 1,
'property_account_income_id' => 1,
'property_account_expense_id' => 2,
'property_account_down_payment_id' => 3,
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/accounts/categories/{id}"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
payload = {
"name": "Electronics",
"parent_id": 1,
"property_account_income_id": 1,
"property_account_expense_id": 2,
"property_account_down_payment_id": 3,
}
response = requests.put(url, headers=headers, json=payload)
data = response.json()
print(data)Example response 200
{
"data": {
"id": 1,
"name": "All",
"full_name": "All",
"parent_path": "/",
"parent_id": null,
"creator_id": 1,
"created_at": "2025-01-28T10:49:51.000000Z",
"updated_at": "2025-01-28T10:49:51.000000Z",
"property_account_income_id": null,
"property_account_expense_id": null,
"property_account_down_payment_id": null
},
"message": "Category updated successfully."
}Error response — 401
{
"message": "Unauthenticated."
}Delete category
DELETE/admin/api/v1/accounts/categories/{id}Delete a product category
🔒 Requires a valid Bearer token.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | The category ID |
curl -X DELETE "https://your-domain.com/admin/api/v1/accounts/categories/{id}" \
-H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
-H "Accept: application/json" \
-H "Content-Type: application/json"const response = await fetch("https://your-domain.com/admin/api/v1/accounts/categories/{id}", {
method: "DELETE",
headers: {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
},
});
const data = await response.json();
console.log(data);<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-domain.com/admin/api/v1/accounts/categories/{id}', [
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);import requests
url = "https://your-domain.com/admin/api/v1/accounts/categories/{id}"
headers = {
"Authorization": "Bearer {YOUR_AUTH_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
}
response = requests.delete(url, headers=headers)
data = response.json()
print(data)Example response 200
{
"message": "Category deleted successfully."
}Error response — 401
{
"message": "Unauthenticated."
}