Deleting media
Remove a file from the library. A file a post still uses stays.
DELETE
https://antwork.io/api/v1/media/{id}ScopemediaRequest
curl -X DELETE https://antwork.io/api/v1/media/med_... \
-H "Authorization: Bearer $ANTWORK_API_KEY"Removes the library record; the stored file is kept, as in the web app. Needs the media scope.
Response
200 OK
{ "object": "media_deleted", "id": "med_...", "deleted": true }409 Conflict
{
"error": {
"type": "invalid_request_error",
"code": "media_in_use",
"message": "launch.mp4 is attached to 1 post(s). Remove it from them first, then delete it."
},
"usedInPosts": [
{ "id": "pQ7x...", "status": "scheduled", "scheduledFor": "2026-11-01T09:00:00.000Z" }
]
}A file still attached to a post answers 409 with media_in_use and lists the posts in usedInPosts. Remove it from them first, so a cleanup script cannot break a scheduled post.
A file that does not exist or is in a workspace you do not own answers
404 with media_not_found.