curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/workspace/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Loop Agent",
"key": "loop_agent",
"product_key": "loop",
"scopes": [
"loop.conversations.view",
"loop.conversations.reply"
]
}
'{
"success": true,
"message": "Workspace role created",
"data": {
"role": {
"uuid": "22222222-2222-4222-8222-222222222222",
"key": "loop_agent",
"name": "Loop Agent",
"product_key": "loop",
"product_label": "Loop",
"scopes": [
"loop.conversations.view",
"loop.conversations.reply"
],
"members_count": 0,
"is_system": false,
"created_at": "2026-08-08T20:12:00+00:00",
"updated_at": "2026-08-08T20:12:00+00:00"
}
}
}{
"success": false,
"message": "Validation failed",
"data": {
"scopes": [
"A role can only include scopes from one product."
]
}
}Workspace Roles
Create a role
Creates a role from a set of scopes belonging to one product. Get the available scope keys from /api/v1/workspace/products//scopes. Re-using the key of a role that was removed brings that role back with the new name and scopes.
POST
/
api
/
v1
/
workspace
/
roles
curl --request POST \
--url https://{subdomain}.mihu.ai/api/v1/workspace/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Loop Agent",
"key": "loop_agent",
"product_key": "loop",
"scopes": [
"loop.conversations.view",
"loop.conversations.reply"
]
}
'{
"success": true,
"message": "Workspace role created",
"data": {
"role": {
"uuid": "22222222-2222-4222-8222-222222222222",
"key": "loop_agent",
"name": "Loop Agent",
"product_key": "loop",
"product_label": "Loop",
"scopes": [
"loop.conversations.view",
"loop.conversations.reply"
],
"members_count": 0,
"is_system": false,
"created_at": "2026-08-08T20:12:00+00:00",
"updated_at": "2026-08-08T20:12:00+00:00"
}
}
}{
"success": false,
"message": "Validation failed",
"data": {
"scopes": [
"A role can only include scopes from one product."
]
}
}Authorizations
Use a Bearer token to access these API endpoints. Example: "Bearer {your-token}"
Body
application/json
Name shown to the user
Maximum string length:
255Example:
"Loop Agent"
Lowercase letters, digits and underscores; derived from the name when omitted
Maximum string length:
255Example:
"loop_agent"
Optional; when given, every scope must belong to this product and at least one scope is required
Example:
"loop"
Scope keys, all from the same product; omit for a role with no access yet
Example:
[
"loop.conversations.view",
"loop.conversations.reply"
]