BetterFans Link SDK — OnlyFans APIBetterFans Link SDK

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:

TypeWhen you get itKey fields
UserFullGET /users/meFull profile with stats, settings, all fields
UserExtendedSubscriber lists, user lookupsProfile + subscription data
UserSenderMessage sender contextName, avatar, username
UserThumbnailCompact list itemsMinimal card data
UserMessagingChat and messaging contextMessaging-specific fields
UserChatListChat list itemsChat-related user info
UserStoryStory contextStory viewer/creator data
UserNotificationNotification payloadsNotification-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

TypeDescription
MessageMessageA chat message with responseType: "message" — text, media, pricing, queue status
MessagePostA post-shaped payload with responseType: "post" — author, media, voting, labels
LastMessageLightweight preview shown in chat lists
MessageUnion 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

TypeDescription
MediaA media attachment (photo, video, audio)
MediaFileMedia file metadata
FileRaw file information
ThumbThumbnail data
PreviewPreview/blur data
import type { Media } from "@betterfans/link-sdk"

function displayMedia(media: Media) {
  console.log(media.type, media.src, media.preview)
}

Subscription types

TypeDescription
SubscribedByDataData about who subscribed to you
SubscribedOnDataData about who you're subscribed to
SubscriptionBundleBundle pricing information
TrialFree trial link data
PromoOfferPromotional offer details

Post types

TypeDescription
MessagePostThe primary post shape (used in feed and responses)
PostMinimal post anchor with ID and author
PostStreamPost stats and overview data

Story types

TypeDescription
StoryHighlightsStory highlights collection
HighlightIndividual highlight with stories
StoryTopTop story with engagement stats

Stream types

TypeDescription
StreamFull live room data — room ID, platform, tips, scheduling

WebSocket event types

TypeDescription
BusEventMapMaps event names to payload types
BusEventTypeUnion of all event name strings
BusChatMessageEventChat message event payload
BusOnlineEventOnline status change payload
BusEventEnvelopeRaw 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.

On this page