Skip to main content
The Media API gives you programmatic access to the NodeForgeCMS media library — the centralised store for all images, documents, and binary files used across your site. You can list existing assets to build custom pickers or integrations, and upload new files directly from your application or CI pipeline. Uploaded files are stored on the server and their paths are returned immediately for use in article coverImage fields or any other content reference. All media endpoints require a valid Bearer token.

List Media Files

Returns a paginated list of all files in the media library. Requires a valid Bearer token.

Query Parameters

number
Page number to retrieve. Defaults to 1.
number
Number of items to return per page. Defaults to 10.

Response


Upload a File

Uploads a new file to the media library. Requires a valid Bearer token. The request must be sent as multipart/form-data with the binary file attached under the file field.

cURL Example

Request Body

file
required
The binary file to upload, sent as a multipart/form-data field named file. The filename and MIME type are inferred from the submitted file.

Response

Supported file types: JPEG (.jpg, .jpeg), PNG (.png), GIF (.gif), and WebP (.webp). Uploads of unsupported MIME types will be rejected with a 400 error. The default maximum file size is 10 MB per upload — contact your system administrator to adjust this limit in the server configuration. Large images are not automatically resized; optimise images before uploading for best front-end performance.

Delete a Media File

Permanently removes a file from the media library and deletes it from the server filesystem. Requires a valid Bearer token.

Path Parameters

number
required
The numeric ID of the media file to delete.

Response

Deleting a media file removes it from the filesystem immediately. Any articles or pages that reference the deleted file’s path will display broken images. Check all content referencing the file before deleting it.