How to Build a Mastodon Multi-Vote Poll With Custom Duration
🔍 WiseChecker

How to Build a Mastodon Multi-Vote Poll With Custom Duration

Mastodon polls let you gather feedback from your followers directly in a post. The default poll settings allow only one vote per person and offer preset durations like one day or seven days. You may want to let followers select multiple options or set a custom expiration time such as three hours or 48 minutes. This article explains how to create a Mastodon multi-vote poll with a custom duration using the Mastodon web interface and third-party apps.

Mastodon’s built-in poll composer does not support multiple votes or custom durations. To enable these features, you must use a client app that exposes the full Poll API or craft the poll manually via the instance API. We will cover both methods so you can choose the approach that matches your technical comfort level.

Key Takeaways: Building Multi-Vote Polls With Custom Durations in Mastodon

  • Poll API parameters multiple and expires_in: Enable multiple selections and set any duration in seconds for a poll.
  • Using a Mastodon client like Tusky or Fedilab: These apps expose advanced poll settings that the official web interface hides.
  • Crafting a poll via the Mastodon API directly: Send a POST request to /api/v1/statuses with poll options to create a custom poll programmatically.

ADVERTISEMENT

Why Mastodon Polls Have Default Limits and How the API Unlocks Them

Mastodon’s standard poll composer, available in the web interface and most mobile apps, offers only single-vote polls with durations of 5 minutes, 30 minutes, 1 hour, 6 hours, 1 day, 3 days, or 7 days. These presets simplify the user interface for the majority of users. The Mastodon Poll API, however, defines two parameters that override these defaults: multiple and expires_in.

The multiple parameter accepts a boolean value. When set to true, the poll allows each voter to select more than one option. The expires_in parameter accepts an integer representing the poll’s lifetime in seconds. You can set it to any positive integer, such as 10800 for three hours or 2880 for 48 minutes. Mastodon instances enforce a maximum poll duration of 30 days, which is 2592000 seconds. If you exceed that limit, the API returns an error.

What You Need Before Starting

To create a multi-vote poll with a custom duration, you need one of the following:

  • A Mastodon client app that supports advanced poll options, such as Tusky for Android, Fedilab for Android, or Metatext for iOS.
  • Access to the Mastodon API via a tool like cURL, Postman, or a programming language such as Python.
  • A Mastodon account on any instance that allows posting (most public instances do).

Methods to Create a Multi-Vote Poll With Custom Duration

Two reliable methods exist for building a Mastodon poll with multiple votes and a custom duration: using a third-party client app or sending an API request directly. The client app method is simpler for non-technical users. The API method gives you full control over every parameter.

Method 1: Using a Third-Party Mastodon Client That Exposes Poll Options

Some Mastodon clients display the multiple and expires_in fields directly in the compose screen. Tusky for Android is one such app. Follow these steps.

  1. Install Tusky from the Google Play Store or F-Droid
    Open the app and sign in to your Mastodon account. If you already use another client, you can install Tusky alongside it without affecting your existing posts.
  2. Tap the compose button to start a new post
    The compose button is a pencil icon or a plus sign at the bottom of the screen. Write your post text as usual.
  3. Tap the poll icon to add a poll
    The poll icon looks like a bar chart. After tapping it, Tusky shows a poll editor with fields for options.
  4. Enable multiple votes by tapping the “Multiple choices” toggle
    This toggle sets the multiple parameter to true. When enabled, voters can select more than one option.
  5. Set a custom duration by tapping the duration field
    Tusky shows a list of preset durations plus a custom option. Tap “Custom” and enter the number of seconds. For three hours, enter 10800. For 48 minutes, enter 2880.
  6. Add your poll options
    Enter each option in its own field. You can add up to four options by default. Tap the plus button to add more options if needed.
  7. Tap the post button to publish the poll
    Your poll now appears on your timeline with multiple votes allowed and the custom duration you set.

Fedilab for Android works similarly. In Fedilab, tap the poll icon in the composer, then tap the gear icon to open advanced poll settings. You will see a checkbox labeled “Multiple answers” and a text field for duration in seconds.

Method 2: Sending a Poll via the Mastodon API Directly

If you prefer to craft the poll programmatically, use the Mastodon API endpoint /api/v1/statuses. This method works on any device with an internet connection and a tool that can send HTTP POST requests. The following example uses cURL, a command-line tool available on Windows, macOS, and Linux.

  1. Obtain an access token for your Mastodon account
    Go to Preferences > Development > New application. Give your app a name, such as “Custom Poll Tool.” Select the write:statuses scope. Save the application and copy the access token shown on the next screen.
  2. Open a terminal or command prompt
    On Windows, press Win+R, type cmd, and press Enter. On macOS, open Terminal from Applications > Utilities.
  3. Run the cURL command with poll parameters
    Replace YOUR_TOKEN, YOUR_INSTANCE, and the option text with your own values. The command below creates a poll with two options, multiple votes enabled, and a duration of 3600 seconds (one hour).
    curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d '{"status":"Which framework do you prefer?","poll":{"options":["React","Vue"],"multiple":true,"expires_in":3600}}' https://YOUR_INSTANCE/api/v1/statuses
  4. Verify the poll was created
    Check your Mastodon timeline. The poll appears as a regular post with the custom duration and multiple votes enabled. You can also inspect the response JSON that cURL outputs to confirm the poll object contains multiple: true and the correct expires_at timestamp.

If you use Python, the requests library makes the same operation more readable. Install it with pip install requests and run the following script after replacing the token, instance, and options.

import requests

token = "YOUR_TOKEN"
instance = "https://YOUR_INSTANCE"
url = f"{instance}/api/v1/statuses"

payload = {
"status": "Which framework do you prefer?",
"poll": {
"options": ["React", "Vue"],
"multiple": True,
"expires_in": 3600
}
}

headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

ADVERTISEMENT

Common Mistakes When Creating Custom Polls

Even with the correct parameters, you may encounter issues that prevent your poll from behaving as expected. Below are the most frequent problems and how to avoid them.

Poll Duration Exceeds the Instance Maximum of 30 Days

Mastodon instances reject polls with an expires_in value greater than 2592000 seconds (30 days). If you need a longer poll, you cannot use the Poll API. Instead, create a regular post and manually track responses. The API returns a 422 Unprocessable Entity error if the duration is too long.

Voters Cannot Select Multiple Options Despite Setting multiple: true

Some Mastodon clients do not render the multi-vote UI correctly. The poll data on the server includes the multiple flag, but the client may still show radio buttons instead of checkboxes. Test your poll with a second account using the same client. If the issue persists, ask voters to use the web interface or a different app to cast their votes.

Poll Options Are Not Displayed in the Correct Order

When you send poll options via the API, Mastodon preserves the order you provide. If you see options rearranged, the client may be sorting them alphabetically or by vote count. This behavior is client-specific and does not affect the poll data on the server.

Mastodon Multi-Vote Poll vs Standard Single-Vote Poll

Item Multi-Vote Poll Standard Single-Vote Poll
Multiple selections Allowed (checkboxes) Not allowed (radio buttons)
Duration flexibility Any value in seconds up to 30 days Only preset durations
API parameter multiple: true multiple: false or omitted
Ease of creation Requires third-party client or API Built into web and mobile interfaces
Use case Ranking, preference ordering, brainstorming Simple yes/no or single-choice questions

Now you can create Mastodon polls that let followers select multiple options and close at exactly the time you choose. Start with the Tusky app if you want a graphical interface. Use the API method if you need to automate poll creation or integrate it into a larger workflow. For future polls, consider adding an open-ended option by including a text field in the post body, as Mastodon polls do not support free-text responses.

ADVERTISEMENT