# Build Your Own OnlyFans CRM with a Complete API Backend



> Everything you need to build a CRM like Infloww, CreatorHero, or OnlyMonster. Embeddable auth via our NPM package, full chat and messaging endpoints, media upload and download, fan management, and real-time webhooks — all production-ready.

[Start Free Trial](https://app.onlyfansapi.com/register) · [Read the Docs](https://docs.onlyfansapi.com/api-reference)

## How Your CRM Connects to OnlyFans

Creators authenticate inside your app via our NPM package. Their account data, chats, and media flow through your CRM in real time.

### Creator Auth

@onlyfansapi/auth opens a secure modal in your app

### Account Connected

You get the account ID and profile data

### Your CRM

Chats, fans, media, and revenue via API

### Live Webhooks

Messages, subs, and payments in real time

## Complete OnlyFans API Suite for Modern Agency CRMs

From seamless creator authentication to real-time chat sync, media pipelines, and financial tracking — every layer of your CRM backend is covered.

### Embeddable Creator Authentication

Let creators connect their OnlyFans account directly inside your CRM. Our @onlyfansapi/auth NPM package opens a secure modal with iframe-based auth, handles 2FA, and returns the account ID.
- API: `POST npm install @onlyfansapi/auth` — Zero-dependency NPM package for embedded OnlyFans authentication.
- Webhook: `accounts.connected` — Fires when a creator successfully connects their OnlyFans account.

### Full Chat & Messaging System

Build a complete inbox inside your CRM. List chats, read message history, send text and PPV messages, show typing indicators, and search conversations.
- API: `POST /api/{account}/chats/{chat_id}/messages` — Send messages — text, media, or PPV with pricing.
- Webhook: `messages.received` — Fires on every incoming fan message with full content and sender data.

### Media Upload & Download

Upload photos and videos to the OnlyFans CDN, manage the vault with lists, and download media using CDN URLs. Complete media pipeline for your CRM.
- API: `POST /api/{account}/media/upload` — Upload files or URLs to the OnlyFans CDN for messages and posts.
- Webhook: `messages.ppv.unlocked` — Fires when a fan unlocks paid content to track PPV revenue.

### Fan Management & Lists

Fetch subscriber lists, segment fans with custom labels, view spending history, and build smart lists for targeted outreach.
- API: `GET /api/{account}/fans` — List fans with spending tier, subscription status, and metadata.
- Webhook: `subscriptions.new` — Fires when a new fan subscribes to track growth and trigger onboarding.

### Revenue & Earnings Analytics

Track transaction feeds, earnings breakdowns, payout histories, and chargebacks. Build financial dashboards with real-time accuracy.
- API: `GET /api/{account}/earnings` — Real-time revenue metrics broken down by stream and date.
- Webhook: `transactions.created` — Fires on every tip, post purchase, and subscription renewal.

### Feed & Post Publishing

Create and schedule posts, manage stories, labels, and archives. Let creators publish content directly from your CRM.
- API: `POST /api/{account}/posts` — Create and schedule posts with media, captions, and publishing options.
- Webhook: `posts.liked` — Fires when a fan likes a post so you can measure engagement.

## Ship Faster with Real Code Examples

Embed auth with our NPM package, build a chat inbox, and manage fan profiles — copy these into your project.

### Embed Creator Auth (NPM)

Use the @onlyfansapi/auth NPM package to let creators connect their OnlyFans account inside your CRM. Zero dependencies, framework-agnostic, full TypeScript support.

```ts
// npm install @onlyfansapi/auth
import { startOnlyFansAuthentication } from '@onlyfansapi/auth';

// Step 1: Create a client session on your backend
const sessionResponse = await fetch(
  'https://app.onlyfansapi.com/api/client-sessions',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      client_reference_id: 'user_123_in_your_db'
    })
  }
);
const { token } = await sessionResponse.json();

// Step 2: Open the auth modal in the browser
startOnlyFansAuthentication(token, {
  onSuccess: (data) => {
    // data.accountId = "acct_XXXX"
    // data.username = "creator_username"
    // data.onlyfansData = { id, username, email, avatar_url, name }
    console.log('Connected:', data.accountId);

    // Save to your database
    await db.creators.create({
      accountId: data.accountId,
      username: data.username,
      email: data.onlyfansData.email,
      avatarUrl: data.onlyfansData.avatar_url,
    });
  },
  onError: (error) => {
    console.error('Auth failed:', error.message);
  }
});
```

### Build a Chat Inbox

List all chats for a creator, fetch message history per chat, and send replies — everything needed for a CRM inbox view.

```ts
// List all chats for a creator
const chatsResponse = await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/chats',
  {
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    }
  }
);
const chats = await chatsResponse.json();

// Get messages for a specific chat
const messagesResponse = await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/chats/' + chatId + '/messages',
  {
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    }
  }
);
const messages = await messagesResponse.json();

// Send a reply from the CRM
await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/chats/' + chatId + '/messages',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      text: 'Thanks for your message! 💕'
    })
  }
);

// Send a PPV message with media
const mediaResponse = await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/media/upload',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      file_url: 'https://your-cdn.com/exclusive.mp4'
    })
  }
);
const media = await mediaResponse.json();

await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/chats/' + chatId + '/messages',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      text: 'Something special just for you 🔥',
      price: 14.99,
      mediaFiles: [media.data.id]
    })
  }
);
```

### Fan CRM View

Build a complete fan profile view: spending data, subscription history, notes, custom tags, and user list membership.

```ts
// Get fan profile with full spending breakdown
const fanResponse = await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/users/' + fanUsername,
  {
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    }
  }
);
const fan = await fanResponse.json();
// fan.data.subscribedOnData = {
//   totalSumm, messagesSumm, tipsSumm,
//   postsSumm, streamsSumm, subscribesSumm
// }

// Get subscription history
const historyResponse = await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/fans/' + fan.data.id
    + '/subscriptions-history',
  {
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    }
  }
);
const history = await historyResponse.json();

// Set custom name (CRM display name)
await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/fans/' + fan.data.id + '/custom-name',
  {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      customName: 'VIP Whale - $' + fan.data.subscribedOnData.totalSumm
    })
  }
);

// Add fan notes
await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/fans/' + fan.data.id + '/notes',
  {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      note: 'High spender. Prefers exclusive content. '
        + 'Last tip: $50 on 2025-03-15.'
    })
  }
);

// Add to a user list for segmentation
await fetch(
  'https://app.onlyfansapi.com/api/acct_XXXX/user-lists/vip_list_id/users',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      userIds: [fan.data.id]
    })
  }
);
```

## Essential Endpoints & Webhooks for CRM Architecture

Every endpoint and webhook needed to sync accounts, stream live messages, and manage content in your custom CRM.

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/client-sessions` | Create client session for embedded auth |
| POST | `/api/authenticate` | Start authentication flow |
| GET | `/api/authenticate/{attempt_id}` | Poll authentication status |
| PUT | `/api/authenticate/{attempt_id}` | Submit 2FA code |
| GET | `/api/{account}/chats` | List all chats |
| GET | `/api/{account}/chats/{chat_id}/messages` | List messages in a chat |
| POST | `/api/{account}/chats/{chat_id}/messages` | Send message (text/media/PPV) |
| GET | `/api/{account}/chats/{chat_id}/messages/search` | Search messages in a chat |
| POST | `/api/{account}/chats/{chat_id}/typing` | Show typing indicator |
| GET | `/api/{account}/chats/{chat_id}/media` | List media in a chat (gallery) |
| POST | `/api/{account}/media/upload` | Upload media to OnlyFans CDN |
| GET | `/api/{account}/media/download/{cdnUrl}` | Download media from CDN |

**Webhook events**

- `accounts.connected` — Creator connects their OnlyFans account via your embedded auth.
- `accounts.reconnected` — Creator reconnects after session expiry.
- `accounts.authentication_failed` — Session expired and auto-reconnect failed — prompt re-authentication.
- `messages.received` — New incoming fan message — update your CRM inbox in real time.
- `messages.sent` — Outgoing message confirmed — sync sent status in your CRM.
- `messages.ppv.unlocked` — Fan unlocked PPV content — track revenue per message.
- `subscriptions.new` — New subscriber — automatically create a fan profile in your CRM.
- `subscriptions.renewed` — Subscription renewed — update lifecycle status.
- `transactions.new` — Payment received — update fan spending and revenue analytics.
- `tips.received` — Fan sent a tip — update fan profile and trigger notifications.

## Building an OnlyFans CRM — Frequently Asked Questions

Common questions about using OnlyFans API as your CRM backend.

### Can I build a CRM like Infloww or CreatorHero with this API?

Yes. OnlyFans API provides everything you need: embeddable auth for creator onboarding, full chat and messaging endpoints for building an inbox, media upload and download, fan management with spending data and segmentation, revenue analytics, and real-time webhooks. Companies like these use the same infrastructure patterns.

### How does the embedded authentication work?

Install the @onlyfansapi/auth NPM package (zero dependencies, framework-agnostic). Create a client session on your backend, then call startOnlyFansAuthentication() in the browser. A secure modal opens where the creator logs in with email/password and 2FA. On success, you get their account ID, username, and profile data. The accounts.connected webhook also fires on your server.

### Can I build a full chat inbox in my CRM?

Yes. The API provides endpoints to list all chats, read message history with pagination, send text and PPV messages with media, show typing indicators, search messages, and manage chat state (mark as read, mute, pin). The messages.received webhook fires in real time so you can update your inbox instantly.

### How do I handle media upload and download?

Upload media using the media/upload endpoint — pass a direct file or a URL. The endpoint returns a media ID you can attach to messages or posts. For downloading, use the media/download endpoint with a CDN URL. The vault endpoints let you manage media libraries with categories.

### Can multiple creators connect to my CRM?

Yes. Each creator authenticates separately via the embedded auth flow and gets their own account ID. Your API key can manage multiple accounts. The Pro plan includes 5 accounts, with additional accounts at $29 each (volume discounts up to 60% off). Enterprise plans support 100+ accounts.

### What fan data is available for CRM profiles?

Full fan profiles include display name, username, subscription status, and complete spending breakdown (messages, tips, posts, streams, subscriptions). You can set custom names and notes per fan, manage user lists for segmentation, and track subscription history over time.

### How do I keep my CRM data in sync with OnlyFans?

Use webhooks. Events fire in real time for new subscriptions, renewals, transactions, tips, messages, and PPV unlocks. Your server receives the event with full payload data and updates your CRM database. No polling needed — everything is push-based.

### Does the auth package work with React, Vue, and other frameworks?

Yes. The @onlyfansapi/auth package is framework-agnostic. It exports ESM and CommonJS modules with full TypeScript definitions. It works with React, Vue, Svelte, Next.js, vanilla JS, or any web framework. The modal UI is responsive and mobile-friendly.

## Build the Next Great OnlyFans CRM. We Handle the Infrastructure.

Start free. Ship your first auth flow and inbox in a day.

[Start For Free](https://app.onlyfansapi.com/register) · [See Pricing](https://onlyfansapi.com/pricing)

## Links

- View on site: https://onlyfansapi.com/onlyfans-crm-api
- API reference: https://docs.onlyfansapi.com/api-reference
- All 320+ endpoints: https://docs.onlyfansapi.com/api-reference/overview
- All 25 webhook events: https://docs.onlyfansapi.com/webhooks/available-events
- Auth package: https://www.npmjs.com/package/@onlyfansapi/auth
- Pricing: https://onlyfansapi.com/pricing
- Sign up: https://app.onlyfansapi.com/register