Skip to the content
EnrichedNowDocs

    Type to search every page.

    Menu

    Scraper APIMastodon

    mastodon.thread

    A Mastodon post and the replies under it: each with text, author, time and counts, and the post it answers.

    Id
    mastodon.thread
    Version
    1
    Billed per
    record — 1 unit for each record of a charged run
    Runs
    within one request

    Start it with POST /v1/scrapers/mastodon.thread/runs. How runs work is in Running a scraper; what a run costs is in Usage and units.

    Inputs

    The fields of input. A field that is not listed here is refused.

    Inputs of mastodon.thread
    FieldTypeDescription
    urlrequiredstringThe post's address, e.g. https://mastodon.social/@Mastodon/117466983307949301.Limit: at most 2048 characters.
    max_repliesintegerHow many replies to return after the post: 1 to 200.Limit: 1 to 200. Default: 50.

    Record fields

    Every record of a run has these fields. A value that is not known is null — never an empty string and never 0.

    Record fields of mastodon.thread
    FieldTypeNotes
    idstringThe post's id on the server that answered.
    uristring or nullThe post's permanent id on the network, on the server it was written on.
    urlstring or nullThe post's address on the web.
    serverstringThe server that answered, e.g. mastodon.social.
    textstring or nullThe post's text, links written out; null for a post that is only media.
    content_warningstring or nullThe warning the author put in front of the text, when there is one.
    sensitivebooleanTrue when the author marked the media as sensitive.Default: false.
    languagestring or nullThe language the post is marked with, e.g. en.
    visibilitystring or nullpublic or unlisted: the only posts a visitor who is not signed in is shown.
    created_atstring (date-time) or nullWhen it was posted, in UTC.
    edited_atstring (date-time) or nullWhen it was last edited, in UTC; null when it never was.
    author_acctstring or nullThe author's full address, user@server.
    author_namestring or nullThe author's display name.
    author_urlstring or nullThe author's profile address.
    author_botboolean or nullTrue when the author's account says it is automated.
    reply_countinteger or nullNumber of replies the answering server knows of.
    boost_countinteger or nullNumber of boosts (reposts) the answering server knows of.
    favourite_countinteger or nullNumber of favourites the answering server knows of.
    quote_countinteger or nullNumber of posts that quote this one; null where the server does not say.
    hashtagsarray of stringThe hashtags of the post, without the #, lower case.
    mentionsarray of stringThe accounts the post mentions, as user@server.
    linksarray of stringThe full addresses of the links in the text, in order, without mentions and hashtags.
    mediaarray of objectThe post's images, videos and audio, in order.
    type (in media[])"image" | "video" | "gifv" | "audio"image, video, gifv (a short looping video without sound) or audio.
    url (in media[])stringThe file at full size.
    preview_url (in media[])string or nullA smaller image of it.
    alt_text (in media[])string or nullThe description the author gave it, when there is one.
    width (in media[])integer or nullWidth in pixels.
    height (in media[])integer or nullHeight in pixels.
    duration_s (in media[])number or nullLength in seconds, for a video or audio.
    link_cardobject or nullThe preview card of a link in the post, when the server made one.
    url (in link_card)stringThe address the card leads to.
    title (in link_card)string or nullThe card's title.
    description (in link_card)string or nullThe card's text.
    image_url (in link_card)string or nullThe card's image.
    provider (in link_card)string or nullThe site the link is on, as the card names it.
    pollobject or nullThe post's poll, when it has one.
    options (in poll)array of objectThe options, in order.
    title (in poll.options[])stringThe option's text.
    votes (in poll.options[])integer or nullVotes for it; null while the poll hides its results.
    votes (in poll)integer or nullVotes cast in all.
    voters (in poll)integer or nullAccounts that voted; null when the server does not say.
    multiple (in poll)boolean or nullTrue when a voter may pick more than one option.
    expires_at (in poll)string (date-time) or nullWhen the poll closes or closed, in UTC.
    expired (in poll)boolean or nullTrue when it has closed.
    quoted_post_urlstring or nullThe address of the post this one quotes, when it quotes one.
    reply_to_idstring or nullThe id, on the answering server, of the post this one replies to; null when it is not a reply.
    boosted_by_acctstring or nullIn an account's posts: the account that boosted this post, when it is listed as a boost.
    boosted_atstring (date-time) or nullWhen it was boosted, in UTC.
    fetched_atstring (date-time)When the answer was read, in UTC.

    Example request

    # Start a run and wait up to 60 seconds for it to finish
    curl -X POST "https://api.enrichednow.com/v1/scrapers/mastodon.thread/runs?wait=60" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"input":{"url":"https://mastodon.social/@Mastodon/117466983307949301","max_replies":2}}'
    
    # Read its records, with the id the first call answered
    curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY"
    from enrichednow import EnrichedNow
    
    client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY
    
    # Start a run, wait for it to end, and get its records
    result = client.scrape("mastodon.thread", {
        "url": "https://mastodon.social/@Mastodon/117466983307949301",
        "max_replies": 2,
    })
    print(result.run.id, result.run.status, result.run.record_count)
    
    # Read its records: pages are fetched as you go
    for record in result.records:
        print(record)

    Install it with pip install enrichednow, then save as run.py and run python3 run.py

    import EnrichedNow from "enrichednow";
    
    const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
    
    // Start a run, wait for it to end, and get its records
    const { run, records } = await client.scrape("mastodon.thread", {
      url: "https://mastodon.social/@Mastodon/117466983307949301",
      max_replies: 2,
    });
    console.log(run.id, run.status, run.record_count);
    
    // Read its records: pages are fetched as you go
    for await (const record of records) console.log(record);

    Install it with npm install enrichednow, then save as run.mjs and run node run.mjs

    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"time"
    
    	enrichednow "github.com/enrichednow/enrichednow-go"
    )
    
    func main() {
    	client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
    	defer cancel()
    
    	// Start a run, wait for it to end, and get its records
    	run, records, err := client.Scrape(ctx, "mastodon.thread", map[string]any{"url": "https://mastodon.social/@Mastodon/117466983307949301", "max_replies": 2})
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(run.ID, run.Status, run.RecordCount)
    
    	// Read its records: pages are fetched as you go
    	for records.Next() {
    		fmt.Println(string(records.Current()))
    	}
    	if err := records.Err(); err != nil {
    		log.Fatal(err)
    	}
    }

    Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go

    import com.enrichednow.EnrichedNowClient;
    import com.enrichednow.ScrapeResult;
    import java.util.Map;
    
    public class Run {
        public static void main(String[] args) {
            EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
    
            // Start a run, wait for it to end, and get its records
            ScrapeResult result = client.scrape("mastodon.thread", Map.of("url", "https://mastodon.social/@Mastodon/117466983307949301", "max_replies", 2));
            System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
    
            // Read its records: pages are fetched as you go
            for (Map<String, Object> record : result.records()) {
                System.out.println(record);
            }
        }
    }

    Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java

    enrichednow run mastodon.thread --input url=https://mastodon.social/@Mastodon/117466983307949301 --input max_replies=2

    Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh

    It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.

    The body on its own:

    JSON
    {
      "input": {
        "url": "https://mastodon.social/@Mastodon/117466983307949301",
        "max_replies": 2
      }
    }

    Example response

    The run, once it has ended. A run that has not ended within wait comes back with 202 and the status queued or running.

    JSON
    {
      "id": "run_841742f37553189ff9c27ba1",
      "scraper_id": "mastodon.thread",
      "scraper_version": 1,
      "status": "ok",
      "reason": null,
      "input": {
        "url": "https://mastodon.social/@Mastodon/117466983307949301",
        "max_replies": 2
      },
      "record_count": 1,
      "units": 1,
      "units_per_request": null,
      "units_per_record": 1,
      "units_per_page": null,
      "diagnostics": {
        "requests": 1,
        "bytes": 259214,
        "wall_ms": 885,
        "facts": {}
      },
      "created_at": "2026-11-16T22:37:50.170950Z",
      "started_at": "2026-11-16T22:37:50.178331Z",
      "finished_at": "2026-11-16T22:37:51.066313Z"
    }

    Its records, from GET /v1/runs/{id}/records. The record is a real one: this scraper's own parser read it from a page recorded from the site.

    JSON
    {
      "records": [
        {
          "id": "117466983307949301",
          "uri": "https://mastodon.social/users/Mastodon/statuses/117466983307949301",
          "url": "https://mastodon.social/@Mastodon/117466983307949301",
          "server": "mastodon.social",
          "text": "#Mastodon is getting a new look in our upcoming 5.0 release.\nWe wrote a bit more about our design process and how we approach community input. If you’re on mastodon.social you will see the new design tomorrow, on Tuesday. We rely on your … [truncated]",
          "content_warning": null,
          "sensitive": false,
          "language": "en",
          "visibility": "public",
          "created_at": "2026-10-19T09:58:40.113000Z",
          "edited_at": null,
          "author_acct": "Mastodon@mastodon.social",
          "author_name": "Mastodon",
          "author_url": "https://mastodon.social/@Mastodon",
          "author_bot": false,
          "reply_count": 65,
          "boost_count": 437,
          "favourite_count": 764,
          "quote_count": 36,
          "hashtags": [
            "mastodon"
          ],
          "mentions": [],
          "links": [
            "https://blog.joinmastodon.org/2026/10/5.0-a-closer-look/"
          ],
          "media": [],
          "link_card": {
            "url": "https://blog.joinmastodon.org/2026/10/5.0-a-closer-look/",
            "title": "5.0: A closer look",
            "description": "October is here, and it's almost time for Mastodon's 5.0 release! We announced our plans for big changes back in August. In this companion article, we're hoping to shed light on some of the decisions behind this major UI overhaul.",
            "image_url": "https://files.mastodon.social/cache/preview_cards/images/211/377/178/original/2fb48094e631509b.jpg",
            "provider": "Mastodon Blog"
          },
          "poll": null,
          "quoted_post_url": null,
          "reply_to_id": null,
          "boosted_by_acct": null,
          "boosted_at": null,
          "fetched_at": "2026-11-19T18:07:40.979728Z"
        }
      ],
      "next_cursor": null
    }

    What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with … [truncated].

    • Shortened: text: 304 characters, the first 237 shown.

    A run does not always end ok. Results and statuses lists every status and the reasons every scraper shares; the reasons of the Mastodon scrapers are in their own section there.