Skip to main content
PUT
/
leave-types
/
{id}
curl -X PUT https://api.companyflow.com/leave-types/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "daysAllowed": 22,
    "maxCarryForwardDays": 10,
    "description": "Updated policy with increased allowance"
  }'
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "company_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Annual Leave",
    "code": "AL",
    "description": "Updated policy with increased allowance",
    "days_allowed": 22,
    "is_paid": true,
    "requires_documentation": false,
    "carry_forward_allowed": true,
    "max_carry_forward_days": 10,
    "color_code": "#3B82F6",
    "status": "active",
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-03-03T15:45:00Z"
  }
}
Update the configuration of an existing leave type. Both PUT and PATCH methods are supported. This endpoint allows you to modify leave policies, allowances, and other settings.

Authentication

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

Path Parameters

id
string
required
The unique identifier of the leave type (UUID format)Example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

Request Body

All fields are optional. Only include the fields you want to update.
name
string
Name of the leave typeExample: "Annual Leave (Updated)"
code
string
Short code for the leave typeExample: "AL"
description
string
Detailed description of the leave typeExample: "Updated policy for annual vacation time"
daysAllowed
number
Total number of days allowed per yearExample: 22
isPaid
boolean
Whether this leave type is paid or unpaidExample: true
requiresDocumentation
boolean
Whether documentation is requiredExample: true
carryForwardAllowed
boolean
Whether unused days can be carried forwardExample: true
maxCarryForwardDays
number
Maximum number of days that can be carried forwardExample: 10
colorCode
string
Hex color code for calendar displayExample: "#10B981"
status
string
Status of the leave type: active or inactiveExample: "active"

Response

success
boolean
Indicates if the request was successful
data
object
The updated leave type object
curl -X PUT https://api.companyflow.com/leave-types/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "daysAllowed": 22,
    "maxCarryForwardDays": 10,
    "description": "Updated policy with increased allowance"
  }'
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "company_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Annual Leave",
    "code": "AL",
    "description": "Updated policy with increased allowance",
    "days_allowed": 22,
    "is_paid": true,
    "requires_documentation": false,
    "carry_forward_allowed": true,
    "max_carry_forward_days": 10,
    "color_code": "#3B82F6",
    "status": "active",
    "created_at": "2025-01-15T10:30:00Z",
    "updated_at": "2025-03-03T15:45:00Z"
  }
}
Changes to leave type configuration will affect all future leave requests. Existing approved leave requests will not be modified.

PATCH vs PUT

This endpoint supports both HTTP methods:
  • PUT: Update specific fields (partial update)
  • PATCH: Update specific fields (partial update)
Both methods work identically - you only need to include the fields you want to update.

Build docs developers (and LLMs) love