Skip to main content
SiteGPT has a developer surface for each direction of integration: control the widget on your page, get events out, and drive the platform programmatically.

Pick your path

JavaScript SDK

Control the widget from your page: open and close it, send messages, inject CSS, identify logged-in users.

Tracking events

The widget emits analytics events (chat opened, lead submitted, and more) to GTM, GA4, or your own code.

Webhooks

SiteGPT POSTs messages, leads, and escalations to your endpoint as they happen.

Agent API (v2)

A full REST API over chatbots, knowledge, conversations, leads, and settings. OpenAPI spec included.

TypeScript SDK

A typed, zero-dependency client for the Agent API: @sitegpt/sdk on npm. Every operation, generated from the live OpenAPI document.

Python SDK

The same client for Python: sitegpt on PyPI. Standard library only, Python 3.9+.

Go SDK

The same client for Go: github.com/sitegpt/sitegpt-go. Zero dependencies, structured errors, confirm-guarded deletes.

CLI

Create and manage chatbots from the command line, or let coding agents do it. Includes an onboarding flow that goes from URL to working chatbot in one command.

MCP server

Connect AI agents (Claude, Cursor, and others) to your SiteGPT account through the Model Context Protocol.

Credentials: the Agents page

Programmatic access is authenticated with API tokens, managed on the Agents page in the top navigation. Tokens are scoped: you choose which permissions they carry and which chatbots they can touch. The same page manages MCP connections. See API tokens & MCP for the full model, and note that the legacy v0 API uses a separate account API key; the v0 reference covers it.

The five-minute tour

The fastest way to feel the surface, assuming the widget is already installed:
  1. Open your site with the widget and run $sitegpt.push(['open']) in the browser console. The chat opens; the SDK is live on your page.
  2. Add a listener: $sitegpt.push(['on', 'conversation_started', console.log]) and start a chat. That is tracking events.
  3. Point a webhook lane at a request inspector and send a message; the ADD_MESSAGE payload arrives.
  4. Create a token on Agents and call curl -H "Authorization: Bearer sgpt_..." https://sitegpt.ai/api/v2/me. That is the Agent API.

Conversation state conflicts

A conversation can be closed (resolved from the dashboard) or held by a human agent (take-over). Both states are enforced at write time, in the database transaction itself, so a state change that races your request still wins:
  • A closed conversation refuses conversation writes with 409 and the error code CONVERSATION_CLOSED. In the v2 Agent API that covers the message sends, escalate, and switch-to-ai; in the v0 legacy API, Send Message and Escalate Conversation.
  • While a human agent holds a conversation, message sends still store the visitor’s text, but no AI answer is generated: a send that races the take-over stores the message and returns it without an answer. The escalate endpoint refuses with 403 and the error code HUMAN_TAKEOVER.
  • switch-to-ai is the API’s release path: it clears a human take-over and hands the conversation back to the AI, or answers 409 CONVERSATION_CLOSED when the conversation is closed.
The v2 OpenAPI document marks the exact operations that can return 409.