Skip to main content
The Connections API manages your connected OnlyFans accounts. Connections are created through Link and used with the Access API.

Obtaining Connection IDs

After a user completes authentication through Link, you receive the connection ID through one of these methods:
MethodWhen to Use
connection.created webhookRecommended. Server-side, reliable, includes full details
Embed onSuccess callbackClient-side, immediate feedback for embedded flows
Redirect query paramsHosted redirect flow, connection_id in URL

Using Client Reference ID

The clientReferenceId you provide when initializing a Link session is your key to mapping connections to users in your system:
// 1. When initializing Link, pass your internal user ID
const session = await fetch("https://api.ofauth.com/v2/link/init", {
  method: "POST",
  headers: { apikey: "YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({
    redirectUrl: "https://yourapp.com/callback",
    clientReferenceId: "user_abc123" // Your internal user ID
  })
});
// 2. In webhook handler, use clientReferenceId to store the connection
app.post("/webhooks/ofauth", async (req, res) => {
  const { type, data } = req.body;
  
  if (type === "connection.created") {
    // Use clientReferenceId to find your user and store their connection
    await db.users.update({
      where: { id: data.clientReferenceId },
      data: { connectionId: data.connection.id }
    });
  }
  
  res.status(200).send("ok");
});
Always pass a clientReferenceId when initializing Link sessions. This is the recommended way to correlate connections back to your users, especially when using webhooks.

Connection States

StateDescription
pendingAuthentication in progress
activeReady for API access
awaiting_2faWaiting for 2FA verification
expiredSession ended, re-authentication needed
failedAuthentication failed

Connection Lifecycle

Connections may expire due to:
  • OnlyFans session expiration
  • User password changes
  • Extended inactivity
Set up webhooks to receive connection.expired events.

API Reference

List Connections

GET /v2/connections
ParameterTypeDescription
limitintegerMax results (default: 10)
offsetintegerSkip count (default: 0)
statusstringFilter: active, expired, awaiting_2fa

Delete Connection

DELETE /v2/connections/{connectionId}
Deleting a connection logs the user out and stops billing.

Reconnecting Expired Connections

When a connection expires, you can reconnect the same OnlyFans account without creating a duplicate connection. Pass the existing connectionId when initializing a new Link session:
curl -X POST https://api.ofauth.com/v2/link/init \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connectionId": "conn_abc123xyz",
    "redirectUrl": "https://yourapp.com/callback"
  }'
ParameterTypeDescription
connectionIdstringExisting connection ID to reconnect. Must start with conn_.
When a valid connectionId is provided:
  • The user completes authentication through Link
  • The existing connection is updated with fresh session data
  • Connection ID remains the same, preserving your references
When an invalid or non-existent connectionId is provided:
  • The system automatically creates a new connection instead
  • No error is thrown—this allows graceful handling of deleted connections
Use reconnection for expired connections to maintain consistent connection IDs in your database and avoid duplicate records.

Best Practices

  • Monitor status via webhooks
  • Handle expiration with re-auth flows using connectionId
  • Store securely - treat connection IDs as credentials
  • Clean up unused connections to stop billing

Next Steps