Add user to organization
POST
/api/v1/organizations/{organizationId}/members
const
url
=
'
https://localhost:8080/api/v1/organizations/example/members
'
;
const
options
= {
method:
'
POST
'
,
headers: {Authorization:
'
'
,
'
Content-Type
'
:
'
application/json
'
},
body:
'
{"roles":["organization_owner","project_owner"],"userId":"example"}
'
}
;
try
{
const
response
= await
fetch
(url
,
options);
const
data
= await
response
.
json
();
console
.
log
(data);
}
catch
(error) {
console
.
error
(error);
}
curl
--request
POST
\
--url
https://localhost:8080/api/v1/organizations/example/members
\
--header
'
Authorization:
'
\
--header
'
Content-Type: application/json
'
\
--data
'
{ "roles": [ "organization_owner", "project_owner" ], "userId": "example" }
'
Add a user to an organization with the specified roles and best-effort sync the membership to the bound IDP organization
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”
organizationId
required
string
Organization ID (integer)
Request Body
Section titled “Request Body ”Roles to assign
Media type
application/json
object
roles
Array
Example
[
"
organization_owner
"
,
"
project_owner
"
]
userId
required
string
Responses
Section titled “ Responses ”User added successfully
Media type
application/json
object
joinedAt
string
organizationId
integer
roles
Array
status
string
Example generated
{
"joinedAt"
:
"
example
"
,
"organizationId"
:
1
,
"roles"
: [
"
example
"
],
"status"
:
"
example
"
}
Invalid request
Media type
application/json
object
error
string
error_description
string
Example
{
"error"
:
"
Unauthorized
"
,
"error_description"
:
"
Invalid token
"
}
Unauthorized
Media type
application/json
object
error
string
error_description
string
Example
{
"error"
:
"
Unauthorized
"
,
"error_description"
:
"
Invalid token
"
}
Forbidden - requires Organization Owner role
Media type
application/json
object
error
string
error_description
string
Example
{
"error"
:
"
Unauthorized
"
,
"error_description"
:
"
Invalid token
"
}
User is already a member of this organization
Media type
application/json
object
error
string
error_description
string
Example
{
"error"
:
"
Unauthorized
"
,
"error_description"
:
"
Invalid token
"
}
Internal server error
Media type
application/json
object
error
string
error_description
string
Example
{
"error"
:
"
Unauthorized
"
,
"error_description"
:
"
Invalid token
"
}