curl -X DELETE "https://api.hooked.so/v1/media/cm4x9s8u60009ab12kl56mn90" \
-H "x-api-key: your_api_key_here"
const mediaId = "cm4x9s8u60009ab12kl56mn90";
const response = await fetch(`https://api.hooked.so/v1/media/${mediaId}`, {
method: "DELETE",
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const result = await response.json();
console.log(response.status, result.message);
import os
import requests
media_id = "cm4x9s8u60009ab12kl56mn90"
response = requests.delete(
f"https://api.hooked.so/v1/media/{media_id}",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
print(response.status_code, response.json()["message"])
{
"success": true,
"message": "Media deleted",
"data": {
"mediaId": "cm4x9s8u60009ab12kl56mn90",
"deleted": true
}
}
{
"success": false,
"message": "Cannot delete: this media is currently used in the project \"Serum ad\""
}
{
"success": false,
"message": "Media not found"
}
Media library
Delete Media
Delete an image or video of your media library for good
DELETE
/
v1
/
media
/
{mediaId}
curl -X DELETE "https://api.hooked.so/v1/media/cm4x9s8u60009ab12kl56mn90" \
-H "x-api-key: your_api_key_here"
const mediaId = "cm4x9s8u60009ab12kl56mn90";
const response = await fetch(`https://api.hooked.so/v1/media/${mediaId}`, {
method: "DELETE",
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const result = await response.json();
console.log(response.status, result.message);
import os
import requests
media_id = "cm4x9s8u60009ab12kl56mn90"
response = requests.delete(
f"https://api.hooked.so/v1/media/{media_id}",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
print(response.status_code, response.json()["message"])
{
"success": true,
"message": "Media deleted",
"data": {
"mediaId": "cm4x9s8u60009ab12kl56mn90",
"deleted": true
}
}
{
"success": false,
"message": "Cannot delete: this media is currently used in the project \"Serum ad\""
}
{
"success": false,
"message": "Media not found"
}
Overview
Deletes one image or video of your media library.This cannot be undone. The media and its file are deleted. Projects already rendered are not affected, but the media can no longer be used in a new project.
- The media is deleted. Get Media answers
404for it from then on, and it leaves List Media. - The storage its file used is given back to your team.
- An import or upload that has not finished (
PENDINGorPROCESSING) can be deleted too: it stops, a file already sent is removed, and nothing is counted against your storage. - A media whose AI generation failed gives back the credits it was charged.
When it is refused
Nothing is deleted and the answer is409 while:
message | What to do |
|---|---|
Cannot delete: this media is currently used in the project "…" | The media is part of that project. Delete the project first (Delete Project), or keep the media. A FAILED media is never blocked. |
Media is still processing | A generation started in the dashboard is still making it. Wait until it is COMPLETED or FAILED. |
curl -X DELETE "https://api.hooked.so/v1/media/cm4x9s8u60009ab12kl56mn90" \
-H "x-api-key: your_api_key_here"
const mediaId = "cm4x9s8u60009ab12kl56mn90";
const response = await fetch(`https://api.hooked.so/v1/media/${mediaId}`, {
method: "DELETE",
headers: { "x-api-key": process.env.HOOKED_API_KEY },
});
const result = await response.json();
console.log(response.status, result.message);
import os
import requests
media_id = "cm4x9s8u60009ab12kl56mn90"
response = requests.delete(
f"https://api.hooked.so/v1/media/{media_id}",
headers={"x-api-key": os.environ["HOOKED_API_KEY"]},
)
print(response.status_code, response.json()["message"])
{
"success": true,
"message": "Media deleted",
"data": {
"mediaId": "cm4x9s8u60009ab12kl56mn90",
"deleted": true
}
}
{
"success": false,
"message": "Cannot delete: this media is currently used in the project \"Serum ad\""
}
{
"success": false,
"message": "Media not found"
}
Errors
| Status | When |
|---|---|
| 401 | Missing or invalid API key (code: "not_authenticated") |
| 403 | The team does not have the Hooked app product (code: "entitlement_required") |
| 404 | No such image or video in your library, including one already deleted. Another team’s media, or an id that is not one, answers the same Media not found |
| 409 | A project uses the media, or a dashboard generation is still making it. Nothing was deleted |
| 500 | Internal server error. Read the media before retrying: it may already be gone |