mattn/go-mastodon

mastodon client for golang

Go

648

564 commits

updated Jul 10, 2026

See the code

README

go-mastodon

Build Status Codecov Go Reference Go Report Card

Usage

There are three ways to authenticate users. Fully working examples can be found in the examples directory.

User Credentials

This method is the simplest and allows you to use an application registered in your account to interact with the Mastodon API on your behalf.

  • Create an application on Mastodon by navigating to: Preferences > Development > New Application
  • Select the necessary scopes

Working example: examples/user-credentials/main.go

Public Application

Public applications use application tokens and have limited access to the API, allowing access only to public data.

Learn more at: Mastodon docs

Working example: examples/public-application/main.go

Application with Client Credentials (OAuth)

This option allows you to create an application that can interact with the Mastodon API on behalf of a user. It registers the application and requests user authorization to obtain an access token.

Learn more at: Mastodon docs

Working example: examples/user-oauth-authorization/main.go

Status of implementations

  • GET /api/v1/accounts/:id
  • GET /api/v1/accounts/verify_credentials
  • PATCH /api/v1/accounts/update_credentials
  • GET /api/v1/accounts/:id/followers
  • GET /api/v1/accounts/:id/following
  • GET /api/v1/accounts/:id/statuses
  • POST /api/v1/accounts/:id/follow
  • POST /api/v1/accounts/:id/unfollow
  • GET /api/v1/accounts/:id/block
  • GET /api/v1/accounts/:id/unblock
  • GET /api/v1/accounts/:id/mute
  • GET /api/v1/accounts/:id/unmute
  • GET /api/v1/accounts/:id/lists
  • GET /api/v1/accounts/relationships
  • GET /api/v1/accounts/search
  • GET /api/v1/apps/verify_credentials
  • GET /api/v1/bookmarks
  • POST /api/v1/apps
  • GET /api/v1/blocks
  • GET /api/v1/conversations
  • DELETE /api/v1/conversations/:id
  • POST /api/v1/conversations/:id/read
  • GET /api/v1/favourites
  • GET /api/v1/filters
  • POST /api/v1/filters
  • GET /api/v1/filters/:id
  • PUT /api/v1/filters/:id
  • DELETE /api/v1/filters/:id
  • GET /api/v1/follow_requests
  • POST /api/v1/follow_requests/:id/authorize
  • POST /api/v1/follow_requests/:id/reject
  • GET /api/v1/followed_tags
  • POST /api/v1/follows
  • GET /api/v1/instance
  • GET /api/v1/instance/activity
  • GET /api/v1/instance/peers
  • GET /api/v1/lists
  • GET /api/v1/lists/:id/accounts
  • GET /api/v1/lists/:id
  • POST /api/v1/lists
  • PUT /api/v1/lists/:id
  • DELETE /api/v1/lists/:id
  • POST /api/v1/lists/:id/accounts
  • DELETE /api/v1/lists/:id/accounts
  • POST /api/v1/media
  • GET /api/v1/mutes
  • GET /api/v1/notifications
  • GET /api/v1/notifications/:id
  • POST /api/v1/notifications/:id/dismiss
  • POST /api/v1/notifications/clear
  • POST /api/v1/push/subscription
  • GET /api/v1/push/subscription
  • PUT /api/v1/push/subscription
  • DELETE /api/v1/push/subscription
  • GET /api/v1/reports
  • POST /api/v1/reports
  • GET /api/v2/search
  • GET /api/v1/statuses/:id
  • GET /api/v1/statuses/:id/context
  • GET /api/v1/statuses/:id/card
  • GET /api/v1/statuses/:id/history
  • GET /api/v1/statuses/:id/reblogged_by
  • GET /api/v1/statuses/:id/source
  • GET /api/v1/statuses/:id/favourited_by
  • POST /api/v1/statuses
  • PUT /api/v1/statuses/:id
  • DELETE /api/v1/statuses/:id
  • POST /api/v1/statuses/:id/reblog
  • POST /api/v1/statuses/:id/unreblog
  • POST /api/v1/statuses/:id/favourite
  • POST /api/v1/statuses/:id/unfavourite
  • POST /api/v1/statuses/:id/bookmark
  • POST /api/v1/statuses/:id/unbookmark
  • GET /api/v1/timelines/home
  • GET /api/v1/timelines/public
  • GET /api/v1/timelines/tag/:hashtag
  • GET /api/v1/timelines/list/:id
  • GET /api/v1/streaming/user
  • GET /api/v1/streaming/public
  • GET /api/v1/streaming/hashtag?tag=:hashtag
  • GET /api/v1/streaming/hashtag/local?tag=:hashtag
  • GET /api/v1/streaming/list?list=:list_id
  • GET /api/v1/streaming/direct
  • GET /api/v1/endorsements
  • GET /api/v1/tags/:hashtag
  • POST /api/v1/tags/:hashtag/follow
  • POST /api/v1/tags/:hashtag/unfollow

Installation

go install github.com/mattn/go-mastodon@latest

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

go
golang
mastodon

Project health

Overall

2.8/10

Maintained

0/10

Code review

0/10
OpenSSF Scorecard

Latest release

v0.0.13 · Jul 10, 2026

Releases this year

3

Significant stargazers

Jaana Dogan

13,360 followers · starred Nov 2022

Heath Stewart

209 followers · starred Dec 2022

Paul Tyng

216 followers · starred Nov 2022

Kris Nóva

3,614 followers · starred Jun 2022

mattn/go-mastodon

mastodon client for golang

Go

648

564 commits

updated Jul 10, 2026

See the code

README

go-mastodon

Build Status Codecov Go Reference Go Report Card

Usage

There are three ways to authenticate users. Fully working examples can be found in the examples directory.

User Credentials

This method is the simplest and allows you to use an application registered in your account to interact with the Mastodon API on your behalf.

  • Create an application on Mastodon by navigating to: Preferences > Development > New Application
  • Select the necessary scopes

Working example: examples/user-credentials/main.go

Public Application

Public applications use application tokens and have limited access to the API, allowing access only to public data.

Learn more at: Mastodon docs

Working example: examples/public-application/main.go

Application with Client Credentials (OAuth)

This option allows you to create an application that can interact with the Mastodon API on behalf of a user. It registers the application and requests user authorization to obtain an access token.

Learn more at: Mastodon docs

Working example: examples/user-oauth-authorization/main.go

Status of implementations

  • GET /api/v1/accounts/:id
  • GET /api/v1/accounts/verify_credentials
  • PATCH /api/v1/accounts/update_credentials
  • GET /api/v1/accounts/:id/followers
  • GET /api/v1/accounts/:id/following
  • GET /api/v1/accounts/:id/statuses
  • POST /api/v1/accounts/:id/follow
  • POST /api/v1/accounts/:id/unfollow
  • GET /api/v1/accounts/:id/block
  • GET /api/v1/accounts/:id/unblock
  • GET /api/v1/accounts/:id/mute
  • GET /api/v1/accounts/:id/unmute
  • GET /api/v1/accounts/:id/lists
  • GET /api/v1/accounts/relationships
  • GET /api/v1/accounts/search
  • GET /api/v1/apps/verify_credentials
  • GET /api/v1/bookmarks
  • POST /api/v1/apps
  • GET /api/v1/blocks
  • GET /api/v1/conversations
  • DELETE /api/v1/conversations/:id
  • POST /api/v1/conversations/:id/read
  • GET /api/v1/favourites
  • GET /api/v1/filters
  • POST /api/v1/filters
  • GET /api/v1/filters/:id
  • PUT /api/v1/filters/:id
  • DELETE /api/v1/filters/:id
  • GET /api/v1/follow_requests
  • POST /api/v1/follow_requests/:id/authorize
  • POST /api/v1/follow_requests/:id/reject
  • GET /api/v1/followed_tags
  • POST /api/v1/follows
  • GET /api/v1/instance
  • GET /api/v1/instance/activity
  • GET /api/v1/instance/peers
  • GET /api/v1/lists
  • GET /api/v1/lists/:id/accounts
  • GET /api/v1/lists/:id
  • POST /api/v1/lists
  • PUT /api/v1/lists/:id
  • DELETE /api/v1/lists/:id
  • POST /api/v1/lists/:id/accounts
  • DELETE /api/v1/lists/:id/accounts
  • POST /api/v1/media
  • GET /api/v1/mutes
  • GET /api/v1/notifications
  • GET /api/v1/notifications/:id
  • POST /api/v1/notifications/:id/dismiss
  • POST /api/v1/notifications/clear
  • POST /api/v1/push/subscription
  • GET /api/v1/push/subscription
  • PUT /api/v1/push/subscription
  • DELETE /api/v1/push/subscription
  • GET /api/v1/reports
  • POST /api/v1/reports
  • GET /api/v2/search
  • GET /api/v1/statuses/:id
  • GET /api/v1/statuses/:id/context
  • GET /api/v1/statuses/:id/card
  • GET /api/v1/statuses/:id/history
  • GET /api/v1/statuses/:id/reblogged_by
  • GET /api/v1/statuses/:id/source
  • GET /api/v1/statuses/:id/favourited_by
  • POST /api/v1/statuses
  • PUT /api/v1/statuses/:id
  • DELETE /api/v1/statuses/:id
  • POST /api/v1/statuses/:id/reblog
  • POST /api/v1/statuses/:id/unreblog
  • POST /api/v1/statuses/:id/favourite
  • POST /api/v1/statuses/:id/unfavourite
  • POST /api/v1/statuses/:id/bookmark
  • POST /api/v1/statuses/:id/unbookmark
  • GET /api/v1/timelines/home
  • GET /api/v1/timelines/public
  • GET /api/v1/timelines/tag/:hashtag
  • GET /api/v1/timelines/list/:id
  • GET /api/v1/streaming/user
  • GET /api/v1/streaming/public
  • GET /api/v1/streaming/hashtag?tag=:hashtag
  • GET /api/v1/streaming/hashtag/local?tag=:hashtag
  • GET /api/v1/streaming/list?list=:list_id
  • GET /api/v1/streaming/direct
  • GET /api/v1/endorsements
  • GET /api/v1/tags/:hashtag
  • POST /api/v1/tags/:hashtag/follow
  • POST /api/v1/tags/:hashtag/unfollow

Installation

go install github.com/mattn/go-mastodon@latest

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

go
golang
mastodon

Project health

Overall

2.8/10

Maintained

0/10

Code review

0/10
OpenSSF Scorecard

Latest release

v0.0.13 · Jul 10, 2026

Releases this year

3

Significant stargazers

Jaana Dogan

13,360 followers · starred Nov 2022

Heath Stewart

209 followers · starred Dec 2022

Paul Tyng

216 followers · starred Nov 2022

Kris Nóva

3,614 followers · starred Jun 2022