Skip to main content
SiteGPT supports OAuth Device Authorization Grant for local CLIs, scripts, and personal AI agents. This is the protocol used by sitegpt login. Use this page when you are building an agent or integration that wants to authenticate without asking the user to copy a token manually.
Most users should run sitegpt login instead of calling these endpoints directly. The CLI handles device authorization, polling, profile storage, and API token use.

Discovery

Agents can discover SiteGPT’s OAuth device flow from the authorization-server metadata:
The protected API resource metadata is available at:
The API resource is:

Client ID

Use this client ID for the first-party SiteGPT CLI/device flow:
client_id identifies the application requesting access. It is not a secret and does not identify the user. All users of the SiteGPT CLI use the same client_id.

Start device authorization

Send a form-encoded request to /oauth/device_authorization:
Response:
Open verification_uri_complete in a browser. The signed-in SiteGPT user reviews the requested access and approves or denies the request.

Poll for the token

Poll /oauth/token with the device code:
Before approval, SiteGPT returns:
Respect the interval before polling again. If you poll too quickly, SiteGPT can return:
After approval, SiteGPT returns a scoped bearer token:
Use access_token as the bearer token for /api/v2 requests:

Request fields

/oauth/device_authorization

/oauth/token

Error responses

Security notes

  • Do not put access_token in prompts, shared chats, source code, or logs.
  • Use the smallest scope set needed for the agent.
  • Use chatbot_id restrictions for chatbot-specific agents.
  • Rotate or revoke tokens after demos and shared sessions.
  • For normal CLI usage, prefer sitegpt login; it stores the token in a local profile.