curl --request POST \
--url https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"employees": [
{
"employeeId": "emp-001",
"employeeStartDate": "2020-01-01",
"compensation": {
"type": "MONTHLY",
"amount": 50000
},
"timeEntries": [],
"previousBimesterEarnigs": [],
"workAddress": {
"state": "AGU"
},
"earnings": [],
"workerRiskClass": "I"
}
],
"payrollConfig": {
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"period": "MONTHLY"
},
"fillDefaultSchedule": true
}
'import requests
url = "https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings"
payload = {
"employees": [
{
"employeeId": "emp-001",
"employeeStartDate": "2020-01-01",
"compensation": {
"type": "MONTHLY",
"amount": 50000
},
"timeEntries": [],
"previousBimesterEarnigs": [],
"workAddress": { "state": "AGU" },
"earnings": [],
"workerRiskClass": "I"
}
],
"payrollConfig": {
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"period": "MONTHLY"
},
"fillDefaultSchedule": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
employees: [
{
employeeId: 'emp-001',
employeeStartDate: '2020-01-01',
compensation: {type: 'MONTHLY', amount: 50000},
timeEntries: [],
previousBimesterEarnigs: [],
workAddress: {state: 'AGU'},
earnings: [],
workerRiskClass: 'I'
}
],
payrollConfig: {startDate: '2026-01-01', endDate: '2026-01-31', period: 'MONTHLY'},
fillDefaultSchedule: true
})
};
fetch('https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings', 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.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings",
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([
'employees' => [
[
'employeeId' => 'emp-001',
'employeeStartDate' => '2020-01-01',
'compensation' => [
'type' => 'MONTHLY',
'amount' => 50000
],
'timeEntries' => [
],
'previousBimesterEarnigs' => [
],
'workAddress' => [
'state' => 'AGU'
],
'earnings' => [
],
'workerRiskClass' => 'I'
]
],
'payrollConfig' => [
'startDate' => '2026-01-01',
'endDate' => '2026-01-31',
'period' => 'MONTHLY'
],
'fillDefaultSchedule' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings"
payload := strings.NewReader("{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"employeeId": "emp-001",
"grossPay": "50000.00",
"employeeTaxes": {
"MX_IMSS_DISEASE_MATERNITY_PENSIONERS_EE": {
"wageBase": "51241.80",
"taxAmount": "192.16",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_KIND_EE": {
"wageBase": "51241.80",
"taxAmount": "164.92",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_MONEY_EE": {
"wageBase": "51241.80",
"taxAmount": "128.10",
"taxType": "CONTRIBUTIONS"
},
"MX_SAT_ISR": {
"wageBase": "50000.00",
"taxAmount": "9107.82",
"taxType": "TAX",
"wageBaseContributions": {
"SALARY": {
"earningKey": "SALARY",
"grossAmount": "50000.00",
"exemptionAmount": "0.00",
"taxableAmount": "50000.00"
},
"SOCIAL_WELFARE_BENEFITS": {
"earningKey": "SOCIAL_WELFARE_BENEFITS",
"grossAmount": "0.00",
"exemptionAmount": "0.00",
"taxableAmount": "0.00"
}
}
},
"MX_IMSS_DISABILITY_LIFE_EE": {
"wageBase": "51241.80",
"taxAmount": "320.26",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_ADVANCED_AGE_EE": {
"wageBase": "51241.80",
"taxAmount": "576.47",
"taxType": "CONTRIBUTIONS"
}
},
"employerTaxes": {
"MX_IMSS_DISEASE_MATERNITY_KIND_ER": {
"wageBase": "51241.80",
"taxAmount": "1134.40",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_WORK_RISK": {
"wageBase": "51241.80",
"taxAmount": "278.52",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_OLD_AGE_ER": {
"wageBase": "51241.80",
"taxAmount": "1024.84",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_ADVANCED_AGE_ER": {
"wageBase": "51241.80",
"taxAmount": "3290.75",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_PENSIONERS_ER": {
"wageBase": "51241.80",
"taxAmount": "538.04",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_MONEY_ER": {
"wageBase": "51241.80",
"taxAmount": "358.69",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISABILITY_LIFE_ER": {
"wageBase": "51241.80",
"taxAmount": "896.73",
"taxType": "CONTRIBUTIONS"
},
"MX_INFONAVIT_HOUSING": {
"wageBase": "51241.80",
"taxAmount": "2562.09",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_NURSERY_SOCIAL_BENEFITS": {
"wageBase": "51241.80",
"taxAmount": "512.42",
"taxType": "CONTRIBUTIONS"
},
"MX_AGU_PAYROLL": {
"wageBase": "50000.00",
"taxAmount": "1250.00",
"taxType": "TAX",
"wageBaseContributions": {
"SALARY": {
"earningKey": "SALARY",
"grossAmount": "50000.00",
"exemptionAmount": "0.00",
"taxableAmount": "50000.00"
},
"TERMINATION_COMPENSATION": {
"earningKey": "TERMINATION_COMPENSATION",
"grossAmount": "0.00",
"exemptionAmount": "0.00",
"taxableAmount": "0.00"
}
}
}
},
"totalEmployerTaxes": "11846.48",
"totalEmployeeTaxes": "10489.73",
"netPay": "39510.27",
"dailySbc": "1737.01",
"totalEmployeeTax": "9107.82",
"totalEmployeeContributions": "1381.91",
"totalEmployerTax": "1250.00",
"totalEmployerContributions": "10596.48"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}Calculate Payroll with Derived Earnings
Calculates gross-to-net payroll by first generating earnings from time entries and compensation, then calculating all Mexican taxes. This endpoint accepts time entries (start/end times per day) and compensation (daily/weekly/monthly/annual) and automatically derives earnings like SALARY, DOUBLE_OVERTIME, and TRIPLE_OVERTIME.
Available earnings can be obtained from the List Earnings endpoint. The response includes taxes and social security contributions — see List Taxes and List Social Security Contributions for details.
curl --request POST \
--url https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"employees": [
{
"employeeId": "emp-001",
"employeeStartDate": "2020-01-01",
"compensation": {
"type": "MONTHLY",
"amount": 50000
},
"timeEntries": [],
"previousBimesterEarnigs": [],
"workAddress": {
"state": "AGU"
},
"earnings": [],
"workerRiskClass": "I"
}
],
"payrollConfig": {
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"period": "MONTHLY"
},
"fillDefaultSchedule": true
}
'import requests
url = "https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings"
payload = {
"employees": [
{
"employeeId": "emp-001",
"employeeStartDate": "2020-01-01",
"compensation": {
"type": "MONTHLY",
"amount": 50000
},
"timeEntries": [],
"previousBimesterEarnigs": [],
"workAddress": { "state": "AGU" },
"earnings": [],
"workerRiskClass": "I"
}
],
"payrollConfig": {
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"period": "MONTHLY"
},
"fillDefaultSchedule": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
employees: [
{
employeeId: 'emp-001',
employeeStartDate: '2020-01-01',
compensation: {type: 'MONTHLY', amount: 50000},
timeEntries: [],
previousBimesterEarnigs: [],
workAddress: {state: 'AGU'},
earnings: [],
workerRiskClass: 'I'
}
],
payrollConfig: {startDate: '2026-01-01', endDate: '2026-01-31', period: 'MONTHLY'},
fillDefaultSchedule: true
})
};
fetch('https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings', 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.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings",
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([
'employees' => [
[
'employeeId' => 'emp-001',
'employeeStartDate' => '2020-01-01',
'compensation' => [
'type' => 'MONTHLY',
'amount' => 50000
],
'timeEntries' => [
],
'previousBimesterEarnigs' => [
],
'workAddress' => [
'state' => 'AGU'
],
'earnings' => [
],
'workerRiskClass' => 'I'
]
],
'payrollConfig' => [
'startDate' => '2026-01-01',
'endDate' => '2026-01-31',
'period' => 'MONTHLY'
],
'fillDefaultSchedule' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings"
payload := strings.NewReader("{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.staging.fluxpayroll.ai/api/mexico-payroll/calculate-with-derived-earnings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"employees\": [\n {\n \"employeeId\": \"emp-001\",\n \"employeeStartDate\": \"2020-01-01\",\n \"compensation\": {\n \"type\": \"MONTHLY\",\n \"amount\": 50000\n },\n \"timeEntries\": [],\n \"previousBimesterEarnigs\": [],\n \"workAddress\": {\n \"state\": \"AGU\"\n },\n \"earnings\": [],\n \"workerRiskClass\": \"I\"\n }\n ],\n \"payrollConfig\": {\n \"startDate\": \"2026-01-01\",\n \"endDate\": \"2026-01-31\",\n \"period\": \"MONTHLY\"\n },\n \"fillDefaultSchedule\": true\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"employeeId": "emp-001",
"grossPay": "50000.00",
"employeeTaxes": {
"MX_IMSS_DISEASE_MATERNITY_PENSIONERS_EE": {
"wageBase": "51241.80",
"taxAmount": "192.16",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_KIND_EE": {
"wageBase": "51241.80",
"taxAmount": "164.92",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_MONEY_EE": {
"wageBase": "51241.80",
"taxAmount": "128.10",
"taxType": "CONTRIBUTIONS"
},
"MX_SAT_ISR": {
"wageBase": "50000.00",
"taxAmount": "9107.82",
"taxType": "TAX",
"wageBaseContributions": {
"SALARY": {
"earningKey": "SALARY",
"grossAmount": "50000.00",
"exemptionAmount": "0.00",
"taxableAmount": "50000.00"
},
"SOCIAL_WELFARE_BENEFITS": {
"earningKey": "SOCIAL_WELFARE_BENEFITS",
"grossAmount": "0.00",
"exemptionAmount": "0.00",
"taxableAmount": "0.00"
}
}
},
"MX_IMSS_DISABILITY_LIFE_EE": {
"wageBase": "51241.80",
"taxAmount": "320.26",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_ADVANCED_AGE_EE": {
"wageBase": "51241.80",
"taxAmount": "576.47",
"taxType": "CONTRIBUTIONS"
}
},
"employerTaxes": {
"MX_IMSS_DISEASE_MATERNITY_KIND_ER": {
"wageBase": "51241.80",
"taxAmount": "1134.40",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_WORK_RISK": {
"wageBase": "51241.80",
"taxAmount": "278.52",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_OLD_AGE_ER": {
"wageBase": "51241.80",
"taxAmount": "1024.84",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_RETIREMENT_ADVANCED_AGE_ER": {
"wageBase": "51241.80",
"taxAmount": "3290.75",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_PENSIONERS_ER": {
"wageBase": "51241.80",
"taxAmount": "538.04",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISEASE_MATERNITY_MONEY_ER": {
"wageBase": "51241.80",
"taxAmount": "358.69",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_DISABILITY_LIFE_ER": {
"wageBase": "51241.80",
"taxAmount": "896.73",
"taxType": "CONTRIBUTIONS"
},
"MX_INFONAVIT_HOUSING": {
"wageBase": "51241.80",
"taxAmount": "2562.09",
"taxType": "CONTRIBUTIONS"
},
"MX_IMSS_NURSERY_SOCIAL_BENEFITS": {
"wageBase": "51241.80",
"taxAmount": "512.42",
"taxType": "CONTRIBUTIONS"
},
"MX_AGU_PAYROLL": {
"wageBase": "50000.00",
"taxAmount": "1250.00",
"taxType": "TAX",
"wageBaseContributions": {
"SALARY": {
"earningKey": "SALARY",
"grossAmount": "50000.00",
"exemptionAmount": "0.00",
"taxableAmount": "50000.00"
},
"TERMINATION_COMPENSATION": {
"earningKey": "TERMINATION_COMPENSATION",
"grossAmount": "0.00",
"exemptionAmount": "0.00",
"taxableAmount": "0.00"
}
}
}
},
"totalEmployerTaxes": "11846.48",
"totalEmployeeTaxes": "10489.73",
"netPay": "39510.27",
"dailySbc": "1737.01",
"totalEmployeeTax": "9107.82",
"totalEmployeeContributions": "1381.91",
"totalEmployerTax": "1250.00",
"totalEmployerContributions": "10596.48"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"error": "VALIDATION_ERROR",
"message": "Invalid input data provided",
"details": [
{
"field": "<string>",
"message": "<string>"
}
]
}Authorizations
Body
Array of employees with time entries and compensation
1Show child attributes
Show child attributes
Show child attributes
Show child attributes
{
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"period": "MONTHLY"
}
When true, auto-fills default time entries (standard work hours) for work days missing from employee timeEntries
Response
Successful payroll calculation with derived earnings
Array of payroll results, one per employee
Show child attributes
Show child attributes