Mastodon
  • What is Mastodon?
  • Using Mastodon
    • Signing up for an account
    • Setting up your profile
    • Posting toots
    • Using the network features
    • Dealing with unwanted content
    • Promoting yourself and others
    • Set your preferences
    • More settings
    • Using Mastodon externally
    • Moving or leaving accounts
    • Running your own server
  • Running Mastodon
    • Preparing your machine
    • Installing from source
    • Configuring your environment
    • Installing optional features
      • Full-text search
      • Hidden services
      • Single Sign On
    • Setting up your new instance
    • Using the admin CLI
    • Upgrading to a new release
    • Backing up your server
    • Migrating to a new machine
    • Scaling up your server
    • Moderation actions
    • Troubleshooting errors
      • Database index corruption
  • Developing Mastodon apps
    • Getting started with the API
    • Playing with public data
    • Obtaining client app access
    • Logging in with an account
    • Guidelines and best practices
    • Libraries and implementations
  • Contributing to Mastodon
    • Technical overview
    • Setting up a dev environment
    • Code structure
    • Routes
    • Bug bounties and responsible disclosure
  • Spec compliance
    • ActivityPub
    • WebFinger
    • Security
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • OAuth Scopes
    • Rate limits
  • API Methods
    • apps
      • oauth
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • suggestions
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
    • admin
    • announcements
    • proofs
    • oembed
  • API Entities
    • Account
    • Activity
    • Admin::Account
    • Admin::Report
    • Announcement
    • AnnouncementReaction
    • Application
    • Attachment
    • Card
    • Context
    • Conversation
    • Emoji
    • Error
    • FeaturedTag
    • Field
    • Filter
    • History
    • IdentityProof
    • Instance
    • List
    • Marker
    • Mention
    • Notification
    • Poll
    • Preferences
    • PushSubscription
    • Relationship
    • Report
    • Results
    • ScheduledStatus
    • Source
    • Status
    • Tag
    • Token

Error

Represents an error message.

    • Example
    • Required attributes
    • Optional attributes
    • Possible reasons
    • See also

Example

{
  "error": "invalid_grant",
  "error_description": "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
}
The most important part of an error response is the HTTP status code. Standard semantics are followed. The body of an error is a JSON object containing more information, if available.

Required attributes

error

Description: The error message.
Type: String
Version history: Added in 0.6.0

Optional attributes

error_description

Description: A longer description of the error, mainly provided with the OAuth API.
Type: String
Version history: Added in 0.6.0

Possible reasons

401 - Unauthorized

require_authenticated_user!

Error: This API requires an authenticated user. Appears when the instance is in secure mode, which disables all public use of API methods.

403 - Forbidden

current_user.disabled?

Error: Your login is currently disabled. Appears when the OAuth token’s authorized user has had their account disabled by a moderator.

!current_user.confirmed?

Error: Your login is missing a confirmed e-mail address. Appears when the email address associated with the OAuth token’s authorized user’s account has not yet been confirmed.

!current_user.approved?

Error: Your login is currently pending approval. Appears when the OAuth token’s authorized user has signed up on an instance with approval-required registrations, and the user has not yet had their account approved by a moderator.

404 - Not Found

RecordNotFound

Error: Record not found. Appears when an entity record does not exist, or the authorized user is not within the audience of a private entity.operates on a user.

422 - Unprocessable Entity

RecordInvalid

Error: {string}. May appear when entity creation failed.

RecordNotUnique

Error: Duplicate record. Appears when you are trying to pin an account or status that is already pinned.

!current_user

Error: This method requires an authenticated user. Appears when using an OAuth token without an authorized user (or no token at all), while trying to call an API method that requires a user to be processed.

See also

app/controllers/api/base_controller.rb

Last updated January 12, 2020 · Improve this page

Sponsored by

Dotcom-Monitor LoadView Stephen Tures Swayable

Join Mastodon · Blog · ·

View source · CC BY-SA 4.0 · Imprint