---
title: "Stamp payroll"
description: "Irreversibly stamp payroll receipts. stamp_run queues every ready receipt of a run; send the ready count and net you checked with get_payroll, and a difference stamps nothing. restamp_row stamps a rejected receipt again after its employee was corrected. Receipts stamp in the background, each on its own; follow them with get_payroll. Safe retries require reusing the same idempotencyKey."
language: en
canonical_url: "https://exac.mx/docs/en/mcp/tools/stamp_payroll"
md_url: "https://exac.mx/docs/en/mcp/tools/stamp_payroll.md"
---

# Stamp payroll

Irreversibly stamp payroll receipts. stamp_run queues every ready receipt of a run; send the ready count and net you checked with get_payroll, and a difference stamps nothing. restamp_row stamps a rejected receipt again after its employee was corrected. Receipts stamp in the background, each on its own; follow them with get_payroll. Safe retries require reusing the same idempotencyKey.

Tool: `stamp_payroll`

## Purpose

Irreversibly submit a run's ready receipts, or one corrected rejected receipt, for SAT stamping.

### Use when

The run's ready receipts were checked and the person confirmed their count and net.

### Do not use when

Receipts still need attention or are being calculated, or you need a one-off payroll CFDI; use create_payroll_invoice_draft.

| Detail | Value |
| --- | --- |
| Permissions | employees:manage + invoices:manage |
| Side effects | Destructive and external |
| Idempotency | Idempotent |

## Input schema

```json
{
  "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": "stamp_run"
            },
            "runId": {
              "type": "string",
              "minLength": 1,
              "description": "runId of a payroll run, as prepared or listed."
            },
            "expectedCount": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991,
              "description": "Ready receipts the person confirmed."
            },
            "expectedNet": {
              "type": "number",
              "minimum": 0,
              "exclusiveMaximum": 1000000000000000000,
              "multipleOf": 0.01,
              "description": "Net of those receipts, in MXN."
            }
          },
          "required": [
            "operation",
            "runId",
            "expectedCount",
            "expectedNet"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "const": "restamp_row"
            },
            "rowId": {
              "type": "string",
              "minLength": 1,
              "description": "rowId of a receipt, as listed in its run's receipts."
            }
          },
          "required": [
            "operation",
            "rowId"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "idempotencyKey",
    "input"
  ],
  "$schema": "http://json-schema.org/draft-07/schema#",
  "additionalProperties": false
}
```

## Output schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "runId": {
              "type": "string"
            },
            "frequency": {
              "enum": [
                "10",
                "02",
                "03",
                "04",
                "05"
              ]
            },
            "periodStart": {
              "$ref": "#/definitions/__schema0"
            },
            "periodEnd": {
              "$ref": "#/definitions/__schema0"
            },
            "paidOn": {
              "$ref": "#/definitions/__schema0"
            },
            "calculating": {
              "type": "boolean"
            },
            "rows": {
              "type": "object",
              "properties": {
                "ready": {
                  "$ref": "#/definitions/__schema1"
                },
                "needs_attention": {
                  "$ref": "#/definitions/__schema1"
                },
                "excluded": {
                  "$ref": "#/definitions/__schema1"
                },
                "queued": {
                  "$ref": "#/definitions/__schema1"
                },
                "stamping": {
                  "$ref": "#/definitions/__schema1"
                },
                "stamped": {
                  "$ref": "#/definitions/__schema1"
                },
                "rejected": {
                  "$ref": "#/definitions/__schema1"
                },
                "canceled": {
                  "$ref": "#/definitions/__schema1"
                }
              },
              "required": [
                "ready",
                "needs_attention",
                "excluded",
                "queued",
                "stamping",
                "stamped",
                "rejected",
                "canceled"
              ],
              "additionalProperties": false
            },
            "missingSalary": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "createdAt": {
              "$ref": "#/definitions/__schema2"
            },
            "stampRequestedAt": {
              "allOf": [
                {
                  "$ref": "#/definitions/__schema2"
                }
              ]
            },
            "stampBlock": {
              "type": "object",
              "properties": {
                "code": {
                  "enum": [
                    "payment_required",
                    "interrupted",
                    "rules_pending_review"
                  ]
                }
              },
              "required": [
                "code"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "runId",
            "frequency",
            "periodStart",
            "periodEnd",
            "paidOn",
            "calculating",
            "rows",
            "missingSalary",
            "createdAt"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "rowId": {
              "type": "string"
            },
            "runId": {
              "type": "string"
            },
            "employeeId": {
              "type": "string"
            },
            "employeeName": {
              "type": "string"
            },
            "employeeTaxId": {
              "allOf": [
                {
                  "type": "string"
                }
              ]
            },
            "state": {
              "enum": [
                "ready",
                "needs_attention",
                "excluded",
                "queued",
                "stamping",
                "stamped",
                "rejected",
                "canceled"
              ]
            },
            "omitted": {
              "type": "boolean"
            },
            "source": {
              "enum": [
                "calculated",
                "manual"
              ]
            },
            "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",
                      "employer_rfc_missing",
                      "employer_registration_missing",
                      "employer_curp_missing",
                      "invalid_salary",
                      "not_employed_in_period",
                      "sdi_below_daily_wage",
                      "rules_unavailable",
                      "negative_net",
                      "employee_missing",
                      "not_in_roster",
                      "period_already_paid",
                      "subsidy_line_invalid",
                      "subsidy_ceiling_exceeded",
                      "subsidy_month_cap_exceeded",
                      "invalid_request",
                      "amounts_changed",
                      "stamp_failed",
                      "stamp_unconfirmed"
                    ]
                  },
                  "field": {
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            },
            "paidDays": {
              "type": "number"
            },
            "totals": {
              "type": "object",
              "properties": {
                "gross": {
                  "type": "number"
                },
                "deductions": {
                  "type": "number"
                },
                "net": {
                  "type": "number"
                },
                "isr": {
                  "type": "number"
                },
                "subsidy": {
                  "type": "number"
                },
                "imss": {
                  "type": "number"
                }
              },
              "required": [
                "gross",
                "deductions",
                "net",
                "isr",
                "subsidy",
                "imss"
              ],
              "additionalProperties": false
            },
            "documentRef": {
              "type": "string"
            },
            "uuid": {
              "type": "string"
            },
            "rejectionCode": {
              "type": "string"
            },
            "errorCode": {
              "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",
                "employer_rfc_missing",
                "employer_registration_missing",
                "employer_curp_missing",
                "invalid_salary",
                "not_employed_in_period",
                "sdi_below_daily_wage",
                "rules_unavailable",
                "negative_net",
                "employee_missing",
                "not_in_roster",
                "period_already_paid",
                "subsidy_line_invalid",
                "subsidy_ceiling_exceeded",
                "subsidy_month_cap_exceeded",
                "invalid_request",
                "amounts_changed",
                "stamp_failed",
                "stamp_unconfirmed"
              ]
            },
            "updatedAt": {
              "$ref": "#/definitions/__schema2"
            },
            "earnings": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "$ref": "#/definitions/__schema4"
                  },
                  "code": {
                    "$ref": "#/definitions/__schema5"
                  },
                  "description": {
                    "$ref": "#/definitions/__schema6"
                  },
                  "taxableAmount": {
                    "type": "number"
                  },
                  "exemptAmount": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "code",
                  "taxableAmount",
                  "exemptAmount"
                ],
                "additionalProperties": false
              }
            },
            "deductions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "$ref": "#/definitions/__schema4"
                  },
                  "code": {
                    "$ref": "#/definitions/__schema5"
                  },
                  "description": {
                    "$ref": "#/definitions/__schema6"
                  },
                  "amount": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "code",
                  "amount"
                ],
                "additionalProperties": false
              }
            },
            "otherPayments": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "$ref": "#/definitions/__schema4"
                  },
                  "code": {
                    "$ref": "#/definitions/__schema5"
                  },
                  "description": {
                    "$ref": "#/definitions/__schema6"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "employmentSubsidy": {
                    "type": "number"
                  }
                },
                "required": [
                  "type",
                  "code",
                  "amount"
                ],
                "additionalProperties": false
              }
            },
            "explanation": {
              "type": "object",
              "properties": {
                "paidDays": {
                  "type": "number"
                },
                "contributionDays": {
                  "type": "number"
                },
                "dailyWage": {
                  "type": "number"
                },
                "integratedDailySalary": {
                  "type": "number"
                },
                "contributionBaseSalary": {
                  "type": "number"
                },
                "isrCaused": {
                  "type": "number"
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "amount": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "label",
                      "amount"
                    ],
                    "additionalProperties": false
                  }
                },
                "rules": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "legalBasis": {
                        "type": "string"
                      },
                      "readOn": {
                        "allOf": [
                          {
                            "$ref": "#/definitions/__schema0"
                          }
                        ]
                      },
                      "validFrom": {
                        "allOf": [
                          {
                            "$ref": "#/definitions/__schema0"
                          }
                        ]
                      },
                      "sourceUrl": {
                        "allOf": [
                          {
                            "type": "string"
                          }
                        ]
                      }
                    },
                    "required": [
                      "key",
                      "label",
                      "legalBasis",
                      "readOn",
                      "validFrom"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "paidDays",
                "contributionDays",
                "dailyWage",
                "integratedDailySalary",
                "contributionBaseSalary",
                "isrCaused",
                "lines",
                "rules"
              ],
              "additionalProperties": false
            },
            "lastReceiptSalaryAvailable": {
              "type": "boolean"
            }
          },
          "required": [
            "rowId",
            "runId",
            "employeeId",
            "employeeName",
            "state",
            "omitted",
            "source",
            "issues",
            "updatedAt",
            "earnings",
            "deductions",
            "otherPayments",
            "lastReceiptSalaryAvailable"
          ],
          "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": {
    "__schema0": {
      "type": "string",
      "format": "date"
    },
    "__schema1": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "net": {
          "type": "number"
        }
      },
      "required": [
        "count",
        "net"
      ],
      "additionalProperties": false
    },
    "__schema2": {
      "type": "string",
      "format": "date-time"
    },
    "__schema4": {
      "type": "string"
    },
    "__schema5": {
      "type": "string"
    },
    "__schema6": {
      "type": "string"
    }
  },
  "oneOf": [
    {
      "required": [
        "data"
      ]
    },
    {
      "required": [
        "error"
      ]
    }
  ]
}
```

## Related tools

- [`get_payroll`](/docs/en/mcp/tools/get_payroll.md) — **Read payroll**: Read payroll settings, runs (optionally of one frequency), one run with its receipt count and net per state, a run's receipts (optionally in one state), or one receipt with its lines and calculation.

- [`save_payroll`](/docs/en/mcp/tools/save_payroll.md) — **Save payroll**: Prepare or adjust payroll before stamping: change payroll settings (only the fields sent change; null clears one), prepare the run of a pay period (idempotent per period; receipts calculate in the background), change its payment date, recalculate it, or update one receipt (omit or include it, capture its amounts, or return it to the calculation), or prepare a canceled receipt again.

- [`get_document`](/docs/en/mcp/tools/get_document.md) — **Get document**: Retrieve one document by its public documentRef. Sales receipt details include stable lineRef values and remaining refundable amounts for sales receipt refunds.

## Related workflow

[See the canonical workflows in Quickstart](/docs/en.md)

## Equivalent REST operations

- [`POST /v1/payroll/runs/{runId}/stamp`](/docs/en/api/documents/payroll/stamp-payroll-run.md)

- [`POST /v1/payroll/rows/{rowId}/restamp`](/docs/en/api/documents/payroll/restamp-payroll-row.md)

Complete documentation: https://exac.mx/docs/en.md
Agent documentation index: https://exac.mx/docs/en/llms.txt
