# Mastodon API

Retrieve public Mastodon statuses, lightweight profiles, and public timelines by account, hashtag, or instance.

Set the instance domain for timeline queries. Usernames on other instances need the matching server name.

- Request: POST https://api.everyinfra.com/api/v1/social with `{"platform": "mastodon", "action": "<action>", "params": {...}}`
- Canonical page: [https://everyinfra.com/en/mastodon-api](https://everyinfra.com/en/mastodon-api?utm_medium=ai_doc&utm_campaign=page_md)
- Each capability uses the price recorded in the public catalog. The response includes the amount charged. Authentication failures, invalid parameters, failed calls, and empty results are not charged.

## Actions

### user_posts — Posts by user
Pull the posts of one Mastodon account, given as a handle or user@instance in `username`. Get like, boost and reply counts, language and a flag that marks boosts. Same-named accounts on other instances stay separate. The full history is not guaranteed.
- Sync delivery · Price: $1.39 per 1,000 requests (every 20 rows count as one call)
- Catalog values: defaultLimit=20, maxLimit=100. For some actions a limit controls pages or per-parent expansion, so it is not always the final row count.
- Parameters:
  - `username` (required): Specifies the Mastodon account handle or full user@instance format, with an optional leading @ symbol. Providing a short handle without specifying an instance defaults to mastodon.social, and identical usernames across different instances represent distinct accounts.
  - `instance` (optional): Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent.
- Returns fields: id, url, text, author_name, author_username, author_url, instance, like_count, reblog_count, comment_count, language, is_reblog, posted_at, platform, media_urls, hashtags
- Capability page: [https://everyinfra.com/en/mastodon-api/user_posts](https://everyinfra.com/en/mastodon-api/user_posts?utm_medium=ai_doc&utm_campaign=page_md) (Markdown: https://everyinfra.com/en/mastodon-api/user_posts.md)

### profile — Profiles
Resolve a Mastodon handle or user@instance address to one account's display name, full `handle`, home instance and profile link. A bare handle is looked up on mastodon.social unless `instance` is set, and a match does not prove it is the account you meant.
- Sync delivery · Price: $1.39 per 1,000 requests
- Parameters:
  - `username` (required): Specifies the Mastodon account handle or full user@instance format, with an optional leading @ symbol. Providing a short handle without specifying an instance defaults to mastodon.social, and identical usernames across different instances represent distinct accounts.
  - `instance` (optional): Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent.
- Returns fields: username, display_name, handle, instance, url, platform
- Capability page: [https://everyinfra.com/en/mastodon-api/profile](https://everyinfra.com/en/mastodon-api/profile?utm_medium=ai_doc&utm_campaign=page_md) (Markdown: https://everyinfra.com/en/mastodon-api/profile.md)

### hashtag — Hashtag
Browse the posts under a Mastodon hashtag, given without the # in `hashtag`, with author, text, language, media links and like, boost and reply counts. They come from one instance's tag timeline and leave out boosts and replies, so they do not measure the whole federated conversation.
- Sync delivery · Price: $1.39 per 1,000 requests (every 20 rows count as one call)
- Catalog values: defaultLimit=20, maxLimit=100. For some actions a limit controls pages or per-parent expansion, so it is not always the final row count.
- Parameters:
  - `hashtag` (required): Specifies the topic tag without the leading # to fetch the hashtag timeline on a target instance. Excludes boosts and replies, so it does not represent a complete sample of federated network tags.
  - `instance` (optional): Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent.
- Returns fields: id, url, text, author_name, author_username, author_url, instance, like_count, reblog_count, comment_count, language, is_reblog, posted_at, platform, media_urls, hashtags
- Capability page: [https://everyinfra.com/en/mastodon-api/hashtag](https://everyinfra.com/en/mastodon-api/hashtag?utm_medium=ai_doc&utm_campaign=page_md) (Markdown: https://everyinfra.com/en/mastodon-api/hashtag.md)

### trending — Trending
Get the posts trending on a Mastodon instance, mastodon.social unless `instance` names another. Each post has author, text, language, media and like, boost and reply counts. Positions and counts show the moment of the call. They do not explain the trending algorithm or rank the whole fediverse.
- Sync delivery · Price: $1.39 per 1,000 requests (every 20 rows count as one call)
- Catalog values: defaultLimit=20, maxLimit=100. For some actions a limit controls pages or per-parent expansion, so it is not always the final row count.
- Parameters:
  - `instance` (optional): Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent.
- Returns fields: id, url, text, author_name, author_username, author_url, instance, like_count, reblog_count, comment_count, language, is_reblog, posted_at, platform, media_urls, hashtags
- Capability page: [https://everyinfra.com/en/mastodon-api/trending](https://everyinfra.com/en/mastodon-api/trending?utm_medium=ai_doc&utm_campaign=page_md) (Markdown: https://everyinfra.com/en/mastodon-api/trending.md)

### timeline — Timeline
Read the public timeline of a Mastodon instance, fosstodon.org by default. Each post has author, text, language, media links and like, boost and reply counts. It is not a signed-in personal feed or an archive of everything on Mastodon.
- Sync delivery · Price: $1.39 per 1,000 requests (every 20 rows count as one call)
- Catalog values: defaultLimit=20, maxLimit=100. For some actions a limit controls pages or per-parent expansion, so it is not always the final row count.
- Parameters:
  - `instance` (optional): Selects a Mastodon instance domain without a scheme or path. Timeline defaults to fosstodon.org and other actions default to mastodon.social. An explicit instance takes precedence over the domain in username, so keep the two values consistent.
- Returns fields: id, url, text, author_name, author_username, author_url, instance, like_count, reblog_count, comment_count, language, is_reblog, posted_at, platform, media_urls, hashtags
- Capability page: [https://everyinfra.com/en/mastodon-api/timeline](https://everyinfra.com/en/mastodon-api/timeline?utm_medium=ai_doc&utm_campaign=page_md) (Markdown: https://everyinfra.com/en/mastodon-api/timeline.md)

## Mastodon API questions

### What can I retrieve with the Mastodon API?

Set `platform` to `mastodon`. The current catalog lists posts by user, profiles, hashtag, trending, and timeline. These action names identify different Mastodon objects or views; they are not interchangeable search modes.

### Which input starts the Mastodon `user_posts` request?

Specifies the Mastodon account handle or full user@instance format, with an optional leading @ symbol. Providing a short handle without specifying an instance defaults to mastodon.social, and identical usernames across different instances represent distinct accounts. Send it as `username` inside `params`.

### Which fields can Mastodon `user_posts` return?

Its declared schema includes `text`, `author_name`, `author_username`, and `author_url`. A declared field can still be absent from an individual record, and every other action has its own field list.

### Does every Mastodon action return immediately?

Actions labeled asynchronous return a job ID you poll. Every other action can also run asynchronously: add `"mode": "async"` to the request body to receive a job ID immediately, useful for slow tasks or large limits. The current catalog contains sync delivery.

## Also

- Machine catalog (no key): https://everyinfra.com/openapi.json · GET /api/v1/social/catalog?platform=mastodon
- API guide for AI clients: https://everyinfra.com/llms.txt · agents guide: https://everyinfra.com/agents.md
