Skip to main content
POST
/
companies
/
{company_id}
/
leave-types
curl -X POST https://api.companyflow.com/companies/123e4567-e89b-12d3-a456-426614174000/leave-types \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Annual Leave",
    "code": "AL",
    "description": "Paid annual vacation time for all employees",
    "daysAllowed": 20,
    "isPaid": true,
    "requiresDocumentation": false,
    "carryForwardAllowed": true,
    "maxCarryForwardDays": 5,
    "colorCode": "#3B82F6",
    "status": "active"
  }'
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "company_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Annual Leave",
    "code": "AL",
    "description": "Paid annual vacation time for all employees",
    "days_allowed": 20,
    "is_paid": true,
    "requires_documentation": false,
    "carry_forward_allowed": true,
    "max_carry_forward_days": 5,
    "color_code": "#3B82F6",
    "status": "active",
    "created_at": "2025-03-03T10:30:00Z",
    "updated_at": "2025-03-03T10:30:00Z"
  }
}
Create a new leave type configuration for a company. Leave types define the different categories of leave available to employees (e.g., Annual Leave, Sick Leave, etc.) along with their policies and allowances.

Authentication

Requires authentication with Bearer token. Available to:
  • Super Admin
  • HR Manager

Path Parameters

company_id
string
required
The unique identifier of the company (UUID format)Example: "123e4567-e89b-12d3-a456-426614174000"

Request Body

name
string
required
Name of the leave typeExample: "Annual Leave"
code
string
required
Short code for the leave type (typically uppercase)Example: "AL"
description
string
required
Detailed description of the leave typeExample: "Paid annual vacation time for all employees"
daysAllowed
number
required
Total number of days allowed per year for this leave typeExample: 20
isPaid
boolean
required
Whether this leave type is paid or unpaidExample: true
requiresDocumentation
boolean
required
Whether documentation (e.g., medical certificate) is requiredExample: false
carryForwardAllowed
boolean
required
Whether unused days can be carried forward to the next yearExample: true
maxCarryForwardDays
number
required
Maximum number of days that can be carried forwardExample: 5
colorCode
string
required
Hex color code for calendar displayExample: "#3B82F6"
status
string
required
Status of the leave type: active or inactiveExample: "active"

Response

success
boolean
Indicates if the request was successful
data
object
The created leave type object
curl -X POST https://api.companyflow.com/companies/123e4567-e89b-12d3-a456-426614174000/leave-types \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Annual Leave",
    "code": "AL",
    "description": "Paid annual vacation time for all employees",
    "daysAllowed": 20,
    "isPaid": true,
    "requiresDocumentation": false,
    "carryForwardAllowed": true,
    "maxCarryForwardDays": 5,
    "colorCode": "#3B82F6",
    "status": "active"
  }'
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "company_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Annual Leave",
    "code": "AL",
    "description": "Paid annual vacation time for all employees",
    "days_allowed": 20,
    "is_paid": true,
    "requires_documentation": false,
    "carry_forward_allowed": true,
    "max_carry_forward_days": 5,
    "color_code": "#3B82F6",
    "status": "active",
    "created_at": "2025-03-03T10:30:00Z",
    "updated_at": "2025-03-03T10:30:00Z"
  }
}
After creating a leave type, employees in the company will need to have leave balances initialized for this type before they can request leave.

Build docs developers (and LLMs) love