Create Client Session
Create Client Session Token for later use in embedded auth components - eg. via @onlyfansapi/auth npm package.
Get your API Key from OnlyFansAPI Console - https://app.onlyfansapi.com/api-keys
In: header
Display Name of the account visible in your OnlyFansAPI Console Dashboard.
Your Internal Reference ID for the connected account.
"us" | "uk" | "de" | "es" | "fr" | "it" | "ua" | "pl" | "ro" | "cz" | "hu" | "sk"
Response Body
curl -X POST "https://app.onlyfansapi.com/api/client-sessions" \
-H "Content-Type: application/json" \
-d '{
"display_name": "STRLCxGLVC Agency / Model: Stella"
}'
const body = JSON.stringify({
"display_name": "STRLCxGLVC Agency / Model: Stella"
})
fetch("https://app.onlyfansapi.com/api/client-sessions", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://app.onlyfansapi.com/api/client-sessions"
body := strings.NewReader(`{
"display_name": "STRLCxGLVC Agency / Model: Stella"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import requests
url = "https://app.onlyfansapi.com/api/client-sessions"
body = {
"display_name": "STRLCxGLVC Agency / Model: Stella"
}
response = requests.request("POST", url, json = body, headers = {
"Content-Type": "application/json"
})
print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;
var body = BodyPublishers.ofString("""{
"display_name": "STRLCxGLVC Agency / Model: Stella"
}""");
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://app.onlyfansapi.com/api/client-sessions"))
.header("Content-Type", "application/json")
.POST(body)
.build();
try {
HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
System.out.println("Status code: " + response.statusCode());
System.out.println("Response body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;
var body = new StringContent("""
{
"display_name": "STRLCxGLVC Agency / Model: Stella"
}
""", Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.PostAsync("https://app.onlyfansapi.com/api/client-sessions", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
"data": {
"token": "ofapi_cs_OriR8Sdocp0f97eFOdbMMZtiz4Aw5FLX",
"display_name": "STRLCxGLVC Agency / Model: Stella",
"client_reference_id": "my_crm_model_12345"
},
"_meta": {
"_credits": {
"used": 0,
"balance": 224907,
"note": "Always"
},
"_cache": {
"is_cached": false,
"note": "Cache disabled for this endpoint"
},
"_rate_limits": {
"limit_minute": 1000,
"limit_day": 50000,
"remaining_minute": 999,
"remaining_day": 49999
}
}
}
Start Typing Indicator POST
Calling this endpoint will show the target fan a "Model is typing..." note in the chat for ~4 seconds. If you want to continue showing the indicator call this endpoint multiple times. Free - no credits charged.
Poll Authentication Status GET
Poll the status of the authentication process. Eg. if 2FA is required, we will ask you for the code using the `twoFactorPending = true` in the response body.