> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ofauth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API overview

> Find API URLs, send tokens, select accounts, and handle results.

Use the V3 API to read data and take actions on OnlyFans accounts shared with your app. A linked account is an account its owner has shared. An authorization records the accounts and permissions that owner approved.

## Base URLs

| Service | URL |
| - | - |
| API | `https://api.ofauth.com/v3` |
| Account sign-in and approval | `https://link.ofauth.com/v3/authorize` |
| Realtime stream (Server-Sent Events) | `https://api.ofauth.com/v3/realtime/events` |

Your app's client ID and secret select its mode: Sandbox, Test, or Live. Changing the hostname does not change that mode. See [environments](https://docs.ofauth.com/v3/api-reference/environments.md).

## Authenticate requests

Use an [official SDK](https://docs.ofauth.com/v3.md#official-sdks) for your application. Get an access token through [authorization](https://docs.ofauth.com/v3/api-reference/link/authorize.md). The token proves your app has permission. For Access and Vault+ requests, send the token and the ID of an account shared with it:

```typescript TypeScript SDK theme={null}
import { OFAuthClient } from "@ofauth/onlyfans-sdk"

const client = new OFAuthClient({
  accessToken: process.env.ACCESS_TOKEN!,
  linkedAccountId: process.env.LINKED_ACCOUNT_ID!
})
const profile = await client.access.profile.get()
console.log(profile.name)
```

```bash cURL theme={null}
curl --fail-with-body https://api.ofauth.com/v3/access/profile \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "x-linked-account-id: $LINKED_ACCOUNT_ID"
```

To manage linked accounts, select the account in the URL and send the token in the `Authorization` header. Each operation lists the permissions it needs, called scopes. See [authentication and permissions](https://docs.ofauth.com/v3/api-reference/authentication.md).

## Use the right access details

| Operation | How to send access details | Request body |
| - | - | - |
| Ask an owner for access | Client ID, state, and PKCE challenge in the URL. See [Authorize](https://docs.ofauth.com/v3/api-reference/link/authorize.md). | None |
| Exchange a code, refresh tokens, or end access | Client ID and secret using one of `client_secret_basic` or `client_secret_post` | Form fields (`application/x-www-form-urlencoded`) |
| Access and Vault+ | Access token and `x-linked-account-id` | Usually JSON. Upload URLs take file bytes. Use the content type listed for the operation. |
| Manage linked accounts | Access token, plus an account ID in the URL when required | JSON when the operation takes a body |

The token endpoint checks your app's client ID and secret. Access requests check the access token returned by sign-in. Use the format listed above for each request.

## Find an operation

| API | Use |
| - | - |
| [Account](https://docs.ofauth.com/v3/api-reference/account/linked-accounts.md) | List shared accounts, read their details, remove access, or change their settings. |
| [Link](https://docs.ofauth.com/v3/api-reference.md#link-authorization-and-tokens) | Ask for access, exchange codes, refresh tokens, and revoke credentials. |
| [Access](https://docs.ofauth.com/v3/api-reference.md#access-account-operations) | Work with profiles, chats, subscribers, content, media, earnings, and other OnlyFans resources. |
| [Vault+](https://docs.ofauth.com/v3/guides/media-storage.md) | Optional convenience for the OnlyFans Vault: load saved media faster and find files or thumbnails by ID, even before they are attached to content. |
| [OnlyFans events](https://docs.ofauth.com/v3/api-reference/realtime/onlyfans-events.md) | Receive message, content, and other account activity. |
| [Lifecycle events](https://docs.ofauth.com/v3/api-reference/system-webhook-events.md) | Track changes to shared accounts and the access owners approved. |

[Dynamic Rules](https://docs.ofauth.com/v3/api-reference/dynamic-rules.md) provides the values needed to sign requests sent directly to OnlyFans.

### Account: shared linked accounts

The Account API lists and manages accounts shared through the same authorization as your token. You cannot use it to access another authorization's accounts. Send the token in the `Authorization` header and select an account in the URL when required.

See [Linked accounts](https://docs.ofauth.com/v3/api-reference/account/linked-accounts.md) for list, read, removal, settings, pagination, and status fields.

### Link: authorization and tokens

| Endpoint | Method | Purpose |
| - | - | - |
| `https://link.ofauth.com/v3/authorize` | `GET` | Ask an owner to approve access. Use PKCE to protect the returned code. |
| `https://api.ofauth.com/v3/link/token` | `POST` | Exchange a code for tokens, or get new tokens with a refresh token. |
| `https://api.ofauth.com/v3/link/revoke` | `POST` | Revoke one access token or renewable credential. |
| `https://api.ofauth.com/v3/authorization` | `GET` | Read the current authorization and grants. |
| `https://api.ofauth.com/v3/authorization` | `DELETE` | End the whole authorization and all its credentials. |
| `https://api.ofauth.com/.well-known/oauth-authorization-server/v3/link` | `GET` | Read the sign-in server's supported settings and URLs. |

Follow [Authorize](https://docs.ofauth.com/v3/api-reference/link/authorize.md) for request and callback fields and [Tokens and refresh](https://docs.ofauth.com/v3/api-reference/link/tokens.md) for token responses, refresh, and ending access.

### Access: account operations

Access operations use `/v3/access/*` for profiles, chats, subscribers, users, posts, stories, media, earnings, promotions, and queued content. Each reference lists the HTTP method, permissions, input fields, and response.

Send only the input fields listed for the operation. Protected media may include a `playback` descriptor. Follow [Play DRM video](https://docs.ofauth.com/v3/guides/drm-playback.md) for player setup and renewal.

## Read responses

Each operation's reference shows its response fields. Profile reads and requests that create an item return the object directly. Access lists usually return `items` and `page`. Linked-account lists return `data`, `has_more`, and `next_cursor`. See [Pagination](https://docs.ofauth.com/v3/reference/pagination.md) to read every page.

Media URLs expire. Read the post, message, or media item again to get fresh URLs. Save media IDs when you need to find the same item later.

## Handle errors and limits

Access, Vault+, and linked-account errors include `error`, `recovery.action`, and `requestId`. Read `recovery.action` to choose the next step. Save `x-request-id` from the response headers if you need support. OAuth endpoints return different error fields. See [error codes](https://docs.ofauth.com/v3/api-reference/errors.md) and [Handle failed requests](https://docs.ofauth.com/v3/reference/error-handling.md).

If you hit a [rate limit](https://docs.ofauth.com/v3/reference/rate-limiting.md), wait for the time given in `Retry-After`. If a network error leaves you unsure whether a change succeeded, check its result before you send it again.

For a complete app example, follow [quickstart](https://docs.ofauth.com/v3/setup/quickstart.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.