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 🙏

© 2026 – Pkg Stats / Ryan Hefner

zoho-api

v1.1.2

Published

Simple access to Zoho REST APIs

Readme

Zoho API

Simple access to Zoho REST APIs

Install

npm i zoho-api

Setup

Generate initial Grant Token (one time only)

The library requires a tokens file in JSON format where it stores the access and refresh tokens. To set this up, a grant token is required, which should be generated in the Zoho Developer console: https://api-console.zoho.com/

Click on '+ Add new client' -> Self-client

After that, click on the newly created client and go to the "Generate Code" tab. On the scopes input you can use any Zoho scopes that you need, for example:

ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.coql.READ

Choose the time duration (10 mins if you need time to run the setup script)

You can leave Scope Description empty.

Click on 'Create' and a token will be displayed, copy that token.

Execute a setup script

In the examples library there's a setup script to copy, but I'll mark all the steps here:

  1. Create a file called 'setup.js' in the root of your project.

  2. Paste the following code:

const Zoho = require('zoho-api');

const api = new Zoho.Api({
    clientId: '1000.XXXXXXXXXXXXXXXXXXXXXXXXX',
    clientSecret: '1111xx...........',
    tokenFile: __dirname + '/path/to/tokens.json', // Absolute path from current directory
    setup: true
});

api.setup('1000.YYYYYYYYYYYYYYYYYYYYYY')
    .then((response) => {
        console.log('Tokens file generated!');
    })
    .catch((err) => {
        console.log('Something failed!');
        console.log(err);
    });

Replace with your clientId and clientSecret. For the 'tokenFile' config, just specify the file where you want to store your OAuth tokens, if the file doesn't exist, it will be created.

Use the grant token generated earlier to set it as the parameter for 'api.setup'.

  1. Run the script:
node setup.js
  1. If everything went well, the tokens file should have been created in the specified location, and a success message will be shown.

  2. Delete the setup file.

Usage

In the examples directory check the 'usage.js' file for reference. Copying here an usage example:

const Zoho = require('zoho-api');

const api = new Zoho.Api({
    clientId: '1000.XXXXXXXXXXXXXXXXXXXXXXXXX',
    clientSecret: '011zzz.....................',
    tokenFile: __dirname + '/files/tokens.json' // Absolute path from current directory
});

api.api('GET', '/settings/modules')
    .then((response) => {
        console.log('Got data!');
        console.log(response.data);
    });

The api is just a wrapper around the REST API, it only simplifies the token generation and re-utilization process. All the REST methods can be checked in the official docs: https://www.zoho.com/crm/developer/docs/api/v2/modules-api.html

Format:

api.api('METHOD', '/path/to/endpoint')

Examples:

api.api('GET', '/Leads');
api.api('GET', '/Accounts');

COQL (Query API)

The query API allows clients to query Zoho modules as if they were SQL tables, check official docs about it: https://www.zoho.com/crm/developer/docs/api/v2/COQL-Overview.html

Example:

let query = "select Last_Name, Account_Name.Parent_Account, Account_Name.Parent_Account.Account_Name, First_Name, Full_Name, Created_Time from Contacts where Last_Name is not null limit 200";
api.coql(query)
    .then((response) => {
        console.log('Got COQL results!');
        console.log(response.data);
    });