Update several media files

Apply the same change to several files in one request. The body carries the fields update a media file carries, and the query names the files to apply them to.

PATCH https://sitepaste.com/api/v1/public/media?fileIds=a,b

Requires the media scope.

Usage

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

Query parameters

ParameterTypeRequiredDescription
fileIdsstringYesThe files to update, up to 100 distinct ids per request. Repeat the parameter or separate ids with commas: ?fileIds=a,b and ?fileIds=a&fileIds=b mean the same thing. A repeated id counts once.

Authorizations

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

Body

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

Send at least one of folderId and note.

Response

200 OK with the number of files updated.

{ "updated": 2 }

An id that matches no file in your workspace is skipped rather than failing the request, so updated can be lower than the number of ids you sent.

Errors

CodeMeaning
422fileIds is missing or empty in the query, more than 100 ids were sent, fileIds was sent in the body, neither folderId nor note was sent, folderId is neither a folder ID nor null, or note is too long
404A well-formed folderId names no folder in your workspace