
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
strapi-plugin-media-library-handler
Advanced tools
Plugin for handling media library (dirs/files manipulation) through api in Strapi
Plugin for handling media library (dirs/files manipulation) through api in Strapi.
npm i strapi-plugin-media-library-handler
Plugin is compatible with Strapi 5.0.0
and above.
No additional configuration needed, the plugin is automatically enabled after installation.
Generate API Token (with proper permissions for Media section) which would be provided as Authorization
header to each API call.
Create a new folder.
POST {STRAPI_BASE_URL}/api/media/folders
Content-Type: application/json
Request Body
{
"name": "My New Folder",
"parentId": 123
}
Response (201)
{
"id": 456,
"name": "My New Folder",
"parent": null,
"createdAt": "2025-05-05T12:34:56.789Z",
...
}
Errors
400 Bad Request
– validation failed.500 Internal Server Error
– unexpected error.Retrieve folders, with optional search and sorting.
GET {STRAPI_BASE_URL}/api/media/folders?parentId=123&_q=term&sort=name:asc&sort=createdAt:desc
Query Parameters
parentId
(integer) — optional, filter by parent folder (omit or null for root)_q
(string) — optional, full-text search stringsort
(string) — optional, repeatable. Format: field:asc|desc
.Response (200)
[
{
"id": 123,
"name": "Root Folder",
"children": { "count": 2 },
"files": { "count": 5 },
...
}
]
Get a specific folder by its ID, including nested parents up to 5 levels.
GET {STRAPI_BASE_URL}/api/media/folders/:id
Path Parameter
id
(integer) — required, positive folder ID.Response (200)
{
"id": 123,
"name": "Nested Folder",
"parent": {
"id": 50,
"name": "Parent 1",
"parent": {
"id": 10,
"name": "Parent 2"
...
}
},
"children": { "count": 0 },
"files": { "count": 3 },
...
}
Errors
400 Bad Request
– invalid or missing ID.404 Not Found
– folder not found.Update an existing folder’s name and/or parent.
PUT {STRAPI_BASE_URL}/api/media/folders/:id
Content-Type: application/json
Path Parameter
id
(integer) — required.Request Body
{
"name": "Renamed Folder",
"parentId": 999
}
Response (200)
{
"id": 123,
"name": "Renamed Folder",
"parent": 999,
...
}
Errors
400 Bad Request
– validation failure.404 Not Found
– folder doesn’t exist.Delete a single folder.
DELETE {STRAPI_BASE_URL}/api/media/folders/:id
Path Parameter
id
(integer) — required.Response (200)
[
{
"id": 123,
"name": "Deleted Folder",
...
}
]
Delete multiple files and folders in one call.
POST {STRAPI_BASE_URL}/api/media/bulk-delete
Content-Type: application/json
Request Body
{
"fileIds": [1, 2, 3],
"folderIds": [10, 11, 12]
}
Response (200)
{
"deletedFiles": [ { ... } ],
"deletedFolders": [ { ... }]
}
Move multiple files and folders to a target folder.
POST {STRAPI_BASE_URL}/api/media/bulk-move
Content-Type: application/json
Request Body
{
"fileIds": [1, 2, 3],
"folderIds": [10, 11, 12],
"targetFolderId": 99
}
Response (200)
{
"movedFiles": [ { ... } ],
"movedFolders": [ { ... } ]
}
Retrieve the entire nested folder tree.
GET {STRAPI_BASE_URL}/api/media/folders-structure
Response (200)
[
{
"id": 1,
"name": "Root",
"children": [
{ "id": 2, "name": "Child A", "children": [ { ... } ] },
...
]
}
]
Upload a file to a folder.
POST {STRAPI_BASE_URL}/api/media/files
Content-Type: multipart/form-data
Form Data
file
(file) — required.folderId
(integer) — optional.alternativeText
(string) — optional.caption
(string) — optional.skipIfExist
(string) — optional, will skip if there is already file existing with same filename, caption and alternativeText (no matter the folderId).Response (200)
{
"data": [
{
"id": 321,
"name": "image.png",
"url": "/uploads/image.png",
"folder": 99,
...
}
]
}
Update file metadata (name, alt text, caption, or folder).
POST {STRAPI_BASE_URL}/api/media/files/:id
Content-Type: application/json
Path Parameter
id
(integer) — required.Request Body
{
"name": "newname.png",
"alternativeText": "An example",
"caption": "Caption text",
"folderId": 99
}
Response (200)
{
"data": {
"id": 321,
"name": "newname.png",
"alternativeText": "An example",
"caption": "Caption text",
"folder": 99,
...
}
}
Retrieve files, with optional search by name, caption or alternativeText, and sorting.
GET {STRAPI_BASE_URL}/api/media/files?name=some_term&sort=createdAt:desc
Query Parameters
name
(string) — optional, filter by filenamecaption
(string) — optional, filter by captionalternativeText
(string) — optional, filter by alternativeTextsort
(string) — optional, repeatable. Format: field:asc|desc
.Response (200)
[
{
"id": 42,
"name": "filename.png",
"alternativeText": "marketing_contributors_other_internal",
"caption": "some random caption",
"folder": {
"id": 159,
"name": "Base dir"
},
"createdAt": "2025-04-20T11:22:33.444Z",
...
},
]
Get file metadata (name, alt text, caption, folder, etc).
GET {STRAPI_BASE_URL}/api/media/files/:id
Path Parameter
id
(integer) — required.Response (200)
{
"data": {
"id": 321,
"name": "newname.png",
"alternativeText": "An example",
"caption": "Caption text",
"folder": 99,
"formats": {
...
}
...
}
}
Delete a single media file.
DELETE {STRAPI_BASE_URL}/api/media/files/:id
Path Parameter
id
(integer) — required.Response (200)
[
{
"id": 123,
"name": "Deleted File",
...
}
]
This project is licensed under the MIT.
FAQs
Plugin for handling media library (dirs/files manipulation) through api in Strapi
The npm package strapi-plugin-media-library-handler receives a total of 78 weekly downloads. As such, strapi-plugin-media-library-handler popularity was classified as not popular.
We found that strapi-plugin-media-library-handler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.