Media DELETE
Delete a media file from your Datasquirel media storage using the API.Overview
Use the Media DELETE endpoint to permanently remove a file from your media storage. Provide the file's database ID to identify which file to delete.
npm Package
import datasquirel from "@moduletrace/datasquirel"; const result = await datasquirel.media.delete({ mediaID: 23, apiKey: process.env.DATASQUIREL_API_KEY, }); console.log(result.success); // true
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mediaID | string | number | Yes | The database ID of the file to delete |
apiKey | string | No | API key. Falls back to DATASQUIREL_API_KEY |
REST API
DELETE /api/v1/media/{id}
Headers:
Authorization: Bearer YOUR_API_KEY
Response
{ "success": true, "payload": { "id": 23 } }
Notes
- A Full Access API key is required. Read-only keys cannot delete files.
- Deletion is permanent. The file and its thumbnail are both removed from storage.
- Use the Media GET endpoint to look up a file's ID before deleting.