Skip to main content
npm install @ofauth/onlyfans-sdk

Quick Example

import { createOFAuthClient } from '@ofauth/onlyfans-sdk';

const client = createOFAuthClient({ apiKey: 'your-api-key' });

const account = await client.account.whoami();
console.log(account.id, account.permissions);

Details

TypeScript
Package@ofauth/onlyfans-sdk
Repositoryonlyfans-sdk-typescript
InitcreateOFAuthClient()
ArchitectureNested client with namespaces
TypesInline types, full IntelliSense
PaginationAsync iterators (for await)
DependenciesNone (uses fetch)

Features

Full Type Safety

Generated from the OpenAPI spec — response types, request params, and error codes are all typed.

Async Iterators

for await over any paginated list automatically.

Proxy Support

Call any OnlyFans endpoint directly through the OFAuth proxy.

Media Upload

Automatic chunking and progress callbacks.

Usage Examples

List subscribers

const subscribers = await client.access.listSubscribers({
  connectionId: 'conn_xxx',
  limit: 50
});

for (const sub of subscribers.data) {
  console.log(sub.username, sub.subscribedAt);
}

Send a message

await client.access.sendMessage({
  connectionId: 'conn_xxx',
  userId: '12345',
  text: 'Hello from OFAuth!'
});

Error handling

import { OFAuthAPIError } from '@ofauth/onlyfans-sdk';

try {
  await client.access.getUser({ connectionId: 'conn_xxx', userId: '999' });
} catch (err) {
  if (err instanceof OFAuthAPIError) {
    console.error(err.status, err.code, err.message);
  }
}