OpenstatXHomeDeveloper docsOpenAPIllms.txt中文

Quickstart

1. Create a workspace (no signup)

Enter your domain on the home page and click "Start tracking". The system creates a persistent anonymous workspace, a secure session and your first site, and shows the recovery key only once. Save it in a password manager; it cannot be recovered if lost.

Programmatic creation (suitable for scripts running in a trusted environment):

curl -sS -X POST https://openstatx.com/api/v1/workspaces \
  -H 'content-type: application/json' \
  -d '{"domain":"example.com","client":"programmatic"}'

The recovery_key in the response must be handed to a human for safekeeping and must not end up in a chat transcript. The bootstrap_token is a restricted token valid for 1 hour; it can only add sites, fetch the install snippet and create read-only credentials.

2. Install the snippet

<script defer src="https://openstatx.com/tracker.js" data-site="PUBLIC_SITE_ID"></script>

3. View reports

The dashboard's "Site overview" shows the browser ledger (PV, UV, sessions, bounce rate) and the HTTP ledger (requests, AI, automation). Every page offers "View API" / "Copy AI query".

4. Read via the API

Create a read-only credential under "Workspace → API credentials" (only summary:read by default), then:

curl -sS https://openstatx.com/api/v1/sites -H "authorization: Bearer $OPENSTATX_TOKEN"
curl -sS "https://openstatx.com/api/v1/sites/$SITE_ID/overview?preset=last_7_days" -H "authorization: Bearer $OPENSTATX_TOKEN"

All credentials in these examples are read from environment variables (OPENSTATX_TOKEN). Never hand your workspace recovery key to an AI or put it in a script.

5. Connect AI (MCP)

Add https://openstatx.com/mcp as a Remote MCP server. Clients that support custom request headers can use Authorization: Bearer stk_... directly; generic clients use OAuth authorization code + PKCE and choose permissions and sites on the consent page. See MCP integration.