Programmatic Registration
Onboard sites and trigger re-indexing directly from your code. Ideal for coding agents, deployment scripts, and automated setup tools.
Overview
The register() function automates the site registration process. It returns all necessary credentials and scaffolded file contents, allowing an agent to complete a full integration without human intervention or CLI prompts.
typescript
import { register } from 'apptvty/setup';
async function onboard() {
const result = await register({
domain: 'mysite.com',
framework: 'nextjs',
agentId: 'my-custom-agent'
});
console.log('Site ID:', result.siteId);
console.log('API Key:', result.apiKey);
console.log('Dashboard:', result.dashboardUrl);
}RegisterOptions
| Field | Type | Description |
|---|---|---|
| domain | string | Required. The site domain, e.g. "mysite.com". |
| framework | "nextjs" | "express" | "other" | Optional. Used for file scaffolding (default: "other"). |
| agentId | string | Optional. Identifier for the registering agent (useful for analytics). |
| string | Optional. Email to associate for magic link claiming. | |
| apiUrl | string | Optional. Override API base URL. |
RegisterResult
Returns credentials, dashboard links, and the full state for environment files.
typescript
interface RegisterResult {
siteId: string;
apiKey: string;
companyId: string;
walletAddress: string | null; // Crossmint USDC wallet
dashboardUrl: string; // Auto-login claim link
setup: {
envVars: {
APPTVTY_SITE_ID: string;
APPTVTY_API_KEY: string;
};
files?: Record<string, string>; // Maps path -> file content (e.g. middleware.ts)
};
}Triggering Re-indexing
Coding agents can also trigger a re-crawl of the site using the migrate() function. This is useful after an agent has modified site content or updated the sitemap.
typescript
import { migrate } from 'apptvty/setup';
await migrate({
siteId: 'site_abc123',
apiKey: 'ak_live_...'
});