npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

multiserviciosweb

v1.1.2

Published

Validate, calculate and obtain CURP information in México.

Readme

ValidaCurp Node.js Client

npm version License: MIT Node.js version

Node.js client for validating, calculating, and obtaining CURP (Clave Única de Registro de Población) information in México.

  • Copyright (c) Multiservicios Web JCA S.A. de C.V., https://multiservicios-web.com.mx
  • More information: https://valida-curp.com.mx
  • License: MIT (https://opensource.org/license/MIT)

1. Requirements

  • Node.js >= 14.0.0

2. Installation

npm install multiserviciosweb

3. Account

3.1. Create an account

Create an account by following this link: https://valida-curp.tawk.help/article/registro-de-usuario

3.2. Create a project

Create a project by following this link: https://valida-curp.tawk.help/article/creaci%C3%B3n-de-proyecto

3.3. Get a token

Get your token by following this link: https://valida-curp.tawk.help/article/obtener-token-llave-privada-proyecto

4. Usage

4.1. Import the library

const { ValidaCurp, ValidaCurpException } = require('multiserviciosweb');

4.2. Create an instance

The constructor receives the token as first parameter. Optionally you can pass a custom endpoint.

// Passing token directly
const client = new ValidaCurp('YOUR-TOKEN');

You can also set the token via environment variable. Create a .env file:

TOKEN_VALIDA_API_CURP=YOUR-TOKEN

Then instantiate without arguments:

const client = new ValidaCurp();

4.3. (Optional) Set API version

You can set the API version to query. Default value is 2.

client.setVersion(2); // 1 or 2

Version 1 of the API is deprecated. Please use version 2.

4.4. (Optional) Custom endpoint

const client = new ValidaCurp('YOUR-TOKEN', 'https://custom.valida-curp.com.mx/curp/');

5. Methods

5.1. Validate CURP

The method isValid() takes a CURP as parameter and validates its structure.

const result = await client.isValid('PXNE660720HMCXTN06');
console.log(result);

Response:

{
  "valido": 1
}

5.2. Get CURP data

The method getData() takes a CURP as parameter and consults the CURP information in RENAPO.

const data = await client.getData('PXNE660720HMCXTN06');
console.log(data);

Response:

{
  "Applicant": {
    "CURP": "PXNE660720HMCXTN06",
    "Names": "ENRIQUE",
    "LastName": "PEÑA",
    "SecondLastName": "NIETO",
    "GenderKey": "H",
    "Gender": "Hombre",
    "DateOfBirth": "1966-07-20",
    "Nacionality": "MEX",
    "CodeEntityBirth": "",
    "EntityBirth": "",
    "KeyEvidentiaryDocument": 1,
    "EvidentiaryDocument": "Acta de nacimiento",
    "CurpStatusKey": "AN",
    "CurpStatus": "Alta Normal"
  },
  "EvidentiaryDocument": {
    "YearRegistration": 1966,
    "KeyIssuingEntity": "",
    "KeyMunicipalityRegistration": 14,
    "MunicipalityRegistration": "",
    "Foja": 0,
    "FolioLetter": "",
    "Book": 0,
    "CertificateNumber": 985,
    "RegistrantNumber": 15,
    "RegistrationEntity": "México",
    "ForeignRegistrationNumber": "",
    "Volume": 0
  }
}

5.3. Calculate a CURP

The method calculate() takes an object as parameter and calculates the CURP structure from the provided data.

const result = await client.calculate({
    names: 'Enrique',
    lastName: 'Peña',
    secondLastName: 'Nieto',
    birthDay: '20',
    birthMonth: '07',
    birthYear: '1966',
    gender: 'H',
    entity: '15',
});
console.log(result);

Required fields:

| Field | Description | Example | |------------------|-----------------------------------------|----------| | names | First name(s) | 'Juan' | | lastName | Paternal last name | 'Pérez'| | secondLastName | Maternal last name | 'López'| | birthDay | Day of birth (2 digits) | '15' | | birthMonth | Month of birth (2 digits) | '09' | | birthYear | Year of birth (4 digits) | '1990' | | gender | 'H' for male, 'M' for female | 'H' | | entity | Entity code (2-digit state code) | '09' |

Response:

{
  "curp": "PXNE660720HMCXTN06"
}

5.4. Get entities

The method getEntities() doesn't take any parameters and returns the list of entities.

const entities = await client.getEntities();
console.log(entities);

Response:

{
  "clave_entidad": [
    { "clave_entidad": "01", "nombre_entidad": "AGUASCALIENTES", "abreviatura_entidad": "AS" },
    { "clave_entidad": "02", "nombre_entidad": "BAJA CALIFORNIA", "abreviatura_entidad": "BC" }
  ]
}

6. Error handling

All methods throw ValidaCurpException on API errors.

const { ValidaCurp, ValidaCurpException } = require('multiserviciosweb');

try {
    const result = await client.getData('PXNE660720HMCXTN06');
} catch (error) {
    if (error instanceof ValidaCurpException) {
        console.error('API Error:', error.message);
    } else {
        console.error('Unexpected Error:', error.message);
    }
}

7. Full example

const { ValidaCurp, ValidaCurpException } = require('multiserviciosweb');

async function main() {
    try {
        const client = new ValidaCurp('YOUR-TOKEN');

        // Validate CURP structure
        console.log(await client.isValid('PXNE660720HMCXTN06'));

        // Get CURP data from RENAPO
        console.log(await client.getData('PXNE660720HMCXTN06'));

        // Calculate CURP
        console.log(await client.calculate({
            names: 'Enrique',
            lastName: 'Peña',
            secondLastName: 'Nieto',
            birthDay: '20',
            birthMonth: '07',
            birthYear: '1966',
            gender: 'H',
            entity: '15',
        }));

        // Get entities
        console.log(await client.getEntities());

    } catch (error) {
        if (error instanceof ValidaCurpException) {
            console.error('ValidaCurp Exception:', error.message);
        } else {
            console.error('Unexpected Error:', error.message);
        }
    }
}

main();

To see the full example click on this link: https://github.com/EdsonBurgosMsWeb/valida-curp-client-nodejs/blob/main/example.js

8. Credits

  • Copyright (c) Multiservicios Web JCA S.A. de C.V., https://multiservicios-web.com.mx
  • Author: Edson Burgos [email protected]

9. License

This project is released under the MIT License. See the LICENSE file for details.