Media and vault
Upload OnlyFans media and manage the vault from code
Uploading media to OnlyFans normally means orchestrating a staging and processing pipeline. The media plugin collapses that into one call: give it a URL, get back an id you can attach to a message or post. Vault routes let you organize and query what is already there.
const client = new OfApiClient({
apiKey: process.env.BFL_API_KEY,
plugins: [media()],
})
const account = client.for("123456789")
const result = await account.plugin.media.upload({ source: "https://cdn.example/set-12.mp4" })
await account.request("POST /chats/:id/messages", {
pathParams: { id: fanId },
body: {
text: "Fresh from today",
mediaFiles: result.kind === "existing" ? [result.mediaId] : [result.ref],
},
})Media and vault API
What's included
One-call upload
account.plugin.media.upload({ source }) handles the whole upload pipeline for photos and videos.
Built-in deduplication
Media that already exists is recognized and returned as an existing id instead of being uploaded twice.
Attach anywhere
Uploaded media attaches directly to messages, PPV and posts using the id the plugin returns.
Vault lists
Create, rename and delete vault lists, and add or remove media from them.
Query the vault
List vault media by type or by list, with pagination, to build a content picker for chatters.
Visibility control
Toggle media visibility in the vault so your team only sees what should be sent.
FAQ
Frequently asked questions
Can I upload media to OnlyFans through an API?
Yes. Add the media plugin to your client and call account.plugin.media.upload with a source URL. The plugin runs the full upload pipeline and returns either an existing media id, if that file is already in the account, or a reference to the new upload. Either one attaches directly to a message or post, so an upload and a send are two lines of code.
Does the media API avoid uploading the same file twice?
Yes. Deduplication is built into the media plugin. When the file you pass is already known for that account, the result comes back with kind set to existing and the media id, and nothing is uploaded again. This matters for bots and mass messages that reuse the same welcome image or promo clip thousands of times across many fans.
Can I organize the OnlyFans vault programmatically?
Yes. Vault routes let you list, create, rename and delete vault lists, add media to a list or remove it, and query vault media by type or by list with pagination. You can also toggle media visibility. Together these are enough to build a content library or a content picker that your chatters use instead of scrolling the vault by hand.
Can I attach vault media to a PPV message?
Yes. Pass the media ids in mediaFiles on POST /chats/:id/messages and set a price, and the message goes out as a locked pay-per-view. The same mediaFiles field works for queued mass messages. Media can come straight from a fresh upload through the plugin or from ids you looked up in the vault, so you choose whether content is new or reused.
Related
Keep exploring the API
Messaging API
Send DMs, mass messages and PPV with vault media attached. Search chats and manage read state.
Chatbot API
Listen for new messages on every account over one WebSocket and reply with typed calls.
Agency API
One key and one connection for every creator. Scoped clients, batching and per-creator key scopes.
LET’S BUILD SOMETHING BETTER
Your next big idea starts with a connection.
Build the tools your team has been waiting for. We’ll handle the connection to OnlyFans.
Your ideas. Your interface. BetterFans Link underneath.