Benchmark

Claude Code is 4.2x faster & 3.2x cheaper with CustomGPT.ai plugin. See the report →

CustomGPT.ai Blog

Delete a Project Using CustomGPT RAG API – A Step-by-Step Guide

Author Image

Written by: Priyansh Khodiyar

Retrieval Augmented Generation RAG The Definitive Guide 2025 4

In this guide, you’ll learn how to completely delete a project from CustomGPT.ai using our RAG API. Whether you need to remove outdated projects or clean up test data, this guide walks you through every step—from creating a project to deleting it—using a Python notebook in Google Colab.

1. Prerequisites to use CustomGPT RAG API

Before you start, make sure you have the following:

  • CustomGPT.ai Account: Sign up and log in at CustomGPT.ai.
  • RAG API Key: Retrieve your RAG API token from your account dashboard and keep it secure.
  • Basic Python Knowledge: Familiarity with Python and REST APIs will be helpful.
  • Google Colab: We’ll run the code in a Colab notebook, so you don’t need to set up a local environment.

Make sure you have read our Getting Started with CustomGPT.ai for New Developers blog to get an overview of the entire platform and how the platform works.

With these essentials in place, we can now move on to setting up your environment.

2. Setting Up Your Environment

Open the Notebook

Upload the Notebook: Open Google Colab and upload the Delete_a_project.ipynb file.

Install Dependencies

This notebook uses Python’s built-in json module and the requests library to handle HTTP requests. These libraries are usually available by default.

Configure Your RAG API Key

At the beginning of the notebook, set up the RAG API endpoint and RAG API token:

api_endpoint = 'https://app.customgpt.ai/api/v1/'

api_token = 'ADD_YOUR_API_TOKEN_HERE'

headers = {

    'Content-type': 'application/json',

    'Authorization': 'Bearer ' + api_token

}

Replace ‘ADD_YOUR_API_TOKEN_HERE’ with your actual RAG API token. This token is required to authenticate your RAG API calls, so keep it confidential.

Get Your API Key

To get your RAG API key, there are two ways:

Method 1 – Via Agent

  1. Agent > All Agents.
  2. Select your agent and go to deploy, click on the API key section and create an API. 

Method 2 – Via Profile section.

  1. Go to profile (top right corner of your screen)
  2. Click on My Profile
  3. You will see the screen something like this (below screenshot). Here you can click on “Create API key”, give it a name and copy the key.
AD 4nXd4P0HrFALeDNzfglXrRpaVt7LFpSv6B63yO5Aj60KA2h1jG1IkBCW n3WwVgfZ23WhVvnR2QsV

Please save this secret key somewhere safe and accessible, especially if you’re handling API tasks like deleting an agent in Python. For security reasons, you won’t be able to view it again through your CustomGPT.ai account. If you lose this secret key, you’ll need to generate a new one.

Now that your environment is ready, we move on to the code walkthrough.

3. Code Walkthrough

This section explains the code step-by-step so you understand what each part does.

3.1 Creating a New Project

Before deleting a project, this notebook creates one. This step is useful for testing or demonstration purposes.

project_name = 'Example ChatBot using Sitemap'

sitemap_path = 'https://adorosario.github.io/small-sitemap.xml'

payload = json.dumps({

    "project_name": project_name,

    "sitemap_path": sitemap_path

})

url = api_endpoint + 'projects'

create_project = requests.request('POST', url, headers=headers, data=payload)

print(create_project.text)

Explanation:

  • Project Details: Here, project_name sets the name of your project and sitemap_path provides a URL that seeds your project’s content.
  • RAG API Request: A POST request is sent to the /projects endpoint, which creates a new project on CustomGPT.ai.
  • Response: The response returns a JSON with the project’s details, including its unique project ID.

After creating the project, the next step is to extract its unique ID for further operations.

3.2 Extracting the Project ID

Once the project is created, extract its ID from the response to use it in the deletion step.

data = json.loads(create_project.text)["data"]

project_id = data["id"]

Explanation:

  • Parsing the Response: The JSON response contains a field called data from which the project ID is extracted.
  • Usage: This project ID is essential for constructing the DELETE request URL later.

With the project ID in hand, we can now proceed to delete the project.

3.3 Deleting the Project

Now that you have the project ID, you can send a DELETE request to remove the project from the platform.

url = api_endpoint + 'projects' + f"/{project_id}"

delete_project = requests.request('DELETE', url, headers=headers)

print(delete_project.text)

Explanation:

  • Endpoint Construction: The DELETE request is sent to the URL /projects/<project_id>, where <project_id> is the unique identifier of the project you want to remove.
  • Deletion Confirmation: The RAG API response should confirm that the project has been successfully deleted.

After the deletion step, we move on to running and testing the notebook to ensure everything works as expected.

4. Running and Testing the Notebook

Step-by-Step Execution

  1. Run the Cells Sequentially: Execute each cell in the notebook one by one.
  2. Monitor the Outputs:
    • Project Creation: Verify that the project is created and that a project ID is returned.
    • Deletion: Check the output of the DELETE request to ensure the project was successfully deleted.

Verifying the Deletion

After running the notebook:

  • Log in to CustomGPT.ai: Visit your dashboard and verify that the project no longer appears. This confirms that the DELETE RAG API call worked correctly.

With the project deleted and verified, you’re almost done. Let’s cover a few common troubleshooting steps.

5. Troubleshooting Common Issues

If you encounter any problems, consider the following tips:

  • Invalid RAG API Token: Make sure you’ve replaced ‘ADD_YOUR_API_TOKEN_HERE’ with your actual RAG API token and that it is active.
  • Endpoint Errors: Verify that the project ID is correctly inserted into the URL.
  • JSON Parsing Errors: Check that the RAG API response is valid JSON and that you’re accessing the correct keys.
  • Network Issues: Ensure that your internet connection is stable to prevent timeouts or failed requests.

For additional help, consult the official CustomGPT.ai documentation or reach out to our community support.

6. Conclusion

In this guide, you learned how to delete a project using the CustomGPT’s RAG API. Specifically, you:

  • Set up your environment and configured your RAG API token.
  • Created a new project and extracted its unique project ID.
  • Sent a DELETE request to remove the project from CustomGPT.ai.
  • Verified the deletion on your dashboard.

This process helps keep your workspace clean by ensuring that only active, relevant projects remain. If you have any questions or need further assistance, consult the CustomGPT.ai documentation or reach out to our community.

Happy coding, and enjoy managing your projects with CustomGPT.ai!

Frequently Asked Questions

How can I safely test project deletion before removing a real project?

u0022They’ve officially cracked the sub-second barrier, a breakthrough that fundamentally changes the user experience from merely ‘interactive’ to ‘instantaneous’.u0022 — Bill French, Technology Strategist. Even with fast API feedback, the safest workflow is to test deletion on a temporary project first. Create a test project, save the project ID returned by the create request, and send the authenticated delete request to that test ID before deleting anything important.

Where can I find the project ID I need for the delete API call?

GEMA’s API-driven deployment handles 248,000 inquiries a year, so keeping the right identifier matters in any production workflow. The project ID you need for deletion is the value returned in the JSON response when you create the project. Save that ID immediately and reuse it in the delete request.

Why does the DELETE request return 404 or unauthorized when I try to remove a project?

An unauthorized response usually means the API key is missing, invalid, or not being sent as a Bearer token in the Authorization header. A 404 usually means the request URL is wrong or the project ID does not match an existing project. Double-check the base API endpoint, confirm you are using the projects route shown in the notebook flow, and make sure the project ID came from the create-project response.

Can I delete a project from PHP or another backend instead of Python and Google Colab?

u0022For the past year, I’ve been using CustomGPT.ai as a specialized AI-powered leadership resource for my VIP clients. One that draws directly from my years of experience, research, and proven leadership strategies. What drew me in? Its simplicity, reasonable cost, and constant feature updates.u0022 — Sara Canaday, Leadership Speaker u0026 Author, Sara Canaday u0026 Associates. Yes. Python in Google Colab is just one example environment. The API details provided for this platform list PHP, Node.js, .NET, Java, Go, Ruby, Swift, and Python, so any backend that can send an authenticated HTTP request can perform the same delete call.

Does deleting a project remove the whole knowledge base, or can I delete only one file?

u0022Check out CustomGPT.ai where you can dump all your knowledge to automate proposals, customer inquiries and the knowledge base that exists in your head so your team can execute without you.u0022 — Stephanie Warlick, Business Consultant. Because a project can contain knowledge sources, a project delete should be treated as a full-project action, not a single-file action. If you only want to remove part of the data, confirm the correct non-project endpoint before sending a project delete request.

Is it safe to put my RAG API key in Google Colab when testing project deletion?

Testing in a private Colab notebook can be reasonable, but the key must be kept confidential. The platform is SOC 2 Type 2 certified, GDPR compliant, and states that data is not used for model training. Your responsibility is to avoid exposing the Bearer token publicly and to keep the key somewhere safe, because you cannot view that secret key again from your account after it is created.

Related Resources

If you’re evaluating larger-scale deployments, this guide adds useful context to the API workflow covered above.

  • Enterprise RAG API — Explore how CustomGPT.ai supports enterprise-grade retrieval-augmented generation use cases, infrastructure needs, and production deployment requirements.

3x productivity.
Cut costs in half.

Launch a custom AI agent in minutes.

Instantly access all your data.
Automate customer service.
Streamline employee training.
Accelerate research.
Gain customer insights.

Try 100% free. Cancel anytime.