Mastodon hub

Mastodon Reply Tree API

The conversation around a post: every parent and the replies, as full post records.

GET /v1/mastodon/posts/context

1 credit Failed requests are free

About this endpoint

GET /v1/mastodon/posts/context?url=https://mastodon.social/@Gargron/1 returns the conversation around the post, from the server in the post URL. data.ancestors holds the parents, oldest first. data.descendants holds the replies in thread order; without a login, servers return at most 60. Every entry is a full post with its author, contentHtml, text, stats, media, hashtags, mentions and replyTo, so one request gives you the whole thread without a lookup per reply.

A missing post returns lookupStatus: not_found with both lists empty. A server that needs a login for the thread returns restricted. There is no paging: the server decides how much of the tree is public.

Mastodon Reply Tree API FAQ

How are the two lists ordered?

ancestors go oldest first, from the root towards the post. descendants are in thread order, so a reply appears near what it answers. replyTo on each post names the post and account it answers.

How many credits does a reply tree cost?

Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth.

Why are there at most 60 replies?

The public tree is limited. Servers cap descendants at 60, and deeper replies can be omitted. The post and its ancestors are unaffected.

Does the context include the post itself?

No. ancestors and descendants are around the post. Fetch GET /v1/mastodon/posts with the same URL for the post itself.