Crear reglas
curl --request POST \
--url https://api.filexpress.app/api/external/hr/labor-rules \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"country_code": "SV",
"name": "Reglas 2027",
"effective_from": "2027-01-01",
"effective_to": null,
"is_active": true,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [
7
],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": [
"daily",
"weekly"
],
"daily_cap_minutes": null,
"weekly_cap_minutes": null,
"total_daily_cap_minutes": null,
"requires_approval": false
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": true,
"breaks": {
"paid": false,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": null
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
}
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country_code: 'SV',
name: 'Reglas 2027',
effective_from: '2027-01-01',
effective_to: null,
is_active: true,
params: {
timezone: 'America/El_Salvador',
day_band: {start: '06:00', end: '19:00'},
mixed_rule: {type: 'night_if_night_minutes_gt', threshold_minutes: 240},
max_ordinary: {
daily: {day: 480, night: 420, mixed: 480},
weekly: {day: 2640, night: 2340, mixed: 2640}
},
week_starts_on: 1,
default_rest_days: [7],
default_daily_minutes: {'1': 480, '2': 480, '3': 480, '4': 480, '5': 480, '6': 240, '7': 0},
overtime: {
basis: ['daily', 'weekly'],
daily_cap_minutes: null,
weekly_cap_minutes: null,
total_daily_cap_minutes: null,
requires_approval: false
},
surcharges: {
ordinary_day: 0,
ordinary_night: 0.25,
overtime_day: 1,
overtime_night: 1.5,
rest_day: 0.5,
holiday: 1,
combination: 'multiplicative'
},
rest_day_compensatory: true,
breaks: {paid: false, min_minutes: 30, auto_deduct_minutes: 0},
tolerances: {
late_grace_minutes: 5,
early_leave_grace_minutes: 0,
absence_after_minutes: null
},
rounding: {unit_minutes: 1, mode: 'none'},
min_hourly_wage: 1.7,
currency: 'USD'
}
})
};
fetch('https://api.filexpress.app/api/external/hr/labor-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.filexpress.app/api/external/hr/labor-rules"
payload = {
"country_code": "SV",
"name": "Reglas 2027",
"effective_from": "2027-01-01",
"effective_to": None,
"is_active": True,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [7],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": ["daily", "weekly"],
"daily_cap_minutes": None,
"weekly_cap_minutes": None,
"total_daily_cap_minutes": None,
"requires_approval": False
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": True,
"breaks": {
"paid": False,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": None
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.filexpress.app/api/external/hr/labor-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'country_code' => 'SV',
'name' => 'Reglas 2027',
'effective_from' => '2027-01-01',
'effective_to' => null,
'is_active' => true,
'params' => [
'timezone' => 'America/El_Salvador',
'day_band' => [
'start' => '06:00',
'end' => '19:00'
],
'mixed_rule' => [
'type' => 'night_if_night_minutes_gt',
'threshold_minutes' => 240
],
'max_ordinary' => [
'daily' => [
'day' => 480,
'night' => 420,
'mixed' => 480
],
'weekly' => [
'day' => 2640,
'night' => 2340,
'mixed' => 2640
]
],
'week_starts_on' => 1,
'default_rest_days' => [
7
],
'default_daily_minutes' => [
'1' => 480,
'2' => 480,
'3' => 480,
'4' => 480,
'5' => 480,
'6' => 240,
'7' => 0
],
'overtime' => [
'basis' => [
'daily',
'weekly'
],
'daily_cap_minutes' => null,
'weekly_cap_minutes' => null,
'total_daily_cap_minutes' => null,
'requires_approval' => false
],
'surcharges' => [
'ordinary_day' => 0,
'ordinary_night' => 0.25,
'overtime_day' => 1,
'overtime_night' => 1.5,
'rest_day' => 0.5,
'holiday' => 1,
'combination' => 'multiplicative'
],
'rest_day_compensatory' => true,
'breaks' => [
'paid' => false,
'min_minutes' => 30,
'auto_deduct_minutes' => 0
],
'tolerances' => [
'late_grace_minutes' => 5,
'early_leave_grace_minutes' => 0,
'absence_after_minutes' => null
],
'rounding' => [
'unit_minutes' => 1,
'mode' => 'none'
],
'min_hourly_wage' => 1.7,
'currency' => 'USD'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": true,
"data": {
"id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"business_id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"country_code": "SV",
"name": "El Salvador – Código de Trabajo",
"source_template_id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"effective_from": "2026-01-01",
"effective_to": null,
"schema_version": 1,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [
7
],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": [
"daily",
"weekly"
],
"daily_cap_minutes": null,
"weekly_cap_minutes": null,
"total_daily_cap_minutes": null,
"requires_approval": false
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": true,
"breaks": {
"paid": false,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": null
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
},
"is_active": true,
"is_template": false,
"recalculation_queued": true
}
}{
"status": false,
"message": "Invalid API Key."
}{
"status": false,
"message": "This integration does not have the 'hr.employees' permission.",
"required_scope": "hr.employees"
}{
"status": false,
"message": "Validation errors",
"errors": {
"start_date": [
"The start date field is required."
]
}
}{
"status": false,
"message": "Rate limit exceeded. Please try again later.",
"rate_limit": 100
}Crear reglas
Crea una vigencia de reglas de la empresa con params completos. No puede solaparse con otra activa. Encola el recálculo de la asistencia afectada.
Permiso requerido: hr.labor_rules.write
POST
/
hr
/
labor-rules
Crear reglas
curl --request POST \
--url https://api.filexpress.app/api/external/hr/labor-rules \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"country_code": "SV",
"name": "Reglas 2027",
"effective_from": "2027-01-01",
"effective_to": null,
"is_active": true,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [
7
],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": [
"daily",
"weekly"
],
"daily_cap_minutes": null,
"weekly_cap_minutes": null,
"total_daily_cap_minutes": null,
"requires_approval": false
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": true,
"breaks": {
"paid": false,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": null
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
}
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country_code: 'SV',
name: 'Reglas 2027',
effective_from: '2027-01-01',
effective_to: null,
is_active: true,
params: {
timezone: 'America/El_Salvador',
day_band: {start: '06:00', end: '19:00'},
mixed_rule: {type: 'night_if_night_minutes_gt', threshold_minutes: 240},
max_ordinary: {
daily: {day: 480, night: 420, mixed: 480},
weekly: {day: 2640, night: 2340, mixed: 2640}
},
week_starts_on: 1,
default_rest_days: [7],
default_daily_minutes: {'1': 480, '2': 480, '3': 480, '4': 480, '5': 480, '6': 240, '7': 0},
overtime: {
basis: ['daily', 'weekly'],
daily_cap_minutes: null,
weekly_cap_minutes: null,
total_daily_cap_minutes: null,
requires_approval: false
},
surcharges: {
ordinary_day: 0,
ordinary_night: 0.25,
overtime_day: 1,
overtime_night: 1.5,
rest_day: 0.5,
holiday: 1,
combination: 'multiplicative'
},
rest_day_compensatory: true,
breaks: {paid: false, min_minutes: 30, auto_deduct_minutes: 0},
tolerances: {
late_grace_minutes: 5,
early_leave_grace_minutes: 0,
absence_after_minutes: null
},
rounding: {unit_minutes: 1, mode: 'none'},
min_hourly_wage: 1.7,
currency: 'USD'
}
})
};
fetch('https://api.filexpress.app/api/external/hr/labor-rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.filexpress.app/api/external/hr/labor-rules"
payload = {
"country_code": "SV",
"name": "Reglas 2027",
"effective_from": "2027-01-01",
"effective_to": None,
"is_active": True,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [7],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": ["daily", "weekly"],
"daily_cap_minutes": None,
"weekly_cap_minutes": None,
"total_daily_cap_minutes": None,
"requires_approval": False
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": True,
"breaks": {
"paid": False,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": None
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.filexpress.app/api/external/hr/labor-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'country_code' => 'SV',
'name' => 'Reglas 2027',
'effective_from' => '2027-01-01',
'effective_to' => null,
'is_active' => true,
'params' => [
'timezone' => 'America/El_Salvador',
'day_band' => [
'start' => '06:00',
'end' => '19:00'
],
'mixed_rule' => [
'type' => 'night_if_night_minutes_gt',
'threshold_minutes' => 240
],
'max_ordinary' => [
'daily' => [
'day' => 480,
'night' => 420,
'mixed' => 480
],
'weekly' => [
'day' => 2640,
'night' => 2340,
'mixed' => 2640
]
],
'week_starts_on' => 1,
'default_rest_days' => [
7
],
'default_daily_minutes' => [
'1' => 480,
'2' => 480,
'3' => 480,
'4' => 480,
'5' => 480,
'6' => 240,
'7' => 0
],
'overtime' => [
'basis' => [
'daily',
'weekly'
],
'daily_cap_minutes' => null,
'weekly_cap_minutes' => null,
'total_daily_cap_minutes' => null,
'requires_approval' => false
],
'surcharges' => [
'ordinary_day' => 0,
'ordinary_night' => 0.25,
'overtime_day' => 1,
'overtime_night' => 1.5,
'rest_day' => 0.5,
'holiday' => 1,
'combination' => 'multiplicative'
],
'rest_day_compensatory' => true,
'breaks' => [
'paid' => false,
'min_minutes' => 30,
'auto_deduct_minutes' => 0
],
'tolerances' => [
'late_grace_minutes' => 5,
'early_leave_grace_minutes' => 0,
'absence_after_minutes' => null
],
'rounding' => [
'unit_minutes' => 1,
'mode' => 'none'
],
'min_hourly_wage' => 1.7,
'currency' => 'USD'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": true,
"data": {
"id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"business_id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"country_code": "SV",
"name": "El Salvador – Código de Trabajo",
"source_template_id": "9d1c5a3e-4b7f-4e2a-9c1d-2f6b8a0e7c11",
"effective_from": "2026-01-01",
"effective_to": null,
"schema_version": 1,
"params": {
"timezone": "America/El_Salvador",
"day_band": {
"start": "06:00",
"end": "19:00"
},
"mixed_rule": {
"type": "night_if_night_minutes_gt",
"threshold_minutes": 240
},
"max_ordinary": {
"daily": {
"day": 480,
"night": 420,
"mixed": 480
},
"weekly": {
"day": 2640,
"night": 2340,
"mixed": 2640
}
},
"week_starts_on": 1,
"default_rest_days": [
7
],
"default_daily_minutes": {
"1": 480,
"2": 480,
"3": 480,
"4": 480,
"5": 480,
"6": 240,
"7": 0
},
"overtime": {
"basis": [
"daily",
"weekly"
],
"daily_cap_minutes": null,
"weekly_cap_minutes": null,
"total_daily_cap_minutes": null,
"requires_approval": false
},
"surcharges": {
"ordinary_day": 0,
"ordinary_night": 0.25,
"overtime_day": 1,
"overtime_night": 1.5,
"rest_day": 0.5,
"holiday": 1,
"combination": "multiplicative"
},
"rest_day_compensatory": true,
"breaks": {
"paid": false,
"min_minutes": 30,
"auto_deduct_minutes": 0
},
"tolerances": {
"late_grace_minutes": 5,
"early_leave_grace_minutes": 0,
"absence_after_minutes": null
},
"rounding": {
"unit_minutes": 1,
"mode": "none"
},
"min_hourly_wage": 1.7,
"currency": "USD"
},
"is_active": true,
"is_template": false,
"recalculation_queued": true
}
}{
"status": false,
"message": "Invalid API Key."
}{
"status": false,
"message": "This integration does not have the 'hr.employees' permission.",
"required_scope": "hr.employees"
}{
"status": false,
"message": "Validation errors",
"errors": {
"start_date": [
"The start date field is required."
]
}
}{
"status": false,
"message": "Rate limit exceeded. Please try again later.",
"rate_limit": 100
}Authorizations
API Key de la integración (Integraciones → Nueva Integración).
Body
application/json
Response
Reglas creadas