API docs / API Reference

API Reference

OnlyFans API Reference

Complete OnlyFans API route reference: chats, messages, posts, users, subscriptions, vault, stories, earnings. Every route is fully typed in the SDK.

Every route on the OnlyFans API is available through the SDK with full type safety. Route strings, query parameters, request bodies, and responses are all typed at compile time.

How routes work

Routes follow the "VERB /path" format. TypeScript uses the route string to infer the exact parameter and response types:

// TypeScript knows this route returns a UserFull
const [err, me] = await account.request("GET /users/me", {})
me.name // ✓ autocomplete works

// TypeScript knows this route needs pathParams.id and a body
const [err, msg] = await account.request("POST /chats/:id/messages", {
  pathParams: { id: "12345" },
  body: { text: markdownToHtml("Hello!") },
})

If you mistype a route, TypeScript catches it at compile time:

// ✗ Type error — no such route
await account.request("GET /chat", {})

Route domains

  • Chats: List chats, search conversations, mark as read.
  • Messages: Send messages, manage queue, likes, PPV.
  • Posts: Create, update, delete, and query posts.
  • Users: Profiles, stats, notifications, settings, blocks.
  • Subscriptions: Subscribers, subscribes, trials, history.
  • Vault: Vault lists, media management, visibility.
  • Stories: Story items, highlights, charts, top content.
  • Earnings: Revenue charts, payouts, referrals, transactions.

Extracting types

You can extract the input and output types for any route:

import type { ApiRoutes } from "@betterfans/link-sdk"

// Response type for a specific route
type ChatList = ApiRoutes["GET /chats"]["response"]

// Query parameters for a route
type ChatQuery = ApiRoutes["GET /chats"]["query"]

// Path parameters for a route (when applicable)
type MessagePath = ApiRoutes["POST /chats/:id/messages"]["pathParams"]
// { id: string }

// Request body for a write route
type SendBody = ApiRoutes["POST /chats/:id/messages"]["body"]