> ## 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.

# Manage linked accounts

> Manage the accounts an owner shares with your V3 authorization.

Use linked accounts to track the OnlyFans accounts shared with your app. Each account belongs to its owner. An authorization records the accounts and permissions that the owner approved.

## Map accounts to your users

Start [authorization](https://docs.ofauth.com/v3/api-reference/link/authorize.md) while the user is signed in to your app. Save the pending `state` value under that user. After exchanging the code for tokens, save the credentials and environment under the same user.

Fetch account IDs through [List linked accounts](https://docs.ofauth.com/v3/api-reference/account/linked-accounts.md#list-linked-accounts), following every page. `authorization_id` is optional in a token response; use `GET /v3/authorization` when your application needs the authorization resource.

Do not use the callback as an account list. The callback returns a code and state. Account IDs come from linked-account routes and lifecycle events.

![A signed-in application user can have an authorization containing several shared accounts. Store those accounts under the authorization and select one linked account per API request.](https://mintcdn.com/ofauth/VVqOdSxbrh7mDF0M/images/v3/shared-account-selection.svg?fit=max\&auto=format\&n=VVqOdSxbrh7mDF0M\&q=85\&s=a93eece96cf038044a5101598515ae10)

## Keep the identifiers distinct

| Identifier | Identifies | Where your app uses it |
| - | - | - |
| Your application's user ID | Your signed-in user | Owns your saved authorization records. |
| `authorization_id` | The accounts and scopes shared with your integration | Associates tokens and linked accounts with your user and environment. |
| Linked account `id` | One shared OnlyFans account | Sent as `x-linked-account-id` on Access and Vault+ requests. |
| `provider_account_id` | The OnlyFans user ID of that account | Identifies the OnlyFans user, not the OFAuth authorization. |

In chat routes, the recipient's OnlyFans ID identifies the fan. It is separate from the linked account ID that selects the creator sending the message.

## Read current account state

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

const client = new OFAuthClient({ accessToken: process.env.ACCESS_TOKEN! })
for await (const account of client.linkedAccounts.iterate()) {
  console.log(account.id, account.status)
}
```

For an account's full record, use `GET /v3/linked-accounts/{id}`. The [linked-account reference](https://docs.ofauth.com/v3/api-reference/account/linked-accounts.md) defines pagination, fields, settings, and status values.

## Keep account access current

Subscribe to [account and access events](https://docs.ofauth.com/v3/guides/webhook-setup.md) to track removed accounts, expired sessions, and revoked authorizations. Fetch the linked-account list again when you need current status or permissions.

Follow [Handle account reconnects](https://docs.ofauth.com/v3/guides/reconnect.md) when an account expires. Follow [Request more access](https://docs.ofauth.com/v3/guides/request-access.md) when a feature needs additional scopes or accounts.

## Remove a shared account

```typescript theme={null}
await client.linkedAccounts.remove({ id: process.env.LINKED_ACCOUNT_ID! })
```

A successful call returns `204`. This removes the account from the current authorization. The owner's account and other applications' access remain.

To end an OAuth credential, use [revocation](https://docs.ofauth.com/v3/api-reference/link/tokens.md#revoke).


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