Docs
MCP serverAvailable tools

Save employee

Create or update a payroll employee.

MCP toolsave_employee

Purpose

Use when
An employee payroll record must be added or changed.
Do not use when
You need to remove an employee or only read employee data.
Required permissions
employees:manage
Side effects
Writes data
Idempotency
Idempotent

Input schema

JSON Schema
{  "type": "object",  "properties": {    "idempotencyKey": {      "type": "string",      "minLength": 1,      "maxLength": 200,      "description": "Unique retry key for this exact operation. Reuse it only when retrying the same request."    },    "input": {      "oneOf": [        {          "type": "object",          "properties": {            "operation": {              "const": "create"            },            "name": {              "$ref": "#/definitions/__schema0"            },            "rfc": {              "type": "string"            },            "curp": {              "$ref": "#/definitions/__schema1"            },            "postalCode": {              "$ref": "#/definitions/__schema2"            },            "employeeNumber": {              "$ref": "#/definitions/__schema3"            },            "employmentStartDate": {              "$ref": "#/definitions/__schema4"            },            "taxSystem": {              "$ref": "#/definitions/__schema5"            },            "socialSecurityNumber": {              "$ref": "#/definitions/__schema6"            },            "contractType": {              "$ref": "#/definitions/__schema7"            },            "regimeType": {              "$ref": "#/definitions/__schema8"            },            "paymentFrequency": {              "$ref": "#/definitions/__schema9"            },            "jobTitle": {              "$ref": "#/definitions/__schema10"            },            "department": {              "$ref": "#/definitions/__schema12"            },            "workScheduleType": {              "$ref": "#/definitions/__schema13"            },            "positionRisk": {              "$ref": "#/definitions/__schema14"            },            "federalEntityCode": {              "$ref": "#/definitions/__schema15"            },            "unionMember": {              "$ref": "#/definitions/__schema16"            },            "bankCode": {              "$ref": "#/definitions/__schema17"            },            "bankAccount": {              "$ref": "#/definitions/__schema19"            },            "contactEmail": {              "$ref": "#/definitions/__schema20"            },            "payroll": {              "type": "object",              "properties": {                "salary": {                  "$ref": "#/definitions/__schema22"                },                "sdiOverride": {                  "$ref": "#/definitions/__schema26"                },                "subsidyAppliedElsewhere": {                  "$ref": "#/definitions/__schema27"                },                "minimumWageZone": {                  "$ref": "#/definitions/__schema29"                },                "fixedDeductions": {                  "$ref": "#/definitions/__schema31"                },                "lastReceiptDeductionsDismissed": {                  "$ref": "#/definitions/__schema35"                }              },              "additionalProperties": false            },            "recurringEarnings": {              "$ref": "#/definitions/__schema37"            },            "recurringDeductions": {              "$ref": "#/definitions/__schema38"            },            "recurringOtherPayments": {              "$ref": "#/definitions/__schema39"            }          },          "required": [            "operation",            "name",            "rfc",            "curp",            "postalCode",            "employeeNumber",            "employmentStartDate"          ],          "additionalProperties": false        },        {          "type": "object",          "properties": {            "operation": {              "const": "update"            },            "employeeId": {              "type": "string"            },            "name": {              "allOf": [                {                  "$ref": "#/definitions/__schema0"                }              ]            },            "curp": {              "allOf": [                {                  "$ref": "#/definitions/__schema1"                }              ]            },            "postalCode": {              "allOf": [                {                  "$ref": "#/definitions/__schema2"                }              ]            },            "employeeNumber": {              "allOf": [                {                  "$ref": "#/definitions/__schema3"                }              ]            },            "employmentStartDate": {              "allOf": [                {                  "$ref": "#/definitions/__schema4"                }              ]            },            "taxSystem": {              "allOf": [                {                  "$ref": "#/definitions/__schema5"                }              ]            },            "socialSecurityNumber": {              "anyOf": [                {                  "$ref": "#/definitions/__schema6"                },                {                  "type": "null"                }              ]            },            "contractType": {              "allOf": [                {                  "$ref": "#/definitions/__schema7"                }              ]            },            "regimeType": {              "allOf": [                {                  "$ref": "#/definitions/__schema8"                }              ]            },            "paymentFrequency": {              "allOf": [                {                  "$ref": "#/definitions/__schema9"                }              ]            },            "jobTitle": {              "anyOf": [                {                  "$ref": "#/definitions/__schema10"                },                {                  "type": "null"                }              ]            },            "department": {              "anyOf": [                {                  "$ref": "#/definitions/__schema12"                },                {                  "type": "null"                }              ]            },            "workScheduleType": {              "anyOf": [                {                  "$ref": "#/definitions/__schema13"                },                {                  "type": "null"                }              ]            },            "positionRisk": {              "anyOf": [                {                  "$ref": "#/definitions/__schema14"                },                {                  "type": "null"                }              ]            },            "federalEntityCode": {              "anyOf": [                {                  "$ref": "#/definitions/__schema15"                },                {                  "type": "null"                }              ]            },            "unionMember": {              "anyOf": [                {                  "$ref": "#/definitions/__schema16"                },                {                  "type": "null"                }              ]            },            "bankCode": {              "anyOf": [                {                  "$ref": "#/definitions/__schema17"                },                {                  "type": "null"                }              ]            },            "bankAccount": {              "anyOf": [                {                  "$ref": "#/definitions/__schema19"                },                {                  "type": "null"                }              ]            },            "contactEmail": {              "anyOf": [                {                  "$ref": "#/definitions/__schema20"                },                {                  "type": "null"                }              ]            },            "payroll": {              "description": "Changes only the payroll terms sent: a term left out keeps its value and null removes one; salary and fixedDeductions are replaced whole. null instead of the object removes every term.",              "allOf": [                {                  "anyOf": [                    {                      "type": "object",                      "properties": {                        "salary": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema22"                            },                            {                              "type": "null"                            }                          ]                        },                        "sdiOverride": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema26"                            },                            {                              "type": "null"                            }                          ]                        },                        "subsidyAppliedElsewhere": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema27"                            },                            {                              "type": "null"                            }                          ]                        },                        "minimumWageZone": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema29"                            },                            {                              "type": "null"                            }                          ]                        },                        "fixedDeductions": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema31"                            },                            {                              "type": "null"                            }                          ]                        },                        "lastReceiptDeductionsDismissed": {                          "anyOf": [                            {                              "$ref": "#/definitions/__schema35"                            },                            {                              "type": "null"                            }                          ]                        }                      },                      "additionalProperties": false                    },                    {                      "type": "null"                    }                  ]                }              ]            },            "recurringEarnings": {              "allOf": [                {                  "$ref": "#/definitions/__schema37"                }              ]            },            "recurringDeductions": {              "allOf": [                {                  "$ref": "#/definitions/__schema38"                }              ]            },            "recurringOtherPayments": {              "allOf": [                {                  "$ref": "#/definitions/__schema39"                }              ]            },            "payrollStatus": {              "description": "inactive (baja) leaves payroll after employmentEndedOn.",              "allOf": [                {                  "enum": [                    "active",                    "inactive"                  ]                }              ]            },            "employmentEndedOn": {              "anyOf": [                {                  "allOf": [                    {                      "$ref": "#/definitions/__schema4"                    }                  ]                },                {                  "type": "null"                }              ],              "description": "Last day worked (fecha de baja)."            }          },          "required": [            "operation",            "employeeId"          ],          "additionalProperties": false        }      ]    }  },  "required": [    "idempotencyKey",    "input"  ],  "$schema": "http://json-schema.org/draft-07/schema#",  "additionalProperties": false,  "definitions": {    "__schema0": {      "type": "string",      "minLength": 1    },    "__schema1": {      "type": "string",      "pattern": "^[A-Z][AEIOUX][A-Z]{2}[0-9]{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])[MHX]([ABCMTZ]S|[BCJMOT]C|[CNPST]L|[GNQ]T|[GQS]R|C[MH]|[MY]N|[DH]G|NE|VZ|DF|SP)[BCDFGHJ-NP-TV-Z]{3}[0-9A-Z][0-9]$"    },    "__schema2": {      "type": "string"    },    "__schema3": {      "type": "string",      "minLength": 1,      "maxLength": 15,      "pattern": "^[^|]+$"    },    "__schema4": {      "type": "string",      "allOf": [        {          "type": "string",          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"        },        {          "type": "string",          "pattern": "^(19|20)"        }      ]    },    "__schema5": {      "enum": [        "601",        "603",        "605",        "606",        "607",        "608",        "610",        "611",        "612",        "614",        "615",        "616",        "620",        "621",        "622",        "623",        "624",        "625",        "626"      ],      "description": "Known SAT tax-system code.",      "x-exac-sat-catalog": "tax-systems"    },    "__schema6": {      "type": "string",      "pattern": "^\\d{1,15}$"    },    "__schema7": {      "enum": [        "10",        "99",        "01",        "02",        "03",        "04",        "05",        "06",        "07",        "08",        "09"      ],      "description": "Known SAT payroll contract-type code.",      "x-exac-sat-catalog": "payroll-contract-types"    },    "__schema8": {      "enum": [        "10",        "11",        "12",        "13",        "99",        "02",        "03",        "04",        "05",        "06",        "07",        "08",        "09"      ],      "description": "Known SAT payroll regime-type code.",      "x-exac-sat-catalog": "payroll-regime-types"    },    "__schema9": {      "enum": [        "10",        "99",        "01",        "02",        "03",        "04",        "05",        "06",        "07",        "08",        "09"      ],      "description": "Known SAT payroll payment-frequency code.",      "x-exac-sat-catalog": "payroll-payment-frequencies"    },    "__schema10": {      "allOf": [        {          "$ref": "#/definitions/__schema11"        }      ]    },    "__schema11": {      "type": "string",      "minLength": 1,      "maxLength": 100,      "pattern": "^[^|]+$"    },    "__schema12": {      "allOf": [        {          "$ref": "#/definitions/__schema11"        }      ]    },    "__schema13": {      "enum": [        "99",        "01",        "02",        "03",        "04",        "05",        "06",        "07",        "08"      ],      "description": "Known SAT payroll work-schedule code.",      "x-exac-sat-catalog": "payroll-work-schedule-types"    },    "__schema14": {      "enum": [        "1",        "2",        "3",        "4",        "5",        "99"      ],      "description": "Known SAT payroll position-risk code.",      "x-exac-sat-catalog": "payroll-position-risks"    },    "__schema15": {      "enum": [        "AGU",        "BCN",        "BCS",        "CAM",        "CHH",        "CHP",        "CMX",        "COA",        "COL",        "DIF",        "DUR",        "GRO",        "GUA",        "HID",        "JAL",        "MEX",        "MIC",        "MOR",        "NAY",        "NLE",        "OAX",        "PUE",        "QUE",        "ROO",        "SIN",        "SLP",        "SON",        "TAB",        "TAM",        "TLA",        "VER",        "YUC",        "ZAC"      ],      "description": "Known SAT federal-entity code.",      "x-exac-sat-catalog": "federal-entities"    },    "__schema16": {      "enum": [        "Sí",        "No"      ]    },    "__schema17": {      "description": "Required with 10-, 11- or 16-digit accounts; omitted for a CLABE.",      "allOf": [        {          "enum": [            "102",            "103",            "106",            "108",            "110",            "112",            "113",            "116",            "124",            "126",            "127",            "128",            "129",            "130",            "131",            "132",            "133",            "134",            "135",            "136",            "137",            "138",            "139",            "140",            "141",            "143",            "145",            "147",            "148",            "149",            "150",            "151",            "152",            "153",            "154",            "155",            "156",            "157",            "158",            "159",            "160",            "166",            "168",            "600",            "601",            "602",            "605",            "606",            "607",            "608",            "610",            "614",            "615",            "616",            "617",            "618",            "619",            "620",            "621",            "622",            "623",            "626",            "627",            "628",            "629",            "630",            "631",            "632",            "633",            "634",            "636",            "637",            "638",            "640",            "642",            "646",            "647",            "648",            "649",            "651",            "652",            "653",            "655",            "656",            "659",            "670",            "901",            "902",            "002",            "006",            "009",            "012",            "014",            "019",            "021",            "030",            "032",            "036",            "037",            "042",            "044",            "058",            "059",            "060",            "062",            "072"          ],          "description": "Known SAT payroll bank code.",          "x-exac-sat-catalog": "payroll-banks"        }      ]    },    "__schema19": {      "type": "string",      "pattern": "^(?:\\d{10}|\\d{11}|\\d{16}|\\d{18})$"    },    "__schema20": {      "description": "Where payroll receipts are sent.",      "allOf": [        {          "type": "string",          "format": "email",          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"        }      ]    },    "__schema22": {      "description": "Fixed salary and the period its amount covers. A salary per day is paid for each calendar day of a pay period; one per decena, quincena or month pays a whole period its fixed days, whatever its calendar days.",      "allOf": [        {          "type": "object",          "properties": {            "amount": {              "$ref": "#/definitions/__schema24"            },            "unit": {              "enum": [                "day",                "week",                "decena",                "catorcena",                "quincena",                "month"              ]            }          },          "required": [            "amount",            "unit"          ],          "additionalProperties": false        }      ]    },    "__schema24": {      "exclusiveMinimum": 0,      "allOf": [        {          "$ref": "#/definitions/__schema25"        }      ]    },    "__schema25": {      "type": "number",      "minimum": 0,      "exclusiveMaximum": 1000000000000000000,      "multipleOf": 0.01    },    "__schema26": {      "description": "Salario diario integrado to use instead of the one calculated from the salary.",      "allOf": [        {          "$ref": "#/definitions/__schema24"        }      ]    },    "__schema27": {      "description": "True when another employer applies the employment subsidy.",      "allOf": [        {          "type": "boolean"        }      ]    },    "__schema29": {      "description": "Minimum wage zone of the employee's workplace; the organization's when omitted.",      "allOf": [        {          "enum": [            "general",            "northBorder"          ]        }      ]    },    "__schema31": {      "description": "Deductions applied on every ordinary receipt.",      "allOf": [        {          "maxItems": 20,          "type": "array",          "items": {            "type": "object",            "properties": {              "type": {                "allOf": [                  {                    "$ref": "#/definitions/__schema34"                  }                ]              },              "amount": {                "$ref": "#/definitions/__schema24"              },              "description": {                "type": "string",                "minLength": 1,                "maxLength": 100,                "pattern": "^[^|]+$"              }            },            "required": [              "type",              "amount"            ],            "additionalProperties": false          }        }      ]    },    "__schema34": {      "enum": [        "100",        "101",        "102",        "103",        "104",        "105",        "106",        "107",        "108",        "109",        "110",        "111",        "112",        "113",        "114",        "115",        "001",        "002",        "003",        "004",        "005",        "006",        "007",        "008",        "009",        "010",        "011",        "012",        "013",        "014",        "015",        "016",        "017",        "018",        "019",        "020",        "021",        "022",        "023",        "024",        "025",        "026",        "027",        "028",        "029",        "030",        "031",        "032",        "033",        "034",        "035",        "036",        "037",        "038",        "039",        "040",        "041",        "042",        "043",        "044",        "045",        "046",        "047",        "048",        "049",        "050",        "051",        "052",        "053",        "054",        "055",        "056",        "057",        "058",        "059",        "060",        "061",        "062",        "063",        "064",        "065",        "066",        "067",        "068",        "069",        "070",        "071",        "072",        "073",        "074",        "075",        "076",        "077",        "078",        "079",        "080",        "081",        "082",        "083",        "084",        "085",        "086",        "087",        "088",        "089",        "090",        "091",        "092",        "093",        "094",        "095",        "096",        "097",        "098",        "099"      ],      "description": "Known SAT payroll deduction-type code.",      "x-exac-sat-catalog": "payroll-deduction-types"    },    "__schema35": {      "description": "True when a person decided not to take the deductions of the last receipt as fixedDeductions; it ends the last_receipt_deductions_missing readiness issue.",      "allOf": [        {          "type": "boolean"        }      ]    },    "__schema37": {      "type": "array",      "items": {        "type": "object",        "properties": {          "code": {            "enum": [              "001",              "002",              "003",              "004",              "005",              "006",              "009",              "010",              "011",              "012",              "013",              "014",              "015",              "019",              "020",              "021",              "022",              "023",              "024",              "025",              "026",              "027",              "028",              "029",              "030",              "031",              "032",              "033",              "034",              "035",              "036",              "037",              "038",              "039",              "044",              "045",              "046",              "047",              "048",              "049",              "050",              "051",              "052",              "053",              "054",              "055",              "056",              "057"            ],            "description": "Known SAT payroll earning-type code.",            "x-exac-sat-catalog": "payroll-earning-types"          },          "taxableAmount": {            "$ref": "#/definitions/__schema25"          },          "exemptAmount": {            "$ref": "#/definitions/__schema25"          }        },        "required": [          "code",          "taxableAmount",          "exemptAmount"        ],        "additionalProperties": false      }    },    "__schema38": {      "type": "array",      "items": {        "type": "object",        "properties": {          "code": {            "$ref": "#/definitions/__schema34"          },          "amount": {            "$ref": "#/definitions/__schema25"          }        },        "required": [          "code",          "amount"        ],        "additionalProperties": false      }    },    "__schema39": {      "type": "array",      "items": {        "type": "object",        "properties": {          "code": {            "enum": [              "999",              "001",              "002",              "003",              "004",              "005",              "006",              "007",              "008",              "009"            ],            "description": "Known SAT payroll other-payment code.",            "x-exac-sat-catalog": "payroll-other-payment-types"          },          "amount": {            "$ref": "#/definitions/__schema25"          },          "employmentSubsidy": {            "allOf": [              {                "$ref": "#/definitions/__schema25"              }            ]          }        },        "required": [          "code",          "amount"        ],        "additionalProperties": false      }    }  }}

Output schema

JSON Schema
{  "type": "object",  "properties": {    "data": {      "type": "object",      "properties": {        "employeeId": {          "type": "string",          "minLength": 1        },        "name": {          "type": "string"        },        "postalCode": {          "type": "string"        },        "taxSystem": {          "type": "string"        },        "employeeNumber": {          "type": "string"        },        "curp": {          "type": "string"        },        "socialSecurityNumber": {          "type": "string"        },        "jobTitle": {          "type": "string"        },        "department": {          "type": "string"        },        "paymentFrequency": {          "type": "string"        },        "employmentStartDate": {          "type": "string"        },        "contractType": {          "type": "string"        },        "workScheduleType": {          "type": "string"        },        "regimeType": {          "type": "string"        },        "positionRisk": {          "type": "string"        },        "federalEntityCode": {          "type": "string"        },        "unionMember": {          "type": "string"        },        "bankCode": {          "type": "string"        },        "bankAccount": {          "type": "string"        },        "contactEmail": {          "type": "string"        },        "payrollStatus": {          "allOf": [            {              "enum": [                "active",                "inactive"              ]            }          ]        },        "employmentEndedOn": {          "type": "string"        },        "payroll": {          "type": "object",          "properties": {            "salary": {              "type": "object",              "properties": {                "amount": {                  "type": "number"                },                "unit": {                  "enum": [                    "day",                    "week",                    "decena",                    "catorcena",                    "quincena",                    "month"                  ]                }              },              "required": [                "amount",                "unit"              ],              "additionalProperties": false            },            "sdiOverride": {              "type": "number"            },            "subsidyAppliedElsewhere": {              "type": "boolean"            },            "minimumWageZone": {              "enum": [                "general",                "northBorder"              ]            },            "fixedDeductions": {              "type": "array",              "items": {                "$ref": "#/definitions/__schema1"              }            },            "lastReceiptDeductionsDismissed": {              "type": "boolean"            }          },          "additionalProperties": false        },        "payrollReadiness": {          "type": "object",          "properties": {            "ready": {              "type": "boolean"            },            "issues": {              "type": "array",              "items": {                "type": "object",                "properties": {                  "code": {                    "enum": [                      "rfc_invalid",                      "tax_system_invalid",                      "postal_code_invalid",                      "curp_invalid",                      "employee_number_invalid",                      "contract_type_invalid",                      "regime_type_invalid",                      "payment_frequency_invalid",                      "unsupported_regime",                      "unsupported_contract",                      "unsupported_frequency",                      "state_code_missing",                      "social_security_number_missing",                      "employment_start_missing",                      "position_risk_missing",                      "integrated_daily_salary_missing",                      "bank_account_invalid",                      "job_title_invalid",                      "department_invalid",                      "work_schedule_type_invalid",                      "contribution_base_salary_invalid",                      "salary_missing",                      "salary_below_minimum_wage",                      "minimum_wage_zone_missing",                      "last_receipt_deductions_missing",                      "employer_rfc_missing",                      "employer_registration_missing",                      "employer_curp_missing"                    ]                  },                  "field": {                    "type": "string"                  }                },                "required": [                  "code",                  "field"                ],                "additionalProperties": false              }            }          },          "required": [            "ready",            "issues"          ],          "additionalProperties": false        },        "lastReceiptDeductions": {          "allOf": [            {              "type": "array",              "items": {                "$ref": "#/definitions/__schema1"              }            }          ]        },        "rfc": {          "type": "string"        },        "lastPayrollDate": {          "type": "string",          "format": "date-time"        }      },      "required": [        "employeeId",        "name",        "payrollReadiness",        "rfc"      ],      "additionalProperties": false    },    "error": {      "$schema": "http://json-schema.org/draft-07/schema#",      "type": "object",      "properties": {        "code": {          "enum": [            "validation_error",            "unauthenticated",            "forbidden",            "payment_required",            "not_found",            "method_not_allowed",            "conflict",            "idempotency_conflict",            "operation_in_progress",            "recovery_required",            "migration_required",            "rate_limited",            "provider_unavailable",            "internal"          ]        },        "message": {          "type": "string"        },        "details": {          "type": "object",          "properties": {            "document": {              "type": "object",              "properties": {                "documentRef": {                  "type": "string",                  "pattern": "^(invoice|withholding|sales_receipt|declaration|tax_compliance_opinion|sales_receipt_refund):.+$"                },                "editable": {                  "type": "boolean"                }              },              "required": [                "documentRef",                "editable"              ],              "additionalProperties": false            },            "issues": {              "type": "array",              "items": {                "type": "object",                "properties": {                  "path": {                    "type": "array",                    "items": {                      "anyOf": [                        {                          "type": "string"                        },                        {                          "type": "number"                        }                      ]                    }                  },                  "message": {                    "type": "string"                  },                  "code": {                    "type": "string"                  }                },                "required": [                  "path",                  "message"                ],                "additionalProperties": false              }            },            "retryable": {              "type": "boolean"            },            "retryAfterSeconds": {              "type": "integer",              "exclusiveMinimum": 0,              "maximum": 9007199254740991            },            "reason": {              "type": "string"            },            "balanceMinor": {              "type": "integer",              "minimum": 0,              "maximum": 9007199254740991            },            "topUpUrl": {              "type": "string"            }          },          "additionalProperties": false        }      },      "required": [        "code",        "message"      ],      "additionalProperties": false    }  },  "$schema": "http://json-schema.org/draft-07/schema#",  "additionalProperties": false,  "definitions": {    "__schema1": {      "type": "object",      "properties": {        "type": {          "type": "string"        },        "amount": {          "type": "number"        },        "description": {          "type": "string"        }      },      "required": [        "type",        "amount"      ],      "additionalProperties": false    }  },  "oneOf": [    {      "required": [        "data"      ]    },    {      "required": [        "error"      ]    }  ]}

Related workflow

See the canonical workflows in Quickstart

Related tools