Benchmark

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

CustomGPT.ai Blog

Updating Your Agent’s Name with the RAG API – A Step-by-Step Guide

Author Image

Written by: Priyansh Khodiyar

How to Update agent's Name with CustomGPT RAG API – A Step-by-Step Guide

1. Introduction

Hi there! In this guide, we’ll show you how to update agent’s name using the CustomGPT.ai RAG API’s Python SDK. Although the code still refers to “project,” in our discussions we often call them “agents.” Whether you’re rebranding your chatbot for a white-label AI chatbot experience or simply organizing your work, this tutorial will walk you through creating an agent and then updating its name—all in a clear, step-by-step format.

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

Get the cookbook link here – https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/Update%20a%20project%20name.ipynb

2. Setting Up the Environment

Before we start, we need to prepare our workspace in Google Colab. This involves specifying the API endpoint, setting up your API token, and importing the necessary libraries.

Code Sample:

# setup API URL and 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

}

# imports

import requests

import json

What This Does:

  • API Endpoint & Token: Sets the base URL for all API calls and uses your API token for authentication (ensure you replace ‘ADD_YOUR_API_TOKEN_HERE’ with your actual API token).
  • Headers: Prepares the HTTP headers required for the requests, including the content type and authorization details.
  • Imports: Loads the requests library to handle HTTP requests and the json module to manage JSON data.

Get API keys

To get your 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.
Create API

Please save this secret key somewhere safe and accessible. For security reasons, as part of how CustomGPT.ai works, 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 our environment is ready, let’s ensure you have everything set up before moving forward.

3. Prerequisites

Before you dive in, check that you have the following:

  • CustomGPT.ai Account: Sign up and log in at CustomGPT.ai.
  • API Key: Generate your API token from your account dashboard.
  • Basic Python Knowledge: Familiarity with Python and REST APIs will help you follow along.
  • Google Colab: We’re using Google Colab—so no local installation is needed!

With these prerequisites in hand, it’s time to create your agent in preparation for tasks like updating an agent name.

4. Creating an Agent (Project) for Your Account

In this section, you’ll create a new agent using a sitemap. Remember, even though the code says “project,” think of this as creating your agent’s workspace, where you’ll later update agent settings.

Code Sample:

# Give a name to your project

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:

  • Agent Details: The code sets a name for your agent and provides a sitemap URL which serves as the content source.
  • Payload Creation: Your agent details are converted into JSON format, which is required by the API.
  • POST Request: A POST request is sent to create your agent. If successful, the API returns a response containing details like the agent’s unique ID.
  • Output: The code prints the JSON response, which should look similar to:
{"data":{"id":507,"project_name":"Example ChatBot using Sitemap",...},"status":"success"}

Great! Now that your agent is created, let’s update its name to give it a fresh identity.

5. Updating the Project Name

Once you have your agent’s ID, you can update agent’s name. This might be useful when rebranding or refining your agent’s title for clarity.

Code Sample:

# Check status of the project if chat bot is active

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

# Get project id from response for created project

updated_project_name = 'New Example ChatBot using Sitemap'

project_id = data["id"]

payload = json.dumps({

    "project_name": updated_project_name

})

# Update the project

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

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

print(create_project.text)

Explanation:

  • Extracting Agent ID: The code parses the original response to retrieve the agent’s unique ID (project_id).
  • Define New Name: A new name is assigned to the agent by setting the variable updated_project_name.
  • Payload for Update: The new agent name is then converted into JSON format.
  • POST Request for Update: A POST request is sent to the agent’s specific URL (constructed using its ID) to update the name.
  • Output: The updated JSON response is printed, showing that your agent now has the new name, for example:
{"data":{"id":507,"project_name":"New Example ChatBot using Sitemap",...},"status":"success"}

Nice work! Your agent now sports a fresh new identity. Next, let’s go over a few common issues you might encounter.

6. Troubleshooting Common Issues

Here are a few tips to resolve common problems you might face:

  • Invalid API Token: Make sure you have replaced ‘ADD_YOUR_API_TOKEN_HERE’ with your actual API token.
  • Incorrect JSON Formatting: If you encounter errors when parsing or sending JSON, verify that your payload is correctly formatted.
  • Connection Problems: Ensure your internet connection is stable and that the API endpoint URL is correct.
  • Unexpected API Responses: Double-check that you’re using the correct endpoints and that the agent ID is being correctly extracted from the response.

If you continue to have issues, consult the official CustomGPT documentation or join the community forum for further support.

7. Conclusion

Congratulations! You’ve now learned how to:

  • Set up your Google Colab environment with the necessary API endpoint, token, and libraries.
  • Create an agent (project) using a sitemap as the content source.
  • Update the agent’s name to give it a fresh identity.

This process is a great way to manage and rebrand your chatbot on the fly. If you have any questions or need further help, feel free to check out the CustomGPT documentation or ask in our community.

Happy coding, and enjoy building your custom chatbot solutions with CustomGPT!

Frequently Asked Questions

Can I rename an existing agent without rebuilding it?

u0022Powered by my custom-built Theory of Change AIM GPT agent on the CustomGPT.ai platform. Rapidly Develop a Credible Theory of Change with AI-Augmented Collaboration.u0022 — Barry Barresi, Social Impact Consultant. You can rename an existing agent without rebuilding it. Creating an agent and updating its name are separate API actions, and the code uses `project` for what many users call an `agent`, so a name change updates the existing resource rather than requiring a new one.

Why does the API say project when the dashboard says agent?

u0022I just discovered CustomGPT, and I am absolutely blown away by its capabilities and affordability! This powerful platform allows you to create custom GPT-4 chatbots using your own content, transforming customer service, engagement, and operational efficiency.u0022 — Evan Weber, Digital Marketing Expert. In the API, the resource is still named `project`, while many users refer to the same resource as an `agent` in the dashboard and in everyday use. Updating the project name in the API changes the name of that same agent resource.

What API key do I need to rename an agent, and where do I get it?

Use a standard API key for authentication and send it as a Bearer token in the `Authorization` header. You can create the key either from Agent u003e All Agents u003e select your agent u003e Deploy u003e API key section, or from Profile u003e My Profile u003e Create API key. Save the secret when it is created, because you will not be able to view the full key again later.

How do I know the new agent name has actually updated?

A successful update response is the first confirmation. A practical second check is to view the agent in the dashboard, where agent names are listed, and confirm that the new name appears there.

What usually causes an agent rename request to fail?

The most common problems are request-setup issues: using the placeholder token instead of a real API key, sending a request without the required `Authorization: Bearer` header, or calling a different base URL than `https://app.customgpt.ai/api/v1/`. If those are correct, make sure your request is targeting the existing project or agent you intend to update.

Can I rename an agent from a quick Python notebook, or do I need a full app build?

u0022We love CustomGPT.ai. It’s a fantastic Chat GPT tool kit that has allowed us to create a ‘lab’ for testing AI models. The results? High accuracy and efficiency leave people asking, ‘How did you do it?’ We’ve tested over 30 models with hundreds of iterations using CustomGPT.ai.u0022 — Brendan McSheffrey, Managing Partner u0026 Founder, The Kendall Project. A simple Python notebook is enough to rename an agent. The rename flow can be run in Google Colab with the Python SDK, so you do not need to build a full application just to change the name.

Related Resources

These additional guides expand on key CustomGPT.ai API workflows and integrations.

  • Update Agent Share Link — Learn how to modify an agent’s share link using the CustomGPT.ai RAG API for smoother access management.
  • Update And Delete Conversations — This guide covers how to update conversation data and remove conversations through the CustomGPT.ai API.
  • Platform Integrations — Explore the available integrations that connect CustomGPT.ai with the tools and platforms already in your workflow.
  • CustomGPT.ai MCP Actions — Get a clear overview of CustomGPT.ai’s MCP actions and how they support more advanced automation and agent behavior.

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.