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

# Migrate from V2 to V3

> Prepare your app for the organization cutover, import your migrated accounts' V3 tokens, and map V2 routes to V3 operations.

You move your whole organization from V2 to V3 in one guided flow in the OFAuth dashboard. This guide covers the code changes your app needs before and after cutover.

![Prepare your V3 integration and import script before cutover, run cutover in the dashboard, then download and import the one-time account token bundle.](https://mintcdn.com/ofauth/VVqOdSxbrh7mDF0M/images/v3/migration-cutover.svg?fit=max\&auto=format\&n=VVqOdSxbrh7mDF0M\&q=85\&s=9877f235fa4da452fa64aa4552d2ef09)

> [!TIP]
>
> Using a coding agent? [Migrate with an AI agent](https://docs.ofauth.com/v3/guides/migrate-with-an-ai-agent.md): install the migration skill and your agent makes these code changes for you to review.

> [!WARNING]
>
> The move is a hard cut. At cutover, V2 stops serving your migrated connections, and V3 has no compatibility layer for V2 API keys, `/v2/*` routes, or the raw access proxy. Prepare and deploy your V3 integration before you schedule cutover.

Creators do not need to reconnect. Every Live connection moves with its ID, its OnlyFans session, and its mapped permissions.

## What changes

### What moves

| V2 | On V3 |
| - | - |
| Live client apps (redirect, embed, whitelabel) | Merged into one V3 integration. Redirect URLs become Live OAuth callbacks. Origins are dropped. |
| Live connections | Moved with unchanged IDs. Creators stay connected. |
| Connection permissions | Mapped to V3 scopes for each connection. See [Permissions to scopes](#permissions-to-scopes). |
| Webhook endpoints | Moved, with their filters mapped to V3 events. See [Webhook events](#webhook-events). The `whsec_` signing secret is kept by default; rotating it is optional. |
| Realtime subscriptions and defaults | Become your V3 Realtime policy. |
| Vault+ settings and retained media | Moved for Developer destinations. Vault+ routes move to `/v3/vault-plus/*`. |
| Dynamic rules | Kept while your V3 subscription stays active, if your V2 plan included them. |

### What is removed

| V2 | V3 alternative |
| - | - |
| API keys (`sk_live_...`, `sk_sandbox_...`) | External OAuth: a client ID and secret per environment, plus a Bearer access token per authorization. |
| Raw access proxy (`/v2/access/proxy/*`) | Typed V3 Access operations. See [Route map](#route-map). |
| Embedded and whitelabel Link | Hosted Live OAuth flow at `https://link.ofauth.com/v3/authorize` with your callbacks and [branding](https://docs.ofauth.com/v3/guides/authorization-branding.md). |
| `/v2/account` import, settings, and whoami | Accounts connect through OAuth and are managed via `/v3/linked-accounts` and the dashboard. |
| V2 sandbox apps, keys, and connections | Deleted. Set up the V3 Sandbox (mock data) and Test environments fresh. |

### Concept map

| V2 | V3 |
| - | - |
| API key in the `apikey` header | `Authorization: Bearer <access_token>`, from `POST https://api.ofauth.com/v3/link/token` |
| `POST /v2/link/init`, then redirect to session URL | `GET https://link.ofauth.com/v3/authorize` with S256 PKCE |
| Connection | Linked account. Migrated accounts keep their connection ID. |
| `x-connection-id` header | `x-linked-account-id` header, with the same ID |
| Client app permissions | Scopes on the authorization request and on each linked account |
| Environment chosen by key prefix | Environment chosen by client ID (separate Sandbox, Test, and Live clients) |
| `GET /v2/account/connections` | [`GET /v3/linked-accounts`](https://docs.ofauth.com/v3/api-reference/account/linked-accounts) |
| `connection.*` webhook events | [`authorization.*` and `linked_account.*`](https://docs.ofauth.com/v3/api-reference/system-webhook-events) lifecycle events |
| `svix-*` webhook headers | Standard Webhooks headers (`webhook-id`, `webhook-timestamp`, `webhook-signature`) |
| `/v2/vault-plus/*` | `/v3/vault-plus/*` |

## Permissions to scopes

Each migrated connection keeps its own V2 permissions, mapped to V3 scopes. Nothing is widened, and there is no review wait.

| V2 permission | V3 scopes |
| - | - |
| `all:read` | Every read scope: `analytics:read`, `finances:read`, `lists:read`, `messages:read`, `notifications:read`, `posts:read`, `profile:read`, `promotions:read`, `queue:read`, `stories:read`, `subscribers:read`, `subscriptions:read`, `users:read`, `vault:read` |
| `all:write` | Every write scope: `lists:write`, `messages:write`, `notifications:write`, `posts:write`, `profile:write`, `promotions:write`, `queue:write`, `stories:write`, `subscribers:write`, `subscriptions:write`, `users:write`, `vault:write`. No read scopes, as in V2. |
| `all:*` | Every read and write scope |
| `earnings:read` | `finances:read` |
| `messages:read` | `messages:read`, `queue:read` |
| `messages:write` | `messages:write`, `queue:write` |
| `posts:read` | `posts:read`, `queue:read` |
| `posts:write` | `posts:write`, `queue:write` |
| `users:write` | `users:write`, `users:read` |
| `payouts:write` | Removed. V3 has no equivalent. |
| All other permissions | The scope with the same name |

The extra `queue:*` and `users:read` scopes cover operations those V2 permissions already allowed. V3 lists scheduled posts and queued mass messages under `queue:*`, and blocked and restricted users under `users:read`.

## Route map

Most V2 Access routes move from `/v2/access/*` to `/v3/access/*` with the same path. Routes whose path or contract changed are listed below.

### Account & linked accounts

| V2 route | V3 operation | Scope |
| - | - | - |
| `GET /v2/account/connections` | `GET /v3/linked-accounts` | Bearer token (any scope) |
| `DELETE /v2/account/connections/:connectionId` | `DELETE /v3/linked-accounts/:id` | Bearer token |
| `GET /v2/access/self` | `GET /v3/access/profile` | `profile:read` |
| `PATCH /v2/access/self` | `PATCH /v3/access/profile` | `profile:write` |
| `GET /v2/access/self/notifications` | `GET /v3/access/notifications` | `notifications:read` |
| `GET /v2/access/self/release-forms` | `GET /v3/access/profile/release-forms` | `profile:read` |
| `GET /v2/access/self/tagged-friend-users` | `GET /v3/access/profile/tagged-friend-users` | `profile:read` |

### Posts, stories & vault

| V2 route | V3 operation | Scope |
| - | - | - |
| `GET /v2/access/posts` | `GET /v3/access/posts` | `posts:read` |
| `GET /v2/access/posts/:postId` | `GET /v3/access/posts/:postId` | `posts:read` |
| `GET /v2/access/users/:userId/posts` | `GET /v3/access/users/:userId/posts` | `posts:read` |
| `POST /v2/access/posts` | `POST /v3/access/posts` | `posts:write` |
| `PUT /v2/access/posts/:postId` | `PUT /v3/access/posts/:postId` | `posts:write` |
| `DELETE /v2/access/posts/:postId` | `DELETE /v3/access/posts/:postId` | `posts:write` |
| `GET /v2/access/users/:userId/stories` | `GET /v3/access/users/:userId/stories` | `stories:read` |
| `PUT /v2/access/stories/:storyId/watched` | `PUT /v3/access/stories/:storyId/watched` | `stories:write` |
| `GET /v2/access/vault/media` | `GET /v3/access/vault/media` | `vault:read` |
| `GET /v2/access/vault/lists` | `GET /v3/access/vault/lists` | `vault:read` |
| `POST /v2/access/vault/lists` | `POST /v3/access/vault/lists` | `vault:write` |
| `PATCH /v2/access/vault/lists/:listId` | `PATCH /v3/access/vault/lists/:listId` | `vault:write` |
| `DELETE /v2/access/vault/lists/:listId` | `DELETE /v3/access/vault/lists/:listId` | `vault:write` |
| `POST /v2/access/vault/lists/:listId/media` | `POST /v3/access/vault/lists/:listId/media` | `vault:write` |

Uploads use a new flow in V3: `POST /v3/access/uploads/start`, `PUT /v3/access/uploads/:mediaUploadId/parts/:partNumber`, then `PUT /v3/access/uploads/:mediaUploadId/finalize` or `POST /v3/access/uploads/finalize` (`vault:write`). See [Upload media](https://docs.ofauth.com/v3/guides/how-to/upload-media.md).

### Earnings & analytics

| V2 route | V3 operation | Scope |
| - | - | - |
| `GET /v2/access/earnings/chart` | `GET /v3/access/finances/earnings/timeseries` (or `/timeseries/total`, `/subscriptions`, `/messages`, `/posts`, `/profile-tips`, `/streams`) | `finances:read` |
| `GET /v2/access/earnings/transactions` | `GET /v3/access/finances/earnings/transactions` | `finances:read` |
| `GET /v2/access/earnings/chargebacks` | `GET /v3/access/finances/earnings/chargebacks` | `finances:read` |
| `GET /v2/access/analytics/posts/chart` | `GET /v3/access/analytics/timeseries/engagement/posts` | `analytics:read` |
| `GET /v2/access/analytics/posts/top` | `GET /v3/access/analytics/posts/top` | `analytics:read` |
| `GET /v2/access/analytics/posts/:postId` | `GET /v3/access/analytics/posts/:postId` | `analytics:read` |
| `GET /v2/access/analytics/stories/chart` | `GET /v3/access/analytics/timeseries/engagement/stories` | `analytics:read` |
| `GET /v2/access/analytics/stories/top` | `GET /v3/access/analytics/stories/top` | `analytics:read` |
| `GET /v2/access/analytics/streams/chart` | `GET /v3/access/analytics/timeseries/engagement/streams` | `analytics:read` |
| `GET /v2/access/analytics/streams/top` | `GET /v3/access/analytics/streams/top` | `analytics:read` |
| `GET /v2/access/analytics/mass-messages/chart` | `GET /v3/access/analytics/timeseries/engagement/messages` | `analytics:read` |
| `GET /v2/access/analytics/mass-messages/sent` | `GET /v3/access/analytics/mass-messages/sent` | `analytics:read` |
| `GET /v2/access/analytics/mass-messages/:massMessageId/buyers` | `GET /v3/access/analytics/mass-messages/:massMessageId/buyers` | `analytics:read` |
| `GET /v2/access/analytics/promotions/chart` | `GET /v3/access/analytics/timeseries/promotions` | `analytics:read` |
| `GET /v2/access/analytics/promotions/top` | `GET /v3/access/analytics/promotions/top` | `analytics:read` |
| `GET /v2/access/analytics/trials/chart` | `GET /v3/access/analytics/timeseries/trial-links` | `analytics:read` |
| `GET /v2/access/analytics/trials/top` | `GET /v3/access/analytics/trial-links/top` | `analytics:read` |
| `GET /v2/access/analytics/campaigns/chart` | `GET /v3/access/analytics/timeseries/tracking-links` | `analytics:read` |
| `GET /v2/access/analytics/campaigns/top` | `GET /v3/access/analytics/tracking-links/rankings` | `analytics:read` |
| `GET /v2/access/analytics/visitor-countries/chart` | `GET /v3/access/analytics/timeseries/visitor-countries` | `analytics:read` |
| `GET /v2/access/analytics/visitor-countries/top` | `GET /v3/access/analytics/visitor-countries/top` | `analytics:read` |

## Prepare before cutover

**1. Save your Live callbacks and client secret**

The dashboard migration wizard pre-fills Live callbacks from your V2 redirect URLs. Review them, add any dedicated reconnect return URL if needed, and save the Live client secret where your backend runs. It is shown once.

**2. Build the V3 OAuth flow for new users**

New users connect through V3 OAuth. Follow [Authorize](https://docs.ofauth.com/v3/api-reference/link/authorize.md) and [Tokens and refresh](https://docs.ofauth.com/v3/api-reference/link/tokens.md). `GET https://link.ofauth.com/v3/authorize` replaces `POST /v2/link/init`, and your callback receives `code` and `state` instead of a connection ID. Store each user's stable `refresh_token` encrypted at rest.

**3. Rehearse in Test**

Complete an OAuth exchange with your Test client and make at least one successful Access call against a Test account.

**4. Verify your Live client credentials**

Confirm your backend can authenticate against `POST https://api.ofauth.com/v3/link/token` with your Live client ID and secret.

**5. Update your webhook receivers**

V3 signs deliveries with the same Standard Webhooks scheme and `whsec_` secret, but renames the headers:

| V2 header | V3 header |
| - | - |
| `svix-id` | `webhook-id` |
| `svix-timestamp` | `webhook-timestamp` |
| `svix-signature` | `webhook-signature` |

Deploy a receiver that accepts both header sets before cutover (example below) and handles V3 [lifecycle events](#webhook-events).

**6. Deploy your account bundle import**

Build and deploy the one-time import script described in [Switch your accounts to V3](#switch-your-accounts-to-v3) so you can run it immediately after cutover finishes.

### Dual-header webhook verification

Until cutover, V2 still sends `svix-*` headers. This receiver accepts both header sets so you can deploy it before cutover:

```typescript theme={null}
import { Webhook } from "standardwebhooks"

const secret = process.env.OFAUTH_WEBHOOK_SECRET
if (!secret) throw new Error("Missing OFAUTH_WEBHOOK_SECRET")

const webhook = new Webhook(secret)

const header = (request: Request, name: string) =>
  request.headers.get(`webhook-${name}`) ??
  request.headers.get(`svix-${name}`) ??
  ""

export async function handleOfauthWebhook(request: Request) {
  const body = await request.text()

  let event: unknown
  try {
    event = webhook.verify(body, {
      "webhook-id": header(request, "id"),
      "webhook-timestamp": header(request, "timestamp"),
      "webhook-signature": header(request, "signature"),
    })
  } catch {
    return new Response("Invalid signature", { status: 400 })
  }

  await processEvent(event)
  return new Response(null, { status: 204 })
}
```

The migration itself sends no webhook events.

## After cutover on V2

Every V2 response for a migrated connection returns `401`:

```json theme={null}
{
  "error": "Connection has migrated",
  "type": "SESSION_NOT_PROVIDED"
}
```

Live V2 API keys for a migrated organization are disabled when cutover finishes. Remove them from your configuration.

## Switch your accounts to V3

When cutover finishes, an organization owner downloads a one-time **account bundle** (`ofauth-migrated-accounts-<organization>-<date>.json`) from the migration page in the dashboard. It contains one V3 refresh token for each migrated Live account.

> [!WARNING]
>
> From cutover until you import the bundle, API calls for your migrated accounts fail. Treat the bundle like your client secret: never commit it, paste it into an agent chat, or share it. Run the import yourself, then delete the file.

The bundle is issued when your organization migrates to a Developer plan (or Developer + Operator). Operator-only migrations have no API bundle.

### Import the bundle

Exchange each account's `refresh_token` once to verify and store a fresh access token alongside the stable refresh token:

```typescript theme={null}
import { readFile } from "node:fs/promises"

type AccountBundle = {
  format: "ofauth.migrated-accounts.v1"
  client_id: string
  token_endpoint: string
  accounts: {
    linked_account_id: string
    authorization_id: string
    refresh_token: string
    scope: string
  }[]
  skipped: { linked_account_id: string; reason: string }[]
}

const clientId = process.env.OFAUTH_LIVE_CLIENT_ID
const clientSecret = process.env.OFAUTH_LIVE_CLIENT_SECRET
if (!clientId || !clientSecret) {
  throw new Error("Missing OFAuth Live client credentials")
}

const credentials = Buffer.from(
  `${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`
).toString("base64")

export async function importAccountBundle(path: string) {
  const bundle: AccountBundle = JSON.parse(await readFile(path, "utf8"))
  if (
    bundle.format !== "ofauth.migrated-accounts.v1" ||
    bundle.client_id !== clientId
  ) {
    throw new Error("This bundle is not for this Live client")
  }

  for (const account of bundle.accounts) {
    const response = await fetch(bundle.token_endpoint, {
      method: "POST",
      headers: {
        authorization: `Basic ${credentials}`,
        "content-type": "application/x-www-form-urlencoded",
      },
      body: new URLSearchParams({
        grant_type: "refresh_token",
        refresh_token: account.refresh_token,
      }),
    })

    const body = await response.json()
    if (!response.ok) {
      await recordImportFailure(account.linked_account_id, body.error)
      continue
    }

    await saveTokens(account.linked_account_id, {
      authorizationId: body.authorization_id ?? account.authorization_id,
      accessToken: body.access_token,
      expiresIn: body.expires_in,
      refreshToken: body.refresh_token,
      scope: body.scope,
    })
  }

  for (const skipped of bundle.skipped) {
    await markReauthorizationRequired(skipped.linked_account_id, skipped.reason)
  }
}
```

From here on, each account is a standard V3 session:

* Store tokens keyed by `linked_account_id`, even when multiple accounts share an `authorization_id`.
* Access tokens are opaque and expire after **15 minutes** (`expires_in: 900`).
* Refresh tokens are **stable and client-bound**: each refresh returns a new access token and the same refresh token. Concurrent refreshes across backend instances and retries after lost responses are safe.
* Refresh tokens expire after **90 days** without a successful authenticated refresh.

### Regenerate the bundle

If the bundle file is lost before or during import, an owner can regenerate it from the migration page (rate-limited to once per 60 seconds). Regenerating revokes every token issued from the previous bundle and issues fresh ones without affecting tokens created through your own OAuth flows.

### Call V3 with the same account ID

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

| Status | `error` | `recovery.action` | Meaning |
| - | - | - | - |
| `403` | `linked_account_required` | `select_linked_account` | `x-linked-account-id` header is missing. |
| `403` | `linked_account_not_granted` | `grant_linked_account` | This authorization does not include the account. |
| `401` | `linked_account_reconnect_required` | `reconnect_linked_account` | The OnlyFans session ended. Direct the creator to [reconnect](https://docs.ofauth.com/v3/guides/reconnect.md). |
| `403` | `linked_account_vault_plus_disabled` | `enable_linked_account_vault_plus` | Vault+ is disabled for this account. |

## Reconnecting migrated accounts

For normal expired sessions, create a targeted reconnect journey with [`POST /v3/linked-accounts/{id}/reconnect`](https://docs.ofauth.com/v3/guides/reconnect) (`client.linkedAccounts.createReconnect`).

If a migrated creator reconnects through your Live OAuth flow (`GET https://link.ofauth.com/v3/authorize`), OFAuth matches the verified OnlyFans account to its migrated connection and claims it in place (preserving the connection ID, installation, and grants). If that creator owns additional migrated accounts in your organization, you can pass their IDs as a comma-separated `linked_account_ids` query parameter on the authorize request to consolidate them under the same holder in one step.

## Webhook events

V2 `connection.*` events are replaced by `authorization.*` and `linked_account.*` lifecycle events. See [System Webhook Events](https://docs.ofauth.com/v3/api-reference/system-webhook-events.md) for full payload details.

| Event type | When | `data.reason` |
| - | - | - |
| `authorization.granted` | Owner approved your app. | `authorized` |
| `authorization.updated` | Owner changed accounts/scopes, or auto-added an account. | `consent_updated`, `auto_added` |
| `authorization.revoked` | Whole authorization ended. | `holder_revoked`, `oauth_revocation`, `integration_deleted`, `integration_suspended` |
| `linked_account.expired` | One account needs a reconnect. | `provider_session_expired` |
| `linked_account.reconnected` | One account works again after reconnect. | `reconnected` |
| `linked_account.disconnected` | One account no longer works for this authorization. | `owner_removed`, `owner_disconnected`, `owner_deleted`, `developer_deleted` |

Lifecycle deliveries are not billed. Payloads carry IDs only; call `GET /v3/linked-accounts` for names, status, and scopes.

## Realtime over Server-Sent Events

V3 Realtime uses **Server-Sent Events (SSE)** instead of WebSockets:

* **Backend stream**: `GET https://api.ofauth.com/v3/realtime/events?linkedAccountId=<account_id>` with `Accept: text/event-stream` and `Authorization: Bearer <access_token>`. See [Realtime OnlyFans events](https://docs.ofauth.com/v3/guides/realtime-onlyfans-events.md).
* **Browser stream**: call `POST https://api.ofauth.com/v3/realtime` from your backend to mint a short-lived `EventSource` URL without exposing access tokens to the browser. See [Realtime from the browser](https://docs.ofauth.com/v3/guides/realtime-browser.md).

Lifecycle events arrive by webhook only; SSE streams carry OnlyFans Realtime activity events.

## Authorization server discovery

RFC 8414 metadata is published at:

```http theme={null}
GET https://api.ofauth.com/.well-known/oauth-authorization-server/v3/link
```

* **Issuer**: `https://api.ofauth.com/v3/link`
* **Authorization endpoint**: `https://link.ofauth.com/v3/authorize`
* **Token endpoint**: `https://api.ofauth.com/v3/link/token`
* **Revocation endpoint**: `https://api.ofauth.com/v3/link/revoke`
* **Userinfo endpoint**: `https://api.ofauth.com/v3/link/userinfo`

## Pricing

Migrating organizations receive **30% off** the first month of the V3 plan they choose (Developer Build keeps its 50% 6-month launch offer instead; discounts do not stack). V2 billing stops at cutover.

## FAQ

> [accordion] Do creators need to log in to OnlyFans again?
>
> No. Migrated accounts keep their OnlyFans session. Creators only reconnect if OnlyFans ends the session, as on V2.

> [accordion] Can I keep my V2 connection IDs?
>
> Yes. Every migrated account keeps its exact ID. Send it in `x-linked-account-id` on V3.

> [accordion] What replaces the raw proxy?
>
> Typed V3 Access operations. If an OnlyFans path you rely on has no V3 operation, contact [support@ofauth.com](mailto:support@ofauth.com) with the path before scheduling cutover.

> [accordion] How long do V3 tokens last?
>
> Access tokens last 15 minutes (`expires_in: 900`). Refresh tokens are stable and expire after 90 days without a successful refresh.

> [accordion] What happens if I lose a refresh token?
>
> Send the user through OAuth authorization again to get a new credential in the same authorization. If you lose the one-time migration bundle before importing, an owner can [regenerate the bundle](#regenerate-the-bundle).

> [accordion] Can I migrate one client app at a time?
>
> No. The whole organization moves together: every Live client app and every Live connection. V2 Sandbox apps, keys, and connections are not migrated; set up V3 Sandbox and Test fresh.


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