CFE Validation

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Intro

This API validates an electricity bill issued by CFE from the account holder's name and the service number printed on it.
In the answer you will get the CFDI that backs the bill —issuer, receiver, amounts and line items— together with the data printed on the bill itself: the customer's address, the tariff, the meter readings and the consumption history.

It is meant to confirm that a bill handed to you as proof of address is real and belongs to the person who handed it in, without having to read the document by hand.

Important Points

Mandatory Fields

All the fields in the body are mandatory and kiban cloud performs validations on the information sent to detect special characters or incorrect formats.

fieldtyperequiredlengthDescription
nameAlphabeticYesmin 2Name of the account holder, as it appears on the bill.
serviceNumberNumericYesN/AService number (número de servicio) printed on the bill. Digits only.

No credentials required

This service runs on credentials kiban provides, so you do not need to contract CFE or send a vault field: the API key of your account is enough.

Dates

cfdi.fecha is delivered as a date without time, in yyyy-mm-dd format, even though the CFDI carries a timestamp.

Test the service (test cases)

We have included a query parameter in Sandbox to enable you to query the test cases that we created for running tests. To get a response, fill the testCaseId parameter with any of the following cases:

NumIdNameDescription
16939a1b2c3d4e5f600000b01Respuesta exitosaIndicates one successful response with the CFDI and the bill data
26939a1b2c3d4e5f600000b02Datos invalidosIndicates a 400 response when the provider rejects the data sent

📘

Test your own test case

In case you want to test your own test case created in link, you can send in the testCaseId parameter the identifier of the test case you want to use.

For more information visit our knowledge center to know more about test cases

Successful response

Inside the response object you will get the next fields.

subfieldDescription
statusStatus returned by the provider.
messageCodeResult code of the validation.
validationCodeCode the provider assigns to the validation performed.
cfdiThe CFDI that backs the bill.
datosThe data printed on the bill.

cfdi

subfieldDescription
fechaIssue date of the CFDI, in yyyy-mm-dd format.
folioFolio of the CFDI.
serieSeries of the CFDI.
versionCFDI version, for example 4.0.
tipoDeComprobanteType of receipt, for example I for income.
formaPagoPayment form code.
metodoPagoPayment method code, for example PUE.
monedaCurrency of the amounts.
lugarExpedicionPostal code where the CFDI was issued.
subTotalAmount before taxes.
totalTotal amount of the bill.
emisorIssuer: nombre, rfc and regimenfiscal.
receptorReceiver: nombre, rfc, usoCFDI, regimenFiscalReceptor and domicilioFiscalReceptor.
conceptosLine items of the bill, as the CFDI carries them.

datos

subfieldDescription
rpuRegistro Permanente de Usuario of the service.
ajustePorRedondeoRounding adjustment applied to the amount.
ocrData read from the bill's OCR line: periodo, digito and tipo.
informacionFacturaBilling information: lineaDeReferencia, uso, montoAPagarEnLetras, cargosCreditos, dias, consumoDiario, precioDiario and codigoDeBarras.
clienteCustomer as printed on the bill: nombre, calle, calle2, colonia, codigoPostal, ciudad, estado, tarifa, consumo, lecturaAnterior and lecturaActual.
historialConsumosConsumption history, with periodo, consumo and importe per period.
{
    "id": "6939a1b2c3d4e5f600000c11",
    "createdAt": "2026-05-10T18:24:02.118Z",
    "finishedAt": "2026-05-10T18:24:04.902Z",
    "duration": 2784,
    "status": "SUCCESS",
    "request": {
        "name": "JUAN PEREZ HERNANDEZ",
        "serviceNumber": "773204509871"
    },
    "response": {
        "status": "OK",
        "messageCode": 0,
        "validationCode": "vcf2789217358129.382917",
        "cfdi": {
            "fecha": "2025-05-10",
            "folio": "000409872345",
            "serie": "RB",
            "version": "4.0",
            "tipoDeComprobante": "I",
            "formaPago": "03",
            "metodoPago": "PUE",
            "moneda": "MXN",
            "lugarExpedicion": "11560",
            "subTotal": "270.50",
            "total": "305.00",
            "emisor": {
                "nombre": "AGUAS DEL NORTE SA DE CV",
                "rfc": "ACE891203TT9",
                "regimenfiscal": "601"
            },
            "receptor": {
                "nombre": "JUAN PEREZ HERNANDEZ",
                "rfc": "PAHJ850612F12",
                "usoCFDI": "G03",
                "regimenFiscalReceptor": "612",
                "domicilioFiscalReceptor": "04330"
            },
            "conceptos": [
                {
                    "cantidad": "1",
                    "claveProdServ": "43191510",
                    "claveUnidad": "KWH",
                    "descripcion": "Energia",
                    "importe": "215.50",
                    "valorUnitario": "215.50"
                }
            ]
        },
        "datos": {
            "rpu": "773204509871",
            "ajustePorRedondeo": "0.02",
            "ocr": {
                "periodo": "202505",
                "digito": "3",
                "tipo": "02"
            },
            "informacionFactura": {
                "lineaDeReferencia": "02 773204509871 250610 000000305 3",
                "uso": "Comercial",
                "montoAPagarEnLetras": "TRESCIENTOS CINCO PESOS  M.N.",
                "cargosCreditos": "305.00",
                "dias": "30",
                "consumoDiario": "2.10",
                "precioDiario": "7.02",
                "codigoDeBarras": "027732045098712506100000003053"
            },
            "cliente": {
                "nombre": "JUAN PEREZ HERNANDEZ",
                "calle": "AV INSURGENTES SUR 1458",
                "calle2": "INT 3",
                "colonia": "DEL VALLE CENTRO",
                "codigoPostal": "03100",
                "ciudad": "CIUDAD DE MÉXICO",
                "estado": "CDMX",
                "tarifa": "02",
                "consumo": "130",
                "lecturaAnterior": "5210",
                "lecturaActual": "5340"
            },
            "historialConsumos": [
                {
                    "periodo": "10 MAR 25 al 10 MAY 25",
                    "consumo": 130,
                    "importe": 305
                }
            ]
        }
    },
    "cost": 0
}

Listing the possible not success responses

Required fields

You will get a 400 bad request error when any of the required fields are not provided.

[
    {
        "message": "name is required",
        "field": "(root)"
    },
    {
        "message": "serviceNumber is required",
        "field": "(root)"
    }
]

Invalid Format

Some of the fields contain illegal characters or formatting or empty value, the service will return a 400 bad request.

[
    {
        "message": "String length must be greater than or equal to 2",
        "field": "name"
    },
    {
        "message": "Does not match pattern '^[0-9]+$'",
        "field": "serviceNumber"
    }
]
🚧

Use v2 to get the error detail

The bodies above are the ones returned by v2. On v1 these validation errors arrive as a bare 400 with no body, so you will not know which field was rejected.

Data rejected by the provider (CFE)

The name and the service number do not match a bill, or the provider could not validate them. You will get a 400 with the execution, where status is INPUT_ERROR and errorMessage carries the reason.

{
    "id": "6939a1b2c3d4e5f600000c12",
    "createdAt": "2026-05-10T18:26:11.004Z",
    "finishedAt": "2026-05-10T18:26:12.771Z",
    "duration": 1767,
    "status": "INPUT_ERROR",
    "errorMessage": "Datos inválidos",
    "request": {
        "name": "JUAN PEREZ HERNANDEZ",
        "serviceNumber": "000000000000"
    }
}

Unauthorized

It means that the provided API is incorrect and that you are not authorized to access it. You will not receive a body, only a 401 HTTP code.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json