Custom Files

Get a file or directory in Custom directory

Get a file or directory under /usr/cdrouter-data/custom/. Returns a list of entries when the path is a directory, or a single entry when it is a file.

GET /api/v1/system/custom/files

URL Parameters

Name Description
path string (required) Path relative to /usr/cdrouter-data/custom/

Response 200 OK

Directory listing:

{
    "timestamp": "2026-05-12T10:57:16.995087401-04:00",
    "data": [
        {
            "name": "scripts",
            "path": "/scripts",
            "size": 6,
            "modified": "2026-05-11T16:40:11.901253455-04:00",
            "is_dir": true
        },
        {
            "name": "setup.sh",
            "path": "/setup.sh",
            "size": 1234,
            "modified": "2026-05-11T16:40:10.908449946-04:00",
            "is_dir": false
        }
    ]
}

File summary:

{
    "timestamp": "2026-05-12T11:05:07.044322567-04:00",
    "data": {
        "name": "setup.sh",
        "path": "/setup.sh",
        "size": 1234,
        "modified": "2026-05-11T16:40:10.908449946-04:00",
        "is_dir": false
    }
}

Download a file from Custom directory

Download a file from /usr/cdrouter-data/custom/.

GET /api/v1/system/custom/files/download

URL Parameters

Name Description
path string (required) Path to the file relative to /usr/cdrouter-data/custom/

Response 200 OK

Content-Type: application/x-shellscript
Content-Disposition: attachment; filename*=UTF-8''setup.sh

Upload a file to Custom directory

Upload a file to a directory under /usr/cdrouter-data/custom/. The filename is taken from the uploaded file. Fails if a file with the same name already exists.

POST /api/v1/system/custom/files/upload

URL Parameters

Name Description
path string (required) Directory to upload into, relative to /usr/cdrouter-data/custom/

Example

Request must have a Content-Type header of multipart/form-data. The request body must have a form key named file whose contents is the file to upload.

POST /api/v1/system/custom/files/upload?path=/
Content-Type: multipart/form-data; boundary=----CBacgHmUVPwTniJL

----CBacgHmUVPwTniJL
Content-Disposition: form-data; name="file"; filename="setup.sh"
Content-Type: application/x-shellscript


<file contents...>
----CBacgHmUVPwTniJL--

Response 200 OK

{
    "timestamp": "2026-05-12T11:05:07.044322567-04:00",
    "data": {
        "name": "setup.sh",
        "path": "/setup.sh",
        "size": 1234,
        "modified": "2026-05-11T16:40:10.908449946-04:00",
        "is_dir": false
    }
}

Create a directory in Custom directory

Create a new directory under /usr/cdrouter-data/custom/. The parent directory must already exist.

POST /api/v1/system/custom/files/mkdir

URL Parameters

Name Description
path string (required) Path of the new directory, relative to /usr/cdrouter-data/custom/

Response 200 OK

{
    "timestamp": "2026-05-12T11:05:07.044322567-04:00",
    "data": {
        "name": "scripts",
        "path": "/scripts",
        "size": 6,
        "modified": "2026-05-11T16:40:11.901253455-04:00",
        "is_dir": true
    }
}

Rename a file or directory in Custom directory

Rename a file or directory under /usr/cdrouter-data/custom/. The file or directory is kept in the same parent directory. Fails if the new name already exists.

POST /api/v1/system/custom/files/rename

URL Parameters

Name Description
path string (required) Path of the file or directory to rename, relative to /usr/cdrouter-data/custom/
name string (required) New filename (plain name only — no path separators allowed)

Response 200 OK

{
    "timestamp": "2026-05-12T11:05:07.044322567-04:00",
    "data": {
        "name": "renamed.sh",
        "path": "/renamed.sh",
        "size": 1234,
        "modified": "2026-05-11T16:40:10.908449946-04:00",
        "is_dir": false
    }
}

Delete a file or directory in Custom directory

Delete a file or directory from /usr/cdrouter-data/custom/. Non-empty directories require recursive=true.

POST /api/v1/system/custom/files/delete

URL Parameters

Name Description
path string (required) Path of the file or directory to delete, relative to /usr/cdrouter-data/custom/
recursive boolean (optional) If true, delete non-empty directories recursively Default: false

Response 204 No Content