curl -X PUT https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Lead Developer",
"description": "Lead software development position"
}'
const response = await fetch(
'https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Lead Developer',
description: 'Lead software development position'
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Lead Developer",
"description": "Lead software development position"
}
response = requests.put(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": "Lead Developer",
"description": "Lead software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T15:45:00Z"
}
}
{
"success": false,
"message": "invalid role id"
}
{
"success": false,
"message": "unauthorized"
}
Roles & Permissions
Update Role
Update an existing role
PUT
/
roles
/
{id}
curl -X PUT https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Lead Developer",
"description": "Lead software development position"
}'
const response = await fetch(
'https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Lead Developer',
description: 'Lead software development position'
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Lead Developer",
"description": "Lead software development position"
}
response = requests.put(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": "Lead Developer",
"description": "Lead software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T15:45:00Z"
}
}
{
"success": false,
"message": "invalid role id"
}
{
"success": false,
"message": "unauthorized"
}
Update a role’s information. All fields are optional - only provide the fields you want to update. Requires Super Admin or HR Manager permissions.
This endpoint supports both
PUT and PATCH methods.Path Parameters
string
required
The unique identifier of the role (UUID format)Example:
"550e8400-e29b-41d4-a716-446655440000"Request Body
string
Name of the role. Must be between 2 and 50 characters if provided.Example:
"Lead Developer"string
Description of the role.Example:
"Lead software development position"string[]
Array of cached permission strings.Example:
["employees:read", "employees:write", "employees:delete"]Response
boolean
Indicates if the request was successful
object
The updated 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 PUT https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Lead Developer",
"description": "Lead software development position"
}'
const response = await fetch(
'https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Lead Developer',
description: 'Lead software development position'
})
}
);
const data = await response.json();
import requests
url = "https://api.companyflow.com/roles/550e8400-e29b-41d4-a716-446655440000"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"name": "Lead Developer",
"description": "Lead software development position"
}
response = requests.put(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": "Lead Developer",
"description": "Lead software development position",
"is_system_role": false,
"permissions_cache": ["employees:read", "employees:write"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T15:45:00Z"
}
}
{
"success": false,
"message": "invalid role id"
}
{
"success": false,
"message": "unauthorized"
}