Skip to content

feat(directory-sync): Add directory-scoped user and group reads - #1759

Merged
ajworkos merged 1 commit into
mainfrom
adam/directory-scoped-dsync-endpoints
Nov 12, 2026
Merged

ajworkos merged 1 commit into
mainfrom
adam/directory-scoped-dsync-endpoints

Conversation

@ajworkos

Copy link
Copy Markdown
Contributor

Description

The API now serves directory-scoped Directory Sync reads (workos/workos#69425, live in production since 2026-11-11) as the successor to the flat /directory_users and /directory_groups routes, which are rate limited because every user carries an unbounded groups array. The published docs already show these SDK method names, so this adds them:

  • directorySync.listDirectoryUsers({ directoryId, group?, idpId?, email?, ...pagination }) → GET /directories/{directoryId}/users
  • directorySync.getDirectoryUser({ directoryId, userId }) → GET /directories/{directoryId}/users/{userId}
  • directorySync.listDirectoryGroups({ directoryId, user?, ...pagination }) → GET /directories/{directoryId}/groups
  • directorySync.getDirectoryGroup({ directoryId, groupId }) → GET /directories/{directoryId}/groups/{groupId}

The user reads return the slim DirectoryUser (no groups), which is the whole point of the new routes. listUsers, getUser, listGroups and getGroup are marked @deprecated pointing at the replacements; they keep working.

Everything hand-owned lives inside @oagen-ignore regions so regeneration preserves it. The @deprecated tags on listGroups and getGroup sit in generated code; the OpenAPI spec marks those operations deprecated, so a regen should carry them (worth checking on the next oagen run).

Specs cover the wire path for each method (including idpId → idp_id and undefined filters being dropped), path-segment encoding of directoryId, the slim response shape, and error propagation. Not exercised against the live API from this branch; the request shape matches DirectoriesUsersController / DirectoriesGroupsController on workos/workos main.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

Already done: the reference pages and Node snippets for these methods shipped in workos/workos#69425.

🤖 Generated with Claude Code

Add listDirectoryUsers, getDirectoryUser, listDirectoryGroups and
getDirectoryGroup for the GET /directories/{directoryId}/users and
/groups routes, and mark the flat listUsers, getUser, listGroups and
getGroup deprecated in favor of them. The scoped user reads return the
slim DirectoryUser without the groups array.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ajworkos
ajworkos requested review from a team as code owners November 12, 2026 15:59
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds four directory-scoped methods for reading Directory Sync users and groups.

  • Directory Sync reads users within one directory and leaves out group arrays.
  • Directory Sync reads groups within one directory, with an optional user filter.

Acknowledged by ajworkos: the deprecation tags on listGroups and getGroup sit in generated code; the author expects the spec to preserve them and deferred confirmation until the next generation run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  App[Application] --> Users[Directory-scoped user reads]
  App --> Groups[Directory-scoped group reads]
  Users --> UserAPI["GET /directories/{directoryId}/users[/userId]"]
  Groups --> GroupAPI["GET /directories/{directoryId}/groups[/groupId]"]
  UserAPI --> Slim[DirectoryUser without groups]
  GroupAPI --> Group[DirectoryGroup]
Loading

Reviews (1) · Last reviewed commit: "feat(directory-sync): Add directory-scop..." · Reviewed by Greptile

@ajworkos
ajworkos merged commit 6e536f1 into main Nov 12, 2026
9 checks passed
@ajworkos
ajworkos deleted the adam/directory-scoped-dsync-endpoints branch November 12, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants