curl -X GET "https://api.contazen.ro/v1/expense-categories/5" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://api.contazen.ro/v1/expense-categories/5?include_children=true" \
-H "Authorization: Bearer YOUR_API_KEY"
const categoryId = 5;
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category details:', data.category);
const categoryId = 5;
const params = new URLSearchParams({
include_children: 'true'
});
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}?${params}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category with children:', data.category);
if (data.category.children) {
console.log('Subcategories:', data.category.children.length);
}
$categoryId = 5;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'];
echo ' (Type: ' . $data['category']['type'] . ')';
$categoryId = 5;
$params = http_build_query([
'include_children' => 'true'
]);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}?{$params}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'] . "\n";
if (isset($data['category']['children'])) {
echo 'Subcategories: ' . count($data['category']['children']) . "\n";
foreach ($data['category']['children'] as $child) {
echo ' - ' . $child['name'] . " (ID: {$child['id']})\n";
}
}
{
"success": true,
"category": {
"id": 5,
"name": "Marketing Expenses",
"parent_id": 0,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": true,
"category": {
"id": 2,
"name": "Travel & Transportation",
"parent_id": 0,
"is_default": true,
"is_visible": true,
"type": "system",
"children": [
{
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 16,
"name": "Public Transport",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 17,
"name": "Hotel Accommodation",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
]
}
}
{
"success": true,
"category": {
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": false,
"error": {
"message": "Category ID is required",
"type": "invalid_request_error",
"code": "parameter_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Category not found",
"type": "invalid_request_error",
"code": "resource_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Unauthorized. API key is required.",
"type": "authentication_error",
"code": "api_key_required"
}
}
Expense Categories
Retrieve Expense Category
Get details of a specific expense category by its ID
GET
/
expense-categories
/
{id}
curl -X GET "https://api.contazen.ro/v1/expense-categories/5" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://api.contazen.ro/v1/expense-categories/5?include_children=true" \
-H "Authorization: Bearer YOUR_API_KEY"
const categoryId = 5;
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category details:', data.category);
const categoryId = 5;
const params = new URLSearchParams({
include_children: 'true'
});
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}?${params}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category with children:', data.category);
if (data.category.children) {
console.log('Subcategories:', data.category.children.length);
}
$categoryId = 5;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'];
echo ' (Type: ' . $data['category']['type'] . ')';
$categoryId = 5;
$params = http_build_query([
'include_children' => 'true'
]);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}?{$params}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'] . "\n";
if (isset($data['category']['children'])) {
echo 'Subcategories: ' . count($data['category']['children']) . "\n";
foreach ($data['category']['children'] as $child) {
echo ' - ' . $child['name'] . " (ID: {$child['id']})\n";
}
}
{
"success": true,
"category": {
"id": 5,
"name": "Marketing Expenses",
"parent_id": 0,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": true,
"category": {
"id": 2,
"name": "Travel & Transportation",
"parent_id": 0,
"is_default": true,
"is_visible": true,
"type": "system",
"children": [
{
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 16,
"name": "Public Transport",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 17,
"name": "Hotel Accommodation",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
]
}
}
{
"success": true,
"category": {
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": false,
"error": {
"message": "Category ID is required",
"type": "invalid_request_error",
"code": "parameter_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Category not found",
"type": "invalid_request_error",
"code": "resource_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Unauthorized. API key is required.",
"type": "authentication_error",
"code": "api_key_required"
}
}
Overview
The Retrieve Expense Category endpoint allows you to get detailed information about a specific expense category by its ID. This works for both system default categories and your custom categories.Path Parameters
Query Parameters
When
true, includes all subcategories under this category in the response (only applicable for parent categories)Response
The expense category object with full details
Show Category Object Properties
Show Category Object Properties
Array of subcategory objects (only included when
include_children=true and category has subcategories)Access Control
- You can only retrieve categories that belong to your firm
- Both system and custom categories are accessible
- Category must exist and not be deleted
curl -X GET "https://api.contazen.ro/v1/expense-categories/5" \
-H "Authorization: Bearer YOUR_API_KEY"
curl -X GET "https://api.contazen.ro/v1/expense-categories/5?include_children=true" \
-H "Authorization: Bearer YOUR_API_KEY"
const categoryId = 5;
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category details:', data.category);
const categoryId = 5;
const params = new URLSearchParams({
include_children: 'true'
});
const response = await fetch(`https://api.contazen.ro/v1/expense-categories/${categoryId}?${params}`, {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Category with children:', data.category);
if (data.category.children) {
console.log('Subcategories:', data.category.children.length);
}
$categoryId = 5;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'];
echo ' (Type: ' . $data['category']['type'] . ')';
$categoryId = 5;
$params = http_build_query([
'include_children' => 'true'
]);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.contazen.ro/v1/expense-categories/{$categoryId}?{$params}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
echo 'Category: ' . $data['category']['name'] . "\n";
if (isset($data['category']['children'])) {
echo 'Subcategories: ' . count($data['category']['children']) . "\n";
foreach ($data['category']['children'] as $child) {
echo ' - ' . $child['name'] . " (ID: {$child['id']})\n";
}
}
{
"success": true,
"category": {
"id": 5,
"name": "Marketing Expenses",
"parent_id": 0,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": true,
"category": {
"id": 2,
"name": "Travel & Transportation",
"parent_id": 0,
"is_default": true,
"is_visible": true,
"type": "system",
"children": [
{
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 16,
"name": "Public Transport",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
},
{
"id": 17,
"name": "Hotel Accommodation",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
]
}
}
{
"success": true,
"category": {
"id": 15,
"name": "Fuel",
"parent_id": 2,
"is_default": false,
"is_visible": true,
"type": "custom"
}
}
{
"success": false,
"error": {
"message": "Category ID is required",
"type": "invalid_request_error",
"code": "parameter_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Category not found",
"type": "invalid_request_error",
"code": "resource_missing",
"param": "id"
}
}
{
"success": false,
"error": {
"message": "Unauthorized. API key is required.",
"type": "authentication_error",
"code": "api_key_required"
}
}
Was this page helpful?