The organizations/{orgId}/invitations endpoint throws 400 if user already exists


We’re utilizing the organizations/{orgId}/invitations endpoint to invite users to an organization but we get a 400 error if the user already exists. Is there an endpoint that checks if the user exists and, if so, adds the member to the organization?

Hi @adam19 ,

Welcome to the Auth0 Community!

I tested with the POST https://{your domain}/api/v2/organizations/{org_id}/invitations endpoint with the below body scripts and did not see the error. The user existing in the organization received the invitation by email.

    "inviter": { 
        "name": "inviter name"}, 
    "invitee": { 
        "email": "" }, 
    "client_id": "xxx", 
    "send_invitation_email": true

As far as I know, the only way to check if a user belongs to an organization via API is by sending the GET https://{your domain}/api/v2/organizations/{org_id}/members request to get the user list. This is the reference doc.

If you still observe this error, could you please provide your body scripts and the details of the error?