Skip to main content

POST /api/folders

Creates a new folder in the photo frame collection. Requires admin authentication.
This is a protected endpoint. You must be logged in as admin to create folders.

Request

string
required
Full path for the new folder (relative to uploads directory)
string
required
Folder name (used for the final directory in the path)

Request Examples

Root Level Folder
Nested Folder

Response

Response Fields

string
Full path to the created/existing folder
string
Name of the folder
string
Path to the parent directory
string
ISO timestamp when folder was created
boolean
Whether the folder already existed before this request

Status Codes

Success
Folder created successfully or already exists
Bad Request
Invalid folder name or path format
Unauthorized
Admin authentication required
Server Error
File system error during folder creation

Folder Name Rules

Folder names cannot contain these characters: < > : " | ? * \
Valid Characters:
  • Letters (a-z, A-Z)
  • Numbers (0-9)
  • Spaces
  • Hyphens (-)
  • Underscores (_)
  • Periods (.)
Naming Guidelines:
  • Use descriptive names
  • Avoid very long names (keep under 100 characters)
  • Consider sorting (use dates, numbers for chronological order)

JavaScript Example

Nested Folder Creation

The API automatically creates parent directories if they don’t exist:

Best Practices

  • Organization: Use consistent naming schemes (dates, categories)
  • Hierarchy: Create logical folder structures (year/month, event/location)
  • Planning: Create folders before uploading related images
  • Validation: Check folder names before creation to avoid errors