Add multiple members to organization
curl --request POST \
--url https://api.trycomp.ai/v1/people/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"members": [
{
"userId": "usr_abc123def456",
"role": "admin",
"department": "it",
"isActive": true,
"fleetDmLabelId": 123
},
{
"userId": "usr_def456ghi789",
"role": "member",
"department": "hr",
"isActive": true
}
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
members: [
{
userId: 'usr_abc123def456',
role: 'admin',
department: 'it',
isActive: true,
fleetDmLabelId: 123
},
{userId: 'usr_def456ghi789', role: 'member', department: 'hr', isActive: true}
]
})
};
fetch('https://api.trycomp.ai/v1/people/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/people/bulk"
payload = { "members": [
{
"userId": "usr_abc123def456",
"role": "admin",
"department": "it",
"isActive": True,
"fleetDmLabelId": 123
},
{
"userId": "usr_def456ghi789",
"role": "member",
"department": "hr",
"isActive": True
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"created": [
{
"id": "mem_abc123def456",
"organizationId": "org_abc123def456",
"userId": "usr_abc123def456",
"role": "member",
"createdAt": "2024-01-01T00:00:00Z",
"department": "it",
"isActive": true,
"fleetDmLabelId": 123,
"user": {
"id": "usr_abc123def456",
"name": "John Doe",
"email": "john.doe@company.com",
"emailVerified": true,
"image": "https://example.com/avatar.jpg",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastLogin": "2024-01-15T12:00:00Z"
}
}
],
"errors": [
{
"index": 2,
"userId": "usr_xyz789abc123",
"error": "User user2@example.com is already a member of this organization"
}
],
"summary": {
"total": 2,
"successful": 1,
"failed": 1
},
"authType": "api-key",
"authenticatedUser": {
"id": "usr_admin123",
"email": "admin@company.com"
}
}{
"message": "Members array cannot be empty"
}{
"message": "Unauthorized"
}{
"message": "Organization with ID org_abc123def456 not found"
}{
"message": "Bulk creation failed"
}People
Add multiple members to organization | Comp AI API
Bulk adds multiple members to the authenticated organization. Each member must have a valid user ID that exists in the system. Members who already exist in.
POST
/
v1
/
people
/
bulk
Add multiple members to organization
curl --request POST \
--url https://api.trycomp.ai/v1/people/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"members": [
{
"userId": "usr_abc123def456",
"role": "admin",
"department": "it",
"isActive": true,
"fleetDmLabelId": 123
},
{
"userId": "usr_def456ghi789",
"role": "member",
"department": "hr",
"isActive": true
}
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
members: [
{
userId: 'usr_abc123def456',
role: 'admin',
department: 'it',
isActive: true,
fleetDmLabelId: 123
},
{userId: 'usr_def456ghi789', role: 'member', department: 'hr', isActive: true}
]
})
};
fetch('https://api.trycomp.ai/v1/people/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/people/bulk"
payload = { "members": [
{
"userId": "usr_abc123def456",
"role": "admin",
"department": "it",
"isActive": True,
"fleetDmLabelId": 123
},
{
"userId": "usr_def456ghi789",
"role": "member",
"department": "hr",
"isActive": True
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"created": [
{
"id": "mem_abc123def456",
"organizationId": "org_abc123def456",
"userId": "usr_abc123def456",
"role": "member",
"createdAt": "2024-01-01T00:00:00Z",
"department": "it",
"isActive": true,
"fleetDmLabelId": 123,
"user": {
"id": "usr_abc123def456",
"name": "John Doe",
"email": "john.doe@company.com",
"emailVerified": true,
"image": "https://example.com/avatar.jpg",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T00:00:00Z",
"lastLogin": "2024-01-15T12:00:00Z"
}
}
],
"errors": [
{
"index": 2,
"userId": "usr_xyz789abc123",
"error": "User user2@example.com is already a member of this organization"
}
],
"summary": {
"total": 2,
"successful": 1,
"failed": 1
},
"authType": "api-key",
"authenticatedUser": {
"id": "usr_admin123",
"email": "admin@company.com"
}
}{
"message": "Members array cannot be empty"
}{
"message": "Unauthorized"
}{
"message": "Organization with ID org_abc123def456 not found"
}{
"message": "Bulk creation failed"
}Authorizations
API key for authentication
Body
application/json
Bulk member creation data
Array of members to create
Show child attributes
Show child attributes
Example:
[
{
"userId": "usr_abc123def456",
"role": "admin",
"department": "it",
"isActive": true,
"fleetDmLabelId": 123
},
{
"userId": "usr_def456ghi789",
"role": "member",
"department": "hr",
"isActive": true
}
]
Response
Bulk member creation completed
Successfully created members
Show child attributes
Show child attributes
Members that failed to be created with error details
Show child attributes
Show child attributes
Show child attributes
Show child attributes
How the request was authenticated
Available options:
api-key, session Show child attributes
Show child attributes
Was this page helpful?
Get integration test statistics grouped by assigneeGet members who can read a specific resource type
⌘I

