Bulk Deletion of Zoho Projects Using Node.js and Zoho Projects API

Bulk Deletion of Zoho Projects Using Node.js and Zoho Projects API

Zoho Projects currently does not provide a built-in option to delete multiple projects in bulk from the UI. When working with testing environments or large numbers of temporary projects, deleting them one by one becomes time-consuming.

To address this, I created a small automation using Node.js and the Zoho Projects API to programmatically delete projects.

Below are the steps I followed.

Prerequisites
• Node.js installed
• Access to Zoho Projects portal
• Zoho API Self Client for OAuth authentication

Step 1 – Install Node.js

Download and install Node.js from:
https://nodejs.org

Verify installation:

node -v
npm -v

Step 2 – Create a working directory

cd Desktop
mkdir zoho-delete-projects
cd zoho-delete-projects

Step 3 – Initialize the Node project

npm init -y

Step 4 – Install Axios (HTTP client)

npm install axios

Step 5 – Create the script file

notepad deleteProjects.js

Step 6 – Add the following script

const axios = require("axios");

const TOKEN = "YOUR_ACCESS_TOKEN";
const PORTAL_ID = "YOUR_PORTAL_ID";

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function deleteProjects() {
try {

const res = await axios.get(
`https://projectsapi.zoho.in/restapi/portal/${PORTAL_ID}/projects/`,
{
headers: {
Authorization: `Zoho-oauthtoken ${TOKEN}`
}
}
);

const projects = res.data.projects;

console.log("Projects found:", projects.length);

for (const p of projects) {

const projectId = p.id_string;

await axios.delete(
`https://projectsapi.zoho.in/restapi/portal/${PORTAL_ID}/projects/${projectId}/`,
{
headers: {
Authorization: `Zoho-oauthtoken ${TOKEN}`
}
}
);

console.log("Deleted:", p.name);

// Delay added to avoid Zoho API rate limits
await sleep(2000);
}

} catch (err) {
console.log(err.response?.data || err.message);
}
}

deleteProjects();

Step 7 – Create a Self Client in Zoho API Console

https://api-console.zoho.com

Scopes used:

ZohoProjects.projects.READ
ZohoProjects.projects.DELETE

Step 8 – Generate a Grant Token

Step 9 – Convert the Grant Token to an Access Token

curl -X POST "https://accounts.zoho.in/oauth/v2/token" ^
-d "grant_type=authorization_code" ^
-d "client_id=CLIENT_ID" ^
-d "client_secret=CLIENT_SECRET" ^
-d "redirect_uri=https://www.zoho.com" ^
-d "code=GRANT_TOKEN"

Step 10 – Copy the access_token from the response.

Step 11 – Find your Portal ID

Example:

https://projects.zoho.in/portal/yourportalname

Portal ID = yourportalname

Step 12 – Update the script

const TOKEN = "ACCESS_TOKEN";
const PORTAL_ID = "yourportalname";

Step 13 – Run the script

node deleteProjects.js

The script will fetch the list of projects and delete them sequentially while respecting Zoho API rate limits.