Skip to content

FISCALISTO / API / REFERENCE

Stamp a whole payroll (batch) · Payroll

Open in ChatGPTOpen in ClaudeOpen in Cursor
POST
/v1/payroll_batches

A whole payroll run in one request: up to 1,000 receipts of one issuer, stamped in the background one after another, without the stamps-per-second limit of a single request. In one of two ways, never mixed: receipts (employee ids; Fiscalisto calculates each receipt with the batch's period) or external_receipts (the receipts your system calculated, as in POST /v1/payroll_receipts/external, with reference instead of metadata). Everything that can be checked beforehand is checked beforehand: if something fails, none is stamped and the error says which receipt (param receipts.3.employee). What's only known when stamping (a period already paid, SAT rejecting an RFC) stays on that receipt, with its error. One receipt per employee and period: sending the run again, even with another Idempotency-Key, returns the receipts it already has. Answers 202; listen for payroll_batch.completed or look up the batch.

Before you call

  • An issuer that already stamps. In production, with its digital seal (CSD) current: POST /v1/issuers/{id}/certificates. In test mode it stamps with SAT's test CSD.

  • The Idempotency-Key header, a new one for each call (for example, the order's id in your system). If the response is lost, repeat the call with the same one and it isn't done twice: Idempotency.

Authorization

bearerAuth
headerAuthorizationBearer <key>

Your secret key: fk_test_… in test mode, fk_live_… in production. Desarrolladores › Llaves.

Headers

Idempotency-Key*string

A new one per CFDI (8 to 255 characters; your order id works). If the response is lost, repeat the request with the same value: it answers the same and never stamps twice.

Length8 <= length <= 255

Request body

application/json
  1. body
issuer?string

Issuer (iss_…). If the key has a single issuer or the account has only one, it can be left out.

Pattern^iss_
name?string

The batch's name, for you (Quincena 20).

Lengthlength <= 120
period?

The pay period: first and last day (FechaInicialPago, FechaFinalPago) and, if it isn't the last one, the payment day (FechaPago). It applies to every receipt in receipts that doesn't carry its own.

send_email?boolean

Send each employee their receipt by email (those with an email). Only with receipts.

receipts?array<>

The receipts Fiscalisto calculates: one employee (emp_…) in each, as in POST /v1/payroll_receipts.

Items1 <= items <= 1000
external_receipts?array<>

The receipts your payroll system calculated, stamped as they are. Instead of receipts.

Items1 <= items <= 1000

Response body

OK. Repeating the request with the same Idempotency-Key answers the same, with the same status and the idempotent-replayed: true header.

application/json
  1. response

A whole payroll (up to 1,000 receipts) stamped in the background.

id*string

Object identifier, with its prefix (iss_, inv_, ret_, cus_, prd_, emp_, bat_, brn_, whs_, stm_, adj_, evt_, whe_).

livemode*boolean

true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT.

object*string

What kind of object it is («invoice», «customer»…).

issuer*string

The issuer (iss_…).

name*string

The batch's name, for you.

calculation*string

fiscalisto: Fiscalisto calculated each receipt (receipts); external: the amounts from your system were stamped (external_receipts).

One of"fiscalisto""external"
status*string

processing: stamping. completed: no receipts are left to stamp.

One of"processing""completed"
total*integer

How many receipts the batch has.

Range-9007199254740991 <= value <= 9007199254740991
stamped*integer

How many receipts were stamped.

Range-9007199254740991 <= value <= 9007199254740991
failed*integer

How many weren't stamped (each with its error).

Range-9007199254740991 <= value <= 9007199254740991
processing*integer

How many are left to stamp.

Range-9007199254740991 <= value <= 9007199254740991
created_at*|

When it was created, ISO 8601 with Mexico City time (-06:00).

completed_at*|

When it finished.

receipts?array<>

Each employee's receipt, in the order you sent them (not included in lists).

Errors

  • This mixes the two ways of issuing a payroll receipt: POST /v1/payroll_receipts calculates it from an employee (emp_…); POST /v1/payroll_receipts/external stamps the amounts your payroll system calculated. Use the matching endpoint.

  • Stamping requires the Idempotency-Key header (8 to 255 characters, a new one per document), so a retry never stamps twice.

  • The issuer is archived and no longer stamps. Its documents can still be read and canceled.

  • The account has several issuers and the request doesn't say which: send issuer (iss_…).

  • The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.

  • POST /v1/payroll_receipts only calculates ordinary payroll (salary, ISR with the employment subsidy and the employee's IMSS quotas). Fiscalisto calculates the aguinaldo, PTU and severance (finiquito or liquidación) with POST /v1/payroll_receipts/extraordinary; pensions, bonuses and the rest are calculated by your payroll system and stamped with POST /v1/payroll_receipts/external. param says which field asked for it.

  • The account has no live stamps left: to stamp, check RFCs against SAT's lists, look up constancias, request SAT downloads or fetch declarations, the compliance opinion or the mailbox from SAT. Buy a pack in Desarrolladores › Timbres y pagos, or turn on auto-recharge. Never happens in test mode.

  • Live, this part of the API (inventario, portal de proveedores, pedidos, comprobación de gastos) follows the empresa's plan, as in the app: it comes with Operaciones (added to any paid plan; included in Corporativo). The books (the /v1/accounting routes except DIOT, cross checks, IVA refunds and fixed assets) come with Contabilidad (added to Independiente, Emprendedor or Negocio; included in Despacho and Corporativo): without it, changing the books answers this error, and reading them works only up to the last month it had it. Add either in Ajustes › Plan y pagos; test mode has everything.

  • That issuer is an empresa of the app connected to your account: through the API it only offers its Portal de proveedores (/v1/portal_suppliers and /v1/supplier_invoices) and, once someone who may pay suppliers and change Configurar pagos turned them on, its supplier payouts (/v1/payouts and /v1/payroll_payouts). It also stops when whoever connected it (or turned its payouts on) no longer has that permission in the empresa: message_es says which. Do everything else in the app.

  • This key can't use that issuer.

  • There is no such issuer in the account (or it belongs to the other mode).

  • The payroll receipt can't be calculated or stamped with that data (period, days, the issuer's employer registration…). message_es says which; for an externally calculated receipt, errors lists every problem with its param.

  • You reached today's limit of something not paid with stamps. Retry-After says how many seconds until midnight in Mexico City.

Plus those of any call (key, fields, limits): Errors. They all carry code, message and, when it's about a field, param.

curl -X POST 'https://api.fiscalisto.com/v1/payroll_batches' \  -H 'Authorization: Bearer fk_test_…' \  -H 'Idempotency-Key: nomina-2026-q20' \  -H 'Content-Type: application/json' \  -d '{  "name": "Semana 2026-43",  "period": {    "start": "2026-10-17",    "end": "2026-10-23"  },  "send_email": true,  "receipts": [    {      "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",      "reference": "s43-9"    },    {      "employee": "emp_OufpKqnrvx9p4TyuI2OPAsDfGhJkLzXcVb",      "reference": "s43-12",      "days": 5    }  ]}'
{  "id": "pyb_OufpKqnrvx9p6tQ2wE8rYu4iOp7aSd3fGh",  "object": "payroll_batch",  "livemode": false,  "issuer": "iss_OufpKqnrvx9p",  "name": "Semana 2026-43",  "calculation": "fiscalisto",  "status": "processing",  "total": 2,  "stamped": 0,  "failed": 0,  "processing": 2,  "created_at": "2026-10-23T09:00:12-06:00",  "completed_at": null,  "receipts": [    {      "index": 0,      "reference": "s43-9",      "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",      "tax_id": "MASO451221PM4",      "name": "MARIA OLIVIA MARTINEZ SAGAZ",      "status": "processing",      "invoice": null,      "uuid": null,      "total": null,      "error": null    },    {      "index": 1,      "reference": "s43-12",      "employee": "emp_OufpKqnrvx9p4TyuI2OPAsDfGhJkLzXcVb",      "tax_id": "GORA800101AB1",      "name": "ANA GOMEZ RUIZ",      "status": "processing",      "invoice": null,      "uuid": null,      "total": null,      "error": null    }  ]}

Was this page helpful?