Skip to content

Uploads an image for use in a post or comment, optionally resizing and converting it to WebP, and returns the media URL and key.

Accepts JPEG, PNG, GIF, WebP and HEIC by default, up to 100 MB, both adjustable by filter. Conversion to WebP happens unless disable_convert=yes is sent, and passing resize with max_width downscales oversized images first. The returned media_key is what identifies the upload when it is later attached to a post or comment.

Endpoint

  • Method: POST

  • Path: /feeds/media-upload

  • Edition: Core

  • Controller: FeedsController@handleMediaUpload

  • Route source: fluent-community/app/Http/Routes/api.php:46

  • Controller source: fluent-community/app/Http/Controllers/FeedsController.php

  • Requires a signed-in user; uploads are rate limited through the fluent_community/check_rate_limit/media_upload hook.

  • Uploaded media starts inactive and is deleted by the cleanup cron if it is never attached to anything.

  • HEIC uploads fail unless the server has Imagick built with HEIC support.

Reconstructed sample

This endpoint belongs to a module that is not active on the reference install (or needs a file upload), so the payload below was reconstructed by reading the controller rather than recorded. Field names and types follow the source; values are illustrative.

POST Post Handle Media Upload

POST
/feeds/media-upload

Uploads an image for use in a post or comment, optionally resizing and converting it to WebP, and returns the media URL and key.

Controller: FeedsController@handleMediaUpload
Route source: fluent-community/app/Http/Routes/api.php:46

Authorizations

ApplicationPasswords

WordPress Application Passwords — use Basic auth with username:application_password.

Type
API Key (header: Authorization)

Request Body

multipart/form-data
object
Format"binary"

Responses

Successful response

application/json
JSON
{
  
"media": {
  
  
"url": "string",
  
  
"media_key": "string",
  
  
"type": "string",
  
  
"width": 0,
  
  
"height": 0
  
}
}

Playground

Authorization
Body

Samples

Powered by VitePress OpenAPI