sitegpt
Official SiteGPT SDK for Python — a small, dependable, zero-dependency client for the SiteGPT API v2 (standard library only, Python 3.9+).
- Envelope-aware — the API responds with
{ ok, data, meta }; the SDK returnsdatadirectly (plain dicts/lists) and raises aSiteGPTError(with the API's errorcode,message, and actionablehint) wheneverokisfalse. - Full API reach — convenience methods cover the highest-value groups (chatbots, knowledge, conversations, leads, messages, onboarding); every one of the 120 API v2 operations is reachable through
request().
Install
pip install sitegpt
Quickstart
Create an API token in the SiteGPT dashboard (Settings → API tokens), then:
import os
from sitegpt import SiteGPT
sitegpt = SiteGPT(api_token=os.environ["SITEGPT_API_TOKEN"])
# List your chatbots
chatbots = sitegpt.chatbots.list()["chatbots"]
chatbot_id = chatbots[0]["id"]
# Add knowledge to a chatbot
sitegpt.knowledge.add_links(
chatbot_id, urls=["https://example.com/docs/getting-started"]
)
# Send a chat message (starts a new conversation)
reply = sitegpt.messages.send(chatbot_id, message="What are your pricing plans?")
# Review conversations and captured leads
conversations = sitegpt.conversations.list(chatbot_id, limit=20)
leads = sitegpt.leads.list(chatbot_id)
Agent onboarding bootstrap (no token required)
The onboarding bootstrap is a public endpoint — an AI agent can provision a SiteGPT workspace with no credentials at all, and the response carries the temporary workspace token to use for everything that follows:
from sitegpt import SiteGPT
# No API token yet — the bootstrap endpoint is public:
bootstrap = SiteGPT()
started = bootstrap.onboarding.start(websiteUrl="https://example.com")
# The response includes a temporary workspace token:
sitegpt = SiteGPT(api_token=started["apiToken"])
sitegpt.knowledge.document_stats(started["workspace"]["chatbotId"])
health() is public too; every other endpoint responds 401 until an api_token is set.
Error handling
from sitegpt import SiteGPT, SiteGPTError
try:
sitegpt.chatbots.get("nonexistent-id")
except SiteGPTError as error:
print(error.status) # HTTP status, e.g. 404
print(error.code) # machine-readable code, e.g. NOT_FOUND
print(error.message) # human-readable message
print(error.hint) # actionable next step, when the API provides one
print(error.request_id) # for support and debugging
Convenience namespaces
| Namespace | Methods |
|---|---|
sitegpt.chatbots |
list, get, create, update, delete, dashboard |
sitegpt.knowledge |
list_documents, get_document, update_document, delete_document, delete_documents, document_stats, resync_documents, add_links, add_website, add_sitemap, add_youtube, set_text, list_sources, get_source, create_source, update_source, revoke_source, ingest_source, list_sync_jobs, get_sync_job |
sitegpt.conversations |
list, get, create, update, delete, escalate, switch_to_ai |
sitegpt.leads |
list, get, update, delete, run_action |
sitegpt.messages |
send, send_to_conversation, list, update |
sitegpt.onboarding |
start, get_workspace, claim_workspace, delete_workspace |
Plus sitegpt.me() and sitegpt.health().
Destructive operations require confirmation
The API requires confirm=true on delete-family endpoints, and the SDK keeps that intent explicit instead of confirming on your behalf: chatbots.delete, knowledge.delete_document, knowledge.delete_documents, knowledge.revoke_source, conversations.delete, and leads.delete take a confirm=True keyword argument and raise a CONFIRMATION_REQUIRED SiteGPTError client-side (before any request) without it:
sitegpt.conversations.delete(chatbot_id, thread_id, confirm=True)
sitegpt.chatbots.delete(chatbot_id, confirm=True)
Body fields and query filters are passed as keyword arguments using the API's own field names (camelCase, exactly as documented in the OpenAPI document):
sitegpt.knowledge.list_documents(chatbot_id, limit=10, source=["WEBSITE"])
sitegpt.knowledge.get_document(chatbot_id, document_id, includeContent=True)
Every other endpoint: request()
# Custom responses, personas, instructions, settings, members, tags, billing…
personas = sitegpt.request(f"/api/v2/chatbots/{chatbot_id}/personas")
sitegpt.request(
f"/api/v2/chatbots/{chatbot_id}/settings",
method="PATCH",
body={"general": {"title": "Support Bot"}},
)
request_with_meta() additionally returns the envelope meta — including meta["nextCursor"] for pagination:
data, meta = sitegpt.request_with_meta(
f"/api/v2/chatbots/{chatbot_id}/conversations", query={"limit": 50}
)
if meta.get("nextCursor"):
more = sitegpt.conversations.list(chatbot_id, cursor=meta["nextCursor"])
Custom base URL
base_url defaults to https://sitegpt.ai and only needs to change if SiteGPT gives you a different API origin.
Related
@sitegpt/sdk— the official TypeScript/JavaScript SDK.@sitegpt/cli— the same API from your terminal, scripts, and AI agents (includes a local MCP server).- API reference: https://sitegpt.ai/api/v2/openapi.json
License
MIT © SiteGPT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sitegpt-0.2.0.tar.gz.
File metadata
- Download URL: sitegpt-0.2.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c90828934419e91a7c889da0ff692257d426dc9b1e4214215e555dab99c9810
|
|
| MD5 |
0a9794d553c1f5a3d5da623458cc3759
|
|
| BLAKE2b-256 |
02ddd9e52da6a9f57c05c35fc0b5bc7b909415cbbd1d700cbc5dc0e25269a2f1
|
Provenance
The following attestation bundles were made for sitegpt-0.2.0.tar.gz:
Publisher:
publish-sdks.yml on sitegpt/sitegpt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sitegpt-0.2.0.tar.gz -
Subject digest:
9c90828934419e91a7c889da0ff692257d426dc9b1e4214215e555dab99c9810 - Sigstore transparency entry: 2590551376
- Sigstore integration time:
-
Permalink:
sitegpt/sitegpt@51d870fd6d15d4d8c9f4920e83b57e2f331e87a0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sitegpt
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@51d870fd6d15d4d8c9f4920e83b57e2f331e87a0 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sitegpt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sitegpt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de12c14322ac111e1dd54aa29fb0683e47eafda13d07bd71e479958b19a541f1
|
|
| MD5 |
4ecfec8f9c26c9dc4f8ace7ad9621000
|
|
| BLAKE2b-256 |
56f3c34353c38bf494dac07bfd8baeddedc007422a46b68dfb6d6939181c469d
|
Provenance
The following attestation bundles were made for sitegpt-0.2.0-py3-none-any.whl:
Publisher:
publish-sdks.yml on sitegpt/sitegpt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sitegpt-0.2.0-py3-none-any.whl -
Subject digest:
de12c14322ac111e1dd54aa29fb0683e47eafda13d07bd71e479958b19a541f1 - Sigstore transparency entry: 2590552062
- Sigstore integration time:
-
Permalink:
sitegpt/sitegpt@51d870fd6d15d4d8c9f4920e83b57e2f331e87a0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sitegpt
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@51d870fd6d15d4d8c9f4920e83b57e2f331e87a0 -
Trigger Event:
workflow_dispatch
-
Statement type: