curl --request POST \
--url https://api.example.com/v1/payroll/calculate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": "MX",
"scheme": "ordinario",
"year": 2024,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee": {
"id": "emp_001",
"daily_salary": 800,
"monthly_salary": 24000,
"factor_integracion": 1.0493,
"risk_class_rate": 0.00522,
"overtime_amount": "0",
"sunday_bonus_days": 0,
"grocery_voucher_amount": "0",
"infonavit_credit_amount": "0",
"num_dependentes_irrf": 0,
"vale_transporte_amount": "0",
"pensao_alimenticia_amount": "0",
"decimo_terceiro_amount": "0",
"ferias_amount": "0",
"rat_fap_rate": "0.02",
"cantidad_hijos": 0,
"cantidad_hijos_incapacitados": 0,
"cuota_sindical_rate": "0",
"afp_rate": "0",
"commission_amount": "0",
"asignacion_familiar_amount": "0",
"colacion_amount": "0",
"movilizacion_amount": "0",
"horas_recargo_nocturno": "0",
"horas_dominicales_diurnas": "0",
"horas_dominicales_nocturnas": "0",
"horas_extra_diurnas": "0",
"horas_extra_nocturnas": "0",
"horas_extra_dominicales_diurnas": "0",
"horas_extra_dominicales_nocturnas": "0",
"overrides": {
"bono_puntualidad": true
}
},
"employer": {
"id": "employer_001",
"rfc": "ABC123456XY0"
},
"overrides": {},
"options": {
"include_audit_trail": true,
"include_diagram": false,
"precision": 2,
"supersedes": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"metadata": {
"run": "nomina-2026-09-q1"
}
}
}
'import requests
url = "https://api.example.com/v1/payroll/calculate"
payload = {
"country": "MX",
"scheme": "ordinario",
"year": 2024,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee": {
"id": "emp_001",
"daily_salary": 800,
"monthly_salary": 24000,
"factor_integracion": 1.0493,
"risk_class_rate": 0.00522,
"overtime_amount": "0",
"sunday_bonus_days": 0,
"grocery_voucher_amount": "0",
"infonavit_credit_amount": "0",
"num_dependentes_irrf": 0,
"vale_transporte_amount": "0",
"pensao_alimenticia_amount": "0",
"decimo_terceiro_amount": "0",
"ferias_amount": "0",
"rat_fap_rate": "0.02",
"cantidad_hijos": 0,
"cantidad_hijos_incapacitados": 0,
"cuota_sindical_rate": "0",
"afp_rate": "0",
"commission_amount": "0",
"asignacion_familiar_amount": "0",
"colacion_amount": "0",
"movilizacion_amount": "0",
"horas_recargo_nocturno": "0",
"horas_dominicales_diurnas": "0",
"horas_dominicales_nocturnas": "0",
"horas_extra_diurnas": "0",
"horas_extra_nocturnas": "0",
"horas_extra_dominicales_diurnas": "0",
"horas_extra_dominicales_nocturnas": "0",
"overrides": { "bono_puntualidad": True }
},
"employer": {
"id": "employer_001",
"rfc": "ABC123456XY0"
},
"overrides": {},
"options": {
"include_audit_trail": True,
"include_diagram": False,
"precision": 2,
"supersedes": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"metadata": { "run": "nomina-2026-09-q1" }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'MX',
scheme: 'ordinario',
year: 2024,
period: {type: 'monthly', start_date: '2024-03-01', end_date: '2024-03-31', days: 30},
employee: {
id: 'emp_001',
daily_salary: 800,
monthly_salary: 24000,
factor_integracion: 1.0493,
risk_class_rate: 0.00522,
overtime_amount: '0',
sunday_bonus_days: 0,
grocery_voucher_amount: '0',
infonavit_credit_amount: '0',
num_dependentes_irrf: 0,
vale_transporte_amount: '0',
pensao_alimenticia_amount: '0',
decimo_terceiro_amount: '0',
ferias_amount: '0',
rat_fap_rate: '0.02',
cantidad_hijos: 0,
cantidad_hijos_incapacitados: 0,
cuota_sindical_rate: '0',
afp_rate: '0',
commission_amount: '0',
asignacion_familiar_amount: '0',
colacion_amount: '0',
movilizacion_amount: '0',
horas_recargo_nocturno: '0',
horas_dominicales_diurnas: '0',
horas_dominicales_nocturnas: '0',
horas_extra_diurnas: '0',
horas_extra_nocturnas: '0',
horas_extra_dominicales_diurnas: '0',
horas_extra_dominicales_nocturnas: '0',
overrides: {bono_puntualidad: true}
},
employer: {id: 'employer_001', rfc: 'ABC123456XY0'},
overrides: {},
options: {
include_audit_trail: true,
include_diagram: false,
precision: 2,
supersedes: '01HX9B2KM3V4W5X6Y7Z8A9B0CD',
metadata: {run: 'nomina-2026-09-q1'}
}
})
};
fetch('https://api.example.com/v1/payroll/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/payroll/calculate",
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' => 'MX',
'scheme' => 'ordinario',
'year' => 2024,
'period' => [
'type' => 'monthly',
'start_date' => '2024-03-01',
'end_date' => '2024-03-31',
'days' => 30
],
'employee' => [
'id' => 'emp_001',
'daily_salary' => 800,
'monthly_salary' => 24000,
'factor_integracion' => 1.0493,
'risk_class_rate' => 0.00522,
'overtime_amount' => '0',
'sunday_bonus_days' => 0,
'grocery_voucher_amount' => '0',
'infonavit_credit_amount' => '0',
'num_dependentes_irrf' => 0,
'vale_transporte_amount' => '0',
'pensao_alimenticia_amount' => '0',
'decimo_terceiro_amount' => '0',
'ferias_amount' => '0',
'rat_fap_rate' => '0.02',
'cantidad_hijos' => 0,
'cantidad_hijos_incapacitados' => 0,
'cuota_sindical_rate' => '0',
'afp_rate' => '0',
'commission_amount' => '0',
'asignacion_familiar_amount' => '0',
'colacion_amount' => '0',
'movilizacion_amount' => '0',
'horas_recargo_nocturno' => '0',
'horas_dominicales_diurnas' => '0',
'horas_dominicales_nocturnas' => '0',
'horas_extra_diurnas' => '0',
'horas_extra_nocturnas' => '0',
'horas_extra_dominicales_diurnas' => '0',
'horas_extra_dominicales_nocturnas' => '0',
'overrides' => [
'bono_puntualidad' => true
]
],
'employer' => [
'id' => 'employer_001',
'rfc' => 'ABC123456XY0'
],
'overrides' => [
],
'options' => [
'include_audit_trail' => true,
'include_diagram' => false,
'precision' => 2,
'supersedes' => '01HX9B2KM3V4W5X6Y7Z8A9B0CD',
'metadata' => [
'run' => 'nomina-2026-09-q1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/payroll/calculate"
payload := strings.NewReader("{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/payroll/calculate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payroll/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"country": "<string>",
"scheme": "<string>",
"year": 123,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee_id": "<string>",
"summary": {
"gross_salary": "<string>",
"total_perceptions": "<string>",
"total_deductions": "<string>",
"net_salary": "<string>",
"employer_contributions_total": "<string>",
"employer_total_cost": "<string>"
},
"perceptions": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"taxable": true,
"imss_base": true,
"tags": [
"<string>"
]
}
],
"deductions": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"tags": [
"<string>"
],
"bracket_applied": {}
}
],
"taxable_bases": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"formula": "<string>"
}
],
"employer_contributions": [
{
"table_id": "<string>",
"label": "<string>",
"total": "<string>",
"components": [
{
"id": "<string>",
"label": "<string>",
"base": "<string>",
"rate": "<string>",
"amount": "<string>"
}
]
}
],
"dsl_version": "2024.2",
"computed_at": "2023-11-07T05:31:56Z",
"status": "success",
"audit_trail": [
{}
],
"period_basis": {
"type": "biweekly",
"sequence": 1,
"periods_in_month": 2,
"factor": "0.5",
"absorbs_residual": false,
"monthly_equivalent": {
"total_perceptions": "<string>",
"total_deductions": "<string>",
"net_salary": "<string>",
"employer_contributions_total": "<string>",
"employer_total_cost": "<string>"
},
"proration": "native"
},
"record": {
"rule_fingerprint": "sha256:b90834cebdc4224c3...",
"engine_version": "<string>",
"schema_version": 123,
"content_digest": "<string>",
"stored": true,
"batch_id": "<string>",
"supersedes_id": "<string>",
"metadata": {}
},
"warnings": [
{
"code": "FLAG_THRESHOLD_MISMATCH",
"field": "overrides.aplica_auxilio_transporte",
"message": "<string>",
"severity": "warning"
}
]
}Calculate payroll for a single employee
Calculate a complete payroll breakdown for one employee.
Returns the full set of perceptions (earnings), deductions, taxable bases, employer contributions, and a configurable audit trail.
Monetary values are returned as JSON strings to prevent floating-point
precision issues. Parse with your language’s Decimal type before arithmetic.
Audit trail is included by default (options.include_audit_trail=true).
For high-frequency integrations where you only need the summary, set it to
false to reduce response payload.
curl --request POST \
--url https://api.example.com/v1/payroll/calculate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country": "MX",
"scheme": "ordinario",
"year": 2024,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee": {
"id": "emp_001",
"daily_salary": 800,
"monthly_salary": 24000,
"factor_integracion": 1.0493,
"risk_class_rate": 0.00522,
"overtime_amount": "0",
"sunday_bonus_days": 0,
"grocery_voucher_amount": "0",
"infonavit_credit_amount": "0",
"num_dependentes_irrf": 0,
"vale_transporte_amount": "0",
"pensao_alimenticia_amount": "0",
"decimo_terceiro_amount": "0",
"ferias_amount": "0",
"rat_fap_rate": "0.02",
"cantidad_hijos": 0,
"cantidad_hijos_incapacitados": 0,
"cuota_sindical_rate": "0",
"afp_rate": "0",
"commission_amount": "0",
"asignacion_familiar_amount": "0",
"colacion_amount": "0",
"movilizacion_amount": "0",
"horas_recargo_nocturno": "0",
"horas_dominicales_diurnas": "0",
"horas_dominicales_nocturnas": "0",
"horas_extra_diurnas": "0",
"horas_extra_nocturnas": "0",
"horas_extra_dominicales_diurnas": "0",
"horas_extra_dominicales_nocturnas": "0",
"overrides": {
"bono_puntualidad": true
}
},
"employer": {
"id": "employer_001",
"rfc": "ABC123456XY0"
},
"overrides": {},
"options": {
"include_audit_trail": true,
"include_diagram": false,
"precision": 2,
"supersedes": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"metadata": {
"run": "nomina-2026-09-q1"
}
}
}
'import requests
url = "https://api.example.com/v1/payroll/calculate"
payload = {
"country": "MX",
"scheme": "ordinario",
"year": 2024,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee": {
"id": "emp_001",
"daily_salary": 800,
"monthly_salary": 24000,
"factor_integracion": 1.0493,
"risk_class_rate": 0.00522,
"overtime_amount": "0",
"sunday_bonus_days": 0,
"grocery_voucher_amount": "0",
"infonavit_credit_amount": "0",
"num_dependentes_irrf": 0,
"vale_transporte_amount": "0",
"pensao_alimenticia_amount": "0",
"decimo_terceiro_amount": "0",
"ferias_amount": "0",
"rat_fap_rate": "0.02",
"cantidad_hijos": 0,
"cantidad_hijos_incapacitados": 0,
"cuota_sindical_rate": "0",
"afp_rate": "0",
"commission_amount": "0",
"asignacion_familiar_amount": "0",
"colacion_amount": "0",
"movilizacion_amount": "0",
"horas_recargo_nocturno": "0",
"horas_dominicales_diurnas": "0",
"horas_dominicales_nocturnas": "0",
"horas_extra_diurnas": "0",
"horas_extra_nocturnas": "0",
"horas_extra_dominicales_diurnas": "0",
"horas_extra_dominicales_nocturnas": "0",
"overrides": { "bono_puntualidad": True }
},
"employer": {
"id": "employer_001",
"rfc": "ABC123456XY0"
},
"overrides": {},
"options": {
"include_audit_trail": True,
"include_diagram": False,
"precision": 2,
"supersedes": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"metadata": { "run": "nomina-2026-09-q1" }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'MX',
scheme: 'ordinario',
year: 2024,
period: {type: 'monthly', start_date: '2024-03-01', end_date: '2024-03-31', days: 30},
employee: {
id: 'emp_001',
daily_salary: 800,
monthly_salary: 24000,
factor_integracion: 1.0493,
risk_class_rate: 0.00522,
overtime_amount: '0',
sunday_bonus_days: 0,
grocery_voucher_amount: '0',
infonavit_credit_amount: '0',
num_dependentes_irrf: 0,
vale_transporte_amount: '0',
pensao_alimenticia_amount: '0',
decimo_terceiro_amount: '0',
ferias_amount: '0',
rat_fap_rate: '0.02',
cantidad_hijos: 0,
cantidad_hijos_incapacitados: 0,
cuota_sindical_rate: '0',
afp_rate: '0',
commission_amount: '0',
asignacion_familiar_amount: '0',
colacion_amount: '0',
movilizacion_amount: '0',
horas_recargo_nocturno: '0',
horas_dominicales_diurnas: '0',
horas_dominicales_nocturnas: '0',
horas_extra_diurnas: '0',
horas_extra_nocturnas: '0',
horas_extra_dominicales_diurnas: '0',
horas_extra_dominicales_nocturnas: '0',
overrides: {bono_puntualidad: true}
},
employer: {id: 'employer_001', rfc: 'ABC123456XY0'},
overrides: {},
options: {
include_audit_trail: true,
include_diagram: false,
precision: 2,
supersedes: '01HX9B2KM3V4W5X6Y7Z8A9B0CD',
metadata: {run: 'nomina-2026-09-q1'}
}
})
};
fetch('https://api.example.com/v1/payroll/calculate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/payroll/calculate",
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' => 'MX',
'scheme' => 'ordinario',
'year' => 2024,
'period' => [
'type' => 'monthly',
'start_date' => '2024-03-01',
'end_date' => '2024-03-31',
'days' => 30
],
'employee' => [
'id' => 'emp_001',
'daily_salary' => 800,
'monthly_salary' => 24000,
'factor_integracion' => 1.0493,
'risk_class_rate' => 0.00522,
'overtime_amount' => '0',
'sunday_bonus_days' => 0,
'grocery_voucher_amount' => '0',
'infonavit_credit_amount' => '0',
'num_dependentes_irrf' => 0,
'vale_transporte_amount' => '0',
'pensao_alimenticia_amount' => '0',
'decimo_terceiro_amount' => '0',
'ferias_amount' => '0',
'rat_fap_rate' => '0.02',
'cantidad_hijos' => 0,
'cantidad_hijos_incapacitados' => 0,
'cuota_sindical_rate' => '0',
'afp_rate' => '0',
'commission_amount' => '0',
'asignacion_familiar_amount' => '0',
'colacion_amount' => '0',
'movilizacion_amount' => '0',
'horas_recargo_nocturno' => '0',
'horas_dominicales_diurnas' => '0',
'horas_dominicales_nocturnas' => '0',
'horas_extra_diurnas' => '0',
'horas_extra_nocturnas' => '0',
'horas_extra_dominicales_diurnas' => '0',
'horas_extra_dominicales_nocturnas' => '0',
'overrides' => [
'bono_puntualidad' => true
]
],
'employer' => [
'id' => 'employer_001',
'rfc' => 'ABC123456XY0'
],
'overrides' => [
],
'options' => [
'include_audit_trail' => true,
'include_diagram' => false,
'precision' => 2,
'supersedes' => '01HX9B2KM3V4W5X6Y7Z8A9B0CD',
'metadata' => [
'run' => 'nomina-2026-09-q1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/payroll/calculate"
payload := strings.NewReader("{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/payroll/calculate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/payroll/calculate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"MX\",\n \"scheme\": \"ordinario\",\n \"year\": 2024,\n \"period\": {\n \"type\": \"monthly\",\n \"start_date\": \"2024-03-01\",\n \"end_date\": \"2024-03-31\",\n \"days\": 30\n },\n \"employee\": {\n \"id\": \"emp_001\",\n \"daily_salary\": 800,\n \"monthly_salary\": 24000,\n \"factor_integracion\": 1.0493,\n \"risk_class_rate\": 0.00522,\n \"overtime_amount\": \"0\",\n \"sunday_bonus_days\": 0,\n \"grocery_voucher_amount\": \"0\",\n \"infonavit_credit_amount\": \"0\",\n \"num_dependentes_irrf\": 0,\n \"vale_transporte_amount\": \"0\",\n \"pensao_alimenticia_amount\": \"0\",\n \"decimo_terceiro_amount\": \"0\",\n \"ferias_amount\": \"0\",\n \"rat_fap_rate\": \"0.02\",\n \"cantidad_hijos\": 0,\n \"cantidad_hijos_incapacitados\": 0,\n \"cuota_sindical_rate\": \"0\",\n \"afp_rate\": \"0\",\n \"commission_amount\": \"0\",\n \"asignacion_familiar_amount\": \"0\",\n \"colacion_amount\": \"0\",\n \"movilizacion_amount\": \"0\",\n \"horas_recargo_nocturno\": \"0\",\n \"horas_dominicales_diurnas\": \"0\",\n \"horas_dominicales_nocturnas\": \"0\",\n \"horas_extra_diurnas\": \"0\",\n \"horas_extra_nocturnas\": \"0\",\n \"horas_extra_dominicales_diurnas\": \"0\",\n \"horas_extra_dominicales_nocturnas\": \"0\",\n \"overrides\": {\n \"bono_puntualidad\": true\n }\n },\n \"employer\": {\n \"id\": \"employer_001\",\n \"rfc\": \"ABC123456XY0\"\n },\n \"overrides\": {},\n \"options\": {\n \"include_audit_trail\": true,\n \"include_diagram\": false,\n \"precision\": 2,\n \"supersedes\": \"01HX9B2KM3V4W5X6Y7Z8A9B0CD\",\n \"metadata\": {\n \"run\": \"nomina-2026-09-q1\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "01HX9B2KM3V4W5X6Y7Z8A9B0CD",
"country": "<string>",
"scheme": "<string>",
"year": 123,
"period": {
"type": "monthly",
"start_date": "2024-03-01",
"end_date": "2024-03-31",
"days": 30
},
"employee_id": "<string>",
"summary": {
"gross_salary": "<string>",
"total_perceptions": "<string>",
"total_deductions": "<string>",
"net_salary": "<string>",
"employer_contributions_total": "<string>",
"employer_total_cost": "<string>"
},
"perceptions": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"taxable": true,
"imss_base": true,
"tags": [
"<string>"
]
}
],
"deductions": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"tags": [
"<string>"
],
"bracket_applied": {}
}
],
"taxable_bases": [
{
"id": "<string>",
"label": "<string>",
"amount": "<string>",
"formula": "<string>"
}
],
"employer_contributions": [
{
"table_id": "<string>",
"label": "<string>",
"total": "<string>",
"components": [
{
"id": "<string>",
"label": "<string>",
"base": "<string>",
"rate": "<string>",
"amount": "<string>"
}
]
}
],
"dsl_version": "2024.2",
"computed_at": "2023-11-07T05:31:56Z",
"status": "success",
"audit_trail": [
{}
],
"period_basis": {
"type": "biweekly",
"sequence": 1,
"periods_in_month": 2,
"factor": "0.5",
"absorbs_residual": false,
"monthly_equivalent": {
"total_perceptions": "<string>",
"total_deductions": "<string>",
"net_salary": "<string>",
"employer_contributions_total": "<string>",
"employer_total_cost": "<string>"
},
"proration": "native"
},
"record": {
"rule_fingerprint": "sha256:b90834cebdc4224c3...",
"engine_version": "<string>",
"schema_version": 123,
"content_digest": "<string>",
"stored": true,
"batch_id": "<string>",
"supersedes_id": "<string>",
"metadata": {}
},
"warnings": [
{
"code": "FLAG_THRESHOLD_MISMATCH",
"field": "overrides.aplica_auxilio_transporte",
"message": "<string>",
"severity": "warning"
}
]
}Authorizations
API key authentication. Send your API key as: Authorization: Bearer <your_api_key>
Headers
Body
Request body for POST /v1/payroll/calculate.
Calculates payroll for a single employee. The most common endpoint — used for payroll runs, payslip generation, and ad-hoc queries.
ISO 3166-1 alpha-2 country code (uppercase).
^[A-Z]{2}$"MX"
Payroll scheme identifier (lowercase). Use GET /v1/payroll/schemes/{country} to list available schemes.
"ordinario"
Calendar year for the payroll calculation.
2020 <= x <= 20302024
Payroll period definition.
Show child attributes
Show child attributes
Employee-side inputs for a payroll calculation.
Show child attributes
Show child attributes
Employer-side inputs for a payroll calculation.
Show child attributes
Show child attributes
Request-level overrides. Merged with employee.overrides. Request-level values take precedence.
Response options. Do not affect the calculation result.
Show child attributes
Show child attributes
Response
Calculation successful.
Full single-employee payroll calculation result.
All monetary values are JSON strings. Parse with your language's Decimal library before doing any arithmetic.
Globally unique calculation ID (ULID). Stable and sortable by time.
"01HX9B2KM3V4W5X6Y7Z8A9B0CD"
Payroll period definition.
Show child attributes
Show child attributes
Employee ID echoed from the request.
High-level financial summary of the payroll calculation.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Version string of the DSL rule set used for this calculation.
"2024.2"
UTC timestamp when this calculation was performed.
"success"Step-by-step calculation trace. Each step shows the formula, resolved inputs, and result. Null when include_audit_trail=false.
Which slice of a liquidated month these figures are, and what the whole month came to. Present on every calculation.
Show child attributes
Show child attributes
Storage and provenance of this calculation: what rules produced it, which engine build ran, and how to verify later that it has not changed.
Show child attributes
Show child attributes
Non-fatal diagnostics about this calculation. Every amount above already reflects the request as sent; a warning flags an input that contradicts the salary the engine used, so the caller can check it. Empty when the request is coherent.
Show child attributes
Show child attributes