Types
TypeScript types for the OnlyFans API — User, Message, Post, Media, Subscription, and all entity types used across the BetterFans Link SDK, the infrastructure behind OFManager.
The SDK ships with comprehensive TypeScript types for the OnlyFans API. Every response field, every query parameter, and every entity shape is typed.
All types are importable directly from the SDK:
import type {
UserFull,
MessageMessage,
Media,
ApiRoutes,
} from "@betterfans/link-sdk"User types
OnlyFans returns different user shapes depending on the context. The SDK provides specific types for each:
| Type | When you get it | Key fields |
|---|---|---|
UserFull | GET /users/me | Full profile with stats, settings, all fields |
UserExtended | Subscriber lists, user lookups | Profile + subscription data |
UserSender | Message sender context | Name, avatar, username |
UserThumbnail | Compact list items | Minimal card data |
UserMessaging | Chat and messaging context | Messaging-specific fields |
UserChatList | Chat list items | Chat-related user info |
UserStory | Story context | Story viewer/creator data |
UserNotification | Notification payloads | Notification-specific fields |
The User union type covers all variants:
import type { User, UserFull, UserExtended } from "@betterfans/link-sdk"Common user fields
Most user types share these fields from UserCore:
interface UserCore {
id: number
name: string
username: string
avatar: string | null
header: string | null
about: string
postsCount: number
mediaCount: number
subscribersCount: number
// ... many more
}Message types
| Type | Description |
|---|---|
MessageMessage | A chat message with responseType: "message" — text, media, pricing, queue status |
MessagePost | A post-shaped payload with responseType: "post" — author, media, voting, labels |
LastMessage | Lightweight preview shown in chat lists |
Message | Union of MessageMessage | MessagePost |
import type { MessageMessage, MessagePost } from "@betterfans/link-sdk"
function handleMessage(msg: MessageMessage) {
console.log(msg.text, msg.price, msg.media)
}Key message fields
interface MessageMessage {
id: number
text: string
price: number
fromUser: UserSender
toUser: UserSender
media: Media[]
createdAt: string
isRead: boolean
// ... many more
}Media types
| Type | Description |
|---|---|
Media | A media attachment (photo, video, audio) |
MediaFile | Media file metadata |
File | Raw file information |
Thumb | Thumbnail data |
Preview | Preview/blur data |
import type { Media } from "@betterfans/link-sdk"
function displayMedia(media: Media) {
console.log(media.type, media.src, media.preview)
}Subscription types
| Type | Description |
|---|---|
SubscribedByData | Data about who subscribed to you |
SubscribedOnData | Data about who you're subscribed to |
SubscriptionBundle | Bundle pricing information |
Trial | Free trial link data |
PromoOffer | Promotional offer details |
Post types
| Type | Description |
|---|---|
MessagePost | The primary post shape (used in feed and responses) |
Post | Minimal post anchor with ID and author |
PostStream | Post stats and overview data |
Story types
| Type | Description |
|---|---|
StoryHighlights | Story highlights collection |
Highlight | Individual highlight with stories |
StoryTop | Top story with engagement stats |
Stream types
| Type | Description |
|---|---|
Stream | Full live room data — room ID, platform, tips, scheduling |
WebSocket event types
| Type | Description |
|---|---|
BusEventMap | Maps event names to payload types |
BusEventType | Union of all event name strings |
BusChatMessageEvent | Chat message event payload |
BusOnlineEvent | Online status change payload |
BusEventEnvelope | Raw event envelope from the bus |
The ApiRoutes interface
The ApiRoutes interface is the type-level registry of every route.
Use it to extract types for any endpoint:
import type { ApiRoutes } from "@betterfans/link-sdk"
// Extract response type
type MyProfile = ApiRoutes["GET /users/me"]["response"]
// Extract query params
type ChatQuery = ApiRoutes["GET /chats"]["query"]
// Extract request body
type NewPost = ApiRoutes["POST /posts"]["body"]
// Extract path params
type MessagePath = ApiRoutes["DELETE /messages/:id"]["pathParams"]This is the foundation of the SDK's type safety — the route string
you pass to request() is used as a key into ApiRoutes to infer
everything else.
Earnings
Access OnlyFans revenue data programmatically — earnings charts, payout history, transaction records, referral balances, and campaign analytics via the BetterFans Link SDK, the infrastructure behind OFManager.
Utilities
Helper functions for working with the API's text format and other conventions.