This guide explains how to delete an existing project using the BlendDuck SDK.

Usage

To delete a project, you’ll use the projects.delete() method of the BlendDuck client.

import BlendDuck from "@blendduck/node-sdk";
// Initialize the BlendDuck client
const client = new BlendDuck({
  apiKey: process.env.BLENDDUCK_API_KEY
});

async function deleteProject(projectId: string) {
  // Delete the project
  await client.projects.delete(projectId);
  console.log(`Project deleted successfully! ID: ${projectId}`);
}

// Usage
deleteProject("your-project-id-here");

Error Handling

If there’s an issue with deleting the project or with the API request, the method will throw an error. It’s good practice to wrap the call in a try-catch block to handle any potential errors gracefully. Common errors might include:

  • Project not found
  • Insufficient permissions
  • Network errors