Social media

Mastodon API

by docs.joinmastodon.org

Social media Added on November 1st, 2026
Visit docs.joinmastodon.org →

What it does

The Mastodon API works with any Mastodon server in the fediverse: read public timelines, hashtags, accounts and posts, and with OAuth publish posts, follow accounts and upload media. Call https:///api/v1/... for example /api/v1/timelines/tag/cats, and get JSON back. Some servers switch off public timelines, so check the server you use. Free, no key needed for public data; posting needs an OAuth token from the server.
  • API
  • HTTP-GET
  • JSON
  • REST

At a glance

API key
Not needed · More APIs with no key
Pricing
Free, no key needed for public data; posting needs an OAuth token from the server.
From the browser
Yes (CORS)
Formats
JSON
Interface
REST, HTTP-GET
Provider
docs.joinmastodon.org

More information: https://docs.joinmastodon.org/client/public/

Compare: Bluesky API vs Mastodon API

Is this your service? Show that it is listed

Put this badge on your website or in your README; it links to this page. About the badge

Listed on Free Web Services

docs.joinmastodon.org
Mastodon API

Example request

curl

curl 'https://mastodon.social/api/v1/trends/tags?limit=1'

JavaScript

const response = await fetch("https://mastodon.social/api/v1/trends/tags?limit=1");
const data = await response.json();
console.log(data);

Python

import requests

response = requests.get(
    "https://mastodon.social/api/v1/trends/tags?limit=1",
    timeout=30,
)
print(response.json())

The JavaScript works in a web page as well as in Node.js 18 or newer.

Did it work for you?

Tell us what you found when you tried Mastodon API.