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

api-inti-dev

v0.1.1

Published

NPM no oficial para consumir la API de ApiInti Dev.

Readme

api-inti-dev

Package no oficial para consumir la API de ApiInti desde Node.js y TypeScript.

Permite consultar informacion de contribuyentes y personas en Peru usando RUC y DNI, con metodos tipados y validaciones basicas de entrada.

Instalacion

npm install api-inti-dev@latest

Requisitos

  • Node.js 18 o superior
  • API Key de ApiInti

Uso rapido

import { ApiInti } from "api-inti";

const api = new ApiInti();
api.configToken(process.env.APIINTI_TOKEN ?? "");

const info = await api.getInfoByRuc("20123456789");
console.log(info.razonSocial);

Tambien puedes pasar el token en el constructor:

import { ApiInti } from "api-inti";

const api = new ApiInti(process.env.APIINTI_TOKEN);

O usar opciones avanzadas:

import { ApiInti } from "api-inti";

const api = new ApiInti({
  token: process.env.APIINTI_TOKEN,
  timeout: 15000,
  baseURL: "https://app.apiinti.dev/api/v1",
});

Metodos disponibles

configToken(token: string): void

Configura o actualiza el token Bearer para autenticar todas las solicitudes.

ConfigToken(token: string): void (deprecated)

Se mantiene por compatibilidad con versiones anteriores. Se recomienda usar configToken.

getInfoByRuc(ruc: string): Promise<InfoByRuc>

Obtiene informacion general de un contribuyente por RUC (11 digitos).

const data = await api.getInfoByRuc("20123456789");
console.log(data.ruc, data.razonSocial, data.estado);

getEstablishmentsByRuc(ruc: string): Promise<EstablishmentsByRuc>

Lista establecimientos (principal y anexos) asociados a un RUC.

const data = await api.getEstablishmentsByRuc("20123456789");
console.log(data.totalEstablecimientos);

getRucByDni(dni: string): Promise<RucByDni>

Consulta si un DNI (8 digitos) tiene RUC asociado.

const data = await api.getRucByDni("12345678");

if (data.tieneRuc) {
  console.log(data.ruc, data.razonSocial);
} else {
  console.log(data.mensaje);
}

getInfoByDni(dni: string): Promise<InfoByDni>

Obtiene nombres y apellidos asociados a un DNI.

const data = await api.getInfoByDni("12345678");
console.log(data.nombreCompleto);

getTaxDomicileByRuc(ruc: string): Promise<TaxDomicileByRuc>

Consulta el domicilio fiscal de un contribuyente por RUC.

const data = await api.getTaxDomicileByRuc("20123456789");
console.log(data.domicilioFiscal.direccionCompleta);

client: AxiosInstance (getter)

Expone la instancia interna de Axios para casos avanzados (interceptores extra, configuracion custom, etc.).

Tipos TypeScript

El paquete incluye declaraciones de tipos para:

  • ApiIntiOptions
  • InfoByRuc
  • EstablishmentsByRuc
  • RucByDni
  • InfoByDni
  • TaxDomicileByRuc

Manejo de errores

Este package lanza errores cuando:

  • No se configura token (Token no configurado)
  • El formato de RUC o DNI es invalido
  • La API responde con error (por ejemplo: [401] No autorizado)

Todos los errores del SDK son instancias de ApiIntiError. Ademas de message, exponen:

  • status: codigo HTTP si existe
  • code: codigo de error de la API (si la API lo envia)
  • rateLimit: metadatos de limite (limit, remaining, reset) si vienen en headers

Tambien puedes usar isRetryableError(error) para decidir reintentos automáticos.

Ejemplo:

import { ApiInti, ApiIntiError, isRetryableError } from "api-inti";

try {
  const data = await api.getInfoByDni("12345678");
  console.log(data);
} catch (error) {
  if (error instanceof ApiIntiError) {
    console.error(error.message);
    console.error("status:", error.status);
    console.error("code:", error.code);
    console.error("rateLimit:", error.rateLimit);
  } else {
    console.error("Error inesperado", error);
  }

  if (isRetryableError(error)) {
    console.log("Error temporal: puedes reintentar la solicitud.");
  }
}

Scripts de desarrollo

npm run build   # build CJS + ESM + d.ts
npm run dev     # modo watch

Licencia

MIT