## SPFE - Get payments, collections, rejections and non-payments

`GET`  https://{entorno}.ticketbaiws.eus/spfe-estados/

Spanish **Law 18/2022 "Crea y Crece"**  (implemented by RD 238/2026 and Order HAC/1028/2026) requires invoices between companies and self-employed professionals to be issued in electronic format and their status to be reported: **payment, collection, rejection or non-payment** . Ticketbai WS automatically sends the full invoices you issue through the API to Spanish customers with a NIF (Spanish tax ID) to the **SPFE (Solución Pública de Facturación Electrónica), the Spanish public B2B e-invoicing platform run by the AEAT (Spanish Tax Agency)** , in UBL format, and downloads the invoices you receive from your suppliers.

These methods are only available to companies that have sending to the SPFE enabled. It is enabled in the company details in the private area (**Factura electrónica B2B** , B2B e-invoicing) or with the **spfe**  parameter of the [New company](https://ticketbaiws.eus/en/empresas-post/) and [Edit company details](https://ticketbaiws.eus/en/empresas-put/) methods. Once enabled, invoices are sent from that day on.

Returns the last 100 statuses (pago, cobro, rechazo, impago: payment, collection, rejection, non-payment) reported to the SPFE with [POST spfe-estados](https://ticketbaiws.eus/en/spfe-estados-post/) or from the private area, with the result of each one: **PENDING**  (queued), **OK**  (accepted by the AEAT) or **ERROR**  (with the list of errors). All filters are optional and can be combined.

**GET methods accept the parameters either in the body as a JSON payload or as a query string in the URL, as shown in the cURL example.**

**PARAMETERS**

- `id` (integer, optional): ID returned by POST spfe-estados. Ejemplo: `128`
- `serie` (string, optional): Series of an issued invoice. Ejemplo: `A`
- `numero` (string, optional): Number of an issued invoice. Ejemplo: `2026000245`
- `factura` (string, optional): Series and number of the invoice (issued or received) Ejemplo: `F2026-0153`
- `nif_emisor` (string, optional): NIF (Spanish tax ID) of the invoice issuer. Ejemplo: `B01000012`

**RESPONSE (return, one row per status)**

- `id` (integer, ID of the status in Ticketbai WS) Ejemplo: `128`
- `estado / baja` (, Reported status and whether it is a cancellation) Ejemplo: `pago`
- `factura, fecha_factura, nif_emisor` (, Invoice it refers to) Ejemplo: `F2026-0153`
- `fecha / vencimiento` (, Reported dates (dd/mm/yyyy)) Ejemplo: `10/11/2026`
- `result` (string, **PENDING**  queued, **OK**  accepted by the AEAT, **ERROR**  rejected (see **errores** )) Ejemplo: `OK`
- `errores` (array, List of AEAT errors: codigo and descripcion)

**GET** `https://{entorno}.ticketbaiws.eus/spfe-estados/`

```bash
$ curl --request GET \
     --url 'https://api-test.ticketbaiws.eus/spfe-estados/?factura=F2026-0153&nif_emisor=B01000012' \
     --header 'Accept: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
```

Respuesta:

```json
HTTP/1.1 200 OK
{
    "result": "OK",
    "return": [
        {
            "id": 128,
            "estado": "pago",
            "baja": false,
            "factura": "F2026-0153",
            "fecha_factura": "03\/11\/2026",
            "nif_emisor": "B01000012",
            "fecha": "10\/11\/2026",
            "vencimiento": "03\/12\/2026",
            "result": "OK",
            "errores": []
        },
        {
            "id": 131,
            "estado": "cobro",
            "baja": false,
            "factura": "A2026000245",
            "fecha_factura": "28\/10\/2026",
            "nif_emisor": "00000014Z",
            "fecha": "09\/11\/2026",
            "vencimiento": "27\/11\/2026",
            "result": "OK",
            "errores": []
        }
    ],
    "msg": null
}
```

Fuente: https://ticketbaiws.eus/en/spfe-estados-get/
