
# Update several media files

Apply the same change to several files in one request. The body carries the fields [update a media file](/api/media/patch-media-fileid) carries, and the query names the files to apply them to.

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

Requires the `media` scope.

## Usage

```bash
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

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| fileIds | string | Yes | The 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

| Header | Type | Required | Description |
|--------|------|----------|-------------|
| Authorization | string | Yes | Bearer token (`Authorization: Bearer sp_...`). Created in the dashboard under Account > Tokens. See [authentication](/api/authentication). |

## Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| folderId | string or null | No | The folder to move the files into. `null` unfiles them. Omit the field to leave their folders alone. |
| note | string | No | The 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.

```json
{ "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

| Code | Meaning |
|------|---------|
| 422 | `fileIds` 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 |
| 404 | A well-formed `folderId` names no folder in your workspace |