Crm · Work hours
List work hours accounts
Lists work hours accounts for accessible mandates, using the current period by default. You can select a period or all periods and filter by rule, contact, name, or userFilter, with pagination. The response includes the accounts and their reviewers, a count, rules, period settings, and booking settings; it is empty when work hours are not set up.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- The caller must have organization access.
- The caller needs
mandate.readandworkHours.read. - Callers limited to assigned work hours entries see only accounts of their assigned entries.
- Without
user.read, other user actors are masked; the current actor is exempt from this check. - Without
apiKey.read, API key actors are masked. - Legacy
contact.readalso permits contact actor details. - Any one of
contact:member.read,contact:address.read,contact:customer.read,contact:sponsor.read,contact:contributor.read,contact:employee.read, orcontact:supplier.readpermits contact actor details, regardless of the contact type.
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired
Query parameters
-
periodFromstring -
allPeriodsbooleandefault
false -
ruleIdid -
contactIdid -
searchstringat most 100 characters
-
userFilterstringnullable -
limitinteger1–200 · default
50 -
offsetintegerat least 0 · default
0
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request GET 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/work-hours/accounts' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/work-hours/accounts", {
method: "GET",
headers: {
"X-API-Key": "YOUR_API_KEY"
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$context = stream_context_create(['http' => [
'method' => 'GET',
'header' => [
'X-API-Key: YOUR_API_KEY',
],
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/work-hours/accounts', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
Response
200 Successful response
Content-Type: application/json
-
accountsobject[]When work hours are not set up,
accountsis empty.19 properties
-
_idid -
mandatesid[] -
ruleobject15 properties
-
_idid -
labelstring1–60 characters
-
unitstringhoursshifts -
requirednumber0–999
-
holderstringcontactgroup -
helpersstringmembersanyone -
proRatastringnonemonths -
feeintegernullableat most 999999
-
buyoutobjectnullable2 properties
-
amountintegerat most 9999999
-
untilDaysinteger0–365
-
-
accountintegernullable1–999999999
-
costCenter1numbernullable1–99999999
-
costCenter2numbernullable1–99999999
-
eventCategoriesobject[]at most 10 items
3 properties
-
namestring1–60 characters
-
nameNormalizedstring1–60 characters
-
bookingCategoryIdid
-
-
legalBasisstringat most 300 characters
-
decidedAtstringnullable
-
-
periodobject3 properties
-
yearinteger2000–2999
-
fromstring -
tostring
-
-
deadlineAtstring -
groupobjectnullable3 properties
-
_idid -
namestringat most 40 characters
-
numberstringat most 24 characters
-
-
monthsinteger0–12
-
calculatedRequirednumber0–999
-
overrideobjectnullable2 properties
-
requirednumber0–999
-
reasonstring2–200 characters
-
-
requirednumber0–999
-
approvednumberat least 0
-
submittednumberat least 0
-
missingnumberat least 0
-
statusstringopensettled -
buyoutobjectnullable2 properties
-
atstring · date-time -
byobject
-
-
settlementobjectnullable6 properties
-
atstring · date-time -
byobject -
missingnumber0–999
-
amountinteger0–9999999999
-
buyoutboolean -
receiptobjectnullable3 properties
-
_idid -
receiptNumberstringat most 30 characters
-
mandateid
-
-
-
contactobjectnullable -
payerobjectnullable -
reviewersobject[]Without
user.read,accounts[].reviewersincludes only the current user, if they are a reviewer.
-
-
countintegercountis zero when work hours are not set up. -
rulesobject[]When work hours are not set up,
rulesis empty andperiodStartMonth,periodFrom, andbookingare null.4 properties
-
_idid -
labelstring1–60 characters
-
unitstringhoursshifts -
activeboolean
-
-
periodStartMonthintegernullable -
periodFromstringnullableperiodFromis null whencontactIdis supplied orallPeriodsis true. -
bookingobjectnullable3 properties
-
defaultMandateidnullable -
sepaDirectDebitCashAccountidnullable -
sepaCreditTransferCashAccountidnullable
-
{
"accounts": [
{
"_id": "000000000000000000000001",
"mandates": [
"000000000000000000000001"
],
"rule": {
"_id": "000000000000000000000001",
"label": "string",
"unit": "hours",
"required": 0,
"holder": "contact",
"helpers": "members",
"proRata": "none",
"fee": 1,
"buyout": {
"amount": 1,
"untilDays": 0
},
"account": 1,
"costCenter1": 1,
"costCenter2": 1,
"eventCategories": [
{
"name": "string",
"nameNormalized": "string",
"bookingCategoryId": "000000000000000000000001"
}
],
"legalBasis": "string",
"decidedAt": "string"
},
"period": {
"year": 2000,
"from": "string",
"to": "string"
},
"deadlineAt": "string",
"group": {
"_id": "000000000000000000000001",
"name": "string",
"number": "string"
},
"months": 0,
"calculatedRequired": 0,
"override": {
"required": 0,
"reason": "string"
},
"required": 0,
"approved": 0,
"submitted": 0,
"missing": 0,
"status": "open",
"buyout": {
"at": "2026-06-15T22:30:00Z",
"by": {
"name": "string",
"type": "user",
"userId": "string",
"image": {
"resource": "string"
}
}
},
"settlement": {
"at": "2026-06-15T22:30:00Z",
"by": {
"name": "string",
"type": "user",
"userId": "string",
"image": {
"resource": "string"
}
},
"missing": 0,
"amount": 0,
"buyout": true,
"receipt": {
"_id": "000000000000000000000001",
"receiptNumber": "string",
"mandate": "000000000000000000000001"
}
},
"contact": {
"name": "string",
"type": "user",
"userId": "string",
"image": {
"resource": "string"
}
},
"payer": {
"name": "string",
"type": "user",
"userId": "string",
"image": {
"resource": "string"
}
},
"reviewers": [
{
"name": "string",
"type": "user",
"userId": "string",
"image": {
"resource": "string"
}
}
]
}
],
"count": 1,
"rules": [
{
"_id": "000000000000000000000001",
"label": "string",
"unit": "hours",
"active": true
}
],
"periodStartMonth": 1,
"periodFrom": "string",
"booking": {
"defaultMandate": "000000000000000000000001",
"sepaDirectDebitCashAccount": "000000000000000000000001",
"sepaCreditTransferCashAccount": "000000000000000000000001"
}
}
Errors
No errors of its own are known for this endpoint.
Errors nearly every request can meet are listed under Errors.