Update a media folder

Rename a folder, set the order of the media inside it, or both.

PATCH https://sitepaste.com/api/v1/public/media/folders/{folderId}

Requires the media scope.

Usage

# Rename it
curl -X PATCH "https://sitepaste.com/api/v1/public/media/folders/f8qjx2v7mz4r" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Wedding Highlights" }'

# Reorder what is in it
curl -X PATCH "https://sitepaste.com/api/v1/public/media/folders/f8qjx2v7mz4r" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "order": ["abc123.jpg", "def456.png"] }'

Body

FieldTypeRequiredDescription
namestringNoThe folder’s new name, 1 to 100 characters.
orderarrayNoThe folder’s complete media list, first to last, by file id, up to 10000 ids.

order is the whole folder, not a patch of it: every file in the folder that the list omits has its manual position cleared and falls back to capture order. Send the folder’s full id list.

Send at least one of them. A body with neither is a 422. So is an empty order array, an empty id inside it, a duplicate id, or more than 10000 ids.

Response

200 OK with the folder record as it now stands, in the same shape GET /media/folders/{folderId} returns it. 409 if another folder already has the name, 400 if {folderId} is malformed, 404 if it is well formed but no folder in your workspace has that id.

Authorizations

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication.