Everything an AI agent can do with the Mastodon API.

A reference guide for building AI agents: every method, how to authenticate, and the permissions each one needs.

Endpoints27
API versionv1
Last updated23 June 2026
Orientation

How the Mastodon API works.

The Mastodon API is how an app or AI agent works with a Mastodon account: posting and deleting statuses, reading the home and public timelines, following and unfollowing accounts, and listing notifications. Access is granted through an OAuth token and a set of scopes that decide what each call can read or write, and an agent is limited to the one server that issued the token. Mastodon is federated, so the server is the user's own instance, and it streams events over a long-lived connection rather than posting them to a webhook.

27Endpoints
8Capability groups
13Read
14Write
13Permissions
Authentication
Every write and most private reads need an OAuth 2.0 bearer token, sent as 'Authorization: Bearer '. Tokens are issued by a single Mastodon server through the authorization code flow, and a token works only against the server that issued it, because Mastodon is federated and each server holds its own accounts and data. Some read endpoints, such as a public account profile or the public timeline, work without a token, subject to the server's own access policy.
Permissions
Access is governed by OAuth scopes. The top-level scopes are read, write, and follow, and each can be requested in a finer-grained form that limits it to one area, such as read:statuses, write:statuses, read:notifications, write:media, read:lists, or write:follows. The follow top-level scope is deprecated in favor of read:follows and write:follows. A push scope covers Web Push subscriptions, and a profile scope, added in Mastodon 4.3, grants only the authenticated account's own profile. The capability shown on each method below is the single short scope it needs.
Versioning
Mastodon versions the API by path segment, not by date. Most methods sit under v1, and a few, such as media upload and search, sit under v2. New methods and fields ship with each Mastodon software release, so the API surface a server exposes depends on which version of Mastodon it runs. From Mastodon 4.4 a Deprecation header marks endpoints that are on the way out, and Mastodon rarely removes methods outright.
Data model
The API is resource-oriented JSON over HTTPS, served by each Mastodon server at its own host. Core resources include statuses at /api/v1/statuses, timelines at /api/v1/timelines, accounts at /api/v1/accounts, notifications at /api/v1/notifications, lists at /api/v1/lists, and polls at /api/v1/polls, with media upload and search at /api/v2. A status is the central object, carrying the post text, media attachments, and an optional poll, and most actions like favourite, reblog, and bookmark hang off a status id.
Connect & authenticate

Connection & authentication methods.

How an app or AI agent connects to Mastodon determines what it can reach. Mastodon is federated, so each server is its own host, and an access token is issued by one server and works only against that server's accounts and data.

Ways to connect

REST API

The REST API is served by each Mastodon server at its own host, under /api/v1 for most methods and /api/v2 for a few such as media upload and search. It answers JSON over HTTPS and authenticates with an OAuth bearer token.

Best forConnecting an app or AI agent to Mastodon.
Governed byThe OAuth token and the scopes it carries.
Docs ↗

Streaming API

The streaming API at /api/v1/streaming delivers events in real time, such as a new status, a deletion, or a notification. It is offered as Server-Sent Events over a kept-open HTTP connection or over a WebSocket that can multiplex several streams like user, public, hashtag, and list.

Best forReceiving events without polling.
Governed byThe OAuth token and a read scope such as read:statuses.
Docs ↗
Authentication

OAuth 2.0 user token

An OAuth 2.0 user token is obtained through the authorization code flow after the user approves the requested scopes on their home server. It acts on behalf of that user and is the standard way to connect to Mastodon.

TokenOAuth user access token
Best forActing on behalf of a specific user
Docs ↗

OAuth 2.0 app token

An app access token is obtained with the client credentials grant and represents the application itself, not a user. It can read public data and register push subscriptions but cannot act for any account.

TokenOAuth client credentials token
Best forReading public data without a user
Docs ↗
Endpoint reference

Every Mastodon API method.

Filter by method, access, or permission, or search any path. Select a row for version detail, rate limits, the related webhook event, and the source.

MethodEndpointWhat it doesAccessPermissionVersion

Statuses

Post, read, edit, and delete statuses, and favourite, reblog, and bookmark them.7

An Idempotency-Key header prevents a duplicate post if the request is retried. A media_ids array attaches files uploaded beforehand.

Acts onstatus
Permission (capability)write:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Public statuses are readable without a token on most servers; private ones need read:statuses and access to that post.

Acts onstatus
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The response returns the deleted status's source so it can be re-drafted. Deletions count against the stricter 30-per-30-minutes limit.

Acts onstatus
Permission (capability)write:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit30 per 30 minutes

Returns the ancestors and descendants that make up the conversation.

Acts onstatus
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Favouriting uses its own write:favourites scope rather than write:statuses.

Acts onstatus
Permission (capability)write:favourites
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

A visibility parameter sets who sees the reblog.

Acts onstatus
Permission (capability)write:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

A bookmark is private to the account and uses the write:bookmarks scope.

Acts onstatus
Permission (capability)write:bookmarks
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Timelines

Read the home timeline of followed accounts and the server's public timeline.3

Returns only what the authenticated account follows, so it always needs a token.

Acts ontimeline
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

From Mastodon 4.5 a server can require a signed-in user to read the public timeline.

Acts ontimeline
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The any, all, and none parameters refine which hashtags match.

Acts ontimeline
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Accounts

Verify the token's own account, read a profile and its posts, and follow or unfollow.6

The profile scope, added in Mastodon 4.3, also satisfies this without granting broader read access.

Acts onaccount
Permission (capability)read:accounts
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Public on most servers, so no scope is required, though a server in secure mode may require a token.

Acts onaccount
Permission (capability)None required
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Public posts return without a token; the read:statuses scope is needed to see posts limited to followers.

Acts onaccount
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The follow top-level scope still works but is deprecated in favor of write:follows.

Acts onaccount
Permission (capability)write:follows
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The follow top-level scope still works but is deprecated in favor of write:follows.

Acts onaccount
Permission (capability)write:follows
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

From Mastodon 4.6 a dedicated PATCH /api/v1/profile endpoint covers profile editing and returns raw, unrendered text.

Acts onaccount
Permission (capability)write:accounts
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Media

Upload a file to attach to a status, and update or remove an unattached attachment.2

Processing is asynchronous, so this can return 202 with a null url until the file is ready. Uploads count against the stricter 30-per-30-minutes limit.

Acts onmedia attachment
Permission (capability)write:media
VersionAvailable since the API’s base version
Webhook eventNone
Rate limit30 per 30 minutes

Only works while the attachment is still unattached to a status.

Acts onmedia attachment
Permission (capability)write:media
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Notifications

List the account's notifications, read a single one, and clear them.3

Types include mention, reblog, favourite, follow, and poll.

Acts onnotification
Permission (capability)read:notifications
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Returns the same shape as one entry in the list endpoint.

Acts onnotification
Permission (capability)read:notifications
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Dismisses every notification at once; a single one can be cleared with the dismiss endpoint.

Acts onnotification
Permission (capability)write:notifications
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
Search across accounts, statuses, and hashtags on the server.1

Basic search works unauthenticated, but the resolve and offset parameters need a token with read:search.

Acts onsearch result
Permission (capability)read:search
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Lists

Create and manage lists and the accounts they contain.3

A list groups accounts so their posts can be read on a list timeline.

Acts onlist
Permission (capability)read:lists
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

A replies_policy parameter sets whose replies appear in the list timeline.

Acts onlist
Permission (capability)write:lists
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

The account must already be followed before it can be added to a list.

Acts onlist
Permission (capability)write:lists
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Polls

Read a poll attached to a status and vote on it.2

A public poll reads without a token; a private one needs read:statuses.

Acts onpoll
Permission (capability)read:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply

Votes are submitted as an array of the chosen option indexes.

Acts onpoll
Permission (capability)write:statuses
VersionAvailable since the API’s base version
Webhook eventNone
Rate limitStandard limits apply
No endpoints match those filters.
Webhooks

Webhook events.

Mastodon does not use classic webhooks that post to a receiver URL. Instead an app or AI agent opens a long-lived streaming connection and receives events, like a new status or a notification, as they happen.

EventWhat it signalsTriggered by
No events match that search.
Rate limits & pagination

Rate limits, pagination & request size.

Mastodon limits how fast an app or AI agent can call, through a default ceiling per account and a separate ceiling per IP address over a rolling five-minute window, with a handful of stricter limits on specific actions.

Request rate

Mastodon applies a default ceiling that every endpoint shares: 300 requests per five minutes per authenticated account, and a much higher 7,500 requests per five minutes per IP address. A few actions carry their own stricter limits on top: media uploads and status deletions are capped at 30 per 30 minutes, and account creation at 5 per 30 minutes. A single method can fall under more than one limit at once, and the response headers X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset always report the limit closest to being hit. Going over returns 429 Too Many Requests.

Pagination

List endpoints use cursor pagination through status and notification ids. The max_id parameter returns results older than that id, since_id and min_id return results newer than it, and limit sets the page size. Each response carries a Link header with prev and next URLs already built, which should be followed rather than constructed by hand, because some entities use an internal id that is not exposed in the response body.

Request size

Requests and responses are JSON. A status is capped at 500 characters by default, though a server can raise this, and the v2 instance endpoint reports the configured maximums for a server. A status can carry up to 4 media attachments, and from Mastodon 4.6 a server publishes its account and profile limits, such as max_note_length and max_display_name_length, through the instance endpoint.

Errors

Status codes & error handling.

The status codes an agent should handle, and what to do about each.

StatusCodeMeaningWhat to do
401UnauthorizedAuthentication is required but missing or invalid, such as on a server running in secure mode, or the token has been revoked.Send a valid OAuth bearer token in the Authorization header.
403ForbiddenThe request is authenticated but not permitted, such as the token lacking the required scope or the action being blocked, like following an account that blocks the user.Grant the missing scope, or stop attempting an action the relationship disallows.
404Not FoundThe record does not exist, or the token cannot see private content, in which case Mastodon returns 404 rather than confirm the content exists.Confirm the id and that the token has access to the resource.
422Unprocessable EntityValidation failed, such as a missing required parameter or a duplicate action like re-pinning a status that is already pinned.Read the error and error_description fields, correct the request, and resend.
429Too Many RequestsA rate limit was exceeded, either the default per-account or per-IP limit or one of the stricter per-action limits.Wait until the time in the X-RateLimit-Reset header before retrying.
503Service UnavailableA remote service the server depends on failed, such as a federation peer being unreachable or an SSL validation error, or the server is temporarily overloaded.Retry later, since the failure is usually transient.
Versioning & freshness

Version history.

Mastodon does not version the API by date. It uses path version segments for the API surface, v1 for most methods and v2 for a few, and ships new methods and fields with each Mastodon software release.

Version history

What changed, and when

Latest versionv1
v1Current version
Path-versioned API surface

Mastodon versions the API by path segment rather than by date. Most methods sit under v1, and a few newer ones, such as media upload and full search, sit under v2. There is no global version header to pin, so the methods and fields a server exposes depend on the Mastodon software version it runs. New capabilities ship with each Mastodon release, and from Mastodon 4.4 a Deprecation header marks any method on the way out.

What changed
  • v1 covers statuses, timelines, accounts, notifications, lists, and polls
  • v2 covers media upload and full search, and the instance entity
  • No global API version header; the server's software version determines the surface
  • From Mastodon 4.4 a Deprecation header flags retiring endpoints
2026-06-17Feature update
Mastodon 4.6

Mastodon 4.6 added a Collections API for curated public account lists, dedicated profile editing endpoints at /api/v1/profile that return raw unrendered text, a fallback attribute on notifications for unsupported types, and account and profile limits, such as max_note_length, exposed through the v2 instance endpoint. It was released on Wednesday 17 June 2026.

What changed
  • Added the Collections API with POST /api/v1/collections and related methods
  • Added GET and PATCH /api/v1/profile for profile editing, replacing reliance on update_credentials
  • Added a supported_types parameter and a fallback attribute for unsupported notification types
  • Exposed account and profile limits through the v2 instance endpoint
  • Added an exclude_direct parameter to filter private mentions from a profile's statuses
2025-11
Mastodon 4.5

Mastodon 4.5 added authoring of quote posts through a quoted_status_id attribute on a new status, an experimental AsyncRefresh API for long-running background work, and administrator controls over which timelines are reachable by everyone, by signed-in users only, or not at all. It was released in November 2025.

What changed
  • Added quote posts via a quoted_status_id attribute when creating a status
  • Added new quote states such as blocked_account, blocked_domain, and muted_account
  • Added the experimental AsyncRefresh API signalled by an HTTP header
  • Added administrator control over public timeline access
2025-07
Mastodon 4.4

Mastodon 4.4 added new REST methods, including GET /api/v1/accounts/:id/endorsements, follow-recommendation support, and a Deprecation header that marks endpoints scheduled for removal. It was released in July 2025.

What changed
  • Added GET /api/v1/accounts/:id/endorsements and related endorsement methods
  • Added a Deprecation header to flag retiring endpoints
  • Added FASP follow-recommendation support and an experimental Async Refreshes API
2024-10-08Feature update
Mastodon 4.3

Mastodon 4.3 added the profile OAuth scope, which grants only the authenticated account's own profile, along with broader API refinements. It was released on Tuesday 8 October 2024.

What changed
  • Added the profile OAuth scope for minimal access to the account's own profile
  • Refined account, status, and notification methods
2023-09
Mastodon 4.2

Mastodon 4.2 reworked full-text search behind the v2 search endpoint and added trends and discovery methods. It was released in September 2023.

What changed
  • Improved full-text search served by GET /api/v2/search
  • Added trends and discovery methods

An integration should check the Mastodon software version of the server it talks to, because a method or field may only exist from a certain release onward.

Mastodon API changelog ↗
Questions

Mastodon API, answered.

Which Mastodon server does a token work against?+
Only the one that issued it. Mastodon is federated, meaning it is a network of independent servers, each holding its own accounts and data. An OAuth token is registered and granted by a single server and authenticates against that server alone. To act for a user, an integration registers an application and obtains a token on that user's home server, and the host part of every request is that server's domain, not a single central address.
How do OAuth scopes work, and which should an agent request?+
Scopes limit what a token can do. The top-level scopes are read, write, and follow, and each can be narrowed to one area, such as read:statuses for reading posts or write:statuses for posting and reblogging. Mastodon recommends requesting the most limited scopes possible, so an agent that only posts should ask for write:statuses rather than the whole write scope. Scopes are space-separated when the application is registered and again when authorization is requested, and the granted token reflects exactly what the user approved.
Does Mastodon support webhooks?+
Not in the classic sense of posting an event to a receiver URL. For real-time events an app or AI agent opens a streaming connection at /api/v1/streaming and receives events, such as update for a new status, delete for a removed one, notification, and status.update for an edit. The stream is delivered either as Server-Sent Events over a kept-open HTTP connection or over a WebSocket that can multiplex several streams like user, public, hashtag, and list. Server administrators do have a separate webhook feature for moderation events, which is distinct from this user-facing API.
What are the rate limits?+
Every endpoint shares a default limit of 300 requests per five minutes per account, with a separate 7,500 per five minutes per IP address. Some actions are stricter: media uploads and status deletions allow 30 per 30 minutes, and account creation allows 5 per 30 minutes. A method can be subject to more than one limit at once, and the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers report the one closest to being exceeded. Exceeding a limit returns 429 Too Many Requests, and the reset header says when to retry.
How is the API versioned?+
By path segment, not by date. Most methods live under v1, and a few newer ones, such as media upload and full search, live under v2. There is no global version header to pin. New methods and fields arrive with each Mastodon software release, so what a server exposes depends on the version it runs. An integration should check the server's reported software version, and from Mastodon 4.4 a Deprecation header flags any endpoint that is being retired.
How does media get attached to a post?+
In two steps. First the file is uploaded with POST /api/v2/media, which returns a media attachment id and may respond with 202 while it finishes processing asynchronously. Then that id is passed in the media_ids field when the status is created with POST /api/v1/statuses. Both steps need the write:media scope for the upload and write:statuses for the post. Alt text and a focal point can be set on the attachment before it is attached, and a status can carry up to four attachments.
Related

More social API guides for agents

What is Bollard AI?

Control what every AI agent can do in Mastodon.

Bollard AI sits between a team's AI agents and Mastodon. Grant each agent exactly the access it needs, read or write, action by action, and every call is checked and logged.

  • Set read, write, or full access per agent, never a shared Mastodon token.
  • Denied by default, so an agent reaches only what has been explicitly allowed.
  • Every call recorded in plain English: who, what, where, and the decision.
Mastodon
Social Agent
Read home timeline ResourceOffReadFull use
Post a status ActionOffReadFull use
Follow and unfollow accounts ActionOffReadFull use
Read notifications ResourceOffReadFull use
Per-agent access, set in Bollard AI, not in Mastodon