Back to changelog

NPM module updates - v4.2.*

Cosmic's avatar


August 24, 2022

cover image

We are excited to roll out new updates to the Cosmic NPM module (v4.2.*). This update adds new chain-style methods (Note: there are no breaking changes). Review the updates below.

Getting Started

Get started by installing the latest module version npm install cosmicjs@latest then import the package into your app.

Then set your Bucket slug and read key. These can be found in Your Bucket > Settings > API Access after logging in to your Cosmic dashboard.

Now use the new chain methods to find, add, edit, and delete Objects and Media in your Bucket.


  • Updated the NPM module to v4.2.*
  • Chain methods are now available
  • Breaking changes: none

What's new

  1. Added chain methods for Objects:
  • bucket.objects.find
  • bucket.objects.findOne
  • bucket.objects.insertOne
  • bucket.objects.updateOne
  • bucket.objects.deleteOne
  1. Added chain methods for Media:

Old methods

For the old npm-v4.1.19 methods, see the docs version for npm-v4.1.19. These methods include:

  1. Objects
  • bucket.getObjects
  • bucket.getObject
  • bucket.addObject
  • bucket.editObject
  • bucket.deleteObject
  1. Media
  • bucket.getMedia
  • bucket.getSingleMedia
  • bucket.addMedia
  • bucket.deleteMedia

We hope you enjoy these new methods for using the Cosmic NPM module. Review all of the methods now available in the Cosmic docs. To stay up with the latest updates to Cosmic, follow us on Twitter, subscribe on YouTube, join us on Slack.