Connections represent authenticated OnlyFans accounts linked to your organization. There are two ways to create connections:
Link authentication — Users authenticate through OFAuth’s secure Link flow. OFAuth handles credentials, 2FA, and session management.
Import — You provide existing OnlyFans session data directly via the API. Useful if you manage authentication yourself or are migrating from another system.
Both types produce a Connection ID that you use with the Access API to interact with OnlyFans data.
The clientReferenceId you provide when initializing a Link session is your key to mapping connections to users in your system:
Copy
// 1. When initializing Link, pass your internal user IDconst 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 })});
Copy
// 2. In webhook handler, use clientReferenceId to store the connectionapp.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.
If you manage OnlyFans authentication yourself, you can import sessions directly. Imported connections are not billed monthly and are not health-checked by the connection monitor. They can be used through the Access API immediately.
OnlyFans session cookie. Must contain auth_id, sess, and fp values.
userAgent
string
Yes
The user agent string used to create the session.
permissions
string[]
No
Permissions to grant. Defaults to organization permissions.
clientReferenceId
string
No
Your internal reference ID for tracking.
OFAuth validates the session by making a request to OnlyFans and automatically fetches the user’s profile data. If the session is invalid or expired, the import will fail.
Copy
curl -X POST https://api.ofauth.com/v2/account/connections/import \ -H "apikey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "cookie": "auth_id=123456; sess=your_session_token; fp=your_fingerprint", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 ...", "clientReferenceId": "user_abc123" }'
The response includes the full connection object with imported: true and the user’s profile data fetched from OnlyFans.
If an active connection with the same OnlyFans user already exists, the import returns a 409 error with the existing connection ID. You can update the session on the existing connection using the update endpoint instead.
If an imported connection’s session expires or needs to be rotated, you can update it in place without deleting and re-importing. This preserves the connection ID.
New OnlyFans session cookie. Must contain auth_id, sess, and fp values.
userAgent
string
Yes
The user agent string used to create the new session.
The new session is validated against OnlyFans and must belong to the same OnlyFans user as the existing connection. If the user ID from the new cookie doesn’t match, the request returns a 409 error.
Copy
curl -X PATCH https://api.ofauth.com/v2/account/connections/import/conn_abc123xyz \ -H "apikey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "cookie": "auth_id=123456; sess=new_session_token; fp=new_fingerprint", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 ..." }'
On success, the connection status is set back to active and the response includes updated user profile data from OnlyFans.
This endpoint only works for imported connections (imported: true). Link-managed connections cannot be updated through this endpoint.
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: