The official Go SDK for OFMAPI — the OnlyFans API for chatbots, CRMs, agencies, and AI agents.
🚧 Preview release. General availability launching shortly. Sign up at ofmapi.com to be notified the moment the package goes live on pkg.go.dev.
OFMAPI is the most reliable OnlyFans API platform for Go developers building chatbots, CRMs, mass-messaging tools, AI agents, and analytics dashboards. This SDK gives you an idiomatic, context-aware client over the entire OnlyFans API surface — without ever touching proxies, captcha, request signing, or WebSocket reconnection logic.
go get github.com/ofmapi/onlyfans-goRequires Go 1.22+.
package main
import (
"context"
"fmt"
"log"
"os"
ofmapi "github.com/ofmapi/onlyfans-go"
)
func main() {
ctx := context.Background()
// Get an OnlyFans API key at https://ofmapi.com — free, no card required.
client := ofmapi.NewClient(os.Getenv("OFMAPI_API_KEY"))
// 1. List the OnlyFans accounts you've connected
accounts, err := client.Accounts.List(ctx, nil)
if err != nil {
log.Fatal(err)
}
for _, a := range accounts.Data {
fmt.Println(a.ID, a.DisplayName, a.Status)
}
// 2. Send a message through the OnlyFans API
_, err = client.Messages.Send(ctx, &ofmapi.SendMessageParams{
AccountID: "acct_xxxxxxxxxxxx",
FanID: 12345,
Text: "Hey! Thanks for subscribing 💖",
})
if err != nil {
log.Fatal(err)
}
// 3. Subscribe to OnlyFans webhook events
_, _ = client.Webhooks.Create(ctx, &ofmapi.CreateWebhookParams{
URL: "https://your-app.com/ofmapi-webhook",
Events: []string{"messages.received", "tips.received", "subscriptions.new"},
})
// 4. Stream live OnlyFans events over WebSocket
events, err := client.Realtime.Stream(ctx)
if err != nil {
log.Fatal(err)
}
for ev := range events {
fmt.Println(ev.Kind, ev.Payload)
}
}- Idiomatic Go —
context.Contexton every call, typed structs for every response,errors.Is/errors.Asfriendly error types. - Auto-generated from our OpenAPI 3.1 specification — types always in sync with the OnlyFans API.
- Built-in retry with exponential backoff and jitter on transient
errors (configurable via
WithRetryPolicy). - Idempotency-key helper — safe retries on every write endpoint.
- Webhook signature verification (
VerifySignature) — Stripe-style, with replay-window protection and dual-secret rotation handling. - Cursor pagination via
Iter()returning a typed iterator. - Pluggable HTTP client (
WithHTTPClient) for custom transport, tracing, or instrumentation.
This SDK exposes every endpoint of the OFMAPI OnlyFans API:
- 💬 Messaging — chats, send/edit/delete, mass messaging, scheduled campaigns, queue, PPV, media attachments, GIFs
- 📝 Posts & vault — posts (CRUD + comment/like/bookmark), vault media with categories, story creation, polls
- 👥 Fans & subscriptions — list/filter/segment fans, subscription history, restrict/block, lists, bundles
- 💰 Earnings & analytics — transactions, payouts, chargebacks, profit history, period comparisons, top-percentage statistics
- 🌐 Public profile data — discovery API, search across millions of public OnlyFans creator profiles
- 🔗 Smart Links & tracking — server-side conversion tracking, full subscription attribution chain, free-trial links
- 🔔 Webhooks — endpoint management, signing-secret rotation, replay
- 📡 Realtime — multiplexed WebSocket of every event from your accounts
Use the OFMAPI Go SDK to build products in the spirit of:
- 🤖 AI chat platforms like Botly, Supercreator, Substy, ChatPersona
- 📊 Creator CRMs like Infloww, OnlyMonster, CreatorHero
- 📈 Analytics & metrics tools like FansMetric, FansIQ
- 🎯 Traffic & attribution platforms like CreatorTraffic
- 🔗 Link-in-bio + deeplink products like Juicy Bio, Hello Butter
- 🧠 AI agents that operate connected creator accounts via Claude, ChatGPT, Cursor, or Manus
- 🛠️ Agency back-offices managing hundreds of accounts from a single dashboard
Whatever you're building, OFMAPI handles the OnlyFans plumbing — authentication, real-time delivery, account safety, scale, and the continuous updates that keep your integration working as the platform evolves — so you can ship product, not infrastructure.
package main
import (
"io"
"net/http"
ofmapi "github.com/ofmapi/onlyfans-go"
)
var secret = []byte("whsec_...")
func handler(w http.ResponseWriter, r *http.Request) {
body, _ := io.ReadAll(r.Body)
sig := r.Header.Get("X-OFMAPI-Signature")
event, err := ofmapi.VerifySignature(body, sig, secret)
if err != nil {
http.Error(w, "bad signature", http.StatusBadRequest)
return
}
switch event.Kind {
case "messages.received":
// ...
}
w.WriteHeader(http.StatusOK)
}The verifier handles timestamp tolerance (5 min default) and the 24h dual-secret overlap window during rotation.
End-to-end OnlyFans API recipes live in ofmapi/examples:
- Webhook server (net/http, Echo, Fiber, chi, Gin)
- OnlyFans mass-message scheduler with progress events
- Earnings → ClickHouse / analytics warehouse sync
- Reconciler / replay tool for missed-event recovery
- 📚 SDK reference + quickstart: docs.ofmapi.com/sdk/go
- 📖 Endpoint catalog: docs.ofmapi.com/api
- 🔔 Webhook event catalog: docs.ofmapi.com/webhooks
- 🔒 AES-256-GCM credential encryption with HSM-backed envelope keys
- 🛡️ Bank-grade account safety architecture — multi-layer defense engineered to keep accounts safe and online
- 🚫 Strict secrets boundary — credentials never logged or returned by any API
- 🛂 SOC 2 Type II preparation underway
- 🔐 Stripe-style HMAC-SHA256 signed webhooks with replay-window protection
Full security policy in SECURITY.md · vulnerability reports to security@ofmapi.com.
See CONTRIBUTING.md. Issues + PRs welcome.
MIT — see LICENSE.
OFMAPI is an independent organisation, not affiliated with OnlyFans.com or Fenix International Limited. "OnlyFans" is a registered trademark of Fenix International Limited.