Getting 400 when creating Member with bitwarden api

Following Bitwarden API docs I am trying to create new member via Bitwarden API by making a POST request to /public/members endpoint. The user gets created properly when collections array is empty.

However whenever I try to assign Users access to a specific collection by passing non empty collections array:

    "email": "[email protected]",
    "collections": [
            "id": "xxxxxx-xxx-xxxx-xxxx-xxxxxxxx",
            "readOnly": true
    "type": 2,
    "accessAll": false,
    "externalId": "testUser_id"

The response is 400 Bad Request I get:

    "Object": "error",
    "Message": "This user has already been invited.",
    "Errors": null

Regardless of the 400 Response I can see the user created in Bitwarden and the collection assigned properly.

I have double checked and this user wasn’t existing prior to making the call. I have also removed the user and invited him again which also returned 400.

Why am I getting 400 Bad request here? Is that a bug on API side or an issue with my request?

Hmm - seems like it could be an issue. You should be able to invite a member + specify collections in the same request, but only if that user hasn’t already been invited to the organization (hence the previous invitation message).

If this is happening on the first member invitation, it’s probably worthy of an issue here: Issues · bitwarden/server · GitHub

Sure, sounds like that this might be a bug. Sending an invite with empty collections array doesn’t result in an error. There was also no issue to assign collections by updating the user after invite with a PUT request.

I will create an issue in bitwarden repo. In the meantime @tgreer or anyone else reading this post - can you possibly try to recreate that on your side/bitwarden instance?