### Example GET Request Headers Source: https://docs.joinmastodon.org/spec/security An example of HTTP headers for a GET request, illustrating the headers that might be included in the signature. ```http GET /users/username/outbox HTTP/1.1 Host: mastodon.example Date: 18 Dec 2019 10:08:46 GMT Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams" ``` -------------------------------- ### Get Account Following Request Example Source: https://docs.joinmastodon.org/methods/accounts Example of an HTTP GET request to retrieve the list of accounts that a specific account is following. ```http GET /api/v1/accounts/:id/following HTTP/1.1 ``` -------------------------------- ### Start and Enable Sidekiq Redis Instance Source: https://docs.joinmastodon.org/admin/scaling Enable the new Sidekiq Redis service to start on boot and start it immediately. ```bash systemctl enable --now redis-sidekiq ``` -------------------------------- ### Install System Repositories Source: https://docs.joinmastodon.org/admin/install Installs essential tools for managing system repositories. ```bash apt install -y curl wget gnupg lsb-release ca-certificates ``` -------------------------------- ### Install Foreman and Run Development Server Source: https://docs.joinmastodon.org/dev/setup Installs the Foreman gem and then runs the Mastodon development server using the 'bin/dev' script, which starts multiple processes like Rails, Vite, streaming API, and Sidekiq. ```bash gem install foreman --no-document bin/dev ``` -------------------------------- ### Start Vagrant Virtual Machine Source: https://docs.joinmastodon.org/dev/setup Starts the virtual machine for the Mastodon development environment. ```bash vagrant up ``` -------------------------------- ### View Status Source Request Example Source: https://docs.joinmastodon.org/methods/statuses This example shows the HTTP GET request to retrieve the source properties of a status, which can then be edited. It requires the status ID and appropriate authorization. ```http GET /api/v1/statuses/:id/source HTTP/1.1 ``` -------------------------------- ### Example API Request for Pagination Source: https://docs.joinmastodon.org/api/guidelines This example demonstrates a typical GET request to an API endpoint, including the Host header and Authorization token, which is often used in conjunction with pagination parameters. ```http GET /api/v1/endpoint HTTP/1.1 Host: mastodon.example Authorization: Bearer ``` -------------------------------- ### User Preferences Example Source: https://docs.joinmastodon.org/entities/Preferences This JSON object shows an example of a user's preferences, including default settings for posting and reading. ```json { "posting:default:visibility": "public", "posting:default:sensitive": false, "posting:default:language": null, "reading:expand:media": "default", "reading:expand:spoilers": false } ``` -------------------------------- ### Install iptables-persistent Source: https://docs.joinmastodon.org/admin/prerequisites Install iptables-persistent to manage and save firewall rules across reboots. ```bash apt install -y iptables-persistent ``` -------------------------------- ### Install PgBouncer Source: https://docs.joinmastodon.org/admin/scaling Install the PgBouncer connection pooler on Debian/Ubuntu systems. ```bash sudo apt install pgbouncer ``` -------------------------------- ### Install Ruby Version Source: https://docs.joinmastodon.org/admin/install Installs the required Ruby version using rbenv, with jemalloc for performance. ```bash RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install ``` -------------------------------- ### Query String Parameter Example Source: https://docs.joinmastodon.org/client/intro Demonstrates how to append query strings to a URL to pass parameters for a GET request. Parameters are in the format key=value, separated by '&'. ```bash curl https://mastodon.example/endpoint?q=test&n=0 ``` -------------------------------- ### Start and Enable Elasticsearch Service Source: https://docs.joinmastodon.org/admin/elasticsearch Reloads the systemd daemon and then starts and enables the Elasticsearch service to run on boot. ```bash systemctl daemon-reload systemctl enable --now elasticsearch ``` -------------------------------- ### Install Tor Packages Source: https://docs.joinmastodon.org/admin/optional/tor Installs the Tor package and the repository key package. This command installs the necessary software to run a Tor onion service. ```bash apt install tor deb.torproject.org-keyring ``` -------------------------------- ### Install Fail2ban Source: https://docs.joinmastodon.org/admin/prerequisites Install the fail2ban package to protect against brute-force login attempts. ```bash apt install fail2ban ``` -------------------------------- ### CollectionItem Example Source: https://docs.joinmastodon.org/entities/CollectionItem A basic example of a CollectionItem object, showing its core attributes. ```json { "id": "116141056635954112", "account_id": "112658193342215767", "state": "accepted", "created_at": "2026-02-25T11:35:01.394Z" } ``` -------------------------------- ### Lookup Account by WebFinger Address Request Example Source: https://docs.joinmastodon.org/methods/accounts Demonstrates a GET request to the lookup endpoint, used to quickly find an account ID from a username or WebFinger address. ```http GET /api/v1/accounts/lookup HTTP/1.1 ``` -------------------------------- ### Install System Packages Source: https://docs.joinmastodon.org/admin/install Installs a comprehensive list of system packages required for Mastodon, including build tools, libraries, and services. ```bash apt update apt install -y \ imagemagick ffmpeg libvips-tools libpq-dev libxslt1-dev file git \ protobuf-compiler pkg-config autoconf bison build-essential \ libssl-dev libyaml-dev libreadline-dev zlib1g-dev libffi-dev \ libgdbm-dev nginx nodejs redis-server postgresql certbot \ python3-certbot-nginx libidn-dev libicu-dev libjemalloc-dev ``` -------------------------------- ### Install rbenv and ruby-build Source: https://docs.joinmastodon.org/admin/install Installs rbenv for Ruby version management and ruby-build for compiling Ruby versions. ```bash git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build ``` -------------------------------- ### Example HTTP Request with Signature Source: https://docs.joinmastodon.org/spec/security An example of an HTTP POST request including the necessary headers for signature verification. ```http POST /users/username/inbox HTTP/1.1 Host: mastodon.example Date: 18 Dec 2019 10:08:46 GMT Digest: e37e179c75071a291f90a5fd4f848da87b491f1282f7bb8509ef2115b81ee0f4 Signature: keyId="https://my.example.com/actor#main-key",headers="(request-target) host date digest",signature="Y2FiYW...IxNGRiZDk4ZA==" Content-Type: application/ld+json; profile="https://www.w3.org/ns/activitystreams" { "@context": "https://www.w3.org/ns/activitystreams", "actor": "https://my.example.com/actor", "type": "Create", "object": { "type": "Note", "content": "Hello!" } "to": "https://mastodon.example/users/username" } ``` -------------------------------- ### Report Example Source: https://docs.joinmastodon.org/entities/Report This JSON object represents an example of a report filed against a user. It includes details about the report itself and the target account. ```json { "id": "48914", "action_taken": false, "action_taken_at": null, "category": "spam", "comment": "Spam account", "forwarded": false, "created_at": "2022-08-25T09:56:16.763Z", "status_ids": [ "108882889550545820" ], "collection_ids": [], "rule_ids": null, "target_account": { "id": "108366849347798387", "username": "Baluke", "acct": "Baluke", "display_name": "Baluke Dental Studios", "locked": false, "bot": false, "discoverable": false, "group": false, "created_at": "2022-05-26T00:00:00.000Z", "note": "

Baluke Dental Studios is a full service dental lab offering fabrication, staining, and digital services. Advanced technologies and a meticulous process ensure reduced chair time, lower costs, and better patient outcomes with beautiful smiles. Talk to a representative today.

https://baluke.com/

", "url": "https://mastodon.social/@Baluke", "avatar": "https://files.mastodon.social/accounts/avatars/108/366/849/347/798/387/original/dbcfe99ed5def0f4.png", "avatar_static": "https://files.mastodon.social/accounts/avatars/108/366/849/347/798/387/original/dbcfe99ed5def0f4.png", "header": "https://static-cdn.mastodon.social/headers/original/missing.png", "header_static": "https://static-cdn.mastodon.social/headers/original/missing.png", "followers_count": 0, "following_count": 0, "statuses_count": 38, "last_status_at": "2022-08-25", "emojis": [], "fields": [] } } ``` -------------------------------- ### Get Account Followers Request Example Source: https://docs.joinmastodon.org/methods/accounts Example of an HTTP GET request to retrieve the followers of a specific account. ```http GET /api/v1/accounts/:id/followers HTTP/1.1 ``` -------------------------------- ### Run Mastodon Setup Wizard Source: https://docs.joinmastodon.org/admin/install Initiates the Mastodon setup wizard to generate configuration, precompile assets, and create the database schema. ```bash RAILS_ENV=production bin/rails mastodon:setup ``` -------------------------------- ### Setup Test Database Source: https://docs.joinmastodon.org/dev/setup Sets up the Mastodon test database. ```bash RAILS_ENV=test bin/rails db:setup ``` -------------------------------- ### Setup Development Database Source: https://docs.joinmastodon.org/dev/setup Sets up the Mastodon development database, including creating databases, loading the schema, and seeding data. ```bash RAILS_ENV=development bin/rails db:setup ``` -------------------------------- ### Get Status Context Request Example Source: https://docs.joinmastodon.org/methods/statuses This example shows the HTTP GET request to retrieve the context of a status, including its ancestors and descendants in a thread. Authentication is required for private statuses and deeper context. ```http GET /api/v1/statuses/:id/context HTTP/1.1 ``` -------------------------------- ### Get Notification Policy Request Source: https://docs.joinmastodon.org/methods/notifications This is an example of an HTTP GET request to retrieve the current notification filtering policy for a user. ```http GET /api/v2/notifications/policy HTTP/1.1 ``` -------------------------------- ### Get Notification Requests Request Source: https://docs.joinmastodon.org/methods/notifications This is an example of an HTTP GET request to retrieve notification requests filtered by the user's policy. ```http GET /api/v1/notifications/requests HTTP/1.1 ``` -------------------------------- ### Get Single Notification Request Source: https://docs.joinmastodon.org/methods/notifications Example of a GET request to retrieve a specific notification request by its ID. Requires the 'read:notifications' scope. ```http GET /api/v1/notifications/requests/:id HTTP/1.1 ``` -------------------------------- ### ActivityPub Create Activity Example Source: https://docs.joinmastodon.org/spec/webfinger This is a sample ActivityPub 'Create' activity. The 'to' field demonstrates how a remote user's profile URI, obtained via WebFinger, is used to address the activity. ```json { "id": "https://social.example/activities/1", "type": "Create", "actor": "https://social.example/actors/1", "object": { "id": "https://social.example/objects/1", "type": "Note", "content": "Hello, Gargron!" }, "to": "https://mastodon.social/users/Gargron" } ``` -------------------------------- ### Keep Alive Comment Example Source: https://docs.joinmastodon.org/methods/streaming This is an example of a heartbeat comment used to keep the server-sent events connection alive. Parsers should ignore lines starting with a colon. ```text :thump ``` -------------------------------- ### String to Sign for GET Request Source: https://docs.joinmastodon.org/spec/security The string constructed from specific HTTP headers that is then hashed and signed for a GET request. This example includes the request target, host, and date. ```text (request-target): get /users/username/outbox host: mastodon.example date: 18 Dec 2019 10:08:46 GMT ``` -------------------------------- ### Example Response: Terms of Service (Configured) Source: https://docs.joinmastodon.org/methods/instance Example JSON response when terms of service are configured, including effective date, status, and content. ```json { "effective_date": "2025-04-15", "effective": true, "content": "

Foo bar newer

\n", "succeeded_by": null } ``` -------------------------------- ### GET Request to View Blocked Users Source: https://docs.joinmastodon.org/methods/blocks This snippet shows the structure of a GET request to the /api/v1/blocks endpoint. It includes example headers and query parameters for retrieving a list of blocked accounts. ```http GET /api/v1/blocks HTTP/1.1 ``` -------------------------------- ### Pagination example for domain blocks Source: https://docs.joinmastodon.org/methods/admin/domain_blocks Illustrates how to use the `Link` header for paginating through the list of blocked domains. ```http Link: ; rel="next", ; rel="prev" ``` -------------------------------- ### Start and Enable Mastodon Systemd Services Source: https://docs.joinmastodon.org/admin/install Reload the systemd daemon and then start and enable the Mastodon web, sidekiq, and streaming services to ensure they run on boot. ```bash systemctl daemon-reload systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming ``` -------------------------------- ### New Users Measure Example Source: https://docs.joinmastodon.org/entities/Admin_Measure Example of the 'new_users' measure, detailing the number of users who joined within a specific time frame. This helps track user acquisition trends. ```json { "key": "new_users", "unit": null, "total": "2", "previous_total": "0", "data": [ { "date": "2022-09-14T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-15T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-16T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-17T00:00:00.000+00:00", "value": "1" }, { "date": "2022-09-18T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-19T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-20T00:00:00.000+00:00", "value": "1" }, { "date": "2022-09-21T00:00:00.000+00:00", "value": "0" }, { "date": "2022-09-22T00:00:00.000+00:00", "value": "0" } ] } ``` -------------------------------- ### Link PreviewCard Example Source: https://docs.joinmastodon.org/entities/PreviewCard Represents a generic link preview card. This example shows a news article with a title and description, but no specific author or provider details. ```json { "url": "https://www.theguardian.com/money/2019/dec/07/i-lost-my-193000-inheritance-with-one-wrong-digit-on-my-sort-code", "title": "‘I lost my £193,000 inheritance – with one wrong digit on my sort code’", "description": "When Peter Teich’s money went to another Barclays customer, the bank offered £25 as a token gesture", "type": "link", "authors": [], "author_name": "", "author_url": "", "provider_name": "", "provider_url": "", "html": "", "width": 0, "height": 0, "image": null, "embed_url": "", "blurhash": null } ``` -------------------------------- ### Scheduled Status Example (GET /api/v1/scheduled_statuses) Source: https://docs.joinmastodon.org/entities/ScheduledStatus This JSON object represents a scheduled status as returned by a GET request to list scheduled statuses. It contains similar information to the POST response, including ID, scheduled time, and parameters. ```json { "id": "1", "scheduled_at": "2022-09-29T00:00:00.000Z", "params": { "poll": null, "text": "test post", "language": null, "media_ids": null, "sensitive": null, "visibility": null, "idempotency": null, "scheduled_at": null, "spoiler_text": null, "application_id": 3, "in_reply_to_id": null, "with_rate_limit": false }, "media_attachments": [] } ``` -------------------------------- ### Response for listing blocked domains Source: https://docs.joinmastodon.org/methods/admin/domain_blocks Example response structure for the `GET /api/v1/admin/domain_blocks` endpoint, showing details of a blocked domain. ```json [ { "id": "1", "domain": "example.com", "digest": "a379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce1947", "created_at": "2022-11-16T08:15:34.238Z", "severity": "noop", "reject_media": false, "reject_reports": false, "private_comment": null, "public_comment": null, "obfuscate": false }, // ... ] ``` -------------------------------- ### Get Single Notification Group Request Source: https://docs.joinmastodon.org/methods/notifications_alpha Example HTTP request to retrieve a specific notification group using its group key. ```http GET /api/v2_alpha/notifications/:group_key HTTP/1.1 ``` -------------------------------- ### Account Following Pagination Link Header Source: https://docs.joinmastodon.org/methods/accounts Example of an HTTP Link header used for paginating through the results of the Get Account Following endpoint. ```http Link: ; rel="next", ; rel="prev" ``` -------------------------------- ### Sample PgBouncer Userlist with Admin User Source: https://docs.joinmastodon.org/admin/scaling Example userlist.txt including a regular user ('mastodon') and an admin user ('pgbouncer'), both using MD5-hashed passwords. ```text "mastodon" "md5d75bb2be2d7086c6148944261a00f605" "pgbouncer" "md5a45753afaca0db833a6f7c7b2864b9d9" ``` -------------------------------- ### Account Followers Pagination Link Header Source: https://docs.joinmastodon.org/methods/accounts Example of an HTTP Link header used for paginating through the results of the Get Account Followers endpoint. ```http Link: ; rel="next", ; rel="prev" ``` -------------------------------- ### Starting Multiple Streaming Server Processes with systemctl Source: https://docs.joinmastodon.org/admin/scaling These commands show how to start individual Mastodon streaming server processes on different ports using systemd. ```bash $ sudo systemctl start mastodon-streaming@4000.service $ sudo systemctl start mastodon-streaming@4001.service $ sudo systemctl start mastodon-streaming@4002.service ``` -------------------------------- ### Search Accounts Request Example Source: https://docs.joinmastodon.org/methods/accounts Demonstrates a GET request to search for accounts by username or display name. Requires a user token and 'read:accounts' scope. ```http GET /api/v1/accounts/search HTTP/1.1 ``` -------------------------------- ### Get Featured Accounts Request Example Source: https://docs.joinmastodon.org/methods/accounts This snippet shows the HTTP request to retrieve a list of accounts that a user is currently featuring on their profile. This endpoint is public. ```http GET /api/v1/accounts/:id/endorsements HTTP/1.1 ``` -------------------------------- ### Enable Nginx Site Configuration Source: https://docs.joinmastodon.org/admin/optional/object-storage-proxy After saving the Nginx configuration file, create a symbolic link to enable the site and reload Nginx to apply the changes. ```bash ln -s /etc/nginx/sites-available/files.example.com /etc/nginx/sites-enabled/ systemctl reload nginx ``` -------------------------------- ### Get Identity Proofs Response Example Source: https://docs.joinmastodon.org/methods/accounts Sample successful response (200 OK) for retrieving identity proofs associated with an account. Note: This endpoint now returns an empty array. ```json [ { "provider": "Keybase", "provider_username": "gargron", "updated_at": "2019-07-21T20:14:39.596Z", "proof_url": "https://keybase.io/gargron/sigchain#5cfc20c7018f2beefb42a68836da59a792e55daa4d118498c9b1898de7e845690f", "profile_url": "https://keybase.io/gargron" } ] ``` -------------------------------- ### Watch Public Timeline for Hashtag Source: https://docs.joinmastodon.org/methods/streaming This example shows how to make a GET request to the /api/v1/streaming/hashtag endpoint to stream public statuses for a specific hashtag. Requires a user token with 'read:statuses' scope. ```http GET /api/v1/streaming/hashtag HTTP/1.1 ``` -------------------------------- ### Video PreviewCard Example Source: https://docs.joinmastodon.org/entities/PreviewCard Represents a video preview card generated from a YouTube URL. Includes details like author, provider, and embed HTML. ```json { "url": "https://www.youtube.com/watch?v=OMv_EPMED8Y", "title": "♪ Brand New Friend (Christmas Song!)", "description": "", "type": "video", "author_name": "YOGSCAST Lewis & Simon", "author_url": "https://www.youtube.com/user/BlueXephos", "provider_name": "YouTube", "provider_url": "https://www.youtube.com/", "html": "", "width": 480, "height": 270, "image": "https://files.mastodon.social/preview_cards/images/014/179/145/original/9cf4b7cf5567b569.jpeg", "embed_url": "", "blurhash": "UvK0HNkV,:s9xBR%njog0fo2W=WBS5ozofV@" } ``` -------------------------------- ### HTTP Signature for Partial Collection Access Source: https://docs.joinmastodon.org/spec/activitypub This example demonstrates a GET request to a partial collection URL, which must be signed with HTTP signatures. It includes the Signature header and the expected JSON-LD response body. ```http GET https://social.sitedethib.com/users/Thib/followers_synchronization HTTP/1.1 Signature: ... # a signature from an account on mastodon.social { "@context": "https://www.w3.org/ns/activitystreams", "id": "https://social.sitedethib.com/users/Thib/followers?domain=mastodon.social", "type": "OrderedCollection", "orderedItems": [ "https://mastodon.social/users/Gargron" ] } ``` -------------------------------- ### Run Database Migrations Source: https://docs.joinmastodon.org/dev/setup Runs new database migrations for the development instance's database. ```bash RAILS_ENV=development bin/rails db:migrate ``` -------------------------------- ### Software Versions Dimension Example Source: https://docs.joinmastodon.org/entities/Admin_Dimension Lists the versions of software components used in the server stack. Each entry includes the software key, human-readable name, version value, and human-readable version. ```json { "key": "software_versions", "data": [ { "key": "mastodon", "human_key": "Mastodon", "value": "3.5.3", "human_value": "3.5.3" }, { "key": "ruby", "human_key": "Ruby", "value": "3.0.4p208", "human_value": "3.0.4p208" }, { "key": "postgresql", "human_key": "PostgreSQL", "value": "10.22", "human_value": "10.22" }, { "key": "redis", "human_key": "Redis", "value": "4.0.9", "human_value": "4.0.9" } ] } ```