PUT
/api/public/v1/employees/{employeeId}/benefitsSet an employee’s benefits
Replaces the whole enrollment list — send every benefit the employee should be in, because anything missing is withdrawn. `PUT` rather than `PATCH` for exactly that reason. Ids that are not this company’s are dropped rather than enrolled.
Required scope
The access token must carry this scope. A token missing it gets 403 Forbidden. Grant them to an API client under Settings → Company → API, and to a teammate under Employee → Permissions.
hr:write
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
employeeId | string | Required | Employee ID. |
Request Body
| Property | Type | Description |
|---|---|---|
benefitIds | array | The complete list. An empty array withdraws them from everything. |
PUTExample request
curl
curl -X PUT "https://www.pxb.app/api/public/v1/employees/{employeeId}/benefits" \
-H "Authorization: Bearer your_access_token" \
-H "Content-Type: application/json" \
-d '{
"benefitIds": [
"ben_08de"
]
}'200Example response
json
{
"message": "Employee benefits updated successfully!",
"content": {
"employeeId": "emp_44f1",
"benefitIds": [
"ben_08de"
]
}
}In the console
The same thing done by hand, for anyone comparing the API against the screen they already use.
Employees → Directory → Benefits
/employee/directory- Open an employee.
- Benefits.
- Tick what they are enrolled in.