Benchmark

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

CustomGPT.ai Blog

Add a Sitemap to an Existing Project Using CustomGPT’s RAG API – A Step-by-Step Guide

Author Image

Written by: Priyansh Khodiyar

Retrieval Augmented Generation RAG The Definitive Guide 2025 1 1 1024x576 1

In this tutorial, you’ll learn how to add a sitemap to an existing project on CustomGPT.ai using our CustomGPT’s RAG API. We’ll cover setting up your environment in Google Colab, and then updating the project. Follow along with the code walkthrough to understand each step of the process.

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

Notebook Link – https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/Add_a_sitemap_to_an_existing_project.ipynb

1. Prerequisites to use CustomGPT’s RAG API

Before you begin, make sure you have the following:

  • CustomGPT.ai Account: Sign up and log in at CustomGPT.ai.
  • RAG API Key: Generate your RAG API token from your dashboard and keep it secure.
  • Basic Python Knowledge: Familiarity with Python and making HTTP requests using libraries like requests.
  • Google Colab: We’ll run the code on Google Colab, so you don’t need any local setup.

2. Setting Up Your Environment in Google Colab

Opening the Notebook

  1. Upload the Notebook: Open Google Colab and upload the Add_a_sitemap_to_an_existing_project.ipynb file.
  2. Verify the Code Cells: Ensure that the required libraries (requests and json) are available. These come pre-installed in Colab, so you’re all set to run the code.

Configuring Your RAG API Key and Endpoints

At the beginning of the notebook, the RAG API endpoint and token are configured:

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

api_token = 'ADD_YOUR_API_TOKEN_HERE'

# imports

import requests

import json

Replace ‘ADD_YOUR_API_TOKEN_HERE‘ with your actual RAG API token. This token authenticates your RAG API calls to CustomGPT, so keep it secure. Plus add the required imports.

Get Your RAG 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 4nXcxuBrv24ItmRvd7NSbiZYqkvNPFOfVPtasQgbZO3BJ7Uge997bDY6dyoZJ kQJMYJg0I2T9 h5VdcZQ

Please save this secret key somewhere safe and accessible, especially if you’re adding a sitemap to an agent. 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.

3. Code Walkthrough

Let’s break down the notebook code to understand how it works.

3.1 Retrieving the Project ID

Go to the particular project you wish to add or upload files to, then, navigate to the Deploy section.

AD 4nXfwDm94CGSXzJ1APDHhPRJR4CHRNRjw L4 u4 gg5xlPYQmejD

You will find the Agent ID on the right top corner.

project_id = 1234

This ID is crucial as it tells the RAG API where to add the file in the next step.

3.2 Adding (or Updating) the Sitemap to the Existing Project

With the project ID in hand, you can now add a new sitemap to your project:

  • Set the New Sitemap Path:

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

  • Prepare the Payload: The payload now includes just the sitemap path:
payload = json.dumps({

    "sitemap_path": new_sitemap_path

})
  • Construct the RAG API Endpoint and Send the Request: The endpoint is built using the project ID:
url = api_endpoint + 'projects' + f"/{project_id}/" + 'sources'

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

print(create_source.text)
  • The response should confirm that the sitemap has been successfully added (or updated) in your project.

4. Running and Testing the Notebook

Now that your notebook is set up, it’s time to execute it to create your project and upload files. Follow these instructions to make sure everything works as expected.

Executing the Notebook

  • Run Each Cell Sequentially:
    Start by executing the cells in order. First, your project will be created, and then the sitemap will be added.
  • Monitor the Outputs:
    • Check the JSON response after project creation for the project ID.
    • Verify the final output to ensure the sitemap has been added.

Verifying on CustomGPT.ai

After running the notebook, log into your CustomGPT.ai dashboard. Your project should now display the updated sitemap information, confirming that your RAG API calls were successful.

5. Troubleshooting Common Issues

While the process is straightforward, here are some common issues you might encounter:

  • Invalid RAG API Key: Ensure your RAG API key is correctly set in the notebook.
  • Endpoint Errors: Verify that the constructed URL, especially with the project ID, is accurate.
  • Network Issues: Check your internet connection if the requests are timing out.
  • JSON Parsing Errors: Make sure the RAG API responses are properly formatted and that you are accessing the correct keys.

For additional help, refer to the CustomGPT.ai documentation or reach out via community support channels.

6. Conclusion

In this guide, we demonstrated how to add a sitemap to an existing project using the CustomGPT”s RAG API in a Google Colab notebook. You learned how to:

  • Configure your RAG API key and set up the environment.
  • Create a new project with an initial sitemap.
  • Extract the project ID and add (or update) the sitemap using a subsequent RAG API call.
  • Run the notebook and verify the changes on your CustomGPT.ai dashboard.

By following these steps, you can easily manage and update your project configurations through RAG API calls. Enjoy building your projects and integrating powerful features with CustomGPT.ai!

If you have any questions or need further assistance, feel free to reach out. Happy coding with CustomGPT.ai!

Frequently Asked Questions

Can I add a sitemap to an existing project without rebuilding the whole agent?

BernCo handled 114,836 contacts across chatbot, phone, and email, which shows why teams update working AI systems instead of starting over. Yes. You can add or update a sitemap in an existing project by sending the sitemap URL to that project’s Agent ID with an authenticated RAG API request. Rebuilding the agent is not required for this workflow.

Should I add a sitemap or just add my website URL?

Use a single URL when you only need one page. Use a sitemap when you want to ingest multiple pages at once through one XML source. The platform accepts both URLs and XML, so the best choice depends on whether you need one page or a broader collection of site content.

Can the RAG API keep my sitemap updated when new pages are published?

The supported flow uses an explicit API request to add or update the sitemap. Automatic background syncing is not described, so if new pages are added to the sitemap, send another update request to refresh that source.

Do I need Google Colab to add a sitemap, or can I use Python, PHP, or JavaScript?

Dan Mowinski, AI Consultant, said, u0022The tool I recommended was something I learned through 100 school and used at my job about two and a half years ago. It was CustomGPT.ai! That’s experience. It’s not just knowing what’s new. It’s remembering what works.u0022 You do not need Google Colab. Colab is just the example environment because it runs the sample notebook without local setup. The same authenticated HTTP request pattern can be implemented in Python, PHP cURL, or JavaScript fetch.

What usually causes a sitemap update to fail?

Start by checking the required inputs: API token, API endpoint, project or Agent ID, and the sitemap URL. Those values are all part of the request setup, so a wrong token, wrong ID, or bad sitemap path are the most likely failure points to troubleshoot first.

How can I verify that the new sitemap pages are actually being used by the agent?

Bill French, Technology Strategist, said, u0022They’ve officially cracked the sub-second barrier, a breakthrough that fundamentally changes the user experience from merely ‘interactive’ to ‘instantaneous’.u0022 Fast answers still need fresh sources. A practical check is to ask about information that appears only on a newly added page and confirm the response matches that page. If citation support is enabled, check whether the cited source is one of the new URLs.

Related Resources

If you’re expanding beyond sitemap ingestion, this guide covers the broader API architecture behind retrieval-powered applications.

  • Enterprise RAG API — Learn how the CustomGPT.ai enterprise RAG API supports scalable retrieval, grounding, and production-ready AI integrations.

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.