Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Mastodon API Ruby Gem

Gem Version Build Status

A ruby interface for the Mastodon API.


gem 'mastodon-api', require: 'mastodon'


All the documentation is available on RubyDoc.


Assuming that you already have an access token for a user on a given Mastodon instance:

require 'mastodon'

client = '', bearer_token: 'your_access_token')

If you need to get an access token, you must first ensure that you have the client ID and client secret for your app on the given Mastodon instance (you should save those for future calls):

client.create_app('My Ruby App', '')

You can then use the client ID and secret in a standard OAuth 2 authorization flow.