Crm · Compensation
Update contributor compensation
Sets up or updates a contributor contact’s compensation, including its active status, rates, individual allowance-limit amounts and Austrian social insurance number. It takes an organization ID and contact ID and returns no content.
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.read. - The caller needs
compensationClaim.edit. - The caller needs
contact:contributor.edit. - The contact lookup is restricted by the caller’s mandate access.
Request
Path parameters
-
organizationIdidrequired -
contactIdidrequired
Body
Content-Type: application/json
-
activebooleanrequired -
socialInsuranceNumberstringrequirednullablepattern
^\d{10}$ -
ratesid[]requiredat most 50 items
-
limitAmountsobject[]requiredat most 10 items
2 properties
-
limitidrequired -
amountintegerrequired0–9999999
-
Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/crm/compensation/contributors/YOUR_CONTACT_ID' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/crm/compensation/contributors/YOUR_CONTACT_ID", {
method: "POST",
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' => 'POST',
'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/crm/compensation/contributors/YOUR_CONTACT_ID', 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;
No request that worked has been recorded yet, so the body is not shown.
Response
200 Successful response
No response body is specified.
What else happens
- The endpoint updates the contributor’s compensation on the contact, preserving its existing
deletedClaimPeriod. - The endpoint clears the Connect user organizations cache for the contact.
Errors
Other errors
| Status | Error | When |
|---|---|---|
| 400 | Only contributor contacts can receive compensation. | If the contact is not found, is not a contributor, or has no contributor data, the endpoint returns BAD_REQUEST (400) with compensation.errors.notContributor. |
| 400 | Choose one of the assigned rates. | If a requested rate is neither active in the settings nor already assigned to the contributor, the endpoint returns BAD_REQUEST (400) with compensation.issues.invalidRate. |
| 400 | Choose an allowance limit from the compensation settings. | If an allowance limit is not in the compensation settings or appears more than once, the endpoint returns BAD_REQUEST (400) with compensation.errors.invalidLimit. |
| 404 | Compensation claims are not set up for this organization. | If compensation claims are not set up for the organization, the endpoint returns NOT_FOUND (404) with compensation.errors.notEnabled. |
Errors nearly every request can meet are listed under Errors.