Create a role
POST /api/roles
POST /api/rolesInteractive request editor loads with JavaScript.
X-API-KEY<token>
In: header
Request Body
application/json
Response Body
application/json
application/json
curl -X POST "$API_BASE_URL/api/roles" \ -H "Content-Type: application/json" \ -d '{ "name": "View Consumer" }'Successfully retrieved the role.
{
"value": {
"id": "bd58fce2-b6cc-4d2d-a53c-6ce11b19c101",
"name": "View Consumer",
"desc": "This role allows users to view comsumers.",
"labels": {
"version": "v2",
"env": "prod"
},
"type": "custom",
"policies": [
"super-admin-permission-policy"
],
"created_at": 1742288232,
"updated_at": 1742288235
}
}Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
{
"value": {},
"error_msg": "error message"
}Complete operation details and schema variants
POST /api/roles
Create a role
Create a custom RBAC role used to group permission policies. The new role can then be assigned to users.
Required IAM Permission: Action iam:CreateRole, Resource arn:api7:iam:role/*
Parameters
Request body
Content type: application/json
name(string, required): The role name.desc(string, optional): The object description.labels(object, optional): Key-value pairs of labels.policies(array, optional): The polices attached to the role.
Responses
200: Successfully retrieved the role.- allOf variant 1
value(object, optional): The specific resource.- allOf variant 2
value(object, optional): The specification of the role of the user.value.id(string, optional): The object ID.value.name(string, optional): The role name.value.desc(string, optional): The object description.value.labels(object, optional): Key-value pairs of labels.value.type(string, optional): Type of the role.value.policies(array, optional): The policies of the role.value.created_at(integer, optional): The object created timestamp.value.updated_at(integer, optional): The object updated timestamp.400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.value(object, optional): The specific resource.error_msg(string, optional): The error message.
cURL
curl -X POST '$API_BASE_URL/api/roles'