Migration steps from the V3 or V4 departments APIs to the Lucca API (v5) department resource.
V3 Departments API
The V3 departments API is deprecated. The following routes will stop responding starting from September 2026:
GET /api/v3/departments
GET /api/v3/departments/{id}
GET /api/v3/departments/tree
V4 Departments API
The V4 departments API has no announced sunset date, but the Lucca API (V5) is the long-term strategic target.If you are on V3 and want a lower-friction interim step (same API-key authentication), you may migrate to V4 first —
but a future migration to the V5 Lucca API will still be required.
The V5 Lucca API departments API endpoints are stable and will not undergo breaking changes. It supports both read and
write operations. We recommend moving to the Lucca API as soon as possible to take advantage of its improved performance,
richer data model, and long-term support.
The V3 GET /api/v3/departments/tree endpoint has no equivalent in the V5 Lucca API. It was removed because its
tree structure made pagination impossible to enforce, causing serious performance issues in large organizations.
To reconstruct a tree client-side, page through GET /lucca-api/departments and use each department’s parent.id field
to build the hierarchy.
Regardless of your starting version, the Lucca API requires an OAuth 2.0 bearer token in place of the legacy API key.
Request the scope that matches your use case:
Operation
Required scope
Read departments
departments.readonly
Create or update departments
departments.readwrite
Read employees (for department membership)
employees.readonly job-positions.readonly
Additionally, all requests must include the Api-Version: 2024-11-01 HTTP header.
A single OAuth 2.0 token can carry multiple scopes. Combine all the scopes you need in one token request —
for example: scope=departments.readonly employees.readonly job-positions.readonly.
Authentication
How to obtain and use OAuth 2.0 bearer tokens with the Lucca authorization server.
Versioning
How to use the Api-Version header to specify the API version.
The users, currentUsers, and currentUsersCount fields no longer appear on department objects.
Use GET /lucca-api/employees?applicableJobPosition.department.id={id}&status=active&include=totalCount instead.
Embedded users and currentUsers fields were removed
v3 department objects included users, currentUsers, and currentUsersCount directly on the department. In v5, you may either
follow the activeEmployees link (only returned when include=links is specified) or build the link to the employees endpoint manually:
GET /lucca-api/employees?applicableJobPosition.department.id={DEPARTMENT_ID}&status=active&include=links,totalCount HTTP/1.1Host: example.ilucca.netAuthorization: Bearer {ACCESS_TOKEN}Api-Version: 2024-11-01
The totalCount in the response is the equivalent of currentUsersCount. Each department also exposes a pre-built links.activeEmployees.href pointing to this query.
V3 supported a ?parentId={integer} query filter to retrieve direct children of a department. v5 has no server-side equivalent — page through all departments and group by parent.id client-side. The level field (1 = root) and sortOrder (0-based among siblings) help reconstruct the correct display order.
V3 embedded currentUsers directly on each department object. In v5, use activeEmployees link (to obtain it, add ?include=links) or query the employees endpoint directly:
GET /lucca-api/employees?applicableJobPosition.department.id=32&status=active&include=links,totalCount HTTP/1.1Host: example.ilucca.netAuthorization: Bearer {ACCESS_TOKEN}Api-Version: 2024-11-01
The totalCount field in the response is the equivalent of the old currentUsersCount.
You need the employees.readonly and job-positions.readonly scopes to query the employees endpoint, even if you only want the count.
Request a bearer token with the departments.readonly scope (add departments.readwrite if needed). See the auth section above.
2
Add the Api-Version header
Include Api-Version: 2024-11-01 on every request.
3
Replace the list endpoint
Swap GET /organization/structure/api/departments?limit=10 for GET /lucca-api/departments?include=links. The response envelope changes: next moves from a bare string to links.next.href.
In v5, prev and next are nested under a links object and are { href } objects rather than bare strings.
count is renamed totalCount and only returned when you add totalCount to the ?include= parameter.
To paginate in v5, follow the full URL in links.next.href. Add totalCount to the include parameter to also receive the total count: ?include=links,totalCount.
v4 had no server-side parent filter either. Continue paging through all departments and grouping client-side —
replace parentLuccaId lookups with parent.id. The level and renamed sortOrder (previously sortOrderInSiblings)
fields provide the same ordering information.
Neither v3 nor v4 officially exposed write endpoints. The Lucca API introduces POST (create) and PATCH (update) operations,
both requiring the departments.readwrite scope.
There is no DELETE endpoint for departments. To decommission a department, set isArchived: true via PATCH.
A department can only be archived when no employees are currently attached to it.