User accounts and profiles
Read a normalized HR profile
/a/User_getHrProfile
Combine a user’s HR metadata with department, role, skill and work-hours context.
When to use this endpoint
Use for CRM2 User → HR profile. The response separates editable HR metadata, a profile summary and active-user choices for manager/approver selectors.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Session requests use the dispatcher’s CSRF protection when configured.
Configured TeamAccess authorizes the primary target ID before this handler.
Explicit Users View and enabled HR enhancements are required. Users Edit still controls pay_type and summary.cost_per_hour.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | One tenant user ID. Integer conversion is performed by the handler; no pagination or ordering applies. |
Example request
$result = FM_api('User_getHrProfile', [
'id'=>'1042',
]);
Example response
{
"id": 1042,
"hr_profile": {
"version": 1,
"employment_type": "",
"job_title": "",
"start_date": "",
"end_date": "",
"pay_type": "",
"overtime_eligible": 0,
"manager_user_id": 0,
"leave_approver_user_ids": [],
"annual_leave": [],
"certifications": []
},
"annual_leave_years": [
2021,
2022,
2023,
2024,
2025,
2026,
2027,
2028,
2029,
2030,
2031,
2032,
2033,
2034,
2035,
2036
],
"summary": {
"id": 1042,
"name": "Alex Morgan",
"email": "alex@example.test",
"active": 1,
"departments": [],
"role": {
"id": 0,
"name": ""
},
"skills": [],
"hours_per_week": 40,
"work_hours": {
"has_custom": 0,
"work_hours": null,
"fallback": {
"version": 2,
"shifts": [],
"is_default": 1
}
},
"cost_per_hour": 0
},
"can_edit_users": 1,
"active_users": [
{
"id": 1042,
"name": "Alex Morgan"
}
]
}
Illustrative populated summary; fallback shifts and user choices vary with settings/data. The year range moves with the server year.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error": "missing or invalid parameter: id"} | id converts below 1. |
{"error": "HR enhancements are disabled"} | Account feature setting disables HR enhancements. |
{"error": "permission denied"} | Users View is denied by the shared permission helper. |
{"error": "user does not exist"} | Target row is absent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Requires Users View and enabled HR enhancements. Users Edit controls can_edit_users, whether summary.cost_per_hour exists, and whether hr_profile.pay_type is shown (blank for a viewer without Edit). Other profile fields are not removed.
- Normalizes employment_type (blank/full_time/part_time/contractor/other), pay_type (blank/hourly/salary/none), dates, manager ID, unique approver IDs, annual-leave year triples and certification records. An invalid saved profile falls back to the complete empty default rather than returning its validation error.
- Annual leave is returned as saved normalized year => [entitled,used,remaining] values, rounded to two decimals; this reader does not recalculate usage. Only current server year minus five through plus ten is retained. annual_leave_years contains those 16 integer years.
- Certification entries contain name, issuer, reference, issue_date, expiry_date and notes. Dates are YYYY-MM-DD or blank. summary departments and skills are name-ordered lists with integer IDs; role ID, active and work-hours flags are normalized; hours/cost are numbers.
- summary.work_hours has the same custom/fallback distinction as User_getWorkShifts. Fallback always reflects account work-day settings, not approved leave events.
- The target may be inactive. active_users lists visible active tenant users ordered by name, retaining the legacy inclusion of temporary users.
Side effects
- Reads data without changing business records, edit markers, activity history or notifications. Shared setting reads can populate their normal settings cache.
See it in Fieldmotion
CRM1
No direct production caller was found in CRM1; its User Main page uses the raw User_get profile.
CRM2
Open a User’s HR profile tab in CRM2. pageUserHrProfile calls User_getHrProfile with id and uses can_edit_users to control editing.
Related endpoints
User_getWorkShifts— Inspect custom versus fallback work hours.User_get— Inspect the older complete user-row contract.User_setMeta— Write an ordinary preference without replacing trusted identity metadata.