Skip to content
Fans API
[official ruby sdk]

OnlyFans
Ruby SDK

An idiomatic Ruby client for the OnlyFans API with rich type support, clear errors, and dependable networking—so your integration stays simple as it grows.

Install
$ bundle add onlyfans --version "~> 0.2.0"
[code examples]

Link stats, chats, messages, media

Fetch the dashboard summary for a tracking link and print clicks, subscribers, spenders, ARPS, and lifetime revenue.
require "bundler/setup"
require "onlyfans"

only_fans_api = Onlyfans::Client.new(api_key: ENV["ONLYFANSAPI_API_KEY"])

# GET /api/{account}/tracking-links/{tracking_link_id}/stats
stats = only_fans_api.tracking_links.get_stats("12345678", account: "acct_XXXXXXXXXXXXX")

summary = stats.data.summary
puts("Clicks: #{summary.clicks_total} · Subs: #{summary.subs_total} · Spenders: #{summary.spenders_total}")

arps = summary.subs_total.to_i.zero? ? 0.0 : summary.revenue_total / summary.subs_total
puts(format("ARPS: $%.2f · Lifetime: $%.2f", arps, summary.revenue_total))
# Output:
# Clicks: 1240 · Subs: 300 · Spenders: 42
# ARPS: $12.40 · Lifetime: $3720.00
[features]

An SDK that feels at
home in Ruby

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

  • Ruby-native API

    Readable method calls and objects that fit naturally into Ruby applications.

  • Yard + RBS + RBI / Sorbet

    Discover classes and methods through comprehensive inline documentation.

  • Connection pooling

    Reuse net/http connections efficiently through connection_pool.

[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.

  • Automatic retries

    Recover from temporary connection, rate-limit, and server failures.

  • Configurable timeouts

    Set client-wide defaults and override behavior for individual calls.

  • Structured errors

    Handle authentication, validation, rate-limit, and server errors separately.

  • Raw responses

    Access headers and underlying response information when you need it.

  • Environment authentication

    Keep credentials out of source control using an environment variable.

  • Custom requests

    Reach additional endpoints without abandoning the SDK client.

[keep exploring]

Everything you need
for the next step

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

  • Screenshot of the Ruby SDK documentation

    Ruby 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-ruby 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

Ruby SDK hero
[START BUILDING]

Build your next integration with Ruby

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