Docs

SDK, REST, three formats.

Install the SDK, request ads, and report impressions and clicks. Text, card, and banner share one endpoint.

TypeScript SDK

Typed API, React hooks, drop-in ad component.

REST API

Request ads. Track impressions and clicks.

Formats

Text, card, banner. Same endpoint, one parameter.

How does a publisher request an ad?

POST /api/ads with a bot id and optional topic. Then POST /api/track/impression or /api/track/click. Use clickUrl for the button, not ctaUrl. Keys stay on the server.

import { PrismAds } from "@prismpublication/sdk";

const prism = new PrismAds({
  apiKey: process.env.PRISM_API_KEY,
  botId: "my-chatbot",
  adFormat: "card",
});

const ad = await prism.displayAd({ topic: "notes", userId: "u-123", frequencyWindow: 5 });
if (ad) await prism.trackImpression(ad.id, "u-123");