# Frequently Asked Questions (/faq) import { Accordion, Accordions } from "fumadocs-ui/components/accordion"; ## Getting Started Follow the steps at [app.onlyfansapi.com/register](https://app.onlyfansapi.com/register). It takes less than 1 minute. Yes! You can use our no-code integrations with [Make](/integrations/make), [n8n](/integrations/n8n), or [Zapier](/integrations/zapier). If you need hands-on help, email us at [hello@onlyfansapi.com](mailto:hello@onlyfansapi.com). No sandbox environment is available. However, you can simply create a new account on OnlyFans.com and connect it to OnlyFans API for testing purposes. All of our API endpoints can be used with any programming language. Click on any endpoint in our [API Reference](/api-reference) to view code examples in cURL, JavaScript/TypeScript, Go, Python, Java, and C#. Yes, absolutely. Just make sure you don't connect multiple services in parallel to the same account. ## API Capabilities & Features Yes, our API fully supports reading and sending messages. Refer to our [List Chats](/api-reference/chats/list-chats) and [Send Message](/api-reference/chats/send-message) endpoints for more details. Image generation is not natively supported at this time. However, we recommend third-party solutions like [fanscreator.ai](https://fanscreator.ai) for this functionality. Direct vault uploads aren't supported by OnlyFans. However, you have a few options: * **Recommended:** Upload media exactly when and where it needs to be posted — for example, directly to a post, message, or scheduled post — instead of preloading it into the vault. This keeps your workflow simple and avoids unnecessary steps. * If you still want to store media in the vault ahead of time, you can: * Upload media using our [OnlyFans CDN upload](/api-reference/media/upload-media-to-the-only-fans-cdn) endpoint. * [Create a post](/api-reference/posts/send-post) with the media, then delete it immediately - the media will remain in your vault * Use our [Send Message](/api-reference/chats/send-message) endpoint to include the media in a message, then delete the message — again, the media will stay in your vault. Yes! Many customers successfully use tools like [n8n](https://n8n.io) and [Supabase](https://supabase.com) for faster development and deployment. Use our [Send Mass Message](/api-reference/mass-messaging/send-mass-message) endpoint. Include just one user ID in the `userIds` array to effectively schedule a message for an individual chat. This behaves exactly like the native "Scheduled Messages" feature in OnlyFans. Refer to our dedicated guide on [setting a price for PPV content](/introduction/guides/composing-messages#setting-a-price-ppv). This will be available in our upcoming Advanced Endpoints feature. You're likely missing the account prefix. * ❌ Wrong: `/api/fans/active` * ✅ Correct: `/api/acct_XXXXXXXX/fans/active` ## Security & Safety Yes, absolutely. We have a 5-year track record with: * Zero accounts banned * Zero accounts red-flagged * Enterprise-grade security measures No. We have a track record of zero account bans over the past 5 years, including many customers using OnlyFans API to build chatbots. Your security is our priority: * All passwords and cookies are hashed in our database * We use OpenSSL with AES-256-CBC encryption * All data is signed with MAC (Message Authentication Code) We implement robust proxy protection: * Each connected account gets a dedicated IP address * Public endpoints use rotating residential proxies * This prevents detection and ensures account safety For more information, refer to our dedicated [proxies guide](introduction/essentials/proxies). ## API Stability & Performance Our API infrastructure includes: * Web Application Firewall (WAF) * Proxy management * Built-in rate limiting * No stability issues reported to date Check our real-time status at: [status.onlyfansapi.com](https://status.onlyfansapi.com) Website updates have minimal impact: * Downtime only occurs if OnlyFans itself is down * We typically adapt to changes within minutes * No extended service interruptions Cache duration varies per endpoint, though most endpoints are not cached. Check our [response structure guide](/introduction/essentials/response-structure) for specific cache durations. ## Rate Limiting & Best Practices **Recommended approach:** Implement exponential backoff 1. When you receive a 429 error, wait 1 second 2. If it happens again, double the wait time (2s → 4s → 8s) 3. Continue up to a maximum wait time 4. Use queuing systems like AWS SQS, Laravel Queues, or Ruby Sidekiq Email us at [hello@onlyfansapi.com](mailto:hello@onlyfansapi.com) for code examples. Rate limits are documented in our [Rate Limits](/introduction/essentials/rate-limits) guide. ## API Keys Management **Best practice:** One API key per service/integration * Create separate keys for different features * Assign dedicated keys to external developers * This improves security and tracking No, you can create as many API keys as you want, regardless of your subscription plan. Yes, a single API key can access all available endpoints. No. Every API key has full access to every account you've connected to OnlyFans API, including every endpoint. ## Account Authentication & Management **Through our [Console](https://app.onlyfansapi.com):** 1. Go to Dashboard -> Accounts 2. Find the relevant account 3. Click on the Account ID to copy it **Through our API:** 1. Call our [List Accounts](/api-reference/account/list-accounts) endpoint 2. The response includes the account ID in the `id` field OnlyFans API account IDs **always** start with `acct_` Always use the format: `acct_XXXXXXXX` * Include the `acct_` prefix * Endpoint URL example: `https://app.onlyfansapi.com/api/acct_abc123/chats` Yes! Use these endpoints for authentication: * [Start Authentication](/api-reference/connect-onlyfans-account/start-authentication) * [Poll Authentication Status](/api-reference/connect-onlyfans-account/poll-authenticationStatus) * Optionally, [Submit 2FA](/api-reference/connect-onlyfans-account/submit2fa) Use our [Get Current Account](/api-reference/account/get-current-account) endpoint to retrieve the authenticated account details. No need to use our UI - integrate these endpoints directly with your platform. Yes! Use our [Start Authentication](/api-reference/connect-onlyfans-account/start-authentication) endpoint. We also have an authentication library available on NPM — see our [Auth documentation](/auth). Follow the "Option 2: By providing cURL request" step in our [connect OnlyFans account guide](/introduction/guides/connect-onlyfans-account#option-2-by-providing-curl-request). It is currently not possible to retrieve the user agent that OnlyFans API uses to make requests. Unfortunately, no — not without risking a red-flag from OnlyFans. Our authentication process is already optimized to be as fast as possible while maintaining safety. The experience is nearly identical to OnlyFans' native process: 1. The QR code that the model normally scans during OF login will appear in our dashboard and via email (sent to both the OnlyFans API user and the model) 2. After scanning the code and completing the selfie check, the account will be authenticated You're probably adding the account again instead of re-connecting it. Use the [Re-authenticate Account](/api-reference/connect-onlyfans-account/re-authenticate-account) endpoint instead of [Start Authentication](/api-reference/connect-onlyfans-account/start-authentication). Yes! Use our [List Accounts](/api-reference/account/list-accounts) endpoint. You can retrieve this through: * The [Get Current Account](/api-reference/account/get-current-account) endpoint under `subscribersCount` * Or the [List User Lists](/api-reference/user-list-collections/list-user-lists) endpoint under `fans.usersCount` The "top X percentage of all creators" value can be retrieved through: * [Get Top Percentage](/api-reference/account/get-top-percentage) endpoint * Or [Get Current Account](/api-reference/account/get-current-account) under `performerTop` Go to our dashboard at [app.onlyfansapi.com](https://app.onlyfansapi.com) and click on "Invite & manage members" in the sidebar. ## Fan Data & Analytics This is normal behavior: * Chat lists return immediately * Fan details are scraped in the background (usually takes 2-3 seconds) Either call our [Get User Details](/api-reference/users/get-user-details) endpoint, or retry the original endpoint after 10 seconds. Use the lastSeen field from our [Get Profile Details](/api-reference/public-profiles/get-profile-details) or [Get User Details](/api-reference/users/get-user-details) endpoints. If the `lastSeen` value is recent, the fan is likely online. ```json { "lastSeen": "2025-05-01T15:01:07+00:00" ... } ``` [-> Read more about caching](/introduction/essentials/response-structure#cache-control) There's two options available: * **Calculate manually:** Use `subscribedOnData.subscribeAt` on endpoints like [List Active Fans](/api-reference/fans/list-active-fans) or [Get User Details](/api-reference/users/get-user-details). * **Human-readable format:** Use `subscribedOnData.duration` (e.g., "3 months") Access comprehensive spending data through these fields: | Field | Description | | ---------------- | ------------------------------ | | `totalSumm` | Combined total of all spending | | `subscribesSumm` | Total spent on subscriptions | | `tipsSumm` | Total spent on tips | | `messagesSumm` | Total spent on paid messages | | `postsSumm` | Total spent on paid posts | | `streamsSumm` | Total spent on streams | * [Get User Details](/api-reference/users/get-user-details) * [List Active Fans](/api-reference/fans/list-active-fans) Filter by fan spendings in our [List Active Fans](/api-reference/fans/list-active-fans), [List All Fans](/api-reference/fans/list-all-fans), and [List Expired Fans](/api-reference/fans/list-expired-fans) endpoints by adding `filter.total_spent` to the query parameters. You can even filter by minimum tips. Use our [Search Profiles](/api-reference/public-profiles/search-profiles) endpoint with the `sort` query parameter set to `subscribers`. Retrieve it through the [List User Lists](/api-reference/user-list-collections/list-user-lists) endpoint under `following.usersCount`. Use the [Get User List](/api-reference/user-list-collections/get-user-list) endpoint with `rebill_on` as the `{userListId}`. Call the [List User Lists](/api-reference/user-list-collections/list-user-lists) endpoint and calculate the difference between `rebill_on.usersCount` and `rebill_off.usersCount`. Use our [Set Fan's Custom Name](/api-reference/fans/set-fans-custom-name) endpoint. Sadly, OnlyFans doesn't store language preferences. Workaround: 1. Fetch chat messages from the fan 2. Use a third-party language detection API 3. Store the detected language in your database No direct endpoint exists, but you can: 1. Retrieve chat messages using the [List ChatMessage](/api-reference/chats/list-chat-message) endpoint 2. Check if `isOpened = true` AND `price > 0`, which indicates a purchased PPV Yes. Any data that you can retrieve through our API endpoints, you can programmatically scrape. `data.fan.id` is the OnlyFans User ID of the fan, which you can also use to get the chat's messages in the [List Chat Messages](/api-reference/chat-messages/list-chat-messages) endpoint. Use our [List Chats](/api-reference/chats/list-chats) endpoint, where `data.fan.id` is the `chat_id` you need for the [List Chat Messages](/api-reference/chat-messages/list-chat-messages) endpoint. Currently, OnlyFans API doesn't support removing multiple users from a list in a single request. You have two options: 1. Clear the entire list using [Clear User List](/api-reference/user-list-collections/clear-user-list) 2. Send one DELETE request per user via [Remove User from a User List](/api-reference/user-list-collections/remove-user-from-a-user-list) ## Webhooks & Media Handling * 📚 Documentation: [docs.onlyfansapi.com/webhooks](/webhooks) * 🎥 Video Demo: [cap.so/s/p2wfkj072yt2x96](https://cap.so/s/p2wfkj072yt2x96) When `"isReady": false`, the media is still processing. **Solution:** 1. Get the chat ID from the webhook 2. Poll the [List ChatMessage](/api-reference/chats/list-chat-message) endpoint every 10-20 seconds 3. Wait for `"isReady": true` 4. The URL will then be available **Alternatively:** Download and store vault content internally for reverse searching by media ID, once the media is ready. Yes, you can use webhooks with no-code tools like Make, n8n or Zapier. Just set up a webhook listener in your tool and configure it to receive data from our API. We have most webhook events available as Make and Zapier modules, which you can find in our [Make](/integrations/make/available-modules#instant-triggers) and [Zapier](/integrations/zapier/available-modules#instant-triggers) directories. Click on the webhook in your dashboard. It will take you to a details page where you can view all events that have recently been sent to your webhook URL. No. Here's how OnlyFans handles typing indicators: * When `users.typing` is received, OnlyFans shows a typing indicator for exactly 5 seconds * If a user continues typing, consecutive `users.typing` events are sent every \~3 seconds, resetting the timer * If no new `users.typing` event is received after 5 seconds, the indicator is hidden * If a `messages.received` event is received while the indicator is active, it is hidden You can replicate this logic in your own UI. You may need to adjust the timing slightly due to webhook delivery delays. We use **at-least-once delivery semantics** for webhooks. If your server doesn't respond within **15 seconds**, the event will be retried up to 5 times with exponential backoff. **Best practices:** * Return a 2xx status code as quickly as possible, then handle logic asynchronously * Implement **idempotency** by deduplicating events based on their unique `event_id` * Check the "Attempts" column in the dashboard to confirm if retries are occurring ## Media & Downloads `cdn*.onlyfans.com` URLs cannot be accessed directly due to OnlyFans' security — they are tied to specific IPs (in this case, our proxy IP). Use our [Download Media from the OnlyFans CDN](/api-reference/media/download-media-from-the-only-fans-cdn) endpoint to successfully download media files. When a 403 occurs: 1. Call the endpoint again that you retrieved the `cdn*.onlyfans.com` URL from 2. Call the download endpoint again with the newly retrieved CDN URL **Important checks:** * Always use the **same Account ID** for both retrieving and downloading. For example, if you got the URL from `/api/acct_ABC123/chats/123/messages`, you must use `acct_ABC123` in your download request * Use the CDN URL immediately — don't wait longer than 1 minute, as CDN URLs expire quickly No distinction between public vs. premium or owned vs. subscribed content. The only limitation is that the authenticated account must have access to view the media file on OnlyFans. No. Any account type can download media as long as the authenticated account has access to view the media file. This happens when `convertedToVideo` is set to `false`. The file is still being converted. Once the conversion completes and the status changes to `true`, you'll be able to download the video successfully. You can only view content that is accessible to the connected account — either your own content (if it's a creator account) or content from creators the account is subscribed to. **TL;DR:** Through our API, you can view all content you can also see when logging into onlyfans.com. Our API does not bypass any subscription or PPV pricing. ## Tracking & Free Trial Links Yes! In our dashboard at [app.onlyfansapi.com](https://app.onlyfansapi.com), click on "Trial & Tracking Links" in the sidebar. You'll see an overview with clicks, subscribers, revenue, spender count, ARPS, creation date, and expiration date. You can also create links and generate shareable URLs with optional revenue visibility. For calculation logic details, see our [Free Trial Links documentation](/api-reference/free-trial-links). No limits! We've created hundreds to thousands of links per day via our API with no restrictions: * 🎁 Free Trials: No limit per day * 🔗 Tracking Links: No limit per day ## API Troubleshooting A 401 error indicates an authorization problem — usually an invalid API key. Verify that: * Your API key is correct * The authorization header is set up correctly in your request Check your API key status at [app.onlyfansapi.com/api-keys](https://app.onlyfansapi.com/api-keys). You're using the wrong HTTP method. Check our [API Reference](/api-reference) to see which HTTP method (GET, POST, DELETE, etc.) is required for the endpoint. The API URL doesn't exist. This usually means: * You're missing the account prefix (use `/api/acct_XXXXXXXX/...`) * The endpoint URL is incorrect Check our [API Reference](/api-reference) for valid endpoint URLs. Double-check that the URL has the correct parameters and there are no network issues on your side. In our dashboard, click on "Logs" in the sidebar to see an overview of all requests and any errors. Click on a specific request to view the full details and response. ## Billing & Subscriptions All of our subscription plans, account pricing, and credit pricing are explained at [onlyfansapi.com/pricing](https://onlyfansapi.com/pricing). For as long as you want, until you've consumed all of your 10 free credits. Afterwards, you'll need to subscribe to a plan. Pricing depends on your needs — the more accounts or credits you need, the better our pricing. Schedule a call at [cal.com/onlyfansapi/15min](https://cal.com/onlyfansapi/15min). We offer dynamic pricing for additional accounts, explained at [onlyfansapi.com/pricing](https://onlyfansapi.com/pricing). You can also pre-purchase account seats. View and change your current plan at [app.onlyfansapi.com/billing](https://app.onlyfansapi.com/billing). You currently cannot pause your subscription. To cancel, go to [app.onlyfansapi.com/billing](https://app.onlyfansapi.com/billing). ## Documentation & Resources Yes! Our OpenAPI schema is available at [app.onlyfansapi.com/scribe-docs/openapi.yaml](https://app.onlyfansapi.com/scribe-docs/openapi.yaml). No. Please refer to our [API Reference](/api-reference) for a complete list of available endpoints. Yes! Visit [docs.onlyfansapi.com/llms.txt](https://docs.onlyfansapi.com/llms.txt) for the canonical AI-friendly version of our documentation. We also keep [docs.onlyfansapi.com/llms-full.txt](https://docs.onlyfansapi.com/llms-full.txt) for backward compatibility. # Introduction (/auth) import { Card, Cards } from "fumadocs-ui/components/card"; import { ShieldCheckIcon, ZapIcon, CodeIcon, MonitorSmartphoneIcon, FeatherIcon, HeartHandshakeIcon, DownloadIcon, RocketIcon } from "lucide-react"; import {SiNextdotjs, SiTypescript} from "@icons-pack/react-simple-icons"; @onlyfansapi/auth - Official Authentication Library The official authentication library for OnlyFans API provides a seamless, secure way to authenticate users with their OnlyFans accounts directly from your application. ## Features } title="Secure & Responsive"> Built with enterprise-grade security and works seamlessly on both desktop and mobile devices. } title="Lightning Fast"> 1.5kB script loads in just 2ms on 4G internet, ensuring your users never wait for authentication. } title="Developer Experience"> Developer-friendly with TypeScript support, comprehensive docs, and intuitive APIs. ## Why choose @onlyfansapi/auth? }> Built with industry-standard security practices to protect user credentials and authentication flows. Trusted by developers who prioritize security. }> Seamlessly works across all devices—desktop, mobile, and tablet. Your users get a consistent authentication experience regardless of their platform. }> Minimal footprint at just 1.5kB ensures lightning-fast load times. Authenticate users in under 2ms even on slower 4G connections. }> Full TypeScript definitions included for better developer experience, type safety, and autocomplete support in your IDE. }> Use with any framework or no framework at all. Works seamlessly with React, Vue, Svelte, Angular, and vanilla JavaScript with zero dependencies. }> Intuitive APIs designed for ease of use with comprehensive documentation, clear examples, and straightforward integration patterns. ## Getting started Ready to integrate authentication into your application? Check out our installation guide and quickstart to get started in minutes. }> Learn how to install and set up @onlyfansapi/auth in your project. }> Get up and running with our auth package in just a few minutes. }> Explore a complete example of using @onlyfansapi/auth with Next.js and Prisma. # Installation (/auth/installation) import { Tabs, Tab } from "fumadocs-ui/components/tabs"; import { Step, Steps } from "fumadocs-ui/components/steps"; import { Card, Cards } from "fumadocs-ui/components/card"; import { TerminalIcon } from "lucide-react"; ## Package Manager Install `@onlyfansapi/auth` using your preferred package manager: ```bash npm install @onlyfansapi/auth ``` ```bash pnpm add @onlyfansapi/auth ``` ```bash yarn add @onlyfansapi/auth ``` ```bash bun add @onlyfansapi/auth ``` ## Prerequisites Before you begin, make sure you have: } href="https://app.onlyfansapi.com" title="An OnlyFans API account"> If you don't have one yet, registering takes just a few seconds. » Create a free account ## Get Your API Key Before creating a client session token, you'll need an API key to authenticate your requests to the OnlyFans API. ### Go to the OnlyFans API console → API Keys Navigate to your [OnlyFans API console](https://app.onlyfansapi.com) and click on **API Keys** in the navigation menu. ### Create a new API key Click the **"Create API Key"** button to generate a new API key. Copy and save your API key securely - you'll need it to create client session tokens. ## Create Your Client Session Token To use `@onlyfansapi/auth`, you'll need to create a client session token (starts with `ofapi_cs_`) through the [Create Client Session](/api-reference/client-sessions/create-client-session) API endpoint. ### Make a POST request to create a client session Use your API key to authenticate the request: ```bash curl -X POST "https://app.onlyfansapi.com/api/client-sessions" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "display_name": "My Application / Model: John Doe" }' ``` **Optional fields:** * `client_reference_id` - Your internal reference ID for the connected account * `proxy_country` - Proxy country value (`"us" | "uk" | "de" | "fr" | "it"`) ### Get the client session token from the response The response will include a `token` field that starts with `ofapi_cs_`: ```json { "data": { "token": "ofapi_cs_OriR8Sdocp0f97eFOdbMMZtiz4Aw5FLX", "display_name": "My Application / Model: John Doe" } } ``` This token is what you'll use with the `@onlyfansapi/auth` package. ### Use the client session token Copy the client session token and use it in your application with `@onlyfansapi/auth`. **Important:** Keep your client session token secure. While it's designed for client-side use, treat it with appropriate security measures. ## Next Steps Once you've installed the package and created your client session token, you're ready to start implementing authentication in your application. * [Quick Start Guide](/auth/quickstart) - Get up and running in minutes * [Create Client Session API Reference](/api-reference/client-sessions/create-client-session) - Full API documentation * [NPM Package](https://www.npmjs.com/package/@onlyfansapi/auth) - Full package documentation on npm # Quick Start (/auth/quickstart) import { Tabs, Tab } from "fumadocs-ui/components/tabs"; import { Step, Steps } from "fumadocs-ui/components/steps"; import { Callout } from "fumadocs-ui/components/callout"; ## Overview This guide will walk you through implementing `@onlyfansapi/auth` in your application. The authentication library provides a simple, secure way to authenticate users with their OnlyFans accounts. ## Before You Start Make sure you've completed the [installation](/auth/installation) steps first. You'll need: * The package installed in your project * An API key to create client session tokens * A client session token (starts with `ofapi_cs_`) to use with the library ## Basic Usage The library exports a single function `startOnlyFansAuthentication` that handles the entire authentication flow. When called, it opens a secure iframe modal where users can authenticate with their OnlyFans account. ### Import ```typescript twoslash import { startOnlyFansAuthentication } from '@onlyfansapi/auth'; ``` ### Function Signature ```typescript const startOnlyFansAuthentication: (clientSessionToken: string, options: { onSuccess: (data: AuthSuccessData) => void; onError: (error: AuthFailureError) => void; onContinue?: () => void; }) => void ``` **Parameters:** * `clientSecret` (string, required): Your client session token obtained from the [Create Client Session](/api-reference/client-sessions/create-client-session) API endpoint * `options.onSuccess` (function, required): Callback invoked when authentication succeeds * `options.onError` (function, required): Callback invoked when authentication fails ## Framework Examples ```tsx import React, { useState } from 'react'; import { startOnlyFansAuthentication } from '@onlyfansapi/auth'; export default function AuthComponent() { const [isLoading, setIsLoading] = useState(false); const [authData, setAuthData] = useState(null); const [error, setError] = useState(null); const handleAuthentication = () => { setIsLoading(true); setError(null); startOnlyFansAuthentication('ofapi_cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', { onSuccess: (data) => { console.log('Authentication successful:', data); setAuthData(data); setIsLoading(false); // data.accountId - The authenticated account ID // data.username - The authenticated username // data.response - Full response from the API }, onError: (error) => { console.error('Authentication failed:', error); setError(error); setIsLoading(false); // error.message - Error message // error.code - Error code (if available) // error.details - Additional error details (if available) }, }); }; return (
{authData && (

Authentication Successful!

Account ID: {authData.accountId}

Username: {authData.username}

)} {error && (

Authentication Failed

{error.message}

)}
); } ```
```vue ``` ```svelte
{#if authData}

Authentication Successful!

Account ID: {authData.accountId}

Username: {authData.username}

{/if} {#if error}

Authentication Failed

{error.message}

{/if}
```
```typescript import { Component } from '@angular/core'; import { startOnlyFansAuthentication } from '@onlyfansapi/auth'; @Component({ selector: 'app-auth', template: `

Authentication Successful!

Account ID: {{ authData.accountId }}

Username: {{ authData.username }}

Authentication Failed

{{ error.message }}

` }) export class AuthComponent { isLoading = false; authData: any = null; error: any = null; handleAuthentication() { this.isLoading = true; this.error = null; startOnlyFansAuthentication('ofapi_cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', { onSuccess: (data) => { console.log('Authentication successful:', data); this.authData = data; this.isLoading = false; }, onError: (error) => { console.error('Authentication failed:', error); this.error = error; this.isLoading = false; }, }); } } ```
```html OnlyFans API Auth
```
## Response Data The library provides TypeScript types for better type safety. Import them if needed: ```typescript import type { AuthSuccessData, AuthError } from '@onlyfansapi/auth'; ``` ### Success Response When authentication is successful, the `onSuccess` callback receives an `AuthSuccessData` object: ```typescript interface AuthSuccessData { accountId: string; // The authenticated OnlyFans account ID username: string; // The authenticated OnlyFans username response: object; // Full response object from the API containing additional metadata } ``` **Example usage:** ```typescript onSuccess: (data) => { // Store the account ID for future API requests localStorage.setItem('ofAccountId', data.accountId); // Redirect to dashboard or update UI console.log(`Authenticated as ${data.username}`); } ``` ### Error Response When authentication fails, the `onError` callback receives an `AuthError` object: ```typescript interface AuthError { message: string; // Human-readable error message code?: string; // Error code (if available) for programmatic handling details?: object; // Additional error details (if available) } ``` **Common error scenarios:** * User cancels the authentication flow * Network connectivity issues * Invalid or expired client session token * OnlyFans account access issues **Example error handling:** ```typescript onError: (error) => { if (error.code === 'AUTH_CANCELLED') { // User closed the authentication modal console.log('Authentication cancelled by user'); } else { // Handle other errors console.error('Authentication failed:', error.message); // Display error to user } } ``` ## Security The authentication library implements multiple security measures to protect user data: * **Origin validation**: All communication with the authentication iframe is validated by origin * **Domain whitelisting**: Only messages from the configured OnlyFansAPI.com domain are accepted * **Secure token transmission**: Client session tokens are passed securely via URL parameters * **HTTPS required**: The library requires HTTPS connections in production environments ## Best Practices ### Storing Client Session Tokens Store your client session token securely: ```typescript // ✅ Good: Use environment variables (if using a build tool) const CLIENT_SECRET = process.env.NEXT_PUBLIC_OFAPI_CLIENT_SECRET; // ✅ Good: Fetch from your backend API (most secure) const clientSecret = await fetch('/api/client-secret').then(r => r.json()); // ❌ Bad: Hardcode in your source code const CLIENT_SECRET = 'ofapi_cs_...'; ``` ### Error Handling Always handle both success and error cases: ```typescript startOnlyFansAuthentication("clientSecret", { onSuccess: (data) => { // Update your application state // Persist authentication data if needed // Redirect or update UI }, onError: (error) => { // Log errors for debugging // Show user-friendly error messages // Provide fallback options }, }); ``` ### User Experience * Show a loading state while authentication is in progress * Disable the authentication button during the flow to prevent duplicate requests * Provide clear feedback on success or failure * Consider adding a "try again" option if authentication fails ## Troubleshooting ### Common Issues **Authentication modal doesn't open:** * Ensure your client session token is valid and properly formatted * Check browser console for any error messages * Verify that pop-ups aren't blocked by your browser **"Invalid client secret" error:** * Verify your client session token is correct (starts with `ofapi_cs_`) * Check that the token hasn't expired * Ensure you're using a token created via the [Create Client Session API](/api-reference/client-sessions/create-client-session) **Network errors:** * Check your internet connection * Verify OnlyFansAPI.com is accessible from your network * Some corporate firewalls may block the authentication iframe ## Next Steps * Review the [Installation Guide](/auth/installation) if you haven't already * Check out the [NPM package](https://www.npmjs.com/package/@onlyfansapi/auth) for the latest version and updates * Visit [onlyfansapi.com/auth](https://onlyfansapi.com/auth) for more information * Explore the [API Reference](/api-reference) to see what you can do with authenticated accounts # Introduction (/data-exports) import { Step, Steps } from 'fumadocs-ui/components/steps'; import { ArrowLeftRightIcon, BanknoteArrowDownIcon, BanknoteXIcon, HeartIcon, ImageIcon, MessagesSquareIcon, TagIcon, TagsIcon, UserSearchIcon, UsersIcon, UserStarIcon } from "lucide-react"; ## Available data export types } title="Transactions" /> } title="Chat Messages" /> } title="Media" /> } title="Trial Links" /> } title="Tracking Links" /> } title="Payouts" /> } title="Chargebacks" /> } title="Public Profiles" /> } title="Followings" /> } title="Fans" /> ## Getting started You can create and manage data exports in two ways: * **Dashboard**: Visit the [Data Exports page](https://app.onlyfansapi.com/tools/data-export) on our Console for a no-code interface * **API**: Use our [Data Exports API endpoints](#using-the-api) to programmatically create and manage exports ### Starting an export via Dashboard To get started, click on the "Create Export" button, which will take you to the export creation page. You're then prompted customize your export: #### Data type As the first step, select the type of data you want to export. Please refer to [the list above](#available-data-export-types) for available export types. #### Export fields Select the fields you want to include in your export. For a full list of available fields, please refer to [the available export fields list](#available-export-fields). #### Accounts Choose which accounts you want to include in your export. You can select all connected accounts, or select specific accounts. #### Date range Select the data range that you wish to be included in your export. #### View the export cost For some Data Export types, it is not possible to calculate the cost upfront. If this is the case, it will be calculated once the export is completed. For other Data Export types, you will see the cost of the export here. #### Select the export file type Click on "Export Data", and choose either CSV or Excel (XSLX). This will start the export! Your data export will now be processed by our servers in the background, and you will be able to download it once completed. ## Using the API Data exports can be created and managed either through our [Dashboard](https://app.onlyfansapi.com/tools/data-export) or programmatically using our API endpoints. The API provides full control over the export lifecycle, allowing you to automate data exports and integrate them into your workflows. ### Export workflow The data export process follows a two-step workflow: #### Create Data Export Use the [Create Data Export](/api-reference/data-exports/create-data-export) endpoint to create a new export request. This endpoint will calculate the required credits based on your selected parameters (data type, fields, accounts, and date range) and prepare the export for processing. #### Start Data Export Once the export has been created and credit calculation is complete, use the [Start Data Export](/api-reference/data-exports/start-data-export) endpoint to begin processing. This will charge the calculated credits and start the actual export process. ### Monitoring exports You can monitor the status and progress of your exports using the following endpoints: * **[List Data Exports](/api-reference/data-exports/list-data-exports)** - Get a paginated list of all data exports for your team * **[Get Data Export Status](/api-reference/data-exports/get-data-export-status)** - Check the current status, progress, and download URL for a specific export Once an export is completed, you can download the file using the download URL provided in the export status response. ## Big data exports Depending on the chosen date range and account size, your export might take several hours to complete if you're exporting a large amount of data. You can safely close the browser window, and return to the Data Exports page later to check the status of your export. ## Available export fields | Transactions | Chat Messages | Trial Links | Tracking Links | Payouts | Chargebacks | Public Profiles | Media | Fans | Followings | | ---------------- | ---------------------------- | ---------------------- | ---------------------- | ------------------- | ------------------- | ------------------- | --------------------------------------------------- | ------------------ | ----------------------------- | | Account ID | Account ID | Account ID | Account ID | Account ID | Account ID | OnlyFans ID | ZIP of every media vault file (photo, video, audio) | ID | OnlyFans ID | | Account Name | Account Name | Account Name | Account Name | Account Name | Account Name | Username | | OnlyFans ID | Username | | Account Username | Account Username | Account Username | Account Username | Account Username | Account Username | Name | | Username | Name | | Transaction ID | Fan ID | OnlyFans ID | OnlyFans ID | OnlyFans ID | OnlyFans ID | About | | Name | Avatar | | Type | Fan Username | Name | Campaign Code | Amount | Payment Type | Location | | Display Name | Is Performer | | Fan ID | Fan Name | URL | Campaign Name | Currency | Fan ID | Website | | Avatar | Is Verified | | Fan Username | Chat ID | Claim Counts | OnlyFans URL | State | Fan Username | Subscribe Price | | Location | Is Real Performer | | Fan Name | Message ID | Clicks Counts | Count Subscribers | Reject Reason | Fan Name | Min Subscribe Price | | Is Performer | Subscribe Price | | Amount | Message Text | Subscribe Counts | Count Transitions | OnlyFans Created At | Amount | Posts Count | | Is Verified | Subscription Price | | VAT Amount | Price | Subscribe Days | Revenue | | VAT Amount | Photos Count | | Can Add Subscriber | Subscription Autoprolong | | Tax Amount | Tip Amount | Is Finished | Revenue Per Subscriber | | Tax Amount | Videos Count | | Can Chat | Subscription Is Muted | | Net Amount | Is Free | Revenue | Revenue Per Click | | Media Tax Amount | Audios Count | | Subscribe Price | Show Posts In Feed | | Fee Amount | Is Tip | Revenue Per Subscriber | OnlyFans Created At | | Net Amount | Favorites Count | | Total Summ | Has Active Paid Subscriptions | | Currency | Sent by (`creator` or `fan`) | OnlyFans Created At | OnlyFans End Date | | Fee Amount | Favorited Count | | Messages Summ | Subscription Status | | Description | Is Opened | OnlyFans Expired At | | | Currency | Subscribers Count | | Subscribes Summ | Subscribe At | | Status | Media Count | Tags (comma separated) | Tags (comma separated) | | Description | Is Verified | | Posts Summ | Expired At | | Created At | OnlyFans Created At | | | | Status | Is Performer | | Tips Summ | Renewed At | | | | | | | Payment Created At | Is Real Performer | | Streams Summ | Last Seen At | | | | | | | OnlyFans Created At | Avatar URL | | Rebill On | Regular Price | | | | | | | | Header URL | | Subscribe At | Discount Percent | | | | | | | | Instagram | | Expired At | Duration | | | | | | | | Twitter | | Renewed At | Can Receive Chat Message | | | | | | | | TikTok | | | Is Blocked | | | | | | | | Facebook | | | Can Unsubscribe | | | | | | | | Gender | | | Tips Enabled | | | | | | | | Gender Confidence | | | | | | | | | | | Join Date | | | | | | | | | | | Last Seen At | | | | ## Pricing The following pricing applies to our data exports: | Export type | Cost | | --------------- | ----------------------- | | Transactions | 1 credit per 20 results | | Chat Messages | 1 credit per 20 results | | Media | 1 credit per 20 results | | Trial Links | 1 credit per 20 results | | Tracking Links | 1 credit per 20 results | | Payouts | 1 credit per 20 results | | Chargebacks | 1 credit per 20 results | | Public Profiles | 3 credits per profile | | Fans | 1 credit per 20 results | | Followings | 1 credit per 20 results | # Use Cases (/data-exports/use-cases) import { Callout } from 'fumadocs-ui/components/callout'; import { DatabaseIcon, UsersIcon, BrainCircuitIcon, BarChart3Icon, ArchiveIcon } from "lucide-react"; Data exports unlock the full potential of your OnlyFans data. Whether you're building automations, training AI models, or migrating to new systems, our comprehensive export tools give you complete control over your data. } title="AI & LLM Training" href="#download-media-and-chats-for-llm-and-lora-training" /> } title="Financial Analytics" href="#export-financial-data-for-analytics-and-automation" /> } title="Backup & Migration" href="#complete-data-backup-and-migration" /> *** ## Download Media and Chats for LLM and LoRA Training AI developers, chatbot builders, and content personalization tools Training AI models to mimic a creator's voice, style, or persona? Our **Media** and **Chat Messages** exports provide the raw data you need for LLM fine-tuning and LoRA training. ### Media exports for visual AI Export your entire **Media Vault** as a ZIP file containing: * All photos (full resolution) * All videos (original quality) * All audio files This is invaluable for training: * **LoRA models** for Stable Diffusion and similar image generators * **Content classifiers** and moderation systems * **Style transfer** and editing tools ### Chat exports for language models The **Chat Messages** export includes: * Complete message history * Message text and timestamps * Fan context (ID, username, name) * Tip and pricing data * Media attachment counts Use this data to: * **Fine-tune LLMs** on a creator's communication style * **Build AI chatbots** that authentically represent creator personalities * **Analyze conversation patterns** for engagement optimization * **Train response suggestion systems** ### Technical integration ```python title="Example: Processing chat exports for training" import pandas as pd # Load your chat export chats = pd.read_csv('chat_messages_export.csv') # Filter for creator's own messages creator_messages = chats[chats['Is From Account'] == True] # Prepare training pairs training_data = [] for idx, row in creator_messages.iterrows(): training_data.append({ "role": "assistant", "content": row['Message Text'] }) # Export for fine-tuning # ... your ML pipeline here ``` *** ## Export Financial Data for Analytics and Automation Accountants, agencies managing multiple creators, and analytics platforms Need to sync your OnlyFans financial data with external tools? Export **Transactions**, **Payouts**, and **Chargebacks** to power your analytics dashboards and automation workflows. ### Available financial exports | Export Type | Key Fields | | ---------------- | --------------------------------------------------------------- | | **Transactions** | Amount, VAT, tax, net, fee, currency, type, status, fan details | | **Payouts** | Amount, currency, state, reject reason, timestamps | | **Chargebacks** | Amount, payment type, status, fan info, media tax breakdown | ### Power your automation stack Integrate data exports with tools like **n8n**, **Zapier**, or **Make** to build powerful financial workflows: #### Example: n8n revenue sync workflow 1. **Schedule trigger** — Run weekly or monthly 2. **API call** — Create and start a Transactions export 3. **Wait for completion** — Poll export status 4. **Download CSV** — Fetch the completed export 5. **Parse data** — Transform for your target system 6. **Update database** — Sync to Airtable, Google Sheets, or your data warehouse 7. **Trigger alerts** — Notify on anomalies (chargebacks, revenue drops) Starting fresh with a new analytics tool? Export your **entire transaction history** to backfill your database with years of financial data in minutes. ### Real-world applications * **Revenue dashboards**: Sync to Metabase, Tableau, or custom BI tools * **Tax preparation**: Export all transactions for your accountant * **Chargeback monitoring**: Track and analyze disputed payments * **Multi-account reconciliation**: Consolidate finances across all managed creators * **Payout forecasting**: Analyze historical patterns to predict future earnings *** ## Complete Data Backup and Migration Creators switching platforms, agencies managing transitions, and disaster recovery Your OnlyFans data is valuable. Whether you're preparing for a platform migration, setting up disaster recovery, or just want peace of mind, our comprehensive exports have you covered. ### Export everything | Data Type | What's Included | | ------------------- | -------------------------------------------------- | | **Media** | Every photo, video, and audio file from your vault | | **Chat Messages** | Complete conversation history with all fans | | **Transactions** | Full financial record of all earnings | | **Trial Links** | All free trial campaigns and performance data | | **Tracking Links** | Marketing campaign data and attribution | | **Payouts** | Complete payout history | | **Chargebacks** | Dispute and chargeback records | | **Public Profiles** | Profile snapshots for record-keeping | ### Backup strategy Set up a robust backup workflow: 1. **Monthly full exports** — Download all data types for comprehensive snapshots 2. **Weekly incremental exports** — Export recent data using date range filters 3. **Store securely** — Save to cloud storage (S3, Google Cloud, Azure) or local NAS 4. **Version your backups** — Maintain historical snapshots for point-in-time recovery ### Migration use cases * **Platform switch**: Export everything before moving to a new content platform * **Agency transition**: Hand off complete data when onboarding or offboarding creators * **Legal compliance**: Maintain records for regulatory requirements * **Content repurposing**: Access your full media library for use on other platforms Exporting years of data? Our system handles big exports seamlessly. Start the export, close your browser, and come back later to download your complete archive. *** ## Get Started Ready to unlock the full potential of your OnlyFans data? # Overview (/api-reference) import { BanknoteArrowDownIcon, BotMessageSquareIcon, ChartSplineIcon, GalleryVerticalEndIcon, ImageDownIcon, ImageIcon, ImageUpIcon, MessageSquareReplyIcon, MessageSquareTextIcon, MessagesSquareIcon, RocketIcon, ScrollTextIcon, SendIcon, SmilePlusIcon, UserCheckIcon, UserSearchIcon, UsersIcon, UserXIcon, } from "lucide-react";

Not sure where to start?

Browse our frequently used API endpoints below to get a feel for what's possible with OnlyFans API. ## Chats & Messages \[!toc] } href="/api-reference/chats/list-chats" title="List Chats"> Retrieve the latest chats, including details like last message and fan details. } href="/api-reference/chat-messages/list-chat-messages" title="List Chat Messages"> Retrieve messages from a specific chat. } href="/api-reference/chat-messages/send-message" title="Send Message"> Send a new chat message to a fan, including support for media and PPVs. } href="/api-reference/mass-messaging/send-mass-message" title="Send Mass Message"> Send or schedule a mass message to collections or individual fans, including support for media and PPVs. ## Payouts & Earnings \[!toc] } href="/api-reference/payouts/get-earning-statistics" title="Earning Statistics"> Get a summary of model earnings over time, including totals and breakdowns. } href="/api-reference/payouts/list-transactions-earnings" title="List Transactions (Earnings)"> Get a list of earning transactions, including details like amount, type, and fan info. } href="/api-reference/payouts/request-manual-withdrawal" title="Request Manual Withdrawal"> Initiate a manual withdrawal, perfect for automating daily payouts. ## Fans & Subscribers \[!toc] } href="/api-reference/fans/list-all-fans" title="List All Fans"> Retrieve a list of all fans, and filter by online, total spendings, duration, and more. } href="/api-reference/fans/list-active-fans" title="List Active Fans"> Get a list of fans who have an active subscription. } href="/api-reference/fans/list-expired-fans" title="List Expired Fans"> Get a list of fans whose subscriptions have expired. } href="/api-reference/fans/list-latest-fans" title="List Latest Fans"> Get a list of fans within a specific date range. ## Media & Vault \[!toc] } href="/api-reference/media-vault/list-vault-media" title="List Vault Media"> Retrieve a list of all fans, and filter by online, total spendings, duration, and more. } href="/api-reference/media-vault-lists/list-vault-lists" title="List Vault Lists"> Get a list of fans who have an active subscription. } href="/api-reference/media/upload-media-to-the-only-fans-cdn" title="Upload media to OnlyFans"> Upload an image, video or audio file to the OnlyFans CDN to include in a message or post. } href="/api-reference/media/download-media-from-the-only-fans-cdn" title="Download media from OnlyFans"> Download an image, video or audio file from OnlyFans to our own CDN.

Haven't found what you're looking for?

} title="Explore our full API reference in the sidebar" href="/api-reference"> We have over 100 endpoints covering most OnlyFans functionality. Check out the sidebar to explore all available endpoints. } title="Ask our AI chatbot"> Our AI chatbot can help you find the right endpoint for your use case. Click the "Ask AI" button in the bottom right to get started. } title="Request a new functionality" href="mailto:hello@onlyfansapi.com"> Need something specific? Let us know! We're constantly adding new endpoints based on user feedback. # Introduction (/integrations) import { SiMake, SiMakeHex, SiZapier, SiZapierHex, SiIfttt, SiIftttHex, SiN8n, SiN8nHex } from "@icons-pack/react-simple-icons"; Please choose an integration to get started: } href="/integrations/n8n" title="n8n (recommended)"> Best for building complex, multi-step no-code automations. Perfect for users who want powerful automation capabilities with full control over their workflows. } href="/integrations/make" title="Make"> Best for simple OnlyFans automations, all without writing code. Ideal for users who want simple visual workflow design. } href="/integrations/zapier" title="Zapier"> Best for quickly setting up no-code automations based on triggers like new messages, PPV purchases, or new fan subscriptions. Great for those who want ease-of-use and a large library of app connections. Or watch our tutorial video: