Getting started
Uploading Media
Send a new photo or video: upload it, register it with OnlyFans, then attach it to a message. Every step goes through this API except sending the file itself, which goes straight to the upload address you are given.
The steps
One file takes up to six calls. Only step 3 skips this API: the file goes straight to the addresses from step 2, with no API key.
For several files, run the steps once per file. Different files can go at the same time.
One permission, api_media_upload, covers every step that goes through this API.
- 1. Optional: check whether the vault already has the file — Lookup Vault Media by Hash
- 2. Get the addresses to upload to — Create Signed Upload
- 3. Send the file to those addresses — directly
- 4. Files over 5 MB only: join the pieces — Finish Multipart Upload
- 5. Register the file — Convert Upload
- 6. Attach it to a message — Send Message or Send Mass Message
One piece or several
Files of 5 MB (5,242,880 bytes) or less go up in one piece. Bigger files go up in pieces of exactly 5,242,880 bytes, with whatever is left over in the last piece — the same split the OnlyFans website uses.
1. Skip files the vault already has
Lookup Vault Media by Hash takes the file's fingerprint as h and its size in bytes as size. If the vault already has the file, you get the vault item back: put its id in mediaFiles and skip the remaining steps. A 404 means it isn't there, so carry on.
The fingerprint is an MD5 hash, worked out the way the file will go up:
- Files of 5 MB or less: the MD5 of the whole file, as 32 lowercase letters and digits
- Bigger files: take the MD5 of each 5 MB piece, join those hashes together as raw bytes (16 per piece, not the 32-character text), take the MD5 of that, and add
-and the number of pieces, such as…-3. It equals theETagthat Finish Multipart Upload gives the joined file, without its quotes.
2–4. Upload the file
Create Signed Upload takes the file's name, its size in bytes and its type, and answers with where to send the file. Send it there with a PUT, setting Content-Type and Content-Length.
Keep key and uploadToken from that answer, and the putUrl you sent the file to. Registering the file needs all three.
- One piece: send the whole file to
putUrl, and keep theETagheader it answers with - Several pieces: send piece 1 to the first
putUrlinkeys[], piece 2 to the second, and so on. They can go at the same time. Keep theETagheader each piece answers with. - Then join the pieces with Finish Multipart Upload, using the
keyfrom the answer. It answers with the joined file'sETag.
5. Register the file
OnlyFans can't use the file until it's registered. Send Convert Upload what the earlier steps gave you. It applies the account's upload settings and watermark for you, and answers with the file ready to attach.
keyanduploadToken— from the Create Signed Upload answerputUrl— the address you sent the file to. For pieces, the first piece's.ETag— one piece: theETagheader from sending the file, which is also the file's MD5. Pieces: theETagfrom Finish Multipart Upload.contentType— the file type you gave Create Signed Upload
6. Attach it to a message
Put the data from Convert Upload — { "processId": …, "host": …, "name": …, "extra": … } — in mediaFiles of Send Message or Send Mass Message, as it is.
Vault IDs and new uploads can share one mediaFiles list. For previews on a paid message, use vault IDs.
Sending the message is also what puts the file in the vault — registering alone doesn't.
Keep it in the vault and tag creators
A registered file isn't in the vault yet: it gets there when it's sent in a message.
To store files in the vault without leaving them in a chat, do what the FansMetric app does: send them to a fan in a free message with no text, take the vault IDs from media[].id in the answer, then remove the message with Unsend Message. The files stay in the vault. The message does reach the fan until it's unsent, so choose the fan with care.
To tag the creators who appear in a file, send their OnlyFans user IDs and the file's vault ID to Attach Tags To Vault Media. A file that was only just sent can take a few seconds to reach the vault: the app waits 3 seconds and tries up to 3 times.
If something fails
The answer says what went wrong. The ones you are most likely to see:
400from any step — a field is missing or the wrong type, and the message names it400withInvalid input.from Convert Upload —keyoruploadTokendoesn't match the upload. Use thekeyfrom the Create Signed Upload answer.404from Lookup Vault Media by Hash — the vault doesn't have the file, so upload it