
# Delete several media files

Delete the files named in the query. To delete a single file, [address it directly](/api/media/delete-media-fileid).

```sh
DELETE https://sitepaste.com/api/v1/public/media?fileIds=abc123.jpg,def456.png
```

Requires the `media` scope.

## Usage

```bash
curl -X DELETE "https://sitepaste.com/api/v1/public/media?fileIds=abc123.jpg,def456.png" \
  -H "Authorization: Bearer $TOKEN"
```

## Authorizations

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

## Query parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| fileIds | string | Yes | The files to delete, up to 100 distinct ids per request. Repeat the parameter (`?fileIds=a&fileIds=b`) or comma-join it (`?fileIds=a,b`); both work. A repeated id counts once. |

## Response

200 OK with the number of files deleted.

```json
{ "deleted": 2 }
```

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

## Errors

| Code | Meaning |
|------|---------|
| 422 | `fileIds` is missing, empty, or holds more than 100 distinct ids |