APIs / Social media / Mastodon

1 credit per call5 endpointsChecked working 6 Dec 2026

Mastodon API

Mastodon API for public profiles, statuses, hashtag timelines and search by instance as JSON. 1 credit per successful call.

Mastodon
GET/v1/mastodon/search?instance=mastodon.social&q=mastodon&type=accounts&resolve=0&limit=5
curl "https://api.perceptlayer.com/v1/mastodon/search?instance=mastodon.social&q=mastodon&type=accounts&resolve=0&limit=5" \
  -H "X-API-Key: $API_KEY"
cURL1 credit per successful call
Run this call below or from your dashboard to see a live response.

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/mastodon/search?instance=mastodon.social&q=mastodon&type=accounts&resolve=0&limit=5" \
  -H "X-API-Key: $API_KEY"

Mastodon · 5 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

Note
Endpoints marked “Needs terms” return personal or social data. They work once you accept the restricted-endpoint terms in your dashboard.
EndpointRequired parametersReturnsCost
GET/v1/mastodon/hashtag
tag+11 optionalNeeds terms
idcreated_atsensitivespoiler_textvisibilitylanguage+14 more
1 credit
GET/v1/mastodon/profile
acct+1 optionalNeeds terms
idusernameacctdisplay_namelockedbot+25 more
1 credit
GET/v1/mastodon/search
q+6 optionalNeeds terms
idusernameacctdisplay_namelockedbot+26 more
1 credit
GET/v1/mastodon/status
id+1 optionalNeeds terms
idcreated_atsensitivespoiler_textvisibilitylanguage+12 more
1 credit
GET/v1/mastodon/statuses
id+10 optionalNeeds terms
idcreated_atsensitivespoiler_textvisibilityuri+15 more
1 credit

Overview

About the Mastodon API

What you can get

The Mastodon API returns public Mastodon data as JSON through 5 endpoints. Each takes an instance, such as mastodon.social. These are restricted endpoints: the restricted-endpoint terms apply, and they don't permit collecting personal data without a lawful basis or using it to contact people.

  • Search: search takes q, with type (accounts, hashtags or statuses), resolve, limit, offset and exclude_unreviewed.
  • Profiles: profile takes an acct.
  • Statuses: status takes an id; statuses takes an id, with limit, max_id, min_id, since_id, exclude_replies, exclude_reblogs, only_media, pinned and tagged.
  • Hashtags: hashtag takes a tag, with limit, max_id, min_id, since_id, only_media, any[], all[], none[], local and remote.

How a call works

Pick the instance and search it: GET /v1/mastodon/search?instance=mastodon.social&q=mastodon&type=accounts&limit=5 with your key in the X-API-Key header. Timelines page with max_id, min_id and since_id. Every successful call costs 1 credit; failed calls cost nothing.

Social mediaJSONRESTMCPSome endpoints need terms

More social media APIs

Use cases

Follow public posts under a hashtag

Use the Mastodon API to follow public posts under a hashtag

Track mentions of a project or brand

Use the Mastodon API to track mentions of a project or brand

Read the public posts of accounts you follow for research

Use the Mastodon API to read the public posts of accounts you follow for research

Find accounts and hashtags on a topic

Use the Mastodon API to find accounts and hashtags on a topic

FAQ

Questions

Do I need an account on the instance?

No. You call this Mastodon API with your Perceptlayer key in the `X-API-Key` header, with no Mastodon account or app token. You do need to accept the restricted-endpoint terms first.

How much does the Mastodon API cost?

Each successful call costs one credit. New accounts get free credits to start, and credit packs bring the price down as you scale.

What format are responses in?

Every endpoint returns JSON, with no HTML parsing on your side.

Is this the official Mastodon API?

No. Perceptlayer is an independent service and is not affiliated with Mastodon. It returns Mastodon data as JSON with a Perceptlayer key, so there is no Mastodon developer account, app review or partner approval to get first. It only reads data: if Mastodon has an official API and you need to act on your own Mastodon account, such as posting, managing orders or reading private data, use that one.

Should I build a Mastodon scraper instead?

You can, but a Mastodon scraper is code you maintain: page changes break it, requests get blocked, and Mastodon's terms govern how you collect data. The Mastodon API gives you 5 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first. Some of these endpoints return social or personal data and need the restricted-endpoint terms; collect only what you have a lawful basis for.

Try the Mastodon API with 100 free credits

No credit card. Failed calls are never billed.