Skip to main content

Employees & Referrals API

Overview​

The Employees & Referrals API provides operations for managing employee records and tracking customer referrals. It supports the full employee lifecycle — from creation and bulk upload through to referral code generation and referral tracking. Each employee is automatically assigned a unique referral code that can be used to link new customer registrations back to the referring staff member.

Available Commands​

#CommandTypeDescription
1CreateEmployeeCommandCommandCreate a new employee record
2UpdateEmployeeCommandCommandUpdate an existing employee record
3RetrieveEmployeesListQueryQueryList employees with filtering and pagination
4RetrieveEmployeeByIdQueryQueryGet a single employee by ID
5UploadEmployeesCommandCommandBulk upload employees from an Excel file
6RetrieveEmployeeReferralsQueryQueryList referrals for a specific employee
7CreateEmployeeReferralCommandCommandLink a customer registration to an employee referral
8SendEmployeeReferralCodeCommandCommandSend referral code to employee's email

Common Request Pattern​

All commands and queries are sent as a POST to the unified BPM endpoint:

POST /api/bpm/cmd
Content-Type: application/json
Authorization: Bearer {token}

Request body:

{
"$type": "CommandOrQueryClassName",
// ...command-specific fields
}

Common Response Pattern​

Success:

{
"success": true,
"data": { },
"message": "Operation completed successfully"
}

Error:

{
"success": false,
"data": null,
"message": "Description of what went wrong",
"errors": ["Detailed error 1", "Detailed error 2"]
}

Authentication​

All Employees & Referrals API requests require a valid Bearer token in the Authorization header. Tokens are obtained via the authentication endpoint and must belong to a user with the appropriate employee management permissions.

Employee Lifecycle​

When an employee is created (individually or via bulk upload), the system automatically generates a unique referralCode. This code can be shared with potential customers. When a customer registers using a referral code, the CreateEmployeeReferralCommand links that registration to the originating employee, enabling performance tracking and incentive calculations.