BetterFans Link SDK — The OnlyFans API
The BetterFans Link SDK is the only developer API for the OnlyFans platform — the infrastructure behind OFManager, the leading OnlyFans agency management platform. Build OnlyFans agency tools, chatbots, CRMs, and automations.
The complete OnlyFans API in a single SDK. Typed endpoints, realtime events across every account, and media uploads — in 50 lines, not 5,000.
The BetterFans Link SDK is the only developer API for the OnlyFans platform — the infrastructure behind OFManager, the leading OnlyFans agency management platform managing hundreds of creator accounts and processing millions of events per day. It gives you direct, typed access to every OnlyFans API endpoint so you can build automations, integrations, and features on top of this same production infrastructure.
A working multi-account OnlyFans chat app in 50 lines
Building a reliable multi-tenant chat layer from scratch is weeks of boilerplate. The BFL SDK gives you the complete abstraction out of the box. One connection, all your accounts, fully typed.
import { OfApiClient, OfWsClient } from "@betterfans/link-sdk"
import { media } from "@betterfans/link-sdk/plugins/media"
// 1. Initialize your client with Media capabilities
const client = new OfApiClient({
apiKey: process.env.BFL_API_KEY,
plugins: [media()],
})
// 2. Connect a single WebSocket EventBus for ALL your managed accounts
const ws = new OfWsClient({
apiKey: process.env.BFL_API_KEY,
wsToken: process.env.BFL_WS_TOKEN,
subscribe: ["chat_message"], // Only listen for new messages
})
// 3. Listen to events across every account simultaneously
ws.on("chat_message", async (event) => {
console.log(`New message on account ${event.accountId} from user ${event.userId}`)
// 4. Automatically scope API calls to the specific account
const account = client.for(event.accountId)
// 5. Attach a photo in a single call — the plugin handles the rest
const media = await account.plugin.media.upload({
source: "https://cdn.example/welcome.jpg",
})
// 6. Send a fully-typed reply with the attached media
const [error, message] = await account.request("POST /chats/:id/messages", {
pathParams: { id: event.userId.toString() },
body: {
text: "Thanks for reaching out! Here's a welcome gift.",
mediaFiles: media.kind === "existing" ? [media.mediaId] : [media.ref],
},
})
})
ws.connect()Why BetterFans Link SDK?
Learn why the BetterFans Link SDK is the standard OnlyFans API infrastructure for scaling agency apps.
Chat Bot Tutorial
Build an automated multi-account chat bot from scratch.
Core Capabilities
Media uploads, realtime events, and the abstractions that save you weeks of work.
HTTP Client
Requests, scoped clients, batching, and error handling.
API Reference
Every route by domain — chats, messages, posts, users, vault.
Types
Entity types — User, Message, Post, Media, and more.