Need to tweak your chatbot’s default prompt, language, or example questions without touching the dashboard? This tutorial shows you how to fetch and update agent settings via the CustomGPTs RAG APIs Python SDK implementation.
We’ll move through these steps:
- Install & authenticate the SDK
- Retrieve the current settings for context
- Build an update payload
- Apply the changes with one API call
- Verify everything updated correctly
If you’re brand‑new, first sign up and read Getting Started with CustomGPT.ai.
For complete code, see the GitHub Cookbook notebook.
Full reference: API docs.
Prerequisites
Requirement | Details |
API Key | Needs “settings‑update” scope. Generate under Settings → API Tokens. |
Project ID | The agent whose settings you’ll update. |
Python 3 + customgpt‑client | Install with pip install customgpt-client. |
Basic Python Skills | Comfortable running scripts and working with dictionaries. |
Everything ready? Let’s jump in.
1 – Authenticate the SDK
First, install (if you haven’t) and authenticate the SDK so all calls carry your token.
# Install the SDK (run once per environment)
!pip install customgpt-client
# Import the SDK interface
from customgpt_client import CustomGPT
CustomGPT.api_key = "YOUR_API_TOKEN" # ← Replace with your real token
Why this matters
Setting api_key globally means every subsequent function call is automatically authorized—no manual headers required.
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, 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 we’re authenticated, let’s take a snapshot of the current settings.
2 – Retrieve Current Settings
Fetching existing values lets you verify what’s already configured and decide what to change.
# Pull the current settings for reference
current_settings = CustomGPT.ProjectSettings.get(
project_id="YOUR_PROJECT_ID" # ← your agent’s ID
)
print("Current Settings:\n", current_settings.parsed.data)
What you’ll see
Typical fields include:
Field | Example |
default_prompt | “Ask me anything …” |
chatbot_msg_lang | “en” |
example_questions | [“What do you do?”, …] |
response_source | “default” |
Knowing these values helps you craft an accurate update payload.
With the baseline captured, let’s prepare new settings.
3 – Define the Update Payload
Only include keys you want to change; all others stay as‑is.
# Build a dictionary containing only the fields you wish to modify
new_settings = {
"default_prompt": "Hello! Ask me anything about our docs.", # New system prompt
"chatbot_msg_lang": "en", # Language code
"example_questions": [ # Suggested starter prompts
"How do I integrate the API?",
"Where can I find code examples?",
"What are the rate limits?"
],
"allow_user_feedback": True # Toggle feedback widget
}
Tip
If you don’t want to touch a field, just omit it—ProjectSettings.update leaves unspecified fields unchanged.
Payload ready? Let’s push the update.
4 – Apply the Settings Update
We pass our dictionary as keyword arguments so each key maps to an API parameter.
update_resp = CustomGPT.ProjectSettings.update(
project_id="YOUR_PROJECT_ID", # Target project
**new_settings # Unpack the dict into kwargs
)
print("Update Status:", update_resp.status) # Should print "success"
Under the hood
ProjectSettings.update sends a PATCH/PUT to /projects/{id}/settings with only the fields you provided.
A “success” response means the backend accepted your changes—let’s double‑check.
5 – Verify the Changes
Pull the settings again and confirm they match your payload.
verified_settings = CustomGPT.ProjectSettings.get(
project_id="YOUR_PROJECT_ID"
)
print("Verified Settings:\n", verified_settings.parsed.data)
Quick sanity check
- Does default_prompt show the new text?
- Are the example_questions updated?
- Is chatbot_msg_lang now “en” (or whichever code you set)?
If something didn’t stick, re‑examine your payload for typos.
With updates confirmed, you’ve successfully re‑configured your chatbot on the fly!
Troubleshooting & FAQs
Common Issues
Problem | Solution |
Invalid API Key | Ensure CustomGPT.api_key is correct and unexpired. |
Missing permission | Token needs “settings‑update” scope. |
Unhandled field | Sending a key the API doesn’t recognize returns a validation error—remove it. |
Boolean fields ignored | Use proper Python booleans (True / False), not strings. |
Frequently Asked Questions
Update only one field?
Absolutely—send just that key in new_settings.
Clear example questions?
Provide an empty list: “example_questions”: [ ].
Effect on active chats?
Ongoing sessions keep their original default_prompt; new sessions use the updated one.
Read‑only fields?
Timestamps like created_at are immutable.
Automate in CI/CD?
Yes—place these SDK calls in your deployment scripts or GitHub Actions.
Related Resources
- Get Settings for a Particular Project – Read the guide
- Update Project Sharing & Grab Share Link – See how
- GitHub Cookbook Notebook – SDK Update Project Settings
Conclusion
In this tutorial you:
- Authenticated the CustomGPT Python SDK
- Fetched your project’s current settings
- Crafted a focused update payload
- Applied the changes in one line of code
- Verified the new configuration
With this approach, you can programmatically fine‑tune prompt language, sample questions, and feature toggles—perfect for CI/CD pipelines or large‑scale bot fleets.
Happy coding, and keep refining those chatbots!
Priyansh is Developer Relations Advocate who loves technology, writer about them, creates deeply researched content about them.