Mastodon API Reference
Post to any Mastodon instance with visibility control, content warnings, and polls.
Quick reference
| auth | OAuth 2.0 (dashboard) |
| text Limit | 500 characters |
| max Media | 4 images or 1 video |
| media Rule | Text or media required (text-only and media-only both work) |
| max Video Duration | No hard limit (99 MB size cap) |
| entity Selection | None |
| first Comment | Supported — instance-defined limit |
Content types
Up to 500 characters (instance default).
Up to 4 images. JPEG, PNG, GIF, WebP, HEIC, AVIF. Max 16 MB each.
MP4, MOV, WebM, M4V. Max 99 MB.
Animated GIFs supported
Up to 4 images attached to one post
Via platformSettings.mastodon.poll — polls and media are mutually exclusive
Media requirements
Constraints enforced by Mastodon's API. Requests that violate these limits will be rejected.
| Constraint | Value |
|---|---|
| Max image size | 16 MB |
| Max video size | 99 MB |
| Image formats | JPEG, PNG, GIF, WEBP, HEIF, HEIC, AVIF |
| Video formats | MP4, QUICKTIME, WEBM, X-M4V |
| Max media items | 4 |
| GIF support | Yes |
Platform settings
Pass these fields inside platformSettings.mastodon in the request body.
| Name | Type | Required | Description |
|---|---|---|---|
visibility | string | Optional | Who can see the post.Default: publicpublicunlistedprivatedirect |
spoilerText | string | Optional | Content warning text. The post body is hidden behind this warning until the reader expands it. |
sensitive | boolean | Optional | Mark attached media as sensitive (blurred until clicked).Default: false |
language | string | Optional | ISO 639-1 language code for the post (e.g. 'en', 'de'). |
poll | object | Optional | Attach a poll: { options: string[] (2-4, max 50 chars each), expiresIn: seconds (default 86400), multiple: boolean, hideTotals: boolean }. Mastodon rejects polls combined with media. |
visibilitystringOptionalWho can see the post.
Default: public
publicunlistedprivatedirectspoilerTextstringOptionalContent warning text. The post body is hidden behind this warning until the reader expands it.
sensitivebooleanOptionalMark attached media as sensitive (blurred until clicked).
Default: false
languagestringOptionalISO 639-1 language code for the post (e.g. 'en', 'de').
pollobjectOptionalAttach a poll: { options: string[] (2-4, max 50 chars each), expiresIn: seconds (default 86400), multiple: boolean, hideTotals: boolean }. Mastodon rejects polls combined with media.
Code examples
Basic post
curl -X POST https://schedulala.com/api/v1/posts \-H "Authorization: Bearer sk_live_YOUR_KEY" \-H "Content-Type: application/json" \-d '{"content": "Hello fediverse from the API!","platforms": [{ "platform": "mastodon" }],"platformSettings": {"mastodon": { "visibility": "unlisted" }},"publishNow": true}'
Post with media
curl -X POST https://schedulala.com/api/v1/posts \-H "Authorization: Bearer sk_live_YOUR_KEY" \-H "Content-Type: application/json" \-d '{"content": "Photo post with a content warning","platforms": [{ "platform": "mastodon" }],"mediaItems": [{ "type": "image", "url": "https://example.com/photo.jpg" }],"platformSettings": {"mastodon": {"visibility": "public","spoilerText": "Photography","sensitive": false}},"publishNow": true}'
Quirks & gotchas
Connect via the dashboard for now — POST /api/v1/connect/mastodon returns a clear error; API-based connect is coming.
visibility defaults to public — set platformSettings.mastodon.visibility explicitly if you want unlisted, private (followers-only), or direct.
Character limit is the instance default (500 on mastodon.social); some instances allow more, but the API validates against 500.
Polls and media are mutually exclusive (a Mastodon rule) — if you send both, the poll is posted and the media is skipped.
spoilerText (content warning) hides the whole post body, not just media — use sensitive: true to blur media only.