You want to export your Mastodon profile fields — the custom text labels and values you set under your profile settings — so you can back them up or reuse them on another instance. Mastodon does not offer a one-click export for profile fields in the web interface. However, you can retrieve them programmatically using your account API token and a simple API call. This article explains how to generate the token, call the correct endpoint, and save the fields as a structured JSON file.
Key Takeaways: Export Profile Fields With the Mastodon API
- Preferences > Development > New Application: Create an app to generate a personal API access token for your account.
- curl GET /api/v1/accounts/verify_credentials: The endpoint that returns your full profile, including all custom fields.
- jq or a text editor: Tools to extract and save the “fields” array from the JSON response into a file.
Understanding the Mastodon API and Profile Fields
Profile fields are custom key-value pairs you add to your Mastodon profile — for example, “Website” with a URL or “Pronouns” with text. Each field has a name, a value, and a verified_at timestamp if the value has been verified. The Mastodon API exposes these fields in the fields array of the Account object when you call the verify_credentials endpoint.
To access this data, you need an API access token with the read:accounts scope. This token is tied to your Mastodon account and allows the API to return your own profile data. You generate the token through the Mastodon web interface by creating a new application in the developer settings. The token is a long alphanumeric string that you pass in the Authorization header of your API request.
The API response is in JSON format. It includes not only profile fields but also your display name, bio, avatar URL, header image, follower count, and other metadata. For the export, you only need the fields array, but saving the entire profile object gives you a complete backup.
Steps to Export Profile Fields Using the API Token
- Log in to your Mastodon instance
Open your Mastodon instance in a web browser. Sign in with your account credentials. Ensure you are on the instance where you want to export profile fields — for example,mastodon.socialor your own domain. - Navigate to Preferences > Development
Click the gear icon in the top-right menu bar to open Preferences. In the left sidebar, click Development. This page lists any existing applications and lets you create new ones. - Create a new application
Click the New Application button. A form appears. Enter a name for the application — for example, “Profile Export Tool”. The name is only for your reference and does not affect functionality. - Set the required API scope
In the Scopes section, you need at minimum theread:accountsscope. Uncheck all other scopes unless you plan to use the token for other purposes. Click Submit to create the application. - Copy the access token
After submission, the page shows the application details. Locate the field labeled Your access token. Click the copy icon or select the token string and copy it to your clipboard. Store this token securely — treat it like a password. - Open a terminal or command prompt
On Windows, open Command Prompt or PowerShell. On macOS or Linux, open Terminal. Ensurecurlis installed. Most systems include curl by default. If not, install it from your package manager or from curl.se. - Call the verify_credentials endpoint
Run the following curl command, replacingYOUR_INSTANCEwith your instance domain (for example,mastodon.social) andYOUR_TOKENwith the token you copied:curl -H "Authorization: Bearer YOUR_TOKEN" https://YOUR_INSTANCE/api/v1/accounts/verify_credentialsPress Enter. The API returns a JSON object containing your full profile.
- Save the response to a file
To save the output to a file, redirect the response with the>operator. For example:curl -H "Authorization: Bearer YOUR_TOKEN" https://YOUR_INSTANCE/api/v1/accounts/verify_credentials > profile.jsonThis creates a file named
profile.jsonin the current directory. Open it with any text editor to view the data. - Extract the fields array
Openprofile.jsonin a text editor or usejqto filter only the fields. If you have jq installed, run:jq '.fields' profile.json > fields.jsonThis creates a new file
fields.jsoncontaining only the profile fields array. Each field object includesname,value, andverified_at.
Common Mistakes and Limitations When Exporting Profile Fields
API token scope is missing read:accounts
If your token does not include the read:accounts scope, the API returns a 403 Forbidden error. To fix this, delete the application in Preferences > Development and create a new one with the correct scope. Alternatively, edit the existing application — Mastodon allows scope changes on saved applications.
Using the wrong instance URL in the API call
The API endpoint must match the instance where you created the token. If you generated the token on mastodon.social but call mastodon.online, the request fails with a 401 Unauthorized or 404 Not Found. Always verify the instance domain in your browser address bar.
Token exposed in scripts or version control
Never hardcode your token in scripts that you commit to a public repository. Use environment variables or a configuration file excluded from version control. If your token is leaked, revoke it immediately by deleting the application in Preferences > Development.
Profile fields with HTML are exported as raw HTML
Mastodon profile fields support a subset of HTML tags like and . When exported, these tags appear as raw HTML in the value field. If you plan to import the fields into another service, you may need to strip or convert the HTML tags manually.
Mastodon Profile Export Methods: API vs Web Interface
| Item | API Token Export | Web Interface Export |
|---|---|---|
| Data returned | Full profile JSON including fields, bio, avatar, counts | CSV of followers, following, lists, blocks, mutes (no profile fields) |
| Profile fields included | Yes, in the fields array | No — the CSV export does not include profile fields |
| Setup required | Create an application and generate a token | None — available in Settings > Import and Export |
| Technical skill needed | Basic command-line knowledge (curl) | None — point and click |
| Automation possible | Yes — scriptable with cron or scheduled tasks | No — manual download each time |
The API method is the only way to export profile fields as structured data. The web interface export does not include custom fields at all. For a complete account backup, use both methods: the API for profile fields and the web interface for followers and lists.
After you export the fields array, you can import it into a new Mastodon account by calling the PATCH /api/v1/accounts/update_credentials endpoint with the fields data. This requires a separate token with the write:accounts scope. Combine both methods to fully migrate your profile fields between instances.