Skip to main content
POST
/
companies
/
{company_id}
/
departments
curl -X POST https://api.companyflow.com/companies/{company_id}/departments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering",
    "code": "ENG",
    "description": "Software engineering and development",
    "cost_center": "CC-100",
    "status": "active"
  }'
{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "company_id": "987fcdeb-51a2-43f7-9c5d-123456789abc",
    "name": "Engineering",
    "code": "ENG",
    "description": "Software engineering and development",
    "parent_department_id": null,
    "cost_center": "CC-100",
    "status": "active",
    "created_at": "2026-03-03T10:00:00Z",
    "updated_at": "2026-03-03T10:00:00Z"
  }
}

Authentication

This endpoint requires authentication with a Bearer token. Only users with Super Admin or HR Manager roles can create departments.
company_id
string
required
The unique identifier of the company

Request Body

name
string
required
Department name (2-255 characters)
code
string
Department code (max 50 characters)
description
string
Department description
parent_department_id
string
UUID of the parent department for hierarchical structure
cost_center
string
Cost center identifier (max 100 characters)
status
string
required
Department status. Must be one of: active, inactive

Response

success
boolean
Indicates if the request was successful
data
object
The created department object
curl -X POST https://api.companyflow.com/companies/{company_id}/departments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering",
    "code": "ENG",
    "description": "Software engineering and development",
    "cost_center": "CC-100",
    "status": "active"
  }'
{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "company_id": "987fcdeb-51a2-43f7-9c5d-123456789abc",
    "name": "Engineering",
    "code": "ENG",
    "description": "Software engineering and development",
    "parent_department_id": null,
    "cost_center": "CC-100",
    "status": "active",
    "created_at": "2026-03-03T10:00:00Z",
    "updated_at": "2026-03-03T10:00:00Z"
  }
}

Build docs developers (and LLMs) love