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..

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. 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!

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.