Create Role
Create Role
POST
https://api.ocamba.com/v2/adex/roles
Creates a custom Role. Required field is name. Optional description and permissions (omit or [] for a role with no privileges). The new role is never the default and is never read-only — use POST /roles/{id}/set-as-default to make it the default. Server sets permissions_counter and members_counter (0).
Note
Do not send id, company_id, is_default, read_only, permissions_counter, or members_counter. System (read-only) roles are not created via this API.
Rate limits:
- Burst: 10/s
- Steady: 150/m
Request schema
bodyResponse schemas
›
201
application/json
›
400
application/json
›
500
application/json
curl -X POST \
"https://api.ocamba.com/v2/adex/roles" \
-H "Authorization: Bearer {TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "Campaign ops",
"description": "Can manage campaigns.",
"permissions": [
"campaigns.get",
"campaigns.post"
]
}'const url = 'https://api.ocamba.com/v2/adex/roles';
const options = {
method: 'POST',
headers: {
Authorization: "Bearer {TOKEN}",
'Content-Type': "application/json"
},
body: JSON.stringify(
{
"name": "Campaign ops",
"description": "Can manage campaigns.",
"permissions": [
"campaigns.get",
"campaigns.post"
]
}
)
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}$ch = curl_init("https://api.ocamba.com/v2/adex/roles");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {TOKEN}",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(
[
"name" => "Campaign ops",
"description" => "Can manage campaigns.",
"permissions" => [
"campaigns.get",
"campaigns.post"
]
]
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);Responses
201 Created
{
"id": "1000",
"company_id": "200",
"name": "Campaign ops",
"description": "Can manage campaigns.",
"is_default": 0,
"read_only": 0,
"permissions": [
"campaigns.get",
"campaigns.post"
],
"permissions_counter": 2,
"members_counter": 0,
"create_time": "2026-03-20 14:00:00",
"update_time": "2026-03-20 14:00:00"
}
400 Bad Request
{
"code": 400,
"title": "Bad request.",
"message": "The request is not valid.",
"trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
500 Internal Server Error
{
"code": 500,
"title": "Internal server error.",
"trace_id": "99a84211-f73d-4ff8-acdf-eb3e06bb9d62"
}
Responses