Skip to main content
@sitegpt/sdk is the official SiteGPT SDK for TypeScript and JavaScript — a typed, zero-dependency client for the SiteGPT API v2.
  • Typed end to end — types are generated from the live API’s OpenAPI 3.1 document (all 119 operations), and every convenience method returns the operation’s exact data payload type.
  • Zero dependencies — built on the global fetch (Node 18+, Bun, Deno, browsers, edge runtimes).
  • Envelope-aware — the API responds with { ok, data, meta }; the SDK returns data directly and throws a SiteGPTError whenever ok is false.
This SDK drives the platform — creating chatbots, training knowledge, reading conversations. To embed the chat widget on your website, use the JavaScript widget SDK instead.

Install

Quickstart

Create a scoped API token on the Agents page, then:

Agent onboarding bootstrap (no token required)

The agent-first 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:
health() is public too; every other endpoint responds 401 until an apiToken is set.

Error handling

Every failed call throws a SiteGPTError carrying the API’s error envelope:

Convenience namespaces

The highest-value API groups have first-class methods: 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.deleteDocument, knowledge.deleteDocuments, knowledge.revokeSource, conversations.delete, and leads.delete take a required { confirm: true } argument and throw a CONFIRMATION_REQUIRED SiteGPTError client-side (before any request) without it:

Every other endpoint: request()

All 119 API v2 operations are reachable through the typed low-level request(path, options) — known paths autocomplete:
requestWithMeta() additionally returns the envelope meta — including meta.nextCursor for pagination:

OpenAPI types

The raw generated types are exported for advanced use, and the OpenAPI document itself ships in the package as openapi.generated.json:

Timeouts

Requests time out after 30 seconds by default. Override the default per client with timeoutMs, or per request with an AbortSignal (a provided signal replaces the timeout signal entirely):

Custom base URL

baseUrl defaults to https://sitegpt.ai and only needs to change if SiteGPT gives you a different API origin:
  • Python SDK — the same client for Python.
  • SiteGPT CLI — the same API from your terminal, scripts, and AI agents (includes a local MCP server).
  • API v2 reference — every endpoint, generated from the live OpenAPI document.