Media
Scrape media from the OnlyFans CDN
Scrapes a `https://cdn*.onlyfans.com/*` URL and uploads it to the OnlyFans API CDN, so that you can view or download the file. **Max file size is 500MB**
AuthorizationBearer <token>
You can retrieve your token by visiting the OnlyFansAPI Console and clicking API Keys -> Create API Key.
In: header
Path Parameters
accountstring
The Account ID
urlstring
The CDN URL to scrape. Keep in mind that these URLs expire fast.
expiration_date?string
The expiration date of our returned temporary_url
. Default of 5 minutes.
Response Body
curl -X POST "https://app.onlyfansapi.com/api/acct_XXXXXXXXXXXXXXX/media/scrape" \
-H "Content-Type: application/json" \
-d '{
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
}'
const body = JSON.stringify({
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
})
fetch("https://app.onlyfansapi.com/api/acct_XXXXXXXXXXXXXXX/media/scrape", {
body
})
package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://app.onlyfansapi.com/api/acct_XXXXXXXXXXXXXXX/media/scrape"
body := strings.NewReader(`{
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
}`)
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/acct_XXXXXXXXXXXXXXX/media/scrape"
body = {
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
}
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("""{
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
}""");
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create("https://app.onlyfansapi.com/api/acct_XXXXXXXXXXXXXXX/media/scrape"))
.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("""
{
"url": "https://cdn2.onlyfans.com/files/e/e5/123/600x400_123.jpg?Tag=2&u=123&Policy=123&Signature=signature&Key-Pair-Id=123"
}
""", Encoding.UTF8, "application/json");
var client = new HttpClient();
var response = await client.PostAsync("https://app.onlyfansapi.com/api/acct_XXXXXXXXXXXXXXX/media/scrape", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
"temporary_url": "https://ofapi-media-prod.nyc3.digitaloceanspaces.com/123/600x400_123.jpg",
"expiration_date": "2025-01-01T00:00:00.000000Z"
}
{
"error": "ONLYFANS_COM_ERROR",
"message": "OnlyFans returned an unknown error.: [403]",
"description": "This error happened most probably because of a bug in the OnlyFans.com API or you sent wrong parameters (like a non-existing user id).",
"onlyfans_response": {
"status": 403,
"body": null
},
"_meta": {
"_credits": {
"used": 1,
"balance": 123,
"note": "OnlyFans returned an error, but we still had to make an API request to OnlyFans.com"
},
"_cache": {
"is_cached": false,
"note": "Cache disabled for this endpoint"
},
"_rate_limits": {
"limit_minute": 1000,
"limit_day": 50000,
"remaining_minute": 999,
"remaining_day": 50000
}
}
}