JavaScript Bundle Size API

Bundle size of npm packages and versions as bundlephobia.com measures them: minified and gzipped bytes, dependency count, what makes up the bundle, ES module, tree-shaking and side-effect flags, peer dependencies and the repository link. One record per package you list.

$0.50 per 1,000 records

You pay only for the records you get. Zero records cost zero. 10,000 free records of this API to start (5,000 at the base price of $1 per 1,000), no card.

Try it
Ready-made, maintained by usRecords, 22 fieldsv1.0

Data from bundlephobia.com

Get this data

Try it here with a few records, download the sample, fill a Google Sheet, or call it from your own code.

Try it

Packages
npm packages, each optionally with a version, range or tag after @: react@18.2.0, lodash, @reduxjs/toolkit@^2, react@next. npmjs.com and bundlephobia.com package links work too. One per line, or separated by commas.
Example: react@18.2.0, lodash

Run it on this page, or call it from your code with the endpoint in the developer section. A free key covers 10,000 records of this API, no card. Create a free key

For developers: the API and MCPThe endpoint, code in curl, JavaScript and Python, every input, and files for your tools
Endpoint
POSThttps://pullrow.dev/v1/apis/js-bundle-size/run
  • Small runs answer in the same request; longer ones answer 202 with a run to poll.
  • fields returns only the fields you name. The examples send the ones picked on this page.
  • Idempotency-Key is optional. A retry with it is never charged twice.
  • You pay for records returned. Zero records cost zero.

Every run option, explained

Calling it needs a key
10,000 free records of this API to start. No card.
curl
curl -X POST "https://pullrow.dev/v1/apis/js-bundle-size/run" \
  -H "Authorization: Bearer $PULLROW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"packages":["react@18.2.0","lodash"]},"max_items":50}'

Inputs

Send them as input in the request body. Leave one out to use its default.

packageslistrequired
npm packages, each optionally with a version, range or tag after @: react@18.2.0, lodash, @reduxjs/toolkit@^2, react@next. npmjs.com and bundlephobia.com package links work too.
example: react@18.2.0, lodash

What's in each record

22 fields: 21 here, 1 technical one under Technical details.

Basics

  • Requested package

    The package as you listed it, such as react@18.2.0 or lodash.

    Example r•••@18.2.0

  • Name

    Package name on npm, such as react or @reduxjs/toolkit.

    Example react

  • Version

    The version measured: the one you asked for, or the newest one matching your range or tag (latest when none is given).

    Example 18.2.0

  • Status

    ok when sizes were measured; not_found, unsupported or failed otherwise (see error).

    Example ok

  • Size bytes

    Minified bundle size in bytes, dependencies included.

    Example 6,618

  • Gzip bytes

    Minified and gzipped bundle size in bytes: roughly what a browser downloads.

    Example 2,608

  • Dependency count

    Number of dependencies bundled with the package.

    Example 1

  • Composition

    Approximate minified bytes each part adds to the bundle, by name: the package itself and its dependencies.

    Example Redux: 18078 · Immer: 31282 · Reselect: 14612

  • Peer dependencies

    Peer dependencies the package expects the app to install, such as react.

    Example react, react-redux

  • Has js module

    Yes when the package ships an ES module build (a module entry).

    Example No

  • Module entry

    Path of that ES module entry inside the package, when bundlephobia gives it.

    Example dist/redux-toolkit.legacy-esm.js

  • Module type

    Yes when the package declares itself an ES module package (type module).

    Example No

  • Tree shakeable

    Yes when bundlers can drop unused exports: an ES module entry, a jsnext:main entry or type module.

    Example No

  • Has side effects

    False when the package declares itself free of side effects; true when it does not, or lists files that have them.

    Example Yes

  • Side effect files

    Files the package lists as having side effects, when it lists them.

    Example *.css

  • Asset types

    Kinds of files in the bundle, such as js and css.

    Example js

  • Scoped

    True for a scoped package such as @types/node.

    Example No

  • Description

    The package's own description.

    Example React is a JavaScript library for building user interfaces.

Technical detailsField names and types for developers, and the 1 field hidden above

Hidden by default

This field comes with each record too. It is an internal code, a note about how the record was read or a copy of what was searched for, so the lists above leave it out.

  • Error errorWhy there are no sizes, for records whose status is not ok.

Field names and types

The names your code reads in each record. "Filled" counts how many of the 3 sample records carry the field.

Field nameTypeShown on this page asFilled
requested_packagetextRequested package3 of 3
nametextName3 of 3
versiontextVersion3 of 3
statustextStatus3 of 3
urllinkLink3 of 3
npm_urllinkNpm link3 of 3
size_bytesnumberSize bytes3 of 3
gzip_bytesnumberGzip bytes3 of 3
dependency_countnumberDependency count3 of 3
compositiongroup of valuesComposition2 of 3
peer_dependencieslistPeer dependencies2 of 3
has_js_moduleyes or noHas js module3 of 3
module_entrytextModule entry2 of 3
is_module_typeyes or noModule type3 of 3
is_tree_shakeableyes or noTree shakeable3 of 3
has_side_effectsyes or noHas side effects3 of 3
side_effect_fileslistSide effect files1 of 3
asset_typeslistAsset types3 of 3
is_scopedyes or noScoped3 of 3
repository_urllinkRepository link3 of 3
descriptiontextDescription3 of 3
errortextError (hidden)0 of 3

How it reads the site

Runs on a reader we built and maintain by hand for this site.

Sample records

Sample records
RecordNameRequested packageVersionStatusSize bytesGzip bytesDependency countCompositionPeer dependenciesHas js moduleModule entryModule typeTree shakeableHas side effectsSide effect filesAsset typesScopedDescriptionLinkNpm linkRepository link
1reactr•••@18.2.018.2.0ok6,6182,6081——No—NoNoYes—jsNoReact is a JavaScript library for building user interfaces.bundlephobia.com/package/r%E2%80%A2%E2%80%A2%E2%80%A2@18.2.0npmjs.com/package/react/v/18.2.0github.com/facebook/react
2@reduxjs/toolkit@reduxjs/t•••@2.2.12.2.1ok37,95113,5894Redux: 18078 · Immer: 31282 · Reselect: 14612react, react-reduxYesdist/redux-toolkit.legacy-esm.jsNoYesNo—jsYesThe official, opinionated, batteries-included toolset for efficient Redux developmentbundlephobia.com/package/@reduxjs/t%E2%80%A2%E2%80%A2%E2%80%A2@2.2.1npmjs.com/package/@reduxjs/toolkit/v/2.2.1github.com/reduxjs/redux-toolkit
3antda•••@5.15.05.15.0ok1,401,353432,27648Rc resize observer: 7792 · Rc util: 47156 · Babel runtime: 23956react, react-domYeses/index.jsNoYesYes*.cssjsNoAn enterprise-class UI design language and React components implementationbundlephobia.com/package/a%E2%80%A2%E2%80%A2%E2%80%A2@5.15.0npmjs.com/package/antd/v/5.15.0github.com/ant-design/ant-design

Sample records from the example output this API publishes. Email addresses and phone numbers in them are masked. Hover over a column name to see the field name your code reads.

Reliability

Counted from real runs. Our own health checks are left out. A run succeeded when it finished and the site neither blocked it nor broke it.

Incidents and repairs

How it is kept working What a repair can't do

A ready-made API, maintained by us. It is not part of the daily check or the automatic rebuild yet.

  • You pay only for records returned. A run that returns none costs nothing.
Known limits
  • Sizes are bundlephobia's own build of each package (minified, then gzipped, with its default settings), not your bundler's output; treat them as a fair comparison between packages and versions.
  • bundlephobia.com is a free community service with no published request limit. Packages are read one at a time, about one a second; a version it has never measured is built on first request, which can take up to a minute.
  • Up to 200 packages per run. Long lists of packages bundlephobia has never measured may not all finish within one run's time limit; ask again for the rest.
  • Packages bundlephobia cannot build (native modules, packages for one operating system such as fsevents) come back with status unsupported; unknown names or versions come back as not_found; a build that fails or takes too long comes back as failed.
  • composition and peer_dependencies are empty for some older measurements, where bundlephobia did not record them.
  • No licence is stated for the numbers; credit bundlephobia.com when you publish them.

Version history

A run uses the live version unless the request names another one with version.