Skip to content

feat: support new Profile API (Mastodon v4.6.0)#1413

Merged
neet merged 5 commits into
mainfrom
devin/1777441182-support-profile-api
Apr 30, 2026
Merged

feat: support new Profile API (Mastodon v4.6.0)#1413
neet merged 5 commits into
mainfrom
devin/1777441182-support-profile-api

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for the new Profile API introduced in Mastodon v4.6.0, as requested in #1412.

New entity

  • Profile (mastodon.v1.Profile) — represents the current user's profile with source values for all editable fields. Unlike Account, the note and fields contain raw unprocessed text (not HTML), and avatar/header are nullable (null when unset). Includes featuredTags, avatarDescription, headerDescription, and new display preferences (showMedia, showMediaReplies, showFeatured).

New methods on ProfileResource

Method HTTP Description
masto.v1.profile.fetch() GET /api/v1/profile Get the current user's profile
masto.v1.profile.update(params) PUT /api/v1/profile Update the current user's profile
masto.v1.profile.avatar.remove() DELETE /api/v1/profile/avatar (existing — return type corrected)
masto.v1.profile.header.remove() DELETE /api/v1/profile/header (existing — return type corrected)

Other changes

  • FeaturedTag: Added missing url field per the official docs.
  • ProfileAvatarResource / ProfileHeaderResource: Return type corrected from void to AccountCredentials to match the API response.
  • E2E tests: Added tests for profile.fetch(), profile.update() (display name and fields).
  • compose.yml: Updated docker image to neetshin/mastodon-dev:nightly for Profile API support.

Usage

// Fetch profile
const profile = await masto.v1.profile.fetch();

// Update profile
const updated = await masto.v1.profile.update({
  displayName: "New Name",
  note: "Updated bio",
  locked: true,
  showMedia: false,
  fieldsAttributes: [
    { name: "Website", value: "https://example.com" },
  ],
});

Closes #1412

Review & Testing Checklist for Human

  • Build and push neetshin/mastodon-dev:nightly from neetlab/docker-mastodon-dev (after merging the publish.yaml update — see notes below)
  • Verify the Profile entity fields match actual API responses from a Mastodon instance running main branch
  • Run E2E tests locally with the nightly docker image to verify profile fetch/update tests pass
  • Confirm the FeaturedTag.url addition doesn't break existing consumers (it's additive)

Notes

  • docker-mastodon-dev update needed: I couldn't push to neetlab/docker-mastodon-dev directly, but the required change is minimal — update publish.yaml to build from Mastodon's main branch instead of v4.5.3:
    -  MASTODON_VERSION: "4.5.3"
    +  MASTODON_VERSION: "nightly"
    +  MASTODON_REF: "main"
    and change ref: v${{ env.MASTODON_VERSION }}ref: ${{ env.MASTODON_REF }}. Both existing patches apply cleanly on main. I have this commit ready at /home/ubuntu/repos/docker-mastodon-dev if you'd like me to create a PR from a fork.
  • The Mastodon serializer also returns formatted_note and formatted_fields (HTML-rendered versions) not yet in official entity docs — can be added in a follow-up.
  • Size impact: none (rest: 3994, oauth: 3991 — identical to main).

Link to Devin session: https://app.devin.ai/sessions/75d862cffe5041f198449d81888f892b
Requested by: @neet

Add support for the Mastodon v4.6.0 Profile API:

- Add Profile entity type with all documented attributes
- Add fetch() and update() methods to ProfileResource
- Add UpdateProfileParams for PATCH /api/v1/profile
- Add PATCH dispatch handling for profile update
- Add multipart-form encoding for profile update (avatar/header uploads)
- Update ProfileAvatarResource/ProfileHeaderResource return types
  from void to AccountCredentials to match API docs
- Add missing url field to FeaturedTag entity

Closes #1412

Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
c5ff266_ " data-view-component="true" class="dropdown-item btn-link"> Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/masto@1413

commit: c5ff266

@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
rest 3.9 KB (0%)
streaming 3.86 KB (0%)
oauth 3.9 KB (0%)

devin-ai-integration Bot and others added 4 commits April 29, 2026 05:44
The new Profile API support adds ~10 bytes of runtime code to the
dispatcher hook (PATCH method + multipart-form encoding for
/api/v1/profile). Bump rest and oauth size limits from 4.0 to 4.1 kB.

Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
Rails routes both PUT and PATCH to the same update action, so the
PATCH override in dispatch() is unnecessary. This keeps the size
limits within the original 4.0 kB budget.

Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
…htly

- Remove unnecessary inferEncoding override for /api/v1/profile since
  Rails routes both PUT and PATCH to the same update action
- Add E2E tests for profile.fetch() and profile.update()
- Update compose.yml to use neetshin/mastodon-dev:nightly for Profile
  API support

Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
Update compose.yml to use neetshin/mastodon-dev:4.5.9.
Remove profile fetch/update E2E tests since the Profile API
(GET/PATCH /api/v1/profile) is not yet available in stable
Mastodon releases (planned for v4.6.0).

Co-Authored-By: Ryō Igarashi (五十嵐 涼) <n33t5hin@gmail.com>
@neet neet merged commit ac170ac into main Apr 30, 2026
8 of 9 checks passed
@neet neet deleted the devin/1777441182-support-profile-api branch April 30, 2026 00:11
@cheeaun

cheeaun commented May 3, 2026

Copy link
Copy Markdown

This seems to be missing handling for header and avatar which requires the profile update endpoint to be included here, if I'm not mistaken.

function inferEncoding(action: HttpActionType, path: string): Encoding {
if (
(action === "create" && path === "/api/v1/accounts") ||
(action === "update" && path === "/api/v1/accounts/update_credentials") ||
(action === "create" && path === "/api/v1/email") ||
(action === "create" && path === "/api/v1/featured_tag") ||
(action === "create" && path === "/api/v1/media") ||
(action === "create" && path === "/api/v2/media")
) {
return "multipart-form";
}

I can open another issue if needed 🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support new Profile API

2 participants