🚀 Fansly API (Alpha) is live!WIP - Updated Daily
Fansly API Logo
Connect fansly account

Send OTP

Initiate a Two-Factor Authentication (2FA) session to receive an OTP.

This endpoint initiates a 2FA session, typically triggering the sending of an OTP (One-Time Password) to the user's registered email or device. This step is often required before performing sensitive actions like payouts.

https://v1.apifansly.com
POST
/api/fansly/{accountId}/twofa/session

Get Started

All requests to the Fansly API require an API Key. See the Authentication page for details.

curl -X POST "https://v1.apifansly.com/api/fansly/{accountId}/twofa/session" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "useEmailTwoFAFallback": true
  }'
fetch("https://v1.apifansly.com/api/fansly/{accountId}/twofa/session", {
  method: "POST",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "useEmailTwoFAFallback": true
  })
})
import requests

url = "https://v1.apifansly.com/api/fansly/{accountId}/twofa/session"
headers = {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "useEmailTwoFAFallback": True
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String jsonBody = "{\"useEmailTwoFAFallback\": true}";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://v1.apifansly.com/api/fansly/{accountId}/twofa/session"))
        .header("x-api-key", "YOUR_API_KEY")
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
        .build();

client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
        .thenApply(HttpResponse::body)
        .thenAccept(System.out::println)
        .join();
using System.Net.Http;
using System.Text;
using System.Text.Json;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");

var json = JsonSerializer.Serialize(new { 
    useEmailTwoFAFallback = true
});
var content = new StringContent(json, Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://v1.apifansly.com/api/fansly/{accountId}/twofa/session", content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
package main

import (
    "bytes"
    "encoding/json"
    "net/http"
    "fmt"
    "io/ioutil"
)

func main() {
    url := "https://v1.apifansly.com/api/fansly/{accountId}/twofa/session"
    
    values := map[string]interface{}{
        "useEmailTwoFAFallback": true,
    }
    jsonData, _ := json.Marshal(values)

    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("x-api-key", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()
    
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}

Path Variables

accountId*
string
The unique identifier for the account.

Request Body Parameters

The request body must be sent as JSON with the following parameters:

useEmailTwoFAFallback*
boolean
Use email as a fallback method to receive the 2FA code.

Response

Success Response (200 OK)

{
  "statusCode": 201,
  "message": "Success",
  "data": {
    "status_code": 200,
    "data": {
      "success": true,
      "response": {
        "emailTwofa": {
          "id": "87584xxxxxxxxx",
          "token": "ODc1ODQwNzUxxxxxxxxxxxxxxxxxxxxxxx",
          "email": "a*********y@g****.com",
          "type": 2
        }
      }
    }
  },
  "timestamp": "2026-02-05T17:04:27.908Z"
}

On this page