npm Trends API

npm package weekly download counts as a normalized time series. Track any package's adoption trajectory, measure growth across periods, and spot emerging libraries before they dominate - via a single POST endpoint.

npm's own API at api.npmjs.org/downloads returns raw download counts. It's usable, but it requires you to pick specific date ranges, handle the pagination, normalize the numbers yourself if you want cross-package comparison, and rebuild that every time you want a different view.

Trends MCP wraps that into a consistent endpoint. Pass a package name, get back a normalized weekly series and growth figures.

Endpoint

POST https://api.trendsmcp.ai/api
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Get a time series

Weekly download trend for any npm package, normalized 0-100.

{
  "source": "npm",
  "keyword": "zod"
}

Response:

[
  {
    "date": "2026-03-21",
    "value": 78,
    "volume": null,
    "keyword": "zod",
    "source": "npm"
  }
]

Daily mode for the last 30 days:

{
  "source": "npm",
  "keyword": "zod",
  "data_mode": "daily"
}

Measure growth

One of the more direct uses: is this package still growing, or has adoption plateaued?

{
  "source": "npm",
  "keyword": "drizzle-orm",
  "percent_growth": ["3M", "6M", "1Y"]
}

Custom date comparison - useful for measuring pre/post major version releases:

{
  "source": "npm",
  "keyword": "drizzle-orm",
  "percent_growth": [
    { "name": "v1 release lift", "recent": "2026-01-01", "baseline": "2025-06-01" }
  ]
}

Preset periods: 7D 14D 30D 1M 2M 3M 6M 9M 12M 1Y 18M 24M 2Y 36M 3Y 48M 60M 5Y MTD QTD YTD

Code examples

Python

import requests

res = requests.post(
    "https://api.trendsmcp.ai/api",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"source": "npm", "keyword": "zod", "percent_growth": ["6M", "1Y"]}
)
data = res.json()

JavaScript

const res = await fetch("https://api.trendsmcp.ai/api", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ source: "npm", keyword: "zod", percent_growth: ["6M", "1Y"] })
});
const data = await res.json();

Common questions

npm's own downloads API at api.npmjs.org/downloads returns raw download counts for specific date ranges. Trends MCP normalizes those counts to 0-100, computes growth automatically, and returns data in a consistent shape across all 14 sources - useful when comparing npm adoption against Google Search or Reddit discussion in one call.
Use the exact npm package name. 'react', 'zod', 'shadcn', 'drizzle-orm'. Scoped packages work too: '@tanstack/react-query'.
Each API call queries one keyword at a time. To compare packages, make separate calls and compare the normalized values.