SDK
Node.js and TypeScript SDK
Use the typed Genesis client in server-side agent and web app integrations.
Install after registry publication
Public npm installation is a post-publication launch gate. Until `sdk:registries:verify` passes, use the workspace package in local development.
npm install @thegenesis/api-client-jsAuth and client setup
import { GenesisClient } from "@thegenesis/api-client-js";
const genesis = new GenesisClient({
apiKey: process.env.GENESIS_API_KEY,
mode: "test",
retries: 2,
timeoutMs: 150
});
await genesis.requestOffers({
testMode: true,
placement: {
placementId: "chat_recommendation_after_answer",
appId: "app_docs_quickstart",
agentType: "conversational_assistant",
surface: "chat"
},
context: {
userMessage: "I need SOC 2 monitoring for a seed-stage SaaS.",
intentKeywords: ["soc2", "monitoring"],
categories: ["security_compliance"],
country: "US"
},
user: {
sessionId: "session_docs_123456"
},
controls: {
maxOffers: 2,
requireDisclosure: true
}
});Tracking
await genesis.trackImpression(response.offers[0]);
await genesis.trackClick(response.offers[0]);Runtime behavior
The SDK should retry transient network failures, enforce timeouts, and return a no-offer fallback instead of throwing during normal no-fill paths.
Keep secret API keys on the server, hash user identifiers before sending them, and render the returned sponsored disclosure wherever an offer appears.