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

danskcvrapi-sdk

v1.0.0

Published

Official JavaScript/TypeScript SDK for DanskCvrApi — typed CvrClient for company lookup, search, financial statements, and statistics from CVR.

Readme

danskcvrapi-sdk

Official TypeScript/JavaScript SDK for DanskCvrApi — a thin, typed wrapper over the REST API for Danish company data from CVR.

No runtime dependencies. Works in Node 18+, Bun, browser (server-side), and edge runtimes.

Installation

npm install danskcvrapi-sdk
# or
bun add danskcvrapi-sdk

Quick start

import { CvrClient } from 'danskcvrapi-sdk';

const client = new CvrClient({ apiKey: process.env.CVR_API_KEY! });

// Look up a company
const company = await client.companies.get('24256790');
console.log(company.name, company.industry_text);
// → NOVO NORDISK A/S, Fremstilling af farmaceutiske præparater

// Search
const hits = await client.companies.search({ q: 'novo', limit: 5 });
for (const hit of hits.results) console.log(hit.cvr_number, hit.name);

// Autocomplete (flat array, English fields)
const suggestions = await client.companies.autocomplete({ q: 'novo' });
// [{ cvr, name, city, postal_code, industry, status, production_units }]

Create an API key at https://danskcvrapi.dk/dashboard/noegler (Hobby plan is free).

API reference

client.companies

client.companies.get(cvr)                             // GET /v1/companies/{cvr}
client.companies.search({ q, status?, limit? })       // GET /v1/companies/search
client.companies.autocomplete({ q, limit? })          // GET /v1/companies/autocomplete
client.companies.batch([...cvr])                      // POST /v1/companies/batch  (Pro+)
client.companies.byAddress({ street, zip_code, … })   // GET /v1/companies/by-address
client.companies.group(cvr)                           // GET /v1/companies/{cvr}/group
client.companies.roles(cvr)                           // GET /v1/companies/{cvr}/roles
client.companies.productionUnits(cvr)                 // GET /v1/companies/{cvr}/production-units
client.companies.history(cvr)                         // GET /v1/companies/{cvr}/history
client.companies.financialStatements(cvr, { scope? }) // GET /v1/companies/{cvr}/financial-statements  (Pro+)

client.productionUnits

client.productionUnits.get(pNumber)   // GET /v1/production-units/{pnummer}

client.persons

client.persons.search({ q, limit? })  // GET /v1/persons/search
client.persons.get(id)                // GET /v1/persons/{id}

client.replication

client.replication.events({ from_sequence_number, limit? })  // GET /v1/replication/companies/events  (Pro+)
client.replication.latestSequenceNumber()                     // GET /v1/replication/companies/latest-sequence-number

client.search

client.search.advanced({ industry, municipality, employees_min, … })  // GET /v1/search/advanced  (Pro+, 40+ filters)
client.search.netGrowth({ granularity, from, to, … })                  // GET /v1/search/net-growth  (Pro+)

client.stats

client.stats.totals()
client.stats.top({ type?, limit? })          // type: 'industries' | 'municipalities' | 'company-types'
client.stats.byMunicipality()                // GET /v1/stats/municipalities
client.stats.byPostalCode()                  // GET /v1/stats/postal-codes
client.stats.byIndustry({ level? })          // GET /v1/stats/industries  (level: 'group' | 'industry')
client.stats.byCompanyType()                 // GET /v1/stats/company-types
client.stats.foundationsPerYear()            // GET /v1/stats/foundations-per-year

client.creditScore

client.creditScore.get(cvr)   // GET /v1/credit-score/{cvr}  (Pro+)

client.reference

client.reference.industries({ q? })  // GET /v1/industries
client.reference.municipalities()    // GET /v1/municipalities
client.reference.regions()           // GET /v1/regions

Offline helper

import { validateCvr } from 'danskcvrapi-sdk';
validateCvr('24256790'); // true (modulus-11 check, no API call)

Error handling

All calls throw CvrError with type, status, and requestId:

import { CvrError } from 'danskcvrapi-sdk';
try {
  await client.companies.financialStatements('24256790');
} catch (err) {
  if (err instanceof CvrError && err.type === 'plan_upgrade_required') {
    // financial statements require Pro plan
  }
  if (err instanceof CvrError && err.type === 'not_found') {
    // company does not exist
  }
}

Error types

| type | HTTP status | Meaning | |---|---|---| | unauthorized | 401 | Missing or invalid API key | | forbidden | 403 | Key blocked or workspace suspended | | not_found | 404 | Resource does not exist | | invalid_request | 400/422 | Bad parameters | | rate_limited | 429 | Too many requests | | plan_upgrade_required | 403 | Endpoint requires a higher plan | | server_error | 5xx | Server-side error (retried automatically) | | network | 0 | Network / DNS failure |

Configuration

new CvrClient({
  apiKey: '…',          // required
  baseUrl: '…',         // optional URL override (default: https://api.danskcvrapi.dk)
  retries: 1,           // retries on 5xx/429 (default: 1)
  userAgentSuffix: '…', // optional string appended to User-Agent
});

Links

License

MIT