
Watch the demo video at the top for a live walkthrough as you follow along! (coming soon)
1. Introduction
Hey there! In this tutorial, we’ll explore how to fetch and update page metadata for your chatbot agent using the CustomGPTs RAG APIs Python SDK implementation. Instead of calling the raw REST endpoints, we’ll leverage the SDK’s Pythonic interface to:
- Install and configure the SDK
- Create an agent from an uploaded file
- List the agent’s pages and grab a page ID
- Retrieve that page’s metadata (like its title)
- Update the page’s metadata
By the end, you’ll see how simple it is to manage page metadata entirely in Python.
Make sure you have read our Getting Started with CustomGPT.ai for New Developers blog to get an overview of the entire platform and its enterprise RAG API.
By the end, you’ll be able to programmatically inspect where your chatbot’s content comes from. For full API reference, see the CustomGPT API docs.
Code – https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/SDK_GetPageMetadata.ipynb
2. Prerequisites
Before you begin, make sure you have:
- CustomGPT.ai Account: Signed up and logged in at CustomGPT.ai.
- API Key: Generated your API token under your dashboard’s API settings.
- Python Environment: Google Colab, Jupyter Notebook, or any Python 3 environment.
- Basic Python Knowledge: Comfortable installing packages, importing modules, and reading JSON-like objects.
Get API keys
To get your API key, there are two ways:
Method 1 – Via Agent
- Agent > All Agents.
- Select your agent and go to deploy, click on the API key section and create an API.
Method 2 – Via Profile section.
- Go to profile (top right corner of your screen)
- Click on My Profile
- 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.
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.
With those ready, let’s install the SDK.
3. Setting Up the SDK
First up, install the customgpt-client package and set your API key:
# Install the CustomGPT SDK so you can call its high‑level methods
!pip install customgpt-client
# Import the main SDK class
from customgpt_client import CustomGPT
# Authenticate all SDK calls by setting your API token
CustomGPT.api_key = "YOUR_API_KEY" # ← Replace with your real token- pip install pulls in the SDK from PyPI.
- from customgpt_client import CustomGPT gives you access to all the SDK’s functions.
- CustomGPT.api_key = … ensures every method you call is authenticated.
Now that the SDK is configured, let’s create our chatbot agent before moving on to updating an agent name.
4. Creating a Chatbot from a File
Instead of a sitemap, we’ll upload a document file as the source for our chatbot. Google Colab makes file uploads easy:
from google.colab import files
from customgpt_client.types import File
# 1) Upload a file interactively from your local machine
uploaded_file = files.upload()
# 2) Extract the binary content of the uploaded file
file_content = next(iter(uploaded_file.values()))
print("Uploaded file bytes:", file_content[:20], "...")
# 3) Give your agent a name
project_name = 'Example ChatBot from File'
# 4) Create the agent by passing the File object to the SDK
create_project = CustomGPT.Project.create(
project_name=project_name,
file=File(payload=file_content, file_name='Yes.doc')
)
# 5) Print the SDK response to verify creation
print("Project creation response:", create_project)- files.upload() opens a file picker in Colab.
- File(payload=…, file_name=…) wraps your file bytes and filename for the SDK.
- CustomGPT.Project.create sends both parameters to create your agent.
Once the agent exists, pages will be generated as it ingests the file. Let’s grab one from the same agent used to retrieve agent stats.
5. Retrieving a Project Page
Next, we pull the list of pages your agent created and select one page ID:
# 1) Extract the new agent’s ID
project_id = create_project.parsed.data.id
print("Project ID:", project_id)
# 2) Fetch all pages for this project
project_page = CustomGPT.Page.get(project_id=project_id)
# 3) Parse out the list of pages
pages_data = project_page.parsed.data.pages.data
print("Pages list:", pages_data)
# 4) Grab the first page’s ID
page_id = pages_data[0].id
print("Selected page ID:", page_id)- CustomGPT.Page.get returns a structured object containing pages.data, an array of pages.
- We pick the first page by indexing [0] and retrieve its .id.
Now that we have a page_id, we can inspect its metadata.
6. Getting Page Metadata
To see details like the page’s title, call the metadata endpoint:
# 1) Fetch metadata for that specific page
page_metadata = CustomGPT.PageMetadata.get(
project_id=project_id,
page_id=page_id
)
# 2) Parse the returned metadata object
metadata = page_metadata.parsed.data
print("Full metadata:", metadata)
# 3) Print just the title field
print("Page title:", metadata.title)- CustomGPT.PageMetadata.get retrieves attributes like title, description, and any custom fields.
- The parsed .data object holds these values, which you can print or manipulate as needed.
Great—now let’s update that title.
7. Updating Page Metadata
With the metadata in hand, you can update fields in a single call. Here’s how to change the page’s title:
# 1) Call the update method with a new title
updated_metadata = CustomGPT.PageMetadata.update(
project_id=project_id,
page_id=page_id,
title='Vanka'
)
# 2) Parse and print the updated data
updated_data = updated_metadata.parsed.data
print("Updated metadata:", updated_data)- CustomGPT.PageMetadata.update sends a PATCH/PUT under the hood to update only the provided fields.
- You get back the new metadata object so you can confirm the change.
8. Troubleshooting Common Issues
- Empty pages.data:
If no pages appear, give the agent a moment to process the file or re-run the conversation creation step. - Invalid Token Errors:
Double‑check CustomGPT.api_key is set correctly. - Permission Denied:
Ensure your API token has the right scopes to read and update metadata. - Network Problems:
Verify your connection and that app.customgpt.ai is reachable.
If you’re still stuck, the CustomGPT SDK docs and community forum are great resources.
9. Conclusion
Congratulations! In this comprehensive tutorial, you learned how to:
- Install and configure the CustomGPT Python SDK.
- Create a chatbot agent from an uploaded file.
- Retrieve the agent’s pages and select a page ID.
- Fetch page metadata such as the title.
- Update the page metadata in a single SDK call.
With these steps, you can fully manage page metadata for your chatbot projects programmatically. Happy coding, and enjoy building powerful chatbots with CustomGPT!

Make Money With AI
Join our Partner Programs!
Boost your reputation, drive revenue and grow your business with CustomGPT.ai.
Frequently Asked Questions
Is it possible to modify page metadata with Python?
TaxWorld’s AI tax assistant reached a 97.5% success rate across 189,351 queries, which highlights how important well-managed source data can be at scale. Yes. In Python, you can authenticate with your API key, list an agent’s pages, capture the page_id, fetch the current metadata, submit an update for fields such as the title, and then fetch the record again to confirm the change.
How do I find a page ID before updating metadata?
List the agent’s pages first. Then identify the record you want by a stable detail such as the page title or the file you uploaded, and use that page_id in the metadata retrieval or update call. This lets you target one specific page record instead of guessing.
Can I fix metadata for hundreds of imported pages without editing them one by one?
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. Yes. If you need to fix many imported pages, you can automate the process in Python by listing pages, selecting the page IDs you want to change, and running the same metadata update call in a loop instead of editing each page manually. After the batch runs, fetch the updated records again to verify the changes.
Should I use the Python SDK or raw REST calls for page metadata tasks?
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 — Dan Mowinski, AI Consultant. For page metadata work, the Python SDK is usually the best choice when you’re already in Python, Jupyter, or Colab and want a Pythonic interface. Direct REST calls are a better fit when you need language-agnostic HTTP integration or you’re working from another stack.
Why didn’t my page metadata update change anything?
Start by checking that you used the correct page_id and that your API key is set, because the SDK authenticates requests with that token. Then fetch the page metadata before the update, send the update request, and fetch the page again to compare the returned fields. If the value is still unchanged, confirm that you targeted the correct agent and page record.
What’s the safest way to store my API key for metadata scripts?
SOC 2 Type 2 certified controls and GDPR compliance matter when scripts handle document titles, URLs, and labels. Store your API key in an environment variable, notebook secret, or another secret manager instead of hard-coding it in a Python file. Save it securely when you create it, because the key is shown only once and you will need to generate a new one if it is lost.
Related Resources
These guides expand on page management, project visibility, and integration options in CustomGPT.ai.
- Delete Agent Pages — Learn how to remove a page from your CustomGPT.ai agent using the API with a practical step-by-step walkthrough.
- List Project Pages — See how to use the SDK to retrieve all pages associated with a project and manage your content more efficiently.
- Available Integrations — Explore the integration options available in CustomGPT.ai to connect your agent with the tools and platforms you already use.
- Custom Integration Guide — Understand how to build a custom integration for CustomGPT.ai when you need more tailored workflows and implementation flexibility.

Priyansh is Developer Relations Advocate who loves technology, writer about them, creates deeply researched content about them.