Skip to main content

What You Can Build

  • AI Chatbots: Automated fan interactions and response management
  • CRM Systems: Message history, conversation tracking, fan engagement tools
  • Mass Messaging: Send promotions, updates, or PPV content to multiple fans
  • Chat Analytics: Message volume, response times, engagement metrics

Quick Example

Send a message to a fan:
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/messages", {
  method: "POST",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Hey! Thanks for subscribing 💕"
  })
})

const message = await response.json()
console.log("Message sent:", message.id)

Common Operations

List Chats

Get a list of all conversations:
const response = await fetch("https://api.ofauth.com/v2/access/chats?" + new URLSearchParams({
  limit: "10",
  offset: "0",
  order: "recent"  // "recent" | "old"
}), {
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

const chats = await response.json()
// Returns array of chat objects with last message, fan info, etc.

Filter Chats

// Priority chats only
const priority = await fetch(
  "https://api.ofauth.com/v2/access/chats?filter=priority",
  { headers }
)

// Unread chats
const unread = await fetch(
  "https://api.ofauth.com/v2/access/chats?filter=unread",
  { headers }
)

// Fans who tipped
const tippers = await fetch(
  "https://api.ofauth.com/v2/access/chats?filter=who_tipped",
  { headers }
)

Get Chat Messages

Fetch messages from a specific conversation:
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/messages?" + new URLSearchParams({
  limit: "20",
  offset: "0"
}), {
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

const messages = await response.json()

Get Chat Media

Retrieve media shared in a specific conversation:
// Get all media from a chat
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/media", {
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

// Or filter by type: photos, videos, or audios
const photos = await fetch("https://api.ofauth.com/v2/access/chats/123456/media?type=photos", {
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

const media = await response.json()
ParameterTypeDescription
typestringFilter by media type: photos, videos, or audios. Omit for all media.
limitnumberResults per page
skip_usersstringSkip user data in response

Send Message with Media

Include images or videos in your message:
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/messages", {
  method: "POST",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Check this out! 🔥",
    mediaItems: [789, 790] // Media IDs from vault
  })
})

Send PPV Message

Send pay-per-view content:
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/messages", {
  method: "POST",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Exclusive content just for you 💋",
    mediaItems: [789],
    price: 9.99,  // $3-$200
    previewMediaCount: 1  // Number of preview items
  })
})

Delete a Message

Delete a sent message:
const response = await fetch("https://api.ofauth.com/v2/access/chats/123456/messages/MESSAGE_ID", {
  method: "DELETE",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

Mass Messaging

Send to multiple fans at once using the mass messaging endpoints:

Create Mass Message

const response = await fetch("https://api.ofauth.com/v2/access/mass-messages", {
  method: "POST",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "New content dropping tomorrow! 🎉",
    userIds: [123, 456, 789],
    // Or target by lists:
    // userLists: [1, 2, 3],
    // excludeUserLists: [4, 5]  // Exclude specific lists
  })
})

Schedule Mass Message

const response = await fetch("https://api.ofauth.com/v2/access/mass-messages", {
  method: "POST",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Scheduled announcement! 📅",
    userLists: [1],
    scheduledDate: "2024-12-25T12:00:00Z"
  })
})

List Mass Messages

View mass message history:
const response = await fetch("https://api.ofauth.com/v2/access/mass-messages?" + new URLSearchParams({
  limit: "20",
  offset: "0"
}), {
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

const massMessages = await response.json()

Update Mass Message

const response = await fetch("https://api.ofauth.com/v2/access/mass-messages/MASS_MESSAGE_ID", {
  method: "PUT",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    text: "Updated message content!",
    userIds: [123, 456]
  })
})

Delete Mass Message

const response = await fetch("https://api.ofauth.com/v2/access/mass-messages/MASS_MESSAGE_ID", {
  method: "DELETE",
  headers: {
    apikey: "YOUR_API_KEY",
    "x-connection-id": "conn_abc123"
  }
})

API Endpoints

EndpointMethodDescription
/v2/access/chatsGETList all chats
/v2/access/chats/{userId}/messagesGETGet messages in a chat
/v2/access/chats/{userId}/messagesPOSTSend a message
/v2/access/chats/{userId}/messages/{messageId}DELETEUnsend a message
/v2/access/chats/{userId}/mediaGETGet media from a chat
/v2/access/mass-messagesGETList mass messages
/v2/access/mass-messagesPOSTCreate mass message
/v2/access/mass-messages/{massMessageId}GETGet mass message details
/v2/access/mass-messages/{massMessageId}PUTUpdate mass message
/v2/access/mass-messages/{massMessageId}DELETEDelete mass message

Full API Reference

See complete endpoint documentation

Query Parameters

List Chats Query

ParameterTypeDefaultDescription
limitnumber10Results per page (1-20)
offsetnumber0Pagination offset
orderstring”recent”Sort order: recent, old
filterstring-Filter: priority, who_tipped, unread
querystring-Search query
userListIdnumber-Filter by user list ID

Chat Messages Query

ParameterTypeDefaultDescription
limitnumber10Results per page (1-20)
offsetnumber0Pagination offset
querystring-Search within messages

Message Options

FieldTypeDescription
textstringMessage content (supports markdown)
mediaItems(number|string)[]Media references (see below)
pricenumberPPV price (33-200)
isLockedTextbooleanLock text behind paywall
previewMediaCountnumberNumber of preview media items
isMarkdownbooleanParse text as markdown (default: true)
userTagsnumber[]Tag users in message
releaseFormsobjectRelease form attachments
Use markdown formatting like **bold**, *italic*, and # headers in your messages. See Text Formatting Guide for all options.

mediaItems Formats

The mediaItems array accepts:
FormatExampleDescription
Vault Media ID12345Direct OnlyFans vault media ID
Vault ID (string)"12345"Auto-converted to number
Upload Reference"ofauth_upload_abc..."mediaUploadId from upload flow
URL"https://..."External HTTP/HTTPS URL
You can pass the mediaUploadId from the upload flow directly - the API resolves it to the vault ID automatically. Upload references are single-use.

Queue-specific Options

FieldTypeDescription
userIdsnumber[]Target specific user IDs
userListsnumber[]Target user list IDs
excludeUserListsnumber[]Exclude user list IDs
scheduledDatestringISO date for scheduled sending
subscribedAfterDatestringTarget users subscribed after date

Tips & Best Practices

Rate Limiting: OnlyFans has strict rate limits on messaging. Space out mass messages and implement exponential backoff for retries.
Content Guidelines: Messages sent through OFAuth are subject to OnlyFans’ terms of service. Automated spam or harassment can result in account suspension.
Media First: When sending messages with media, upload the media to the vault first using /uploads/init to get media IDs, then reference those IDs in mediaItems.

Common Workflows

Welcome New Subscriber

Automatically greet new fans when they subscribe:
// 1. Get recently subscribed fans
const response = await fetch(
  "https://api.ofauth.com/v2/access/subscribers?type=latest&latestType=new&limit=10",
  { headers }
)
const newFans = await response.json()

// 2. Send welcome message to each
for (const fan of newFans.list) {
  await fetch(`https://api.ofauth.com/v2/access/chats/${fan.id}/messages`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      text: `Hey ${fan.name}! Thanks so much for subscribing! Let me know if there's anything you'd like to see.`
    })
  })
  
  // Space out messages to avoid rate limits
  await new Promise(r => setTimeout(r, 2000))
}

Send PPV to High-Value Fans

Target your best customers with exclusive content:
// 1. Upload exclusive content first
const uploadInit = await fetch("https://api.ofauth.com/v2/access/uploads/init", {
  method: "POST",
  headers,
  body: JSON.stringify({
    filename: "exclusive.mp4",
    mimeType: "video/mp4",
    size: fileSize
  })
})
const { mediaUploadId, uploadUrl } = await uploadInit.json()

// 2. Upload the file
await fetch(uploadUrl, {
  method: "PUT",
  body: fileBuffer,
  headers: { "Content-Type": "video/mp4" }
})

// 3. Complete the upload
await fetch("https://api.ofauth.com/v2/access/uploads/complete", {
  method: "POST",
  headers,
  body: JSON.stringify({ mediaUploadId })
})

// 4. Send as PPV to a specific user list
await fetch("https://api.ofauth.com/v2/access/mass-messages", {
  method: "POST",
  headers,
  body: JSON.stringify({
    text: "Exclusive content just for my VIPs!",
    mediaItems: [mediaUploadId],
    price: 15.00,
    previewMediaCount: 1,
    userLists: [VIP_LIST_ID]
  })
})

Respond to Unread Messages

Build a simple auto-responder or notification system:
// Get unread chats
const response = await fetch(
  "https://api.ofauth.com/v2/access/chats?filter=unread&limit=20",
  { headers }
)
const unreadChats = await response.json()

for (const chat of unreadChats.list) {
  // Get the latest message
  const messagesResp = await fetch(
    `https://api.ofauth.com/v2/access/chats/${chat.withUser.id}/messages?limit=1`,
    { headers }
  )
  const messages = await messagesResp.json()
  const lastMessage = messages.list[0]
  
  // Process the message (e.g., send to your AI, notify staff, etc.)
  console.log(`New message from ${chat.withUser.name}: ${lastMessage.text}`)
}