Get department hierarchy
Department Information
Get Department Hierarchy
Admin-only endpoint that retrieves the full hierarchical structure of all departments. Each department may include nested child departments inside the children array.
GET
Get department hierarchy
Admin-only endpoint that retrieves the full hierarchical structure of all departments. Each department may include nested child departments inside the
children array.
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
Response
200 OK - Successfully retrieved department hierarchy
401 Unauthorized
500 Internal Server Error
Example
Notes
- This is an admin-only endpoint - requires administrative privileges
- Returns departments in a hierarchical tree structure
- Root departments have
parentId: null - Child departments are nested in the
childrenarray - The hierarchy can have multiple levels of nesting
- Use this for organizational charts or department trees
- Departments are sorted alphabetically within each level
- Empty
childrenarrays indicate leaf departments (no sub-departments)
Use Cases
- Organizational Charts: Display company structure
- Department Selection: Create hierarchical dropdown menus
- Reporting Structure: Show management hierarchy
- Access Control: Implement department-based permissions
- Analytics: Analyze departmental data with hierarchy context
Performance Considerations
- Large organizational hierarchies may take longer to load
- Consider caching the hierarchy for frequently accessed data
- The endpoint returns the complete hierarchy in a single request
- For very large organizations, consider using the list endpoint with pagination