> ## Documentation Index
> Fetch the complete documentation index at: https://docs.postsyncer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Post to Mastodon

> What a Mastodon account takes through the API: posts and threads, visibility, content warnings and quotes, media limits, first comments, deletes, comments and analytics.

A Mastodon account has `platform` `mastodon`. It posts single posts and threads on the account's own server, each with text, photos or a video.

## Connect an account

A Mastodon account signs in on its own server. A [connect link](https://docs.postsyncer.com/api-reference/accounts/connect-link.md) with `provider` `mastodon` also needs `mastodon_instance`, the server's address, such as `mastodon.social`.

## What you can post

* A post with text, up to 4 photos, or one video.
* A thread: each item of `content` is one post, sent as a reply to the one before.
* A reply to any post, with `in_reply_to_id`, or a quote, with `quoted_status_id`.

## Settings

Every key is optional. [Create a post](https://docs.postsyncer.com/api-reference/posts/create.md#platform-specific-settings) has the full list.

| Key | What it does |
| - | - |
| `text` | Mastodon's own text for the first post, instead of the first item's text. |
| `visibility` | `public` (the default), `unlisted`, `private` (followers only) or `direct`. |
| `spoiler_text` | A content warning shown before the post, up to 500 characters. |
| `sensitive` | Mark the media as sensitive. |
| `language` | The post's language, as an ISO 639-1 code such as `en`. |
| `in_reply_to_id` | The id of a post on the server to reply to. Used on the first post only: the rest of a thread replies to the post before. |
| `quoted_status_id` | The id of a post to quote, on servers that take quote posts. |
| `quote_approval_policy` | Who may quote this post: `public`, `followers` or `nobody`. Sent only with `quoted_status_id`, on a `public` or `unlisted` post. |
| `media` | This account's own media library ids, in place of the first item's media. |

`visibility`, `spoiler_text`, `sensitive`, `language` and `quoted_status_id` go on every post of a thread, not only the first.

## Text

Each post takes 500 characters, even on a server that allows more. PostSyncer cuts a longer post to 500 when it's sent. To keep every word, split the text into more items.

## Media

| | Limit |
| - | - |
| Photos | Up to 4, 10 MB each |
| Video | 1, up to 40 MB |
| Picture types | JPG, PNG, GIF, WebP |
| Video types | MP4, MOV, WebM |

* A post carries photos or a video, not both. In a thread, each post has its own media under these rules.
* Videos aren't converted for Mastodon.
* A file's alt text, set in the app's media library, goes with it, up to 420 characters.
* PostSyncer doesn't check a video's length for Mastodon. The server's own limits apply.

## Threads and first comments

* Each item after the first is posted as a reply to the one before. Each item has its own text and media.
* A first comment (`is_first_comment: true`) is a reply at the end of the thread. With `first_comment_delay` `0` it goes out with the thread. With a delay (1 minute when you leave it out), it's posted that many minutes later, under the thread's last post.

## Delete a post

Deleting the post in PostSyncer asks Mastodon to delete the first post. The rest of the thread and the first comment stay up. If the server refuses, the refusal is only logged: PostSyncer's copy is deleted and the post stays live. See [Test safely](https://docs.postsyncer.com/test-safely.md#what-cant-be-undone).

## Comments

* PostSyncer reads replies an hour after the post goes out, every 6 hours for its first day, then once a day until it's 7 days old, and whenever you ask with [Sync comments](https://docs.postsyncer.com/api-reference/comments/sync.md).
* Replies go out from the account, with photos or a video.
* Mastodon can't hide replies: hide answers `422` with `Mastodon can't hide comments. Delete the comment instead.`
* Delete removes a reply the account wrote, one sent from PostSyncer included. The server refuses to delete anyone else's: the answer is still `200` `Comment deleted successfully`, and nothing changes.

## Analytics

Mastodon gives `likes` (favourites), `comments`, `shares` (boosts) and `quotes`. It gives no `impressions`, so `engagement_rate` is `null`. See [Read analytics](https://docs.postsyncer.com/guides/analytics.md).

## Example

A draft post for followers only, with a content warning:

```json theme={null}
{
  "workspace_id": 4815,
  "schedule_type": "draft",
  "content": [
    {
      "text": "Behind the bar: how we dial in a new espresso each morning.",
      "media": ["https://cdn.postsyncer.com/examples/espresso-shot.jpg"]
    }
  ],
  "accounts": [
    {
      "id": 16246,
      "settings": {
        "visibility": "private",
        "spoiler_text": "Coffee nerd talk",
        "language": "en"
      }
    }
  ]
}
```

## Related

> [card] [Connect social accounts](https://docs.postsyncer.com/guides/connect-accounts.md)
>
> Connect links, with the Mastodon server.

> [card] [Compare the 12 networks](https://docs.postsyncer.com/platforms/overview.md)
>
> How Mastodon differs from the other networks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.