# File to pay the payroll at the bank

`POST https://api.fiscalisto.com/v1/payroll_bank_files`

The disbursement file that pays each employee's net from your bank's portal: BBVA (Net Cash), Banamex (BancaNet, layout D), Banorte (Banorte en su Empresa), Santander (Enlace) or a SPEI CSV for any bank. It takes the stamped (and not canceled) payroll receipts with that payment date, adds them up per employee and pays the CLABE on their record (clabe on the employee): within the same bank by account, to another one by SPEI. It doesn't charge or move money: you upload it to the bank and authorize it there. Whoever can't be paid (no CLABE, another bank on Santander) goes in excluded with the reason. Upload the first one as a test: each portal validates it before loading anything.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header |  | Optional (the SDKs send it on their own). If the response is lost, repeat the request with the same value within 24 hours: it answers the same, with idempotent-replayed: true, and doesn't do it twice (it doesn't create, send emails or charge). |

## Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string (iss_…) |  | Issuer (iss_…). If the key has a single issuer or the account has only one, it can be left out. |
| `payment_date` | string | yes | The receipts' payment date (FechaPago): the payroll receipts stamped with that date are paid, added up per employee. It's also the day the bank applies the file. |
| `layout` | `bbva`, `banamex`, `banorte`, `santander`, `spei` |  | The bank's format: bbva (Net Cash), banamex (BancaNet, layout D), banorte (Banorte en su Empresa), santander (Enlace, Santander accounts only) or spei (CSV for any bank). By default, that of account's bank. |
| `account` | string |  | The CLABE of the issuer's debit account. By default, the one used last time in the app, or its first bank account. |
| `sequence` | integer |  | The day's file (1 to 99): a second file on the same day carries another number. 1 by default. (from 1 to 99) |
| `client_number` | string |  | Banamex: your BancaNet customer number (12 digits). |
| `issuer_number` | string |  | Banorte: your issuer number (5 digits). |

Example:

```json
{
  "payment_date": "2026-10-31",
  "layout": "bbva"
}
```

## With the TypeScript SDK

```ts
import { Fiscalisto } from "fiscalisto";

// La llave viene de FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

const payrollBankFile = await fiscalisto.payrollBankFiles.create({ payment_date: "2026-10-31", layout: "bbva" }, { idempotencyKey: "pedido-A-1042" });
```

## With the Python SDK

```python
from fiscalisto import Fiscalisto

# La llave viene de FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

payroll_bank_file = fiscalisto.payroll_bank_files.create({"payment_date": "2026-10-31", "layout": "bbva"}, idempotency_key="pedido-A-1042")
```

## With the PHP SDK

```php
<?php

use Fiscalisto\Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

$payrollBankFile = $fiscalisto->payrollBankFiles->create([
    'payment_date' => '2026-10-31',
    'layout' => 'bbva',
], ['idempotency_key' => 'pedido-A-1042']);
```

## With the .NET SDK

```csharp
using Fiscalisto;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var payrollBankFile = await fiscalisto.PayrollBankFiles.CreateAsync(new CreatePayrollBankFileParams
{
    PaymentDate = "2026-10-31",
    Layout = "bbva",
}, new RequestOptions { IdempotencyKey = "pedido-A-1042" });
```

## With the Go SDK

```go
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// La llave viene de FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	payrollBankFile, err := client.PayrollBankFiles.Create(ctx, &fiscalisto.CreatePayrollBankFileParams{
		PaymentDate: "2026-10-31",
		Layout:      fiscalisto.String("bbva"),
	}, fiscalisto.WithIdempotencyKey("pedido-A-1042"))
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", *payrollBankFile)
}
```

## With the Java SDK

```java
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.RequestOptions;
import com.fiscalisto.model.CreatePayrollBankFileParams;

// La llave viene de FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

var payrollBankFile = fiscalisto.payrollBankFiles().create(new CreatePayrollBankFileParams()
        .setPaymentDate("2026-10-31")
        .setLayout("bbva"), RequestOptions.idempotencyKey("pedido-A-1042"));
System.out.println(payrollBankFile);
```

## Response 201

OK.

A `PayrollBankFile` object:

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `object` | `"payroll_bank_file"` | yes | What kind of object it is («invoice», «customer»…). |
| `livemode` | boolean | yes | true in production (fk_live_ keys), false in test mode (fk_test_). Test objects aren't valid before the SAT. |
| `issuer` | string | yes | The issuer (iss_…). |
| `layout` | `bbva`, `banamex`, `banorte`, `santander`, `spei` | yes | The bank's format: bbva, banamex, banorte, santander or spei (CSV). |
| `payment_date` | string | yes | Payment date (FechaPago), YYYY-MM-DD. The last day of the period by default. |
| `account` | string or null | yes | The CLABE of the account to debit. |
| `file_name` | string | yes | The name the bank's portal expects it with. |
| `content_type` | `text/plain`, `text/csv` | yes | text/plain for the banks' portals, text/csv for spei. |
| `content` | string | yes | The file as text, with lines ending in CR LF. |
| `content_base64` | string | yes | The same file in Windows-1252 (ANSI), in base64: save it as is to upload it. |
| `total` | number | yes | Total in the receipt's currency (Total). |
| `count` | integer | yes | How many payments it carries. (from -9007199254740991 to 9007199254740991) |
| `payments` | array of object | yes | Each payment in the file, in the order it goes. |
| `payments[].employee` | string or null | yes | The employee (emp_…); null if another system stamped the receipt and there is no employee with that RFC. |
| `payments[].number` | string or null | yes | Employee number (NumEmpleado). |
| `payments[].name` | string | yes | Name. |
| `payments[].tax_id` | string | yes | RFC (Rfc), 12 characters for a persona moral and 13 for a persona física. |
| `payments[].amount` | number | yes | The net pay: the sum of their receipts with that pay date. |
| `payments[].clabe` | string | yes | The CLABE it is paid to. |
| `payments[].spei` | boolean | yes | true: to another bank via SPEI; false: to an account at the same bank. |
| `payments[].receipts` | array of string | yes | Series and folio of the receipts it pays. |
| `excluded` | array of object | yes | Who isn't in the file and why (no CLABE, another bank…). |
| `excluded[].employee` | string or null | yes | The employee (emp_…); null if another system stamped the receipt and there is no employee with that RFC. |
| `excluded[].number` | string or null | yes | Employee number (NumEmpleado). |
| `excluded[].name` | string | yes | Name. |
| `excluded[].tax_id` | string | yes | RFC (Rfc), 12 characters for a persona moral and 13 for a persona física. |
| `excluded[].amount` | number | yes | The net pay: the sum of their receipts with that pay date. |
| `excluded[].reason` | string | yes | Why it isn't in the file. |

```json
{
  "object": "payroll_bank_file",
  "livemode": false,
  "issuer": "iss_OufpKqnrvx9p",
  "layout": "bbva",
  "payment_date": "2026-10-31",
  "account": "012180001122334451",
  "file_name": "nomina-bbva-20261031-01.txt",
  "content_type": "text/plain",
  "content": "",
  "content_base64": "",
  "total": 5000.37,
  "count": 1,
  "payments": [
    {
      "employee": "emp_OufpKqnrvx9p3RxmD1RIDgEHzKYPYnYBlV",
      "number": "9",
      "name": "MARIA OLIVIA MARTINEZ SAGAZ",
      "tax_id": "MASO451221PM4",
      "amount": 5000.37,
      "clabe": "012180001234567899",
      "spei": false,
      "receipts": [
        "N-118"
      ]
    }
  ],
  "excluded": []
}
```

## Errors

- `feature_not_in_plan` (403): 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.
- `issuer_archived` (400): The issuer is archived and no longer stamps. Its documents can still be read and canceled.
- `issuer_linked_empresa` (403): 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.
- `issuer_missing` (404): There is no such issuer in the account (or it belongs to the other mode).
- `issuer_not_allowed` (403): This key can't use that issuer.
- `issuer_required` (400): The account has several issuers and the request doesn't say which: send `issuer` (iss_…).
- `livemode_mismatch` (400): The object belongs to the other mode: an fk_test_ key only sees test data and an fk_live_ key only live data.
- `resource_missing` (404): There's no object with that id (or it belongs to another issuer or the other mode).

Plus those of any call (key, fields, limits): https://fiscalisto.com/en/docs/api/errores.md.
