ROMAN VAZQUEZ MACIAS
12/03/2025, 6:52 PMAsk Inkeep
12/03/2025, 6:52 PMAsk Inkeep
12/03/2025, 6:52 PM/bulk/users endpoint :
curl -X POST <https://api.permit.io/v2/facts/{proj_id}/{env_id}/bulk/users> \
-H "Authorization: Bearer {your_permit_token}" \
-H "Content-Type: application/json" \
-d '{
"operations": [{
"key": "user|892179821739812389327",
"email": "<mailto:jane@coolcompany.com|jane@coolcompany.com>",
"first_name": "Jane",
"last_name": "Doe",
"attributes": {}
}, ...]
}'
(2) , (1)
Bulk Role Assignment
After creating users, you can assign roles in bulk using a separate API call :
curl -X POST <https://api.permit.io/v2/facts/{proj_id}/{env_id}/role_assignments/bulk> \
-H "Authorization: Bearer {your_permit_token}" \
-H "Content-Type: application/json" \
-d '[{
"user": "892179821739812389327",
"role": "admin",
"tenant": "default"
}, ...]'
Default Role Assignment
Yes, you can use a default RBAC role when uploading users (3) . The documentation shows an example where users are automatically assigned a default "viewer" role during sync :
// Assign the user a default role ("viewer") in the specified tenant
await permit.api.users.assignRole({
user: user._id.toString() , // Reference the user by their unique ID
role: "viewer", // Assign the "viewer" role
tenant: tenantId, // Specify the tenant the user belongs to
}) ;
This approach allows you to set a baseline permission level for all new users , which you can later modify as needed through role assignment operations (1) .
The bulk operations require two separate API calls - one to create users and another to assign roles . This gives you flexibility to create users first and then assign appropriate roles based on your RBAC policy configuration (4) .Ask Inkeep
12/03/2025, 6:52 PMAsk Inkeep
12/03/2025, 7:00 PM