Response Structure
Understanding API response format, metadata, and headers
Response Format
Every API response follows a consistent structure with two main components:
- The
data
field containing OnlyFans information - Optional
_pagination
field with pagination information, if the endpoint is paginated - The
_meta
object containing request metadata
Here's an example response:
Response Body Structure
{
"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": 1000,
"remaining_minute": 59,
"remaining_day": 988
}
}
}
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
/messages
endpoints - Subscriber data for
/subscribers
endpoints
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
: Requests allowed per dayremaining_minute
: Remaining requests this minuteremaining_day
: Remaining requests today
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 | Daily limit |
x-rate-limit-limit-minute | 60 | Rate Limit Headers | Per-minute limit |
x-rate-limit-remaining-day | 988 | Rate Limit Headers | Remaining daily requests |
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=true
to 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.