Response Structure
Understanding API response format, metadata, and headers
Response Format
Every API response follows a consistent structure with two main components:
- The
datafield containing OnlyFans information - Optional
_paginationfield with pagination information, if the endpoint is paginated - The
_metaobject containing request metadata
Here's an example response:
Response Body Structure
We have removed our daily rate limits!
We have decided to remove our daily rate limits. Please remove any references to these values in your integrations.
{
"data": {
// OnlyFans response data
"view": "f",
"avatar": "https://...",
"isFriend": false,
"isBlocked": false,
"canReport": false
},
"_meta": {
"_credits": {
"used": 0,
"balance": 9852,
"note": "Cache HIT. No credits debited"
},
"_cache": {
"is_cached": true,
"cached_at": "2025-01-29T16:30:43+00:00",
"note": "Add ?fresh=true to the request URL to skip the cache and get a fresh response from OnlyFans"
},
"_rate_limits": {
"limit_minute": 60,
"limit_day": null, // Legacy
"remaining_minute": 59,
"remaining_day": null, // Legacy
"notice": "We have decided to remove our daily rate limits. Please remove any references to this in your integrations."
}
}
}The data Field
The data field always contains the actual OnlyFans response data. Its structure varies depending on the endpoint being called. For example:
- Profile information for
/profiles/{username} - Message data for
/messagesendpoints - Subscriber data for
/subscribersendpoints
Not every field in `data` comes straight from OnlyFans
Some endpoints are Hybrid (live OnlyFans response enriched with extra fields from our database) or Computed (built entirely from data we've stored or calculated). See Endpoint data sources for the exhaustive breakdown of which endpoints fall into each category.
The optional _pagination field
Some endpoints return paginated data. For example, /chats, /chats/XYZ/messages or /tracking-links.
In this case, the response will include a _pagination field with the next_page field that you can use to fetch the next page of results.
If there are no more pages, the next_page field will be null.
{
"data": {
// OnlyFans response data
},
"_meta": {
"_pagination": {
"next_page": "https://app.onlyfansapi.com/api/acct_XXXXXXXXXXX/chats/?offset=10&limit=10"
}
}
}The _meta Object
The _meta object contains three sections of metadata about your request:
-
_credits: Credit usage informationused: Credits consumed by this requestbalance: Your remaining credit balancenote: Additional information about credit usage
-
_cache: Caching status and informationis_cached: Whether this response was served from cachecached_at: When the response was cachednote: Instructions for bypassing cache if needed
-
_rate_limits: Rate limiting informationlimit_minute: Requests allowed per minutelimit_day: Legacy: Requests allowed per day (removed)remaining_minute: Remaining requests this minuteremaining_day: Legacy: Remaining requests today (removed)
Error Responses
When a request fails, the response drops the data field and returns a top-level error string alongside the matching HTTP status code:
{
"error": "Not Found"
}Some errors carry an additional machine-readable code field. Treat code as optional: error is always present, code is only added where we can be more specific than the status code alone.
account_not_found
Returned with a 404 when the acct_ ID in the request URL (or in the Account-Id header) does not resolve to a connected account on your team:
{
"error": "Not Found",
"code": "account_not_found"
}The account is gone — it was disconnected, deleted, or never existed — so the fix is to reconnect the creator rather than to correct a resource ID. For privacy reasons, an acct_ ID that belongs to a different team returns this exact same response.
To find out the moment an account is disconnected instead of on your next request, subscribe to the accounts.disconnected webhook.
A 404 without a code means the endpoint or the requested resource doesn't exist; the account itself resolved fine.
Using the OnlyFans user ID instead of the OFAPI ID?
If the account ID in your URL doesn't start with acct_, you'll get {"error": "You must use the OFAPI ID (starting with acct_), not the OnlyFans user ID"} instead. You can look up the acct_ ID with List Accounts.
Response Headers
Each response includes comprehensive metadata in the headers:
| Header | Value | Category | Description |
|---|---|---|---|
content-type | application/json | Content Headers | Always application/json |
x-ofapi-credits-balance | 9852 | Credit Headers | Your remaining credit balance |
x-ofapi-credits-used | 0 | Credit Headers | Credits used by this request |
x-ofapi-is-cached | true | Credit Headers | Whether response was cached |
x-rate-limit-limit-day | 1000 | Rate Limit Headers | Legacy: Removed |
x-rate-limit-limit-minute | 60 | Rate Limit Headers | Per-minute limit |
x-rate-limit-remaining-day | 988 | Rate Limit Headers | Legacy: Removed |
x-rate-limit-remaining-minute | 59 | Rate Limit Headers | Remaining minute requests |
Cache Control
You can control caching behavior using query parameters:
- By default, responses are cached when possible (only for public endpoints)
- Add
?fresh=trueto force a fresh response from OnlyFans - Cached responses don't consume credits
- Cache duration varies by endpoint
The same information is available in both headers and the _meta object. Use
headers for quick access in code, and the _meta object for more detailed
information including notes and timestamps.