/api/v2/organizations/{orgId}/members fails to find (some) users, returns 404


When trying to add a batch of users to organization, sometimes I receive 404 “One or more of the users do not exist.”,“errorCode”:“inexistent_user” back. Which is fair, this is a part of our big user import/migration process, some users might have been removed in the meantime, between the bulk import and trying to add them to organizations, later.
What is the expected behavior, regarding other users in the batch? Are they going to be added to org successfully, or is the entire batch failed/rolled back? I couldn’t find the expected behavior in the documentation (suggestion: add to documentation, if not present indeed)
Thank you in advance,
Michal Berezowski

Hi @michal.berezowski , welcome to Auth0!

Fair point!

If the request fails with 404, none of the users that currently are not members of the specific org will be aded there. (the whole request fails)

Please let us know any questions!

1 Like

Thanks for your reply, Marcelina, that fully clarifies the current behaviour.

If I may add my $0.02 of feedback here - perhaps it would be better if the behaviour was the opposite (adding the existing users, skipping the deleted ones). Api consumers probably care more about successfully adding existing users, than to be informed about the deleted ones - if the later breaks the happy path (we certainly do, in our case :wink: )

At the minimum, return 404 with the list of missing users’ ids - so it is possible to filter them out & retry, without having to engage other apis (checking for existence of every user in the batch; a looped operation, at that).

(However I appreciate it might be only due to our specific migration flow and its scale, that it is less than optimal.)

Thank you again for clarifying,
Best Regards,

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.