# 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.

npm package, one of the npm scrapers.

| | |
| --- | --- |
| 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](https://docs.enrichednow.com/running-a-scraper.md); what a run costs is in [Usage and units](https://docs.enrichednow.com/usage-and-units.md).

## Inputs

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `package` | string | yes | The 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_versions` | integer | no | Return this many of the package's versions, newest first; 0 returns none. Limit: 0 to 1000. Default: `20`. |
| `include_readme` | boolean | no | true 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](https://docs.enrichednow.com/results-and-statuses.md#npm).
- `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`.

| Field | Type | Notes |
| --- | --- | --- |
| `name` | string | The package's name, with its scope when it has one, e.g. "@types/node". |
| `url` | string | The package's page on npmjs.com. |
| `description` | string or null | The package's one-line description. |
| `latest_version` | string or null | The version the latest tag points to: what a plain install gets. |
| `dist_tags` | object of string values | The package's distribution tags and the version each points to, e.g. {"latest": "19.2.0", "next": "19.3.0-canary"}. |
| `license` | string or null | The licence the latest version declares, e.g. "MIT". |
| `keywords` | array of string | The keywords the latest version declares. |
| `homepage` | string or null | The website the package names. |
| `repository` | string or null | The source repository's address, as a web address where the package wrote a git one. |
| `bugs_url` | string or null | Where the package asks for bug reports. |
| `author` | string or null | The author's name as the package states it. |
| `maintainers` | array of string | The npm usernames of the accounts that can publish the package. |
| `created_at` | string (date-time) or null | When the package was first published, in UTC. |
| `modified_at` | string (date-time) or null | When the package's entry in the registry last changed, in UTC. |
| `latest_published_at` | string (date-time) or null | When the latest version was published, in UTC. |
| `version_count` | integer or null | How many versions the package has published; null when the version list could not be read. |
| `versions` | array of object | The newest versions first, as many as max_versions asked for. Empty when the version list could not be read. |
| `versions[].version` | string | The version number, e.g. "19.2.0". |
| `versions[].published_at` | string (date-time) or null | When the version was published, in UTC. |
| `versions[].deprecated` | string or null | The maintainers' notice when the version is deprecated; null when it is not. |
| `dependencies` | object of string values | The latest version's runtime dependencies and the version range of each. |
| `peer_dependencies` | object of string values | The latest version's peer dependencies and the version range of each. |
| `engines` | object of string values | The runtimes the latest version says it needs, e.g. {"node": ">=18"}. |
| `unpacked_size_bytes` | integer or null | The size of the latest version once unpacked, in bytes. |
| `file_count` | integer or null | How many files the latest version holds. |
| `tarball_url` | string or null | The address the latest version's archive downloads from. |
| `deprecated` | string or null | The maintainers' notice when the latest version is deprecated; null when it is not. |
| `readme` | string or null | The package's README as written, when include_readme asked for it and the registry holds one. |
| `downloads_last_day` | integer or null | Downloads on the last day npm has counted (downloads_until). |
| `downloads_last_week` | integer or null | Downloads in the seven days up to downloads_until. |
| `downloads_last_month` | integer or null | Downloads in the thirty days up to downloads_until. |
| `downloads_until` | string or null | The last day the download counts include, as YYYY-MM-DD: usually the day before yesterday. |
| `fetched_at` | string (date-time) | When the package was read, in UTC. |

## Example request

It starts a run with this scraper's example input and waits up to 60 seconds for it. The key is read from `ENRICHEDNOW_API_KEY`.

```bash
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}}'
```

## 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](https://docs.enrichednow.com/results-and-statuses.md#reason-codes) lists every status and the reasons every scraper shares; [the reasons of the npm scrapers](https://docs.enrichednow.com/results-and-statuses.md#npm) are in their own section there.
