# Mastodon API for any federated server

Publish to any Mastodon server via REST API with threads, visibility scopes, content warnings, polls, quotes, alt text, replies and boost analytics.

Building across the Fediverse means dynamically registering OAuth apps on every user’s Mastodon domain, storing per-instance client secrets, handling async media attachment processing and threading replies manually. PostSyncer connects any Mastodon server behind one REST API.

**REST API:** https://postsyncer.com/api/v1 · **MCP server:** https://postsyncer.com/mcp · **Docs:** https://postsyncer.com/docs/platforms/mastodon

## Example Mastodon request

```bash
curl -X POST "https://postsyncer.com/api/v1/posts" \
  -H "Authorization: Bearer $POSTSYNCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "workspace_id": 4815,
    "schedule_type": "schedule",
    "schedule_for": {
      "date": "2026-12-09",
      "time": "11:30",
      "timezone": "America/Los_Angeles"
    },
    "content": [
      {
        "text": "Behind the bar: how we dial in a washed Ethiopian espresso each morning.",
        "media": [
          "https://cdn.postsyncer.com/examples/espresso-shot.jpg"
        ]
      },
      {
        "text": "Full grind size and water mineral notes are up on our blog."
      }
    ],
    "accounts": [
      {
        "id": 16246,
        "settings": {
          "visibility": "public",
          "spoiler_text": "Coffee roasting nerdery",
          "sensitive": false,
          "language": "en"
        }
      }
    ]
  }'
```

```json
{
  "id": 81430,
  "status": "SCHEDULED",
  "platforms": [
    {
      "account_id": 16246,
      "platform": "mastodon",
      "status": "PENDING",
      "settings": {
        "visibility": "public",
        "spoiler_text": "Coffee roasting nerdery",
        "language": "en"
      }
    }
  ],
  "skipped_accounts": [],
  "needs_media": []
}
```

## Quick start

1. **Connect any Mastodon server.** Authorize accounts on mastodon.social, fosstodon.org or self-hosted domains in PostSyncer or via POST /accounts/connect-links with mastodon_instance.

2. **Send posts, threads, polls or quotes.** Call POST /posts with text, photos or video, visibility, spoiler_text content warnings, polls, in_reply_to_id or quoted_status_id.

3. **Answer replies and track boosts.** Sync replies from the instance via /comments, reply with photos or a video, and track favourites, replies, boosts and quotes via /analytics.

## Mastodon endpoints

- `POST /api/v1/posts` (`posts:create / schedule / publish`): Publish Mastodon posts, threads, polls, replies and quote posts on any federated instance.

- `POST /api/v1/accounts/connect-links` (`accounts:create`): Create a hosted connect link for provider: mastodon specifying mastodon_instance (for example mastodon.social).

- `DELETE /api/v1/posts/{id}` (`posts:delete`): Cancel scheduled posts or ask the Mastodon server to delete the first post of a thread.

- `GET /api/v1/comments` (`comments:read`): List Mastodon replies synced on schedule or via POST /comments/sync.

- `POST /api/v1/comments` (`comments:create`): Reply to a Mastodon comment as the account, optionally attaching photos or a video.

- `GET /api/v1/analytics/posts/{id}` (`analytics:read`): Read favourites (likes), replies (comments), boosts (shares) and quotes.

## Mastodon media and text specs

- **Photos** (JPG, PNG, GIF, WebP, Up to 4 · 10 MB each): Alt text set in the PostSyncer media library travels with each photo up to 420 characters.

- **Video** (MP4, MOV, WebM, 1 video · up to 40 MB): Videos are sent without transcoding; server duration caps apply. Cannot mix with photos.

- **Text & CW** (Plain text, 500 chars post · 500 chars CW): Single posts trim to 500 characters even on custom instances; use content[] threads for longer writing.

- **Polls** (2–4 options, 50 chars/option · 5m–43,829m): Supports multiple: true and hide_totals: true; Mastodon 4.6+ allows combining polls with media.

- **Visibility** (4 Fediverse scopes, public, unlisted, private, direct): Applies to every post of a thread automatically alongside spoiler_text, sensitive and language.

- **platform key:** mastodon

- **Instance discovery:** Works with any Mastodon server; connect links require mastodon_instance (e.g. mastodon.social).

- **Threads & first comment:** Multi-item content[] chains replies on the instance; is_first_comment replies at the end (delay 0 sends inline).

- **Deleting posts:** DELETE /posts/{id} requests the server to delete the first post; later thread replies remain up.

- **Comments API:** Synced on schedule; reply with media and delete own replies. Mastodon cannot hide replies (returns 422).

- **Analytics metrics:** likes (favourites), comments, shares (boosts) and quotes (impressions and engagement_rate are null).

## Mastodon capabilities and settings

Mastodon communities expect proper content warnings, alt text, unlisted thread replies and server-agnostic authentication. PostSyncer handles every Fediverse nuance cleanly.

- **Dynamic per-instance OAuth.** Skip writing custom dynamic app registration tables for every Mastodon domain. Pass provider: mastodon and mastodon_instance to POST /accounts/connect-links and let PostSyncer handle the handshake.

- **Thread-wide visibility & content warnings.** Set visibility (public, unlisted, private or direct), spoiler_text, sensitive media blur, language and quoted_status_id once — PostSyncer propagates them cleanly across every post in your thread.

- **Accessible alt text from the media library.** Attach up to 420 characters of image description in the PostSyncer media library and PostSyncer forwards it natively to Mastodon on every post and thread reply.

- **Multi-choice & hidden-total polls.** Create polls with 2–4 choices up to 50 characters each (counting emoji flags accurately as 1 character), durations from 5 minutes to a month (43,829 minutes), multiple selections and hide_totals.

- **Quote posts & quote approval policies.** Quote statuses via quoted_status_id on servers that support quote posts, and declare quote_approval_policy (public, followers or nobody) on public and unlisted posts.

- **Cross-post alongside Bluesky, X & Threads.** Publish open-web announcements simultaneously across Mastodon, Bluesky, Threads and X from one POST /posts call while giving Mastodon its own content warning or visibility.

- `text` (string (cut at 500 chars)): Mastodon-specific copy for the first post, overriding content[0].text.

- `visibility` ("public" | "unlisted" | "private" | "direct"): Fediverse post scope applied across the whole thread (defaults to public).

- `spoiler_text` (string (cut at 500 chars)): Content warning banner displayed above every post of the thread.

- `sensitive` (boolean): Marks attached photos or video as sensitive across the thread.

- `language` (string): ISO 639-1 language code (e.g. en) or auto to let the Mastodon instance detect it.

- `poll` (object): Poll with enabled, options (2–4 unique choices ≤ 50 chars), duration_minutes (5–43829), multiple and hide_totals.

- `in_reply_to_id` (string): Status ID on the same instance that the first post replies to.

- `quoted_status_id` (string): Status ID to quote on Mastodon servers supporting quote posts.

- `quote_approval_policy` ("public" | "followers" | "nobody"): Who may quote this post (sent alongside quoted_status_id on public/unlisted posts).

- `media` (number[]): Replaces the first item’s media with Mastodon-specific media library IDs.

## Why federated Mastodon integrations break standard OAuth libraries

Unlike centralized social networks with one OAuth base URL and one static client ID, Mastodon is distributed across thousands of independent domains. Supporting end users directly requires calling /api/v1/apps dynamically on each new domain, persisting per-domain client credentials, rotating tokens and guarding against SSRF when accepting arbitrary instance URLs.

PostSyncer solves federated OAuth once. Your backend creates a hosted connect link with provider: mastodon and mastodon_instance (such as mastodon.social), and once connected every Mastodon account uses the exact same POST /api/v1/posts schema as every other network in your workspace.

## Poll validation and Mastodon server version differences

Mastodon poll rules differ subtly from X and LinkedIn: choices can run up to 50 characters, emoji flags count as a single character, case-distinct strings like Yes and yes count as separate options, and durations accept any whole minute count from 5 up to 43,829 (one month, defaulting to 1 day). PostSyncer validates all of those rules before scheduling and returns 422 with exact remediation instructions.

Because Mastodon 4.6 added polls alongside media while older servers refuse that combination, PostSyncer surfaces the server’s clear failure reason if an older instance declines a media-plus-poll post.

## Replies, moderation boundaries and Fediverse metrics

PostSyncer syncs Mastodon replies an hour after publishing, every 6 hours on day one, and daily through day seven (plus on-demand POST /comments/sync). You can reply with photos or video via POST /comments and delete replies authored by your account. Because Mastodon does not support hiding replies, PATCH /comments/{id}/hide returns 422.

On the analytics side, Mastodon tracks favourites (likes), replies (comments), boosts (shares) and quotes — leaving impressions and engagement_rate null since federated servers do not collect impression telemetry.

## Publish to your Mastodon server from ChatGPT, Claude or Codex via MCP

Connect your AI agent to PostSyncer’s MCP server to write Mastodon threads with content warnings, configure polls and reply to Fediverse conversations without managing instance tokens.

Related pages: [Mastodon MCP](https://postsyncer.com/mastodon-mcp), [Mastodon scheduler](https://postsyncer.com/mastodon-scheduler), [Unified social media API](https://postsyncer.com/unified-social-media-api).

## Limits and plans

| Plan | Social accounts | Posts | API posts a day, per network |
| --- | --- | --- | --- |
| Free | 2 | 20 a month | Within the 20 |
| Starter ($29 a month) | 10 | Unlimited | Unlimited |
| Pro ($49 a month) | 30 | Unlimited | Unlimited |
| Agency ($99 a month) | 100, then $1/mo each | Unlimited | Unlimited |

Every plan: 60 requests a minute for each PostSyncer user, across all their keys, the API and the MCP server together.

## FAQ

### Does the Mastodon API work with any Mastodon instance or only mastodon.social?

It works with any Mastodon server. Pass the domain (such as mastodon.social or your own self-hosted server) in mastodon_instance when creating a connect link or connecting in the app.

### Can I set Mastodon content warnings (spoiler_text) and visibility per post?

Yes. Pass visibility (public, unlisted, private or direct), spoiler_text (up to 500 characters) and sensitive: true in accounts[].settings; PostSyncer applies them to every post in the thread.

### How are Mastodon threads and alt text handled?

Multiple objects in content[] publish as chained replies on the server, and image alt text saved in your PostSyncer media library is sent automatically up to 420 characters.

### Can I publish Mastodon polls with multiple choice or hidden vote totals?

Yes. Pass settings.poll with enabled: true, 2–4 options (up to 50 chars), duration_minutes (5 to 43,829), and optional multiple: true or hide_totals: true.

### Can I hide replies on Mastodon via the API?

No. Mastodon does not support hiding replies, so PATCH /comments/{id}/hide returns 422. You can delete replies written by your own account via DELETE /comments/{id}.

### What analytics does Mastodon return?

PostSyncer returns favourites (likes), replies (comments), boosts (shares) and quotes. Impressions and engagement_rate are null because Mastodon does not report impression counts.

---

Page: https://postsyncer.com/mastodon-api · Updated 2026-11-27
