Skip to main content
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

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 children array
  • The hierarchy can have multiple levels of nesting
  • Use this for organizational charts or department trees
  • Departments are sorted alphabetically within each level
  • Empty children arrays 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

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Response

Successfully retrieved department hierarchy

message
string
data
object