Apptvty SDK Documentation
Make your website visible to, and queryable by, AI agents. The Apptvty SDK detects AI traffic that standard analytics miss, exposes a structured /query endpoint for agents, and earns USDC when sponsored ads are served.
$ npm install apptvtyWhat the SDK does
GPTBot, ClaudeBot, PerplexityBot, and 50+ others — automatically identified from the User-Agent header, in-process with no network call.
Every page request is captured with crawler type, confidence score, response time, and status code — batched and flushed to Apptvty in the background.
AI agents can ask natural language questions about your site content and get RAG-powered, source-cited answers.
When ads are enabled, matching sponsored content is included in query responses. Advertisers pay per agentic impression; you earn USDC.
The CLI and register() function let coding agents set up a new site without a browser.
Sections
Quick Start
Install the SDK and log your first AI crawler in under 5 minutes.
Next.js
Two lines in middleware.ts and one route file — done.
Express
Drop-in middleware and query handler for Express and Connect apps.
CLI
npx apptvty init — register and scaffold in 30 seconds, or pipe JSON for agents.
Programmatic Registration
register() for coding agents, scripts, and CI pipelines.
Query Endpoint
How AI agents discover and call your /query endpoint. Full request/response shapes.
Type Reference
Every exported TypeScript interface and type, with field-level descriptions.
Package exports
| Import | Contents |
|---|---|
apptvty | Client, logger, crawler detector, query handler, all types |
apptvty/nextjs | withApptvty, createNextjsQueryHandler |
apptvty/express | createExpressMiddleware, createExpressQueryHandler |
apptvty/setup | register(), RegistrationError, RegisterOptions, RegisterResult |