Update a media file

Update one media file’s note, the folder it sits in, or both. Files cannot be renamed, though folders can. To apply the same change to many files at once, use update several media files.

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

Requires the media scope.

Usage

curl -X PATCH "https://sitepaste.com/api/v1/public/media/abc123.jpg" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "note": "Hero shot, edited", "folderId": "f8qjx2v7mz4r" }'

Authorizations

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

Path parameters

ParameterTypeRequiredDescription
fileIdstringYesThe file’s ID, as returned by list media.

Body

FieldTypeRequiredDescription
notestringNoThe note text. An empty string clears it, and a cleared note is omitted on read. Max 200 bytes.
folderIdstring or nullNoThe folder to move the file into. null unfiles it. Omit the field to leave its folder alone.

Send at least one of the two.

Response

200 OK with the updated file record, in the same shape GET /media/{fileId} returns it.

Errors

CodeMeaning
422Neither field was sent, note is too long, folderId is neither a folder ID nor null, or fileIds was sent (that belongs on PATCH /media)
404No file with that ID in your workspace, or a well-formed folderId names no folder in it