All posts

Tutorial

How to Upload Media and Schedule Posts with Fansly API

Mark Lucas7 min read
How to Upload Media and Schedule Posts with Fansly API

Managing posts manually becomes difficult when you're working with multiple Fansly accounts or building software for creators. Automating the publishing process lets you upload media, create posts, and schedule content directly from your application.

This guide walks through the entire process using Fansly API. You'll learn how to upload photos and videos, create free and PPV posts, configure media permissions, and manage scheduled posts. The examples use Python and the requests library.

How it works

The publishing process is straightforward. Upload your media, create the post using the returned media ID, and manage it through the scheduled posts endpoints.

  1. Upload the media. You send the file, and Fansly API processes it in the background. When it's done, you get a mediaId.
  2. Create the post. You send the caption, the media IDs and a scheduledFor time. The post is saved with its scheduled publishing time and published automatically when that time arrives.
  3. Manage the queue. You list the scheduled posts and cancel any that need to change.

If the photos or videos are already in the creator's vault, you can skip the upload and reuse them.

Before you start

You need a Fansly API key and a connected Fansly account. The getting started guide shows you how to get both in a few minutes. Each connected account has an account ID, which goes in every request below so the API knows which creator you're posting for.

Start with a little setup that every step shares:

import osimport timefrom datetime import datetime, timezone import requests API = "https://v1.apifansly.com/api/fansly"HEADERS = {"x-api-key": os.environ["FANSLY_API_KEY"]}ACCOUNT_ID = "YOUR_ACCOUNT_ID"

Step 1: upload media to Fansly

Media uploads are processed asynchronously. When you upload a file, the API returns a job ID that you can use to check its processing status. Once the upload is complete, you'll receive the media ID needed to attach the file to a post or message.

Start the upload

Send the file as multipart/form-data to the upload endpoint:

POST/api/fansly/{accountId}/media/upload

The response comes back right away with a jobId:

json
{  "statusCode": 201,  "message": "Success",  "data": {    "success": true,    "jobId": "8",    "message": "Upload job queued. Use the status endpoint to track progress."  }}

Wait for it to finish

Check the job status every few seconds:

GET/api/fansly/{accountId}/media/upload/{jobId}/status

Look at data.state. While it says waiting or active, the file is still processing, so keep checking. When it says completed, the mediaId is in data.result.mediaId. If it says failed, stop and check the file.

The full upload function

Here's both steps together. It uploads a file and returns its mediaId:

def upload_media(path):    with open(path, "rb") as f:        r = requests.post(            f"{API}/{ACCOUNT_ID}/media/upload",            headers=HEADERS,            files={"file": f},        )    r.raise_for_status()    job_id = r.json()["data"]["jobId"]     while True:        time.sleep(3)        r = requests.get(            f"{API}/{ACCOUNT_ID}/media/upload/{job_id}/status",            headers=HEADERS,        )        status = r.json()["data"]        if status["state"] == "completed":            return status["result"]["mediaId"]        if status["state"] == "failed":            raise RuntimeError(f"Upload failed: {path}")

Save the mediaId in your database. That's what you attach to posts and messages. The status response may also include CDN links to the file, but those expire after 5 hours, so don't store them.

Or reuse media from the vault

List the creator's vault albums, open the album you want, and copy the mediaId of each item:

GET/api/fansly/{accountId}/vault/albums
GET/api/fansly/{accountId}/vault/albums/{albumId}/media

This is useful when you already have media uploaded to the creator's vault. You can reuse existing media IDs instead of uploading the same files again.

Step 2: schedule a post

Now send the post to the create post endpoint:

POST/api/fansly/{accountId}/posts

The field that schedules it is scheduledFor. It's a Unix timestamp in milliseconds, not seconds. Leave it out, or set it to 0, and the post goes live right away.

json
{  "content": "New photo set drops tonight",  "mediaIds": ["12345678912345678"],  "scheduledFor": 1796148000000}

Every post needs a caption, media or both. Fansly API won't accept an empty post.

The schedule function

This function schedules a post for a given date and time, and turns it into a pay-per-view post if you pass a price:

def schedule_post(caption, media_ids, publish_at, price=None):    body = {        "content": caption,        "mediaIds": media_ids,        "scheduledFor": int(publish_at.timestamp() * 1000),    }    if price:        body["access_type"] = ["ppv"]        body["price"] = price     r = requests.post(f"{API}/{ACCOUNT_ID}/posts", headers=HEADERS, json=body)    r.raise_for_status()    return r.json()["data"]["response"]["id"]  media_id = upload_media("photo-set-01.jpg")post_id = schedule_post(    "New photo set drops tonight",    [media_id],    datetime(2026, 12, 1, 18, 0, tzinfo=timezone.utc),)print("Scheduled post:", post_id)

Always create your times in UTC, like the example does. A time without a time zone uses your server's local time, which is a common reason posts go out an hour early or late.

Other post options

Pay-per-view posts. Set access_type to ["ppv"] and price to an amount in dollars, like 9.99.

For You Page posts. Set postToFYP to true. Fansly requires at least one public video that's 3 seconds or longer, or the request is rejected.

Posts that expire. Add expiresAt, also in milliseconds, and the post disappears at that time. This works well for limited-time offers.

Who can reply. The replyPermissions object controls comments. You can allow replies only from subscribers, from accounts the creator follows, from fans who tipped a minimum amount, or from fans who bought paid content.

The composing posts guide covers every field.

Step 3: configure post and media permissions

Pay-per-view is just one way to lock content. Media permissions let you decide exactly who can unlock each post, and they work the same way for posts, messages, mass messages and automated messages.

Add a free preview

You can attach a preview to locked media so fans can see a sample before purchasing or unlocking the full content. To add one, pass an object with a previewId instead of a plain media ID:

json
{  "content": "Full video in the post",  "mediaIds": [    { "mediaId": "MAIN_VIDEO_ID", "previewId": "TEASER_CLIP_ID" }  ],  "access_type": ["ppv"],  "price": 12}

Upload the teaser the same way as any other media, then use its mediaId as the previewId.

Lock to subscribers, lists or a time window

access_type accepts more than "ppv":

  • "subscription": only subscribers can see it. Add subscriptionTierId and subscriptionTierName to limit it to one tier, or leave them out for every tier.
  • "follow": only followers can see it.
  • "list": only fans on one of the creator's lists, set with listId and listLabel.
  • "limited_time": only between validAfter and validBefore.

Give fans more than one way to unlock

Sometimes you want "VIP subscribers get it free, everyone else pays." For that, use the permissions array. A fan who meets any one of the rules can unlock the media:

json
{  "content": "New exclusive video",  "mediaIds": ["MEDIA_ID"],  "permissions": [    {      "access_type": ["subscription"],      "subscriptionTierId": "TIER_ID",      "subscriptionTierName": "Gold VIP"    },    {      "access_type": ["ppv"],      "price": 5    }  ]}

When you send a permissions array, any access_type or price at the top level of the request is ignored, so put every rule inside the array. The media permissions reference has more examples.

Step 4: manage scheduled posts

List scheduled posts

To see everything waiting to go out on an account, call:

GET/api/fansly/{accountId}/posts/scheduled

Each item has a postId and its scheduledFor time:

r = requests.get(f"{API}/{ACCOUNT_ID}/posts/scheduled", headers=HEADERS)scheduled = r.json()["data"]["data"]["response"]["scheduledPosts"] for post in scheduled:    publish_at = datetime.fromtimestamp(post["scheduledFor"] / 1000, timezone.utc)    print(post["postId"], publish_at)

You can use this endpoint to keep your application's content calendar in sync with Fansly. Compare the scheduled posts returned by the API with your local records to identify missing or cancelled posts.

Cancel a scheduled post

To take a post out of the queue, cancel it by its ID:

POST/api/fansly/{accountId}/posts/scheduled/{postId}/cancel
requests.post(    f"{API}/{ACCOUNT_ID}/posts/scheduled/{post_id}/cancel",    headers=HEADERS,).raise_for_status()

To change a scheduled post, like swapping a photo or moving it to another day, cancel it and schedule it again with the new details.

Before using this in production

Upload early. Large videos take time to process. Upload media when it's added to your content calendar, not minutes before the post is due, so a slow upload never delays a post.

Check file size limits. The maximum upload size depends on your plan, from 100 MB per file on Starter up to 1 GB and more on Enterprise. Media uploads also use credits based on file size, at 1 credit per MB.

Use a job queue for many accounts. If you schedule content for several creators, run uploads and post creation through a job queue so one slow upload doesn't hold up the rest.

Keep a record. Store every mediaId and postId with the account it belongs to. You'll need them to cancel, reschedule or report on posts later.

Retry with care. If a request fails because of a network error, wait a few seconds and try again. Before you retry creating a post, check the scheduled posts list first so you don't schedule the same post twice.

Put it to work

With these four steps, your app can fill a creator's calendar weeks ahead, run warm-up plans for new accounts and handle content for many creators at once. If you're building a full scheduling tool on top of this, our guide to building a Fansly post scheduler covers planning a posting schedule that keeps fans engaged.

SHARE THIS ARTICLE

Ready to start building
with Fansly API?

No credit card required, get started for Free!