Skip to content

Media

POST/api/v2/media

Upload media

Mastodon compatible User token Scope write

Body parameters

filefilerequired

descriptionstring

filter_namestring

filter_classstring

replace_idstring

Returns

curl -X POST "https://pixelfed.social/api/v2/media" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@pier.jpg" \
  -F "description=Wooden pier at sunset, two people fishing at the far end"
Response
{
  "id": "728341067224219648",
  "type": "image",
  "url": null,
  "remote_url": null,
  "preview_url": "https://pixelfed.social/storage/m/_v2/2/pier.jpg?v=1757871611",
  "optimized_url": null,
  "text_url": null,
  "meta": null,
  "description": "Wooden pier at sunset, two people fishing at the far end",
  "license": null,
  "is_nsfw": false,
  "orientation": null,
  "filter_name": null,
  "filter_class": null,
  "mime": "image/jpeg",
  "blurhash": "U4Rfzst8?bt7ogayj[j[~pfQ9Goe%Mj[WBay"
}
POST/api/v1/media

Upload media (v1)

Mastodon compatible User token Scope write

Body parameters

filefilerequired

descriptionstring

filter_namestring

filter_classstring

Returns

curl -X POST "https://pixelfed.social/api/v1/media" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@pier.jpg" \
  -F "description=Wooden pier at sunset, two people fishing at the far end"
Response
{
  "id": "728341067224219648",
  "type": "image",
  "url": "https://pixelfed.social/storage/m/_v2/2/pier.jpg?v=1757871611",
  "remote_url": null,
  "preview_url": "https://pixelfed.social/storage/m/_v2/2/pier.jpg?v=1757871611",
  "text_url": null,
  "meta": null,
  "description": "Wooden pier at sunset, two people fishing at the far end",
  "mime": "image/jpeg",
  "blurhash": "U4Rfzst8?bt7ogayj[j[~pfQ9Goe%Mj[WBay"
}
GET/api/v1/media/{id}

Get an upload

Mastodon compatible User token Scope read

Path parameters

idstringrequired

Returns

curl "https://pixelfed.social/api/v1/media/728341067224219648" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN"
Response
{
  "id": "728341067224219648",
  "type": "image",
  "url": "https://pixelfed.social/storage/m/_v2/2/pier.jpg",
  "remote_url": null,
  "preview_url": "https://pixelfed.social/storage/m/_v2/2/pier_thumb.jpg",
  "text_url": null,
  "description": "Wooden pier at sunset, two people fishing at the far end",
  "mime": "image/jpeg",
  "blurhash": "UJF}Qo~W9aIV4.xuRjWB00WB-pof",
  "meta": {
    "focus": {
      "x": 0,
      "y": 0
    },
    "original": {
      "width": 1080,
      "height": 1350,
      "size": "1080x1350",
      "aspect": 0.8
    }
  }
}
PUT/api/v1/media/{id}

Update alt text

Mastodon compatible User token Scope write

Path parameters

idstringrequired

Body parameters

descriptionstring

Returns

curl -X PUT "https://pixelfed.social/api/v1/media/728341067224219648" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Wooden pier at sunset, two people fishing off the far end"
  }'
Response
{
  "id": "728341067224219648",
  "type": "image",
  "url": "https://pixelfed.social/storage/m/_v2/2/pier.jpg",
  "preview_url": "https://pixelfed.social/storage/m/_v2/2/pier_thumb.jpg",
  "description": "Wooden pier at sunset, two people fishing off the far end",
  "mime": "image/jpeg",
  "blurhash": "UJF}Qo~W9aIV4.xuRjWB00WB-pof"
}
Pixelfed is free and open source software. Edit this page Report a docs issue