curl -X POST https://api.companyflow.com/companies/{company_id}/roles \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}'
const response = await fetch(
'https://api.companyflow.com/companies/{company_id}/roles',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Senior Developer',
description: 'Senior-level software development position',
permissions_cache: ['employees:read', 'employees:write']
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/companies/{company_id}/roles"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"company_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Senior Developer",
"description": "Senior-level software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"success": false,
"message": "invalid request body"
}
{
"success": false,
"message": "unauthorized"
}
Roles & Permissions
Create Role
Create a new role for a company
POST
/
companies
/
{company_id}
/
roles
curl -X POST https://api.companyflow.com/companies/{company_id}/roles \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}'
const response = await fetch(
'https://api.companyflow.com/companies/{company_id}/roles',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Senior Developer',
description: 'Senior-level software development position',
permissions_cache: ['employees:read', 'employees:write']
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/companies/{company_id}/roles"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"company_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Senior Developer",
"description": "Senior-level software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"success": false,
"message": "invalid request body"
}
{
"success": false,
"message": "unauthorized"
}
Create a new role within a company. Requires Super Admin or HR Manager permissions.
Path Parameters
string
required
The unique identifier of the company
Request Body
string
required
Name of the role. Must be between 2 and 50 characters.Example:
"Senior Developer"string
Optional description of the role.Example:
"Senior-level software development position"string[]
Optional array of cached permission strings.Example:
["employees:read", "employees:write"]Response
boolean
Indicates if the request was successful
object
The created role object
Show Role Object
Show Role Object
string
Unique identifier for the role
string
The company this role belongs to
string
Name of the role
string
Description of the role
boolean
Whether this is a system-defined role
string[]
Array of cached permission strings
string
ISO 8601 timestamp of when the role was created
string
ISO 8601 timestamp of when the role was last updated
curl -X POST https://api.companyflow.com/companies/{company_id}/roles \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}'
const response = await fetch(
'https://api.companyflow.com/companies/{company_id}/roles',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Senior Developer',
description: 'Senior-level software development position',
permissions_cache: ['employees:read', 'employees:write']
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/companies/{company_id}/roles"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Senior Developer",
"description": "Senior-level software development position",
"permissions_cache": ["employees:read", "employees:write"]
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"company_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Senior Developer",
"description": "Senior-level software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"success": false,
"message": "invalid request body"
}
{
"success": false,
"message": "unauthorized"
}