The official Node / TypeScript SDK for OFMAPI — the OnlyFans API for chatbots, CRMs, agencies, and AI agents.
🚧 Preview release. General availability launching shortly. Sign up at ofmapi.com to be notified the moment the package goes live on npm.
OFMAPI is the most reliable OnlyFans API platform for Node and TypeScript developers building chatbots, CRMs, mass-messaging tools, AI agents, and analytics dashboards. This SDK gives you a fully typed client over the entire OnlyFans API surface — without ever touching proxies, captcha, request signing, or WebSocket reconnection logic.
npm install @ofmapi/onlyfans
# or
pnpm add @ofmapi/onlyfans
# or
bun add @ofmapi/onlyfansRequires Node 20+, Bun, or Deno (via npm: specifier). Works in Node,
Bun, Deno, and Edge runtimes (Cloudflare Workers, Vercel Edge, Fastly).
import { Client } from "@ofmapi/onlyfans";
// Get an OnlyFans API key at https://ofmapi.com — free, no card required.
const client = new Client({ apiKey: process.env.OFMAPI_API_KEY! });
// 1. List the OnlyFans accounts you've connected
const accounts = await client.accounts.list();
for (const a of accounts) console.log(a.id, a.displayName, a.status);
// 2. Send a message through the OnlyFans API
await client.messages.send({
accountId: "acct_xxxxxxxxxxxx",
fanId: 12345,
text: "Hey! Thanks for subscribing 💖",
});
// 3. Subscribe to OnlyFans webhook events
await client.webhooks.create({
url: "https://your-app.com/ofmapi-webhook",
events: ["messages.received", "tips.received", "subscriptions.new"],
});
// 4. Stream live OnlyFans events over WebSocket
for await (const event of client.realtime.stream()) {
console.log(event.kind, event.payload);
}- Full TypeScript types for every method, response, and webhook event — auto-generated from our OpenAPI 3.1 specification, always in sync with the OnlyFans API.
- Promise-based and AsyncIterable-based ergonomics — pick what suits your code.
- Built-in retry with exponential backoff and jitter on transient errors.
- Idempotency-key helper — safe retries on every write endpoint.
- Webhook signature verification (
verifySignature) — Stripe-style, with replay-window protection and dual-secret rotation handling. - Cursor-based pagination as async iterators
(
for await (const fan of client.fans.iter()) ...). - Tree-shakeable — bundle only what you import.
- Edge-compatible — Cloudflare Workers, Vercel Edge, Fastly Compute.
This SDK exposes every endpoint of the OFMAPI OnlyFans API:
- 💬 Messaging — chats, send/edit/delete, mass messaging, scheduled campaigns, queue, PPV, media attachments, GIFs
- 📝 Posts & vault — posts (CRUD + comment/like/bookmark), vault media with categories, story creation, polls
- 👥 Fans & subscriptions — list/filter/segment fans, subscription history, restrict/block, lists, bundles
- 💰 Earnings & analytics — transactions, payouts, chargebacks, profit history, period comparisons, top-percentage statistics
- 🌐 Public profile data — discovery API, search across millions of public OnlyFans creator profiles
- 🔗 Smart Links & tracking — server-side conversion tracking, full subscription attribution chain, free-trial links
- 🔔 Webhooks — endpoint management, signing-secret rotation, replay
- 📡 Realtime — multiplexed WebSocket of every event from your accounts
Use the OFMAPI Node / TypeScript SDK to build products in the spirit of:
- 🤖 AI chat platforms like Botly, Supercreator, Substy, ChatPersona
- 📊 Creator CRMs like Infloww, OnlyMonster, CreatorHero
- 📈 Analytics & metrics tools like FansMetric, FansIQ
- 🎯 Traffic & attribution platforms like CreatorTraffic
- 🔗 Link-in-bio + deeplink products like Juicy Bio, Hello Butter
- 🧠 AI agents that operate connected creator accounts via Claude, ChatGPT, Cursor, or Manus
- 🛠️ Agency back-offices managing hundreds of accounts from a single dashboard
Whatever you're building, OFMAPI handles the OnlyFans plumbing — authentication, real-time delivery, account safety, scale, and the continuous updates that keep your integration working as the platform evolves — so you can ship product, not infrastructure.
import { verifySignature, SignatureMismatch } from "@ofmapi/onlyfans";
export async function POST(request: Request) {
const body = await request.text();
const sig = request.headers.get("X-OFMAPI-Signature")!;
try {
const event = verifySignature(body, sig, process.env.WEBHOOK_SECRET!);
if (event.kind === "messages.received") {
// typed payload — `event.payload` is fully narrowed
}
return new Response(null, { status: 200 });
} catch (e) {
if (e instanceof SignatureMismatch) return new Response(null, { status: 400 });
throw e;
}
}The verifier handles timestamp tolerance (5 min default) and the 24h dual-secret overlap window during rotation.
End-to-end OnlyFans API recipes live in ofmapi/examples:
- Webhook server (Next.js Route Handlers, Hono, Express, Fastify, Elysia)
- OnlyFans mass-message scheduler with progress events
- AI auto-reply chatbot (Vercel AI SDK + OpenAI / Claude / Anthropic)
- Earnings dashboard (Next.js + Tremor)
- Reconciler / replay tool for missed-event recovery
- 📚 SDK reference + quickstart: docs.ofmapi.com/sdk/node
- 📖 Endpoint catalog: docs.ofmapi.com/api
- 🔔 Webhook event catalog: docs.ofmapi.com/webhooks
- 🔒 AES-256-GCM credential encryption with HSM-backed envelope keys
- 🛡️ Bank-grade account safety architecture — multi-layer defense engineered to keep accounts safe and online
- 🚫 Strict secrets boundary — credentials never logged or returned by any API
- 🛂 SOC 2 Type II preparation underway
- 🔐 Stripe-style HMAC-SHA256 signed webhooks with replay-window protection
Full security policy in SECURITY.md · vulnerability reports to security@ofmapi.com.
See CONTRIBUTING.md. Issues + PRs welcome.
MIT — see LICENSE.
OFMAPI is an independent organisation, not affiliated with OnlyFans.com or Fenix International Limited. "OnlyFans" is a registered trademark of Fenix International Limited.