Skip to the content
EnrichedNowDocs

    Type to search every page.

    Menu

    Scraper APInpm

    npm.package

    A package of the npm registry: description, latest version, licence, keywords, repository, maintainers, dependencies, its versions with their dates, and its download counts.

    Id
    npm.package
    Version
    1
    Billed per
    request — 1 unit for a charged run
    Runs
    within one request

    Start it with POST /v1/scrapers/npm.package/runs. How runs work is in Running a scraper; what a run costs is in Usage and units.

    Inputs

    The fields of input. A field that is not listed here is refused.

    Inputs of npm.package
    FieldTypeDescription
    packagerequiredstringThe package's name, e.g. react or @types/node, or its address on npmjs.com.Limit: at least 1 characters, at most 400 characters.
    max_versionsintegerReturn this many of the package's versions, newest first; 0 returns none.Limit: 0 to 1000. Default: 20.
    include_readmebooleantrue also returns the package's README as written.Default: false.
    • package is the name as npm writes it, with its scope where it has one (@types/node), or the package's address on npmjs.com.
    • latest_version is the version the latest tag points to; dist_tags lists every tag. The licence, keywords, links, dependencies and size are the latest version's own.
    • versions is the newest versions first with the date each was published, max_versions of them; version_count is how many there are in all. A deprecated version carries the maintainers' notice in deprecated.
    • downloads_last_day, downloads_last_week and downloads_last_month are npm's counts up to downloads_until, usually the day before yesterday.
    • A few packages have published so many versions that their full entry cannot be read. The run then ends partial with versions_not_read: the record holds the latest version's details and the download counts, and no version list — see the reasons of this family.
    • maintainers are npm usernames. Email addresses are not returned.

    Record fields

    Every record of a run has these fields. A value that is not known is null — never an empty string and never 0.

    Record fields of npm.package
    FieldTypeNotes
    namestringThe package's name, with its scope when it has one, e.g. "@types/node".
    urlstringThe package's page on npmjs.com.
    descriptionstring or nullThe package's one-line description.
    latest_versionstring or nullThe version the latest tag points to: what a plain install gets.
    dist_tagsobject of string valuesThe package's distribution tags and the version each points to, e.g. {"latest": "19.2.0", "next": "19.3.0-canary"}.
    licensestring or nullThe licence the latest version declares, e.g. "MIT".
    keywordsarray of stringThe keywords the latest version declares.
    homepagestring or nullThe website the package names.
    repositorystring or nullThe source repository's address, as a web address where the package wrote a git one.
    bugs_urlstring or nullWhere the package asks for bug reports.
    authorstring or nullThe author's name as the package states it.
    maintainersarray of stringThe npm usernames of the accounts that can publish the package.
    created_atstring (date-time) or nullWhen the package was first published, in UTC.
    modified_atstring (date-time) or nullWhen the package's entry in the registry last changed, in UTC.
    latest_published_atstring (date-time) or nullWhen the latest version was published, in UTC.
    version_countinteger or nullHow many versions the package has published; null when the version list could not be read.
    versionsarray of objectThe newest versions first, as many as max_versions asked for. Empty when the version list could not be read.
    version (in versions[])stringThe version number, e.g. "19.2.0".
    published_at (in versions[])string (date-time) or nullWhen the version was published, in UTC.
    deprecated (in versions[])string or nullThe maintainers' notice when the version is deprecated; null when it is not.
    dependenciesobject of string valuesThe latest version's runtime dependencies and the version range of each.
    peer_dependenciesobject of string valuesThe latest version's peer dependencies and the version range of each.
    enginesobject of string valuesThe runtimes the latest version says it needs, e.g. {"node": ">=18"}.
    unpacked_size_bytesinteger or nullThe size of the latest version once unpacked, in bytes.
    file_countinteger or nullHow many files the latest version holds.
    tarball_urlstring or nullThe address the latest version's archive downloads from.
    deprecatedstring or nullThe maintainers' notice when the latest version is deprecated; null when it is not.
    readmestring or nullThe package's README as written, when include_readme asked for it and the registry holds one.
    downloads_last_dayinteger or nullDownloads on the last day npm has counted (downloads_until).
    downloads_last_weekinteger or nullDownloads in the seven days up to downloads_until.
    downloads_last_monthinteger or nullDownloads in the thirty days up to downloads_until.
    downloads_untilstring or nullThe last day the download counts include, as YYYY-MM-DD: usually the day before yesterday.
    fetched_atstring (date-time)When the package was read, in UTC.

    Example request

    # Start a run and wait up to 60 seconds for it to finish
    curl -X POST "https://api.enrichednow.com/v1/scrapers/npm.package/runs?wait=60" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"input":{"package":"is-odd","max_versions":3}}'
    
    # Read its records, with the id the first call answered
    curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY"
    from enrichednow import EnrichedNow
    
    client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY
    
    # Start a run, wait for it to end, and get its records
    result = client.scrape("npm.package", {
        "package": "is-odd",
        "max_versions": 3,
    })
    print(result.run.id, result.run.status, result.run.record_count)
    
    # Read its records: pages are fetched as you go
    for record in result.records:
        print(record)

    Install it with pip install enrichednow, then save as run.py and run python3 run.py

    import EnrichedNow from "enrichednow";
    
    const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
    
    // Start a run, wait for it to end, and get its records
    const { run, records } = await client.scrape("npm.package", {
      package: "is-odd",
      max_versions: 3,
    });
    console.log(run.id, run.status, run.record_count);
    
    // Read its records: pages are fetched as you go
    for await (const record of records) console.log(record);

    Install it with npm install enrichednow, then save as run.mjs and run node run.mjs

    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"time"
    
    	enrichednow "github.com/enrichednow/enrichednow-go"
    )
    
    func main() {
    	client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
    	defer cancel()
    
    	// Start a run, wait for it to end, and get its records
    	run, records, err := client.Scrape(ctx, "npm.package", map[string]any{"package": "is-odd", "max_versions": 3})
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(run.ID, run.Status, run.RecordCount)
    
    	// Read its records: pages are fetched as you go
    	for records.Next() {
    		fmt.Println(string(records.Current()))
    	}
    	if err := records.Err(); err != nil {
    		log.Fatal(err)
    	}
    }

    Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go

    import com.enrichednow.EnrichedNowClient;
    import com.enrichednow.ScrapeResult;
    import java.util.Map;
    
    public class Run {
        public static void main(String[] args) {
            EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
    
            // Start a run, wait for it to end, and get its records
            ScrapeResult result = client.scrape("npm.package", Map.of("package", "is-odd", "max_versions", 3));
            System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
    
            // Read its records: pages are fetched as you go
            for (Map<String, Object> record : result.records()) {
                System.out.println(record);
            }
        }
    }

    Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java

    enrichednow run npm.package --input package=is-odd --input max_versions=3

    Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh

    It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.

    The body on its own:

    JSON
    {
      "input": {
        "package": "is-odd",
        "max_versions": 3
      }
    }

    Example response

    The run, once it has ended. A run that has not ended within wait comes back with 202 and the status queued or running.

    JSON
    {
      "id": "run_841742f37553189ff9c27ba1",
      "scraper_id": "npm.package",
      "scraper_version": 1,
      "status": "ok",
      "reason": null,
      "input": {
        "package": "is-odd",
        "max_versions": 3
      },
      "record_count": 1,
      "units": 1,
      "units_per_request": 1,
      "units_per_record": null,
      "units_per_page": null,
      "diagnostics": {
        "requests": 1,
        "bytes": 259214,
        "wall_ms": 885,
        "facts": {}
      },
      "created_at": "2026-11-16T22:37:50.170950Z",
      "started_at": "2026-11-16T22:37:50.178331Z",
      "finished_at": "2026-11-16T22:37:51.066313Z"
    }

    Its records, from GET /v1/runs/{id}/records. The record is a real one: this scraper's own parser read it from a page recorded from the site.

    JSON
    {
      "records": [
        {
          "name": "is-odd",
          "url": "https://www.npmjs.com/package/is-odd",
          "description": "Returns true if the given number is odd, and is an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.",
          "latest_version": "3.0.1",
          "dist_tags": {
            "latest": "3.0.1"
          },
          "license": "MIT",
          "keywords": [
            "array",
            "count",
            "even"
          ],
          "homepage": "https://github.com/jonschlinkert/is-odd",
          "repository": "https://github.com/jonschlinkert/is-odd",
          "bugs_url": "https://github.com/jonschlinkert/is-odd/issues",
          "author": "Jon Schlinkert",
          "maintainers": [
            "doowb",
            "jonschlinkert"
          ],
          "created_at": "2015-02-24T05:53:13.392000Z",
          "modified_at": "2026-04-14T14:26:11.557000Z",
          "latest_published_at": "2018-05-31T20:04:53.306000Z",
          "version_count": 7,
          "versions": [
            {
              "version": "3.0.1",
              "published_at": "2018-05-31T20:04:53.306000Z",
              "deprecated": null
            },
            {
              "version": "3.0.0",
              "published_at": "2018-05-30T18:00:55.554000Z",
              "deprecated": null
            }
          ],
          "dependencies": {
            "is-number": "^6.0.0"
          },
          "peer_dependencies": {},
          "engines": {
            "node": ">=4"
          },
          "unpacked_size_bytes": 6510,
          "file_count": 4,
          "tarball_url": "https://registry.npmjs.org/is-odd/-/is-odd-3.0.1.tgz",
          "deprecated": null,
          "readme": null,
          "downloads_last_day": 166526,
          "downloads_last_week": 1076767,
          "downloads_last_month": 4000915,
          "downloads_until": "2026-11-17",
          "fetched_at": "2026-11-19T18:07:41.017882Z"
        }
      ],
      "next_cursor": null
    }

    What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with … [truncated].

    • Shortened: keywords: 10 items, the first 3 shown.
    • Shortened: versions: 3 items, the first 2 shown.

    A run does not always end ok. Results and statuses lists every status and the reasons every scraper shares; the reasons of the npm scrapers are in their own section there.