- A SiteGPT account with at least one chatbot that has content. API v2 needs the Growth plan or above, on your own account or on the account that owns the chatbot. See Which plan applies.
- A terminal with
curl.
YOUR_API_TOKEN and YOUR_CHATBOT_ID. Replace them with your own values.
Step 1: Create an API token
- Sign in to SiteGPT.
- In the top navigation, select Agents.
- In Create API token, enter the Token name
First API calls. - Keep the default Expires value and the Standard access level.
- Keep All accessible chatbots.
- Select Create token.
- Copy the token. It starts with
sgpt_. SiteGPT shows it only once.
"ok": true. data.user.email is the email address of your account.
Step 2: List your chatbots
data.chatbots list. Each chatbot has an id and a title:
id of the chatbot that you want to test, and save it:
Step 3: Send a message
Send a question as a visitor. Use a question that your content can answer.data.conversation.threadIdis the ID of the new conversation.data.message.answer.textis the chatbot’s answer.
Step 4: Read the conversation
data.conversation. Its messages list has your question and the chatbot’s answer. The conversation also has fields such as mode, escalated, and resolved.
What you did
You created a token, found a chatbot, started a conversation, and read it back. Every API v2 call follows the same pattern:- The base URL is
https://sitegpt.ai/api/v2. - The token goes in the
Authorization: Bearerheader. - The response is
{ "ok": true, "data": ..., "meta": ... }, or{ "ok": false, "error": ... }when something fails.
Next steps
- API conventions: pagination, errors, and deletes.
- Authentication: access levels, scopes, and device login.
- TypeScript SDK and Python SDK: the same calls from code.
- The endpoint pages in this API reference list every operation, with its scopes and fields. The OpenAPI document is at
https://sitegpt.ai/api/v2/openapi.json. - Moving from the legacy API? See Move from API v0 to v2.