Mastodon
  • What is Mastodon?
  • Using Mastodon
    • Signing up for an account
    • Setting up your profile
    • Posting to your profile
    • Using the network features
    • Quoting other posts
    • Dealing with unwanted content
    • Promoting yourself and others
    • Set your preferences
    • More settings
    • Using Mastodon externally
    • Moving or leaving accounts
    • Official iOS and Android apps
    • Running your own server
  • Running Mastodon
    • Preparing your machine
    • Installing from source
    • Configuring your environment
    • Configuring full-text search
    • Installing optional features
      • Object storage
      • Onion services
      • Captcha
      • 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
    • Roles
  • Developing Mastodon apps
    • Getting started with the API
    • Playing with public data
    • Obtaining client app access
    • Logging in with an account
    • Libraries and implementations
    • Implementing quote posts
  • Contributing to Mastodon
    • Technical overview
    • Setting up a dev environment
    • Code structure
    • Routes
    • Security issues and responsible disclosure
  • Spec compliance
    • ActivityPub
    • WebFinger
    • Security
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime formats
    • Guidelines and best practices
    • OAuth Tokens
    • OAuth Scopes
    • Rate limits
  • API Methods
    • apps
      • oauth
      • emails
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • followed_tags
      • suggestions
      • tags
    • async_refreshes
    • profile
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • grouped notifications
    • notifications
      • push
    • search
    • health
    • instance
      • trends
      • directory
      • custom_emojis
      • announcements
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • proofs
    • oembed
  • API Entities
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • AsyncRefresh
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Quote
    • QuoteApproval
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • ShallowQuote
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

Experimental async refreshes API methods

Methods concerning async refreshes

    • Get Status of Async Refresh
    • See also
This page documents API endpoints that are not finalized. We plan to use this for several different use-cases but so far have only implemented one. We also do not yet use it in our mobile apps. As such, requirements might still change. We also welcome feedback from third-party developers. Once we declare this API as stable and move it, we will keep this endpoint around for one additional version, so consumers have time to migrate to the stable endpoint.

Get Status of Async Refresh

GET /api/v1_alpha/async_refreshes/:id HTTP/1.1

Sometimes an API request might not return the expected results or not all possible results as either a background job is already running to (re-)create these results or the request triggers a background job to create or fetch results.

Examples of this are timelines that need to be re-created (which takes some time) and search or other requests that trigger fetching additional results from remote servers in the background.

In all of these cases, the API response MAY include an additional header:

Mastodon-Async-Refresh: id="<string>", retry=<int>, result_count=<int>

The retry key includes a number of second the client SHOULD at least wait until retrying the same endpoint OR querying this one.

The key result_count is optional. If present it includes a number of results that have already been fetched as part of this ongoing async refresh.

Using the id, the client can query this endpoint here to get the current status of this async refresh.

The status of an async refresh is either running or finished. For some async refreshes, like a timeline re-generation, this information is sufficient to decide to either wait some more or refresh the timeline. Other kinds of async refreshes may optionally include a key result_count that includes a number of new results already generated or fetched. Depending on this number, the client can decide to refetch the resource, wait some more, or do nothing. I.e. a finished job with a result_count of 0 means that the job has finished but yielded nothing new. Refreshing is not necessary in this case.

Please note that the asynchronous nature of background jobs can lead to race conditions. Also the fact that some async refreshes might be user-agnostic while the fetched data is not, might mean that while new data is fetched, it will not be suitable for the current user. For example a background could be triggered to fetch new replies to a post. New replies could exist but the current usr might have blocked their authors.

For those reasons the AsyncRefresh can only ever serve as an indicator of when it could be worthwile for a client to request new data. In the general case there is no guarantee that new data will be served.

Returns: AsyncRefresh
OAuth: App token + read
Version history:
4.4.0 - added

Request

Headers

Authorization
required Provide this header with Bearer <app_token> to gain authorized access to this API method.

Response

200: OK

{
  "async_refresh": {
    "id": "ImNvbnRleHQ6MTEzNjQwNTczMzAzNzg1MTc4OnJlZnJlc2gi--c526259eb4a1f3ef0d4b91cf8c99bf501330a815",
    "status": "running",
    "result_count": 2
  }
}

404: Not found

{
  "error": "Not Found"
}

See also

app/controllers/api/v1_alpha/async_refreshes_controller.rb

Last updated October 17, 2025 · Improve this page

Sponsored by

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

Join Mastodon · Blog ·

View source · CC BY-SA 4.0 · Imprint