Skip to main content
DELETE
https://api.imperial.gay
/
images
/
:id
Delete Media
curl --request DELETE \
  --url https://api.imperial.gay/images/:id \
  --header 'Authorization: <authorization>'
{
  "message": "<string>"
}

Request

Headers

Authorization
string
required
Your API key in the format: Bearer imperial_live_xxxxxxxxxxxxx

Path Parameters

id
string
required
The unique identifier of the media to delete

Response

message
string
Confirmation message

Example Requests

curl -X DELETE https://api.imperial.gay/images/67d8f9a1b2c3d4e5f6789012 \
  -H "Authorization: Bearer imperial_live_xxxxxxxxxxxxx"

Example Response

{
  "message": "Image deleted successfully"
}

What Gets Deleted

When you delete media, the following are removed:
  • The media file from Cloudflare R2 storage
  • Video thumbnails (if applicable)
  • Database records associated with the upload
  • Storage quota is freed up for new uploads
Deletion is permanent and cannot be undone. The CDN URL will stop working immediately.

Operations Count

Deleting media counts as 1 operation towards your monthly limit. This ensures accurate tracking of all API activity.

Bulk Deletion

To delete multiple files, make separate DELETE requests for each item:
Node.js
const imageIds = [
  '67d8f9a1b2c3d4e5f6789012',
  '67d8f9a1b2c3d4e5f6789013',
  '67d8f9a1b2c3d4e5f6789014'
];

// Delete in parallel
await Promise.all(
  imageIds.map(id =>
    axios.delete(
      `https://api.imperial.gay/images/${id}`,
      {
        headers: {
          'Authorization': 'Bearer imperial_live_xxxxxxxxxxxxx'
        }
      }
    )
  )
);

Error Responses

Not Found

{
  "error": "Image not found",
  "statusCode": 404
}

Unauthorized

{
  "error": "Unauthorized",
  "statusCode": 401
}

Forbidden

If you try to delete media that doesn’t belong to you:
{
  "error": "You don't have permission to delete this image",
  "statusCode": 403
}

Storage Recovery

After deletion, your storage quota is immediately updated. You can verify this by checking your account statistics:
curl -X GET https://api.imperial.gay/stats/overview \
  -H "Authorization: Bearer imperial_live_xxxxxxxxxxxxx"

Best Practices

Storage Management: Regularly delete unused media to free up storage space for new uploads.
External Links: If you’ve shared CDN URLs externally (in websites, apps, etc.), deleting the media will break those links.
Dashboard: You can also delete media through the Dashboard interface with bulk selection support.