Skip to content

REST API ​

All endpoints use the MEDIAFLOW_ROUTE_PREFIX (default mediaflow), the web middleware (session and CSRF) and access control. From JavaScript, send X-CSRF-TOKEN and Accept: application/json. Route names start with mediaflow., e.g. route('mediaflow.upload').

js
const headers = {
  Accept: 'application/json',
  'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
}

Uploads ​

MethodEndpointNameParametersResponse
POST/uploaduploadfile (required), folder or folder_id (ID, name or path like blog/covers), collection, visibility (public/private), thumbnails (bool){ success, media }
GET/status/{id}status—status, is_ready, error_message, url
GET/csrf-tokencsrf-token—A fresh CSRF token for long-lived pages. Public.

The media object contains id, uuid, name, original_name, extension, mime_type, size_bytes, human_size, url, thumbnail_url, status, is_image, is_video, is_audio, is_document, width, height and folder_id.

Errors return { success: false, error } with a 4xx status.

js
const body = new FormData()
body.append('file', fileInput.files[0])
body.append('folder', 'blog/covers')

const { media } = await fetch('/mediaflow/upload', { method: 'POST', headers, body }).then((r) => r.json())

Media ​

MethodEndpointNameParametersDescription
GET/managermanagerfolder_id, search, type (image, video, document), collection, sort (created_at, original_name, size_bytes), order (asc/desc), pageHTML page, or JSON with folders, media, breadcrumbs and pagination for JSON/AJAX requests. 24 items per page.
GET/media/{id}media.show—One media item with its variants.
PATCH/media/{id}media.updatename, folder_idRename (display name only) and/or move.
DELETE/media/{id}media.destroy—Soft-delete the record and remove the original and variant files.
POST/media/{id}/optimizemedia.optimizeformat (webp, jpeg, jpg, png), quality (30–100), width/max_width, height/max_height (20–8000), action (replace/copy)Re-encode or resize. Returns metrics and media. See Image Optimization.
POST/media/bulkmedia.bulkaction (delete/move), ids[] (max 500), target_folder_idBulk delete or move.

Folders ​

MethodEndpointNameParametersDescription
GET/foldersfolders.indexparent_idChild folders with media and child counts.
POST/foldersfolders.storename, parent_idCreate a folder. Names are unique per parent.
PATCH/folders/{id}folders.updatename, parent_idRename or move. Descendant paths are updated; moving into its own subtree is rejected.
DELETE/folders/{id}folders.destroy—Delete a folder. Its files and subfolders move up to the parent.

Settings ​

MethodEndpointNameDescription
GET/settingssettingsSettings page, or JSON settings (secrets masked) and the provider list. /settings-page is an alias.
POST/settingssettings.updateSave settings. See accepted keys. Unknown keys are ignored; invalid values return 422.
POST/settings/resetsettings.resetDelete all saved settings.
POST/settings/test-providersettings.test-providerTest cloud credentials. See Cloud Providers.
GET/settings/providerssettings.providersMetadata for the ten provider presets.

Diagnostics ​

MethodEndpointNameDescription
GET/diagnosticsdiagnostics.viewDiagnostics page.
GET/diagnostics/infodiagnostics.infoPHP and Laravel versions, GD/Imagick/WebP support, S3 driver status and active storage config.
POST/diagnostics/testdiagnostics.testWrite/read/delete probe on disk, which must be defined in config/filesystems.php.

Pages and delivery ​

MethodEndpointNameDescription
GET/ and /managermanagerMedia manager page.
GET/pipelinepipelineUpload pipeline visualizer.
GET/docs and /documentationdocs, docs.aliasIn-app documentation. Public.
GET/delivery/{media}delivery.streamSigned streaming of private files. Public; requires a valid signature. Accepts variant.

Assets ​

EndpointNameDescription
/vendor/mediaflow/css/mediaflow.css, /vendor/mediaflow/js/mediaflow.js, /vendor/mediaflow/img/{file}mediaflow.asset.*Fallback asset routes, used until you publish the assets. Not prefixed.
/mediaflow/assets/css, /assets/js, /assets/img/{file}mediaflow.assets.*Prefixed aliases of the same files.

Released under the MIT License.