File Manager API

Version 1.0

POST

/api/upload

Upload a single file

Parameters

{input_name}
Required. File to upload (max: 10MB). The input name will be used as subfolder
path
Required. Subdirectory path for the file

Headers

X-API-Key
Required. Project API key

Example

Request:

curl -X POST http://your-app.test/api/upload \
                        -H "X-API-Key: your-project-api-key" \
                        -F "avatar=@image.jpg" \
                        -F "path=users"

Response:

{
    "message": "File uploaded successfully",
    "file": {
        "original_name": "image.jpg",
        "name": "1683900000_64789abc12345.jpg",
        "path": "project-name/users/avatar/1683900000_64789abc12345.jpg",
        "full_url": "http://your-app.test/storage/project-name/users/avatar/1683900000_64789abc12345.jpg"
    }
}
POST

/api/upload-multiple

Upload multiple files

Parameters

{input_name}[]
Required. Array of files to upload (max: 10MB each). The input name will be used as subfolder
path
Optional. Subdirectory path for the files

Headers

X-API-Key
Required. Project API key

Example

Request:

curl -X POST http://your-app.test/api/upload-multiple \
                        -H "X-API-Key: your-project-api-key" \
                        -F "documents[]=@doc1.pdf" \
                        -F "documents[]=@doc2.pdf" \
                        -F "path=contracts"

Response:

{
    "message": "Files uploaded successfully",
    "files": [
        {
            "original_name": "doc1.pdf",
            "name": "1683900000_64789abc12345.pdf",
            "path": "project-name/contracts/documents/1683900000_64789abc12345.pdf",
            "full_url": "http://your-app.test/storage/project-name/contracts/documents/1683900000_64789abc12345.pdf"
        }
    ]
}
POST

/api/upload-multiple-compressed

Upload multiple files with image compression

Parameters

{input_name}[]
Required. Array of files to upload (max: 10MB each). The input name will be used as subfolder
path
Optional. Subdirectory path for the files
quality
Optional. Image compression quality (1-100, default: 80)
max_width
Optional. Maximum image width in pixels (min: 100, default: 2000)
max_height
Optional. Maximum image height in pixels (min: 100, default: 2000)

Headers

X-API-Key
Required. Project API key

Example

Request:

curl -X POST http://your-app.test/api/upload-multiple-compressed \
                        -H "X-API-Key: your-project-api-key" \
                        -F "photos[]=@photo1.jpg" \
                        -F "photos[]=@photo2.png" \
                        -F "path=gallery" \
                        -F "quality=75" \
                        -F "max_width=1600" \
                        -F "max_height=1600"

Response:

{
    "message": "Files processed successfully",
    "compressed_files": [
        {
            "original_name": "photo1.jpg",
            "path": "project-name/gallery/photos/1683900000_64789abc12345.jpg",
            "full_url": "http://your-app.test/storage/project-name/gallery/photos/1683900000_64789abc12345.jpg",
            "compressed": true,
            "dimensions": {
                "width": 1600,
                "height": 1200
            }
        }
    ]
}
DELETE

/api/files

Delete a file using either full URL or relative path

Parameters

path
Required. Either the full URL or relative path to the file

Headers

X-API-Key
Required. Project API key

Examples

Delete using relative path

curl -X DELETE http://your-app.test/api/files \
                            -H "X-API-Key: your-project-api-key" \
                            -H "Content-Type: application/json" \
                            -d '{"path": "project-name/users/avatar/file.jpg"}'

Delete using full URL

curl -X DELETE http://your-app.test/api/files \
                            -H "X-API-Key: your-project-api-key" \
                            -H "Content-Type: application/json" \
                            -d '{"path": "http://your-app.test/storage/project-name/users/avatar/file.jpg"}'