Overview
POST
/access/rolesaccessCreate a custom role (workspace admins; ≤20 live custom roles)
Create a record in roles.
Auth: bearerAuth — calls run as the authenticated user.
Parameters
- workspacequerystring
Request body
application/json · optional
- slugstring
- namestring
- descriptionoptionalstring
- defaultForoptional"" | "customer" | "persona"
- grantsAccessGrant[]
Example
{
"slug": "string",
"name": "string",
"description": "string",
"defaultFor": "",
"grants": [
{
"feature": "string",
"itemVerbs": "string",
"subitemVerbs": "string"
}
]
}Responses
201
Created role
- roleAccessRole
Example
{
"role": {
"id": "string",
"slug": "string",
"name": "string",
"description": "string",
"isSystem": true,
"defaultFor": "",
"grants": [
{
"feature": "string",
"itemVerbs": "string",
"subitemVerbs": "string"
}
]
}
}400
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}401
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}403
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}404
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}409
Error
- erroroptionalobject
Example
{
"error": {
"message": "string",
"code": "string"
}
}Code examples
cURL
curl -X POST "https://api.agenticdeveloperhub.com/access/roles" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"slug": "string",
"name": "string",
"description": "string",
"defaultFor": "",
"grants": [
{
"feature": "string",
"itemVerbs": "string",
"subitemVerbs": "string"
}
]
}'JavaScript
const res = await fetch("https://api.agenticdeveloperhub.com/access/roles", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: "{\n \"slug\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"defaultFor\": \"\",\n \"grants\": [\n {\n \"feature\": \"string\",\n \"itemVerbs\": \"string\",\n \"subitemVerbs\": \"string\"\n }\n ]\n}",
});
const data = await res.json();