Skip to main content

Moderation

This page covers the APIs for managing blocked accounts, muted accounts, domain blocks, and user reports.

All list methods return MastodonPage<T>, which carries the result items along with nextMaxId and prevMinId cursors parsed from the Link response header. See the Pagination guide for details.


Blocked accounts

Listing blocks

final page = await client.blocks.fetch(limit: 40);
for (final account in page.items) {
print(account.acct);
}

// Next page
if (page.nextMaxId != null) {
final next = await client.blocks.fetch(maxId: page.nextMaxId);
}

Parameters:

ParameterDefaultMaxDescription
limit4080Number of results
maxIdReturn results older than this ID
sinceIdReturn results newer than this ID
minIdReturn the oldest results after this ID (reverse pagination)

To block or unblock an account, use client.accounts.block() and client.accounts.unblock().


Muted accounts

Listing mutes

final page = await client.mutes.fetch(limit: 40);
for (final account in page.items) {
print(account.acct);
}

// Next page
if (page.nextMaxId != null) {
final next = await client.mutes.fetch(maxId: page.nextMaxId);
}

Parameters:

ParameterDefaultMaxDescription
limit4080Number of results
maxIdReturn results older than this ID
sinceIdReturn results newer than this ID

To mute or unmute an account, use client.accounts.mute() and client.accounts.unmute().


Domain blocks

User-level domain blocks hide posts and notifications from an entire domain. This is distinct from instance-level domain blocks (see client.instance.fetchDomainBlocks()).

Listing blocked domains

final page = await client.domainBlocks.fetch(limit: 100);
for (final domain in page.items) {
print(domain);
}

Parameters:

ParameterDefaultMaxDescription
limit100200Number of results
maxIdReturn results older than this ID
sinceIdReturn results newer than this ID
minIdReturn the oldest results after this ID (reverse pagination)

Blocking a domain

await client.domainBlocks.block('spam.example.com');

Blocking a domain hides all public posts and notifications from accounts on that domain, removes any existing followers from that domain, and prevents new follows to accounts there.

Unblocking a domain

await client.domainBlocks.unblock('spam.example.com');

Reports

Reporting an account

final report = await client.reports.create(
MastodonReportCreateRequest(
accountId: '12345',
comment: 'This account is posting spam.',
category: 'spam',
),
);
print(report.id);

Reporting specific statuses

final report = await client.reports.create(
MastodonReportCreateRequest(
accountId: '12345',
statusIds: ['111', '222'],
comment: 'These posts violate the rules.',
category: 'violation',
ruleIds: ['1', '3'],
),
);

Forwarding to a remote admin

Set forward: true to send a copy of the report to the administrators of the reported account's home server.

final report = await client.reports.create(
MastodonReportCreateRequest(
accountId: '67890',
comment: 'Harassment from a remote account.',
forward: true,
),
);

Request fields

FieldRequiredDescription
accountIdYesID of the account to report
statusIdsNoStatus IDs to attach as evidence
commentNoReason for the report (max 1000 characters)
forwardNoForward to the remote server administrator
categoryNospam, legal, violation, or other
ruleIdsNoRule IDs violated (used with violation category)