How to Export Mastodon Blocks List With Pagination Handling
🔍 WiseChecker

How to Export Mastodon Blocks List With Pagination Handling

When you block a large number of accounts on Mastodon, your blocks list can span multiple pages. The built-in export tool in Mastodon only exports the first page of your blocks list by default. This means you may lose entries if you try to migrate your blocks to another instance or create a backup. This article explains how to export your full Mastodon blocks list, including all pages, using your browser’s developer tools. You will learn the exact steps to capture every blocked account without missing any entries.

Key Takeaways: Exporting Blocks List with Pagination

  • Preferences > Import and Export > Export > blocks.csv: This default export only includes the first page of your blocks list.
  • Browser Developer Tools (F12) > Network tab: Use this to capture the full API response for your blocks list.
  • API endpoint /api/v1/blocks?limit=80&max_id=: This endpoint returns up to 80 blocked accounts per page. You must loop through pages to get all entries.

ADVERTISEMENT

Why Mastodon Blocks List Exports Only Show One Page

Mastodon uses pagination for all lists that can contain many items. The blocks list is no exception. When you use the standard export tool at Preferences > Import and Export > Export, Mastodon generates a CSV file. That CSV file contains only the first 80 blocked accounts by default. The export tool does not automatically page through the entire list. This is a limitation of the current Mastodon user interface, not a bug.

The API endpoint that serves the blocks list is /api/v1/blocks. By default, it returns 40 items per page. You can increase this to a maximum of 80 items per page using the limit parameter. To get the next page, you must send the max_id parameter, which is the ID of the last account on the current page. The standard export tool does not handle this pagination logic. To export all blocked accounts, you must either write a script that loops through the pages or manually capture each page using your browser’s developer tools.

Steps to Export Your Full Mastodon Blocks List

The method below uses the browser’s developer tools to capture the raw API response for each page of your blocks list. This approach works on any Mastodon instance and does not require any additional software. You will need a text editor to combine the results into a single CSV file.

  1. Open your Mastodon blocks page in your browser
    Navigate to Preferences > Moderation > Blocks. This page shows your blocked accounts. Scroll to the bottom of the page to see the pagination buttons.
  2. Open Developer Tools and switch to the Network tab
    Press F12 on Windows or Cmd+Option+I on Mac. Click the Network tab. Check the box that says “Preserve log” so the log stays even after page reloads.
  3. Reload the blocks page
    Press F5 to reload the page. In the Network tab, you will see many requests. Look for a request that contains api/v1/blocks in its name. Click that request.
  4. View the Response tab of the API request
    In the right panel, click the Response tab. You will see a JSON array of blocked accounts. Each object contains the id, acct, and display_name fields. Copy the entire JSON response and paste it into a text editor. Save this as blocks_page1.json.
  5. Find the max_id for the next page
    In the same API request, click the Headers tab. Look for the Request URL. It will look like https://yourinstance.social/api/v1/blocks?limit=80. If the response includes a Link header, look for the max_id parameter in that header. If no Link header exists, find the last id value in the JSON response you copied. That ID is your max_id for the next page.
  6. Construct the URL for the next page
    In a new browser tab, type the following URL, replacing yourinstance.social and max_id_value with your instance domain and the max_id you found:
    https://yourinstance.social/api/v1/blocks?limit=80&max_id=max_id_value. Press Enter.
  7. Capture the next page response
    The browser will display the raw JSON response for the next page. Copy that JSON and save it as blocks_page2.json. Repeat steps 5 through 7 until the API returns an empty array []. That means you have reached the last page.
  8. Combine all JSON files into one CSV
    Open each JSON file. Each file contains an array of objects. Extract the acct field from each object. In Mastodon, the acct field is the account handle (for example, @user@instance.social). Create a single CSV file with a header row account and one row per blocked account. Save the file as full_blocks.csv.
  9. Import the CSV into another Mastodon instance
    On your new instance, go to Preferences > Import and Export > Import. Under “Import type”, select “Blocking”. Upload your full_blocks.csv file. Click Upload. Mastodon will process the import and block all accounts in the list.

ADVERTISEMENT

What to Avoid When Exporting Blocks with Pagination

Using the Default Export Tool for Large Block Lists

The default export tool at Preferences > Import and Export > Export > blocks.csv only exports the first 80 entries. If you have more than 80 blocked accounts, this file is incomplete. Do not rely on this export for full backups or migrations. Always verify the number of rows in the CSV against the number shown on your blocks page.

Manually Copying from the Web Interface

Copying account names one by one from the blocks page is error-prone and time-consuming. The web interface only shows 40 accounts per page by default. If you have hundreds of blocked accounts, manual copying will take too long and you may miss entries. Use the API method described above instead.

Not Checking the Link Header

Some Mastodon instances include a Link header in the API response that contains the URL for the next page. If you ignore this header and manually guess the max_id, you might skip pages. Always check the Headers tab in Developer Tools for the Link header first. If it exists, use the max_id from that header instead of the last ID in the response.

Importing Duplicate Entries

If you accidentally export the same page twice, your CSV will contain duplicate account handles. Mastodon handles duplicates during import by skipping them, but it wastes processing time. Remove duplicates before importing. You can do this in a spreadsheet by selecting the account column and using the Remove Duplicates feature.

Manual Pagination vs Automated Script: Export Methods Compared

Item Manual Pagination (Browser DevTools) Automated Script (Python, curl)
Setup time No installation needed, works in any browser Requires Python or curl installed and configured
Effort for 100+ blocks Repeating steps for each page, 5-10 minutes One-time script run, under 1 minute
Error risk Higher if you miss a page or copy wrong data Lower if script handles pagination correctly
Access token needed No, uses your existing browser session Yes, requires creating a Mastodon API access token

This article explained how to export your full Mastodon blocks list using manual pagination with browser developer tools. You now know how to capture each page of the API response and combine the results into a complete CSV file. For users with more than 500 blocked accounts, consider writing a small script that uses the Mastodon API with an access token to automate the process. The key detail to remember is that the max_id parameter controls pagination and the default export only gives you the first 80 entries.

ADVERTISEMENT