Last updated
Changelognpmjs.com API
HealthyRead-onlyStructured data from npmjs.com. Generated from www.npmjs.com.
/get_downloads1 credit per callGet Downloads
Daily download counts for a package (the downloads chart on the package page).
Authorization: Bearer <key> on every request.Parameters
package name, e.g. react or @types/node
last-day, last-week, last-month, last-year, or a range YYYY-MM-DD:YYYY-MM-DD
Response fields
packagestartendtotaldaily
downloadsdaypagination
counthas_morenext_cursorfetched_atagecurl "https://api.maviapi.com/v1/sites/npmjs/get_downloads?name=react&period=last-month" \-H "Authorization: Bearer $MAVI_KEY"
{
"package": "string",
"start": "string",
"end": "string",
"total": 0,
"daily": [
{
"downloads": 0,
"day": "string"
}
],
"pagination": {
"count": 0,
"has_more": false,
"next_cursor": null
},
"fetched_at": "string",
"age": 0
}Get all the data, no code
Collect every page of GET /get_downloads into a dataset, for one request or for a whole list of them, then download it as CSV or JSON. A page costs the same as one call of the endpoint; the download is free.
Use npmjs.com API from Claude, ChatGPT and your coding tools
Add this URL as a custom connector and sign in to maviapi. Nothing to install.
https://mcp.maviapi.com/mcpOr run it locally, with each endpoint of npmjs.com API as its own tool:
claude mcp add maviapi -e MAVIAPI_TOOLS=npmjs -- npx -y '@maviapi/mcp'Import npmjs.com API into Postman and other tools
How to importPaste a link into Postman, Insomnia, an agent framework or a no-code tool to get every endpoint with its parameters and response fields. The link always serves the current endpoints, so importing it again picks up new ones.
- OpenAPI 3.1
https://api.maviapi.com/v1/apis/npmjs/openapi.json - Postman
https://api.maviapi.com/v1/apis/npmjs/postman.json
The Postman collection sends the shared demo key until you put your own key in its maviapi_key variable.
Build with the npmjs.com API
Choose a starting endpoint
- Get Downloads
GET /get_downloadsDaily download counts for a package (the downloads chart on the package page).
Parameters and response fields for GET /get_downloads
Request parameters Name Type / location Required Description name string / query No package name, e.g. react or @types/node period string / query No last-day, last-week, last-month, last-year, or a range YYYY-MM-DD:YYYY-MM-DD Response fields Field Type Description package string start string end string total integer daily object[] daily[].downloads integer daily[].day string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - Search Packages
GET /search_packagesSearch npm packages, like the npmjs.com search page.
Parameters and response fields for GET /search_packages
Request parameters Name Type / location Required Description q string / query No search text; supports qualifiers like keywords:x, author:x, maintainer:x, scope:x page integer / query No 1-based results page size integer / query No results per page (1-250) Response fields Field Type Description total integer page integer size integer results object[] results[].name string results[].version string results[].description string results[].keywords string[] results[].license string results[].date string results[].publisher string results[].maintainers string[] results[].links object results[].links.homepage string results[].links.repository string results[].links.bugs string results[].links.npm string results[].downloads_weekly integer results[].downloads_monthly integer results[].dependents integer results[].score number results[].url string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor string fetched_at string age integer - Get Package
GET /get_packagePackage detail page: latest version metadata, readme, dist-tags, maintainers, version count and weekly downloads.
Parameters and response fields for GET /get_package
Request parameters Name Type / location Required Description name string / query No package name, e.g. react or @types/node Response fields Field Type Description name string description string dist_tags object dist_tags.beta string dist_tags.rc string dist_tags.next string dist_tags.latest string dist_tags.backport string dist_tags.experimental string dist_tags.canary string latest object latest.name string latest.version string latest.description string latest.license string latest.homepage string latest.repository object latest.repository.url string latest.repository.type string latest.repository.directory string latest.bugs object latest.bugs.url string latest.keywords string[] latest.author null latest.main string latest.types null latest.engines object latest.engines.node string latest.dependencies object latest.peer_dependencies object latest.optional_dependencies object latest.dev_dependencies object latest.deprecated null latest.publisher string latest.maintainers string[] latest.tarball string latest.integrity string latest.file_count integer latest.unpacked_size integer version_count integer created string modified string last_publish string maintainers string[] license string homepage string repository object repository.url string repository.type string repository.directory string readme null weekly_downloads integer url string fetched_at string age integer - List Versions
GET /list_versionsVersions tab of a package: all published versions, newest first, with publish date, deprecation and dist-tags.
Parameters and response fields for GET /list_versions
Request parameters Name Type / location Required Description name string / query No package name, e.g. react or @types/node page integer / query No 1-based page of versions size integer / query No versions per page (1-1000) Response fields Field Type Description name string dist_tags object dist_tags.beta string dist_tags.rc string dist_tags.next string dist_tags.latest string dist_tags.backport string dist_tags.experimental string dist_tags.canary string total integer page integer size integer versions object[] versions[].version string versions[].published string versions[].tags string[] versions[].deprecated null versions[].publisher string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor string fetched_at string age integer - Get Package Version
GET /get_package_versionMetadata of one specific version of a package (dependencies, dist info, publisher).
Parameters and response fields for GET /get_package_version
Request parameters Name Type / location Required Description name string / query No package name, e.g. react or @types/node version string / query No exact version (e.g. 18.2.0) or a dist-tag (e.g. latest, next) Response fields Field Type Description name string version string description string license string homepage string repository object repository.url string repository.type string repository.directory string bugs object bugs.url string keywords string[] author null main string types null engines object engines.node string dependencies object peer_dependencies object optional_dependencies object dev_dependencies object deprecated null publisher string maintainers string[] tarball string integrity string file_count integer unpacked_size integer fetched_at string age integer - Get Version Downloads
GET /get_version_downloadsDownloads of each version of a package over the last 7 days (Versions tab), sorted by downloads descending.
Parameters and response fields for GET /get_version_downloads
Request parameters Name Type / location Required Description name string / query No package name, e.g. react or @types/node Response fields Field Type Description package string versions object[] versions[].version string versions[].downloads integer pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - List Org Packages
GET /list_org_packagesPackages belonging to an organization / scope (the org page), alphabetical.
Parameters and response fields for GET /list_org_packages
Request parameters Name Type / location Required Description org string / query No organization name without @, e.g. babel page integer / query No 1-based page size integer / query No packages per page (1-1000) Response fields Field Type Description org string total integer page integer size integer packages object[] packages[].name string packages[].permission string packages[].url string url string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor string fetched_at string age integer - List User Packages
GET /list_user_packagesPackages a user can publish (the ~username profile page), alphabetical.
Parameters and response fields for GET /list_user_packages
Request parameters Name Type / location Required Description username string / query No npm username, e.g. sindresorhus page integer / query No 1-based page size integer / query No packages per page (1-1000) Response fields Field Type Description username string total integer page integer size integer packages object[] packages[].name string packages[].permission string packages[].url string url string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor string fetched_at string age integer
Export npmjs.com data to CSV
Each list below downloads as a CSV file with one row per record. Collect it into a dataset with "Get all the data, no code" under the console above. The dataset reads the list page by page, and you download it as CSV, JSON or JSONL.
| List | CSV columns |
|---|---|
Search PackagesGET /search_packages | name, version, description, keywords, license, date, publisher, maintainers, links, downloads_weekly, downloads_monthly, dependents, score, url |
List VersionsGET /list_versions | version, published, tags, deprecated, publisher |
A nested value (a list or an object) is written as JSON in one cell. How datasets and exports work
npmjs.com API questions
What you get, what it costs and how to call it.
Is there an official npmjs.com API?
This npmjs.com API is not official. It is an independent, hosted API from maviapi for the public data on npmjs.com, and it is not made, endorsed or supported by npmjs.com. Whether npmjs.com offers a developer API of its own is a question for npmjs.com. This one is ready to call with a maviapi key, and every endpoint and field it returns is documented on this page.
What data can I get from the npmjs.com API?
The npmjs.com API has 8 endpoints. Each returns JSON with the parameters and fields documented above:
- GET
/get_downloads: Daily download counts for a package (the downloads chart on the package page). - GET
/search_packages: Search npm packages, like the npmjs.com search page. - GET
/get_package: Package detail page: latest version metadata, readme, dist-tags, maintainers, version count and weekly downloads. - GET
/list_versions: Versions tab of a package: all published versions, newest first, with publish date, deprecation and dist-tags. - GET
/get_package_version: Metadata of one specific version of a package (dependencies, dist info, publisher). - GET
/get_version_downloads: Downloads of each version of a package over the last 7 days (Versions tab), sorted by downloads descending. - GET
/list_org_packages: Packages belonging to an organization / scope (the org page), alphabetical. - GET
/list_user_packages: Packages a user can publish (the ~username profile page), alphabetical.
How much does the npmjs.com API cost?
Calls are paid in credits from your maviapi plan, and only successful calls are charged. Every endpoint of this API costs 1 credit per call. On the Basic plan ($19 a month for 25,000 credits), 1,000 calls cost about $0.76. Failed calls are free. The Free plan gives you 1,000 credits a month, with no credit card required. See plans and credit prices for everything after that.
How do I call the npmjs.com API?
Send an HTTPS request to the endpoint with your API key in the Authorization header. For example, GET /get_downloads:
curl 'https://api.maviapi.com/v1/sites/npmjs/get_downloads' \
-H "Authorization: Bearer $MAVI_KEY"Create a key on your API keys page, or try any endpoint first in the console above with the free test key.
What are the ways to get npmjs.com data as JSON?
Each way to get npmjs.com data as JSON fits a different need:
- Your own scraper: Full control and no vendor, but the parsing, the blocked requests and the repairs after every change on npmjs.com are yours. Better for a one-off pull from a page that rarely changes.
- Apify: A marketplace of Actors you run, where input, output and price are set by each Actor. Better when an Actor already returns what you need, or you want to host your own code. See maviapi vs Apify.
- RapidAPI: A hub of APIs added by many providers, called with one RapidAPI key and priced per API. Better when you already use the hub and one of its APIs covers what you need. Source: RapidAPI docs.
- maviapi: The npmjs.com API on this page: 8 documented endpoints, a published response schema and one key for the whole catalog. Better when this data is part of your product and you do not want to maintain a scraper.
What happens when npmjs.com changes its layout?
Your code does not change. maviapi keeps the npmjs.com API working when npmjs.com changes its pages, so you keep calling the same endpoints and get JSON in the shape documented here. See its current health on the status page and what changed in its changelog.
Will an update break my npmjs.com API integration?
No. An endpoint you use never changes shape: new fields, optional parameters and endpoints are added beside it, and a change that would break a call ships as a new endpoint. Ignore response fields you do not know, and follow the changelog for what is new.
Related APIs
- Tripadvisor API
Trip-planning data from Tripadvisor: geo search plus attractions, restaurants and hotels by location (geo_id), with…
- Eventbrite API
Events listed on Eventbrite for a city and date range: dates, venue with address and coordinates, image and summary…
- Songkick Concerts API
Upcoming concerts and music festivals in any city from Songkick, for a date window, with venues, performers, prices…