Uploading media
Learn how to upload photos/videos, and include them in your posts or messages.
OnlyFans API makes it really easy to include photos and videos in your posts and messages. You can upload media files directly to our API, and then reference them in our relevant endpoints.
Prepare the relevant photo, video or audio
- If you want to use a new photo or video, you may upload it to our API.
- Alternatively, if you want to use a photo or video from your Vault, you may reference its ID directly in the relevant endpoints.
Upload your photo or video to our API
The full media upload endpoint documentation can be found here.
Submit a POST request to our https://app.onlyfansapi.com/api/{account}/media/upload endpoint. You can upload media in one of two ways:
- File upload โ send the file directly as a multipart form upload using the
filefield. - URL upload โ provide a
file_urlfield containing an HTTPS URL pointing to the media file. Our server will download it and upload it to the OnlyFans CDN on your behalf. This is useful when the media already exists at a remote URL and you want to avoid downloading it locally first.
You must provide exactly one of file or file_url โ not both, and not neither. Providing both or neither will result in a 422 validation error.
Option 1: Upload a file directly
curl --location 'https://app.onlyfansapi.com/api/{account}/media/upload' \
--header 'Authorization: Bearer {token}' \
--form 'file=@"/Users/me/Documents/MyVideo.mp4"'Option 2: Upload from a URL
If your media is already hosted at a remote URL, you can pass it via file_url instead of uploading the file directly:
curl -X POST 'https://app.onlyfansapi.com/api/{account}/media/upload' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-d '{"file_url": "https://example.com/media/photo.jpg"}'If the upload was successful, the response will be something as follows:
{
"prefixed_id": "ofapi_media_123",
"file_name": "MyVideo.mp4",
"processId": "abc123",
"host": "convert1.onlyfans.com",
"sourceUrl": "https://of2transcoder.s3.amazonaws.com/upload/xxx/xxx/MyVideo.mp4?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=xxx&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxx&X-Amz-Date=xxx&X-Amz-SignedHeaders=host&X-Amz-Expires=604800&X-Amz-Signature=xxx",
"extra": "xxx",
"additional": {
"user": "169224851"
},
"thumbs": [
{
"id": 1,
"url": "https://cdn2.onlyfans.com/files/f/f0/xxx/300x300_xxx.jpg?Expires=xxx&Signature=xxx&Key-Pair-Id=xxx"
}
],
"note": "Maximum file size is 1 GB. Need higher limits? Contact us for enterprise options."
}You may use the prefixed_id (e.g., ofapi_media_123) in our relevant endpoints to include this media file.
Important!
The prefixed_id from the above request can only be used once. After you use it in a post or message, it will no longer be valid for future use. If you want to reuse the same media file, you must upload it again to get a new prefixed_id.
Validation rules
| Scenario | Result |
|---|---|
file provided, no file_url | Valid |
file_url provided, no file | Valid |
| Both provided | 422 error |
| Neither provided | 422 error |
| File exceeds 1 GB | 422 error |
Including your media in a new post
The full send post endpoint documentation can be found here.
Once you have retrieved the correct media IDs (either from the upload response, or from your Vault), you can include them in your post:
{
"text": "The text of your post",
"mediaFiles": ["ofapi_media_123", "1234567890"]
}Including your media in a chat message
The full send chat message endpoint documentation can be found here.
Once you have retrieved the correct media IDs (either from the upload response, or from your Vault), you can include them in your post:
{
"text": "The text of your message",
"mediaFiles": ["ofapi_media_123", "1234567890"]
}Media file array options
You can include two different types of IDs in the mediaFiles array:
-
An OnlyFans API ID starting with
ofapi_media_. This needs to be theprefixed_idof the media file we just uploaded.Important! The
ofapi_media_ID from a media file upload can only be used once.After you use it in a post or message, it will no longer be valid for future use. To use the media again, you must use the OnlyFans Vault Media ID.
-
An OnlyFans Vault Media ID like
1234567890. This is the OnlyFans ID of a media file that already exists in the Vault. Use our List Vault Media endpoint to retrieve this ID.