Skip to content
campaiDeveloper
campai.com

Crm · Compensation

POST/{organizationId}/{mandateId}/crm/compensation/claims

Add compensation claim

Creates a draft compensation claim for a contributor and the compensation period containing the supplied date. It takes an organization, a mandate, a contact and a date, and returns claimId. The claim follows the contact’s mandates, and a notification is sent for the period opening.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • Organization access with mandate.read and compensationClaim.insert is required.
  • The contact must be visible under the caller’s mandate access.

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired

Body

Content-Type: application/json

  • contactIdidrequired
  • datestringrequired
Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/crm/compensation/claims' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • claimIdid
Response200
{
  "claimId": "000000000000000000000001"
}

What else happens

  • Creates a draft compensation claim.
  • Advances the claim’s yearly sequence number.
  • Sends a period-opening notification for the claim.
  • Notification delivery can create a delivery batch.
  • Notification delivery can update an existing delivery batch.
  • Notification delivery can remove earlier delivery items for the same source.
  • Notification delivery can create delivery items.
  • Preparing a notification email creates an email notification log.
  • Notification delivery can create or update a read receipt.
  • A replacement notification can remove matching earlier notifications.
  • Notification processing can create a notification record.
  • Notification processing can create or update a user watch counter.
  • Notification delivery can enqueue a common.processNotificationDelivery job on DefaultQueue.

Errors

Caused by the organization's data

StatusErrorWhen
400This asset does not belong to this design owner.If the notification email is being prepared and the default action email template contains an asset that does not belong to that template.
400Invalid email headersIf the notification email subject contains a line break, or its sender name is missing or contains a line break.

Other errors

StatusErrorWhen
400No claim can be created for this contact and period.If the contact is not found or is not visible under the mandate filter, the endpoint returns 400 with compensation.errors.notEligible.
400No claim can be created for this contact and period.If the contact is not a contributor or is not eligible for the period, the endpoint returns 400 with compensation.errors.notEligible.
400No claim can be created for this contact and period.If the contact has no mandates, the endpoint returns 400 with compensation.errors.notEligible.
400Notification key is required when replace is trueIf a replacement notification has no key, the endpoint returns 400 with dispatch.notification.createNotification.keyRequiredForReplace.
400Global notifications only support root targetIf a global notification has no root target, the endpoint returns 400 with dispatch.notification.createNotification.globalNotificationsOnlyRoot.
400Root notifications must be globalIf an organization notification has a root target, the endpoint returns 400 with dispatch.notification.createNotification.rootNotificationsMustBeGlobal.
400Exactly one of user or contact is requiredIf a notification specifies both a user and a contact, the endpoint returns 400 with dispatch.notification.createNotification.exactlyOneRecipientRequired.
400Exactly one of user or contact is requiredIf a notification specifies neither a user nor a contact, the endpoint returns 400 with dispatch.notification.createNotification.exactlyOneRecipientRequired.
400Organization is required when contact is providedIf a contact notification has no organization, the endpoint returns 400 with dispatch.notification.createNotification.organizationRequiredForContact.
400Notification message or details is requiredIf a notification has no usable message or details, the endpoint returns 400 with dispatch.notification.createNotification.messageOrDetailsRequired.
400Community-App notification links require an organizationIf a Community-App notification link requires an organization but its ID or short ID is missing, the endpoint returns 400 with dispatch.notification.createNotification.connectLinkRequiresOrganization.
400The email sender name is invalid.If the organization’s email sender name is missing or contains a line break, the endpoint returns 400 with emailSender.invalidName.
404Compensation claims are not set up for this organization.If compensation claims are not set up, the endpoint returns 404 with compensation.errors.notEnabled.
404This contact has no compensation profile.If the contributor’s compensation profile is not active, the endpoint returns 404 with compensation.errors.profileNotFound.
404Notification contact not foundIf the notification contact cannot be found in the organization, the endpoint returns 404 with dispatch.notification.createNotification.contactNotFound.
404The organization has no default template for this transactional typeIf the organization has no default action email template, the endpoint returns 404 with templates.transactional.noDefault.
409A claim for this contact and period already exists.If a claim already overlaps the contact’s period, the endpoint returns 409 with compensation.errors.claimExists.
412Email sender settings must be transferred before sending from this organization.If the organization’s email sender settings are not initialized, the endpoint returns 412 with emailSender.notInitialized.
2 rare errors, such as when something changes at the same moment
StatusErrorWhen
404Organization was not foundIf the organization can no longer be found.
408Cache loading timed outIf loading information needed for the notification email takes too long.

Errors nearly every request can meet are listed under Errors.