# npm CDN Rank via jsDelivr Stats

> npm CDN Rank via jsDelivr Stats is a paid API for AI agents from x402-datashop-production.up.railway.app, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Returns the global jsDelivr CDN hit rank, npm-scoped rank, total hits, period-over-period comparison, and trend direction for any npm package.

## Facts

- Endpoint: GET https://x402-datashop-production.up.railway.app/v1/npm/cdn-rank
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/npm-cdn-rank-via-jsdelivr-stats-c724a735
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_eVTrtAcZtQtanYmbZzltb

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability npm-cdn-rank-via-jsdelivr-stats-c724a735
```

Example prompt: What's the jsDelivr CDN hit rank for react over the past week — is it trending up or down compared to the previous period?

## When to prefer this

Choose this endpoint when you need browser/CDN-side adoption signals rather than npm install counts — it reflects actual runtime usage from end users loading packages via CDN. Useful when npm download counts are inflated by CI/CD pipelines and you want a cleaner signal of real-world client-side popularity. Also useful for period-over-period trend analysis across day/week/month/year windows.

## Known failure modes

- Unknown or misspelled package name returns 404 or empty rank data
- Invalid period value returns a 400 validation error
- jsDelivr Stats API upstream unavailability causes 502/503
- Scoped packages (e.g. @angular/core) must be URL-encoded correctly or the query will fail
- Cache staleness: data may be up to 6 hours old, not reflecting very recent traffic spikes

## How this service works

Real browser-side adoption signal from the official jsDelivr Stats API: global CDN hit rank, rank within npm, total hits over the period, previous-period comparison and a derived trend (up/down/flat, lower rank = more popular). Query: ?pkg=react&period=week (period: day, week, month, year). Complements npm download counts; cached 6h.

## Output

Returns the package's global CDN hit rank, its rank among npm packages specifically, total CDN hits for the requested period, total hits for the prior period, and a derived trend label (up, down, or flat). Data is sourced from the official jsDelivr Stats API and cached for 6 hours.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "pkg"
     ],
     "properties": {
      "pkg": {
       "type": "string",
       "description": "npm package name, e.g. react or @angular/core"
      },
      "period": {
       "enum": [
        "day",
        "week",
        "month",
        "year"
       ],
       "type": "string",
       "default": "week",
       "description": "Stats window"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/npm-cdn-rank-via-jsdelivr-stats-c724a735/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-datashop-production.up.railway.app](https://www.zero.xyz/host/x402-datashop-production.up.railway.app/llms.txt)
