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
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token (Authorization: Bearer sp_...). Created in the dashboard under Account > Tokens. See authentication. |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| fileId | string | Yes | The file’s ID, as returned by list media. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
| note | string | No | The note text. An empty string clears it, and a cleared note is omitted on read. Max 200 bytes. |
| folderId | string or null | No | The 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
| Code | Meaning |
|---|---|
| 422 | Neither field was sent, note is too long, folderId is neither a folder ID nor null, or fileIds was sent (that belongs on PATCH /media) |
| 404 | No file with that ID in your workspace, or a well-formed folderId names no folder in it |