Skip to content
Fans API
[official typescript sdk]

OnlyFans
TypeScript SDK

A modern, fully typed SDK for server-side JavaScript and TypeScript. Get editor autocomplete, predictable errors, and simple access to every OnlyFans API endpoint.

Install
$ npm install @onlyfansapi/onlyfans-sdk
/TYPESCRIPT/NODE, DENO, BUN/BUILT-IN RETRIES
[code examples]

Link stats, chats, messages, media

Fetch clicks, subscriptions, spenders, and revenue for a tracking link, then derive ARPS and lifetime revenue from the typed summary.
import OnlyFansAPI from '@onlyfansapi/onlyfans-sdk';

const client = new OnlyFansAPI();

// GET /api/{account}/tracking-links/{tracking_link_id}/stats
const { data } = await client.trackingLinks.getStats('12345678', {
  account: 'acct_XXXXXXXXXXXXX',
});

const summary = data?.summary;
console.log(`Clicks: ${summary?.clicks_total} · Subs: ${summary?.subs_total} · Spenders: ${summary?.spenders_total}`);

const arps = (summary?.revenue_total ?? 0) / (summary?.subs_total || 1);
console.log(`ARPS: $${arps.toFixed(2)} · Lifetime: $${summary?.revenue_total}`);
// Output:
// Clicks: 1240 · Subs: 300 · Spenders: 42
// ARPS: $12.40 · Lifetime: $3720
[features]

A type-safe OnlyFans API client
for Node.js, Deno and Bun

Idiomatic objects, flexible IO, and strong tooling support for growing codebases.

  • Fully Typed

    TypeScript definitions for every request and response, with docs on hover in your editor.

  • Automatic retries

    Failed requests retry twice with exponential backoff, including rate limits and timeouts.

  • Flexible uploads

    Pass a web File, a fetch Response, an fs.ReadStream, or use the toFile helper.

[production ready]

The details that matter
after your first request

Resilient networking and predictable behavior are built into the client, so production code stays focused on your product.

  • Analytics Dashboards

    Bring account and performance data into reporting experiences your team can act on.

  • Media Workflows

    Build upload flows around familiar file, stream, and byte-based objects.

  • Internal Automation

    Build upload flows around familiar file, stream, and byte-based objects.

  • Multi-account tools

    Create focused interfaces for teams working across multiple connected accounts.

  • Reporting Pipelines

    Move structured API responses into warehouses, spreadsheets, and custom reports.

  • Custom integrations

    Extend the typed client with custom requests when your product needs more flexibility.

[keep exploring]

Everything you need
for the next step

Move from the quick start to complete endpoint details and source code.

  • Screenshot of the TypeScript SDK documentation

    TypeScript SDK docs

    Installation, configuration, examples, and language-specific guidance.

  • Screenshot of the OnlyFans API reference

    API reference

    Explore endpoints, parameters, response schemas, and error details.

  • Screenshot of the onlyfansapi-typescript-sdk GitHub repository

    Source on GitHub

    Review the SDK source, releases, examples, and contribution guide.

[faq]

Questions before you start

The questions agencies and developers actually ask, answered by the team that runs proxies at scale.

Do you have more questions?Contact Us

TypeScript SDK hero
[START BUILDING]

Build your next integration
with TypeScript

Install the SDK, connect your API key, and make your first OnlyFans API request in minutes.