Pixelfed is a decentralized social network designed for sharing photos and images, offering an ethical and privacy-friendly alternative to platforms like Instagram. Based on the ActivityPub protocol, it allows users to create or join independent instances, while interacting with the federation as a whole. With an ad-free approach, total respect for personal data and familiar features such as albums, stories and interactions, Pixelfed offers a community experience focused on transparency and creativity.
After this presentation of the Pixelfed service, we’ll publish a post on the Pixelfed network with PHP.
Prerequisites
First of all, you need an account on a Pixelfed instance. In my case, I’m using the pixelfed.social
instance.
You also need a personal access token.
To do this
- Connect to your Pixelfed instance
- Click on your avatar in the top right-hand corner
- Click on “Profile
- Click on the “Edit profile” button
- Click on the “Applications” tab
- Click on the “Create New Token” link
- Define the application name: in our case, I’ll call it “PixelBot”.
- Check the
write
extents - Click on the “Create” button
- Retrieve your personal access token
Theory
Pixelfed uses (more or less) the same endpoints as Mastodon, whose documentation is available online.
In our case, we’ll use :
POST /api/v1/media
POST /api/v1/statuses
Implementation
We’ll be implementing PHP 8.4 with the Curl extension installed and enabled.
|
|
As you can see, uploading is a two-stage process: first, media upload, then post creation.
Conclusion
After simply executing the code, here’s how it looks:

After running the code, you’ll notice that
- the application name is not displayed
- emojis can also be easily used in the code.