npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@merkl/api

v1.7.53

Published

--- description: Easily interact with the Merkl API using the dedicated NPM package ---

Readme


description: Easily interact with the Merkl API using the dedicated NPM package

📦 Merkl API V4 NPM Package

Merkl API V4 comes with a dedicated NPM package to help you interact with it.

This quickstart guide will help you get started with interacting with the Eden Treaty app object using the Merkl API package.

Installation 🚀

To begin, install the @merkl/api package into your project:

npm install @merkl/api

Usage Example 🛠️

Here's a step-by-step guide to instantiating the Merkl API object and making API calls.

Import the Merkl API Package 📦

import { MerklApi } from '@merkl/api'

Instantiate the Merkl API Object 🌐

Initialize the Merkl API object by providing the base URL. Developers can leverage autocomplete features in their IDEs since all methods are strongly typed, ensuring a seamless development experience:

const merkl = MerklApi('https://api.merkl.xyz').v4

Making API Calls 📡

Below are examples of common API calls you can make. When making API calls, you can pass query parameters as an object under the query property and path parameters directly in the method arguments, as shown in the examples below:

Get Opportunities 💼

Retrieve a list of opportunities filtered by a specific chainId:

const opportunities = await merkl.opportunities.index.get({
  query: { chainId: '1' },
})

console.log(opportunities.data)

Get Rewards for a Specific Address 🏆

Retrieve rewards for a specific user address. Note that all methods are strongly typed for better developer experience: this ensures reduced debugging time, as incorrect parameter usage is flagged early, and improved code completion in supported IDEs for faster development.

const rewards = await merkl
  .users({
    address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
  })
  .rewards.get({ query: { chainId: 1 } })

console.log(rewards.data)

Get Campaigns Rewarding USDC

Retrieve campaigns filtered by token symbol, such as USDC:

const campaignsUSDC = await merkl.campaigns.index.get({
  query: { tokenSymbol: 'USDC' },
})

console.log(campaignsUSDC.data)

Notes 📝

  • All API responses are wrapped within a data attribute. This consistency across all API calls ensures that developers can reliably access the actual response payload. Access this attribute to get the actual response payload.
  • The Merkl API object methods are strongly typed, making it easier to catch errors during development.

For additional documentation and advanced usage, refer to the Merkl API swagger.


You're now ready to interact with the Merkl API! 🎉