Skip to main content

Delete Media

Permanently delete a media file from your SchedPilot library. This action cannot be undone.

Endpoint

DELETE https://api.schedpilot.com/developers/v1/media/delete

Authentication

HeaderValue
X-API-KEYsmm_your_key_here
AuthorizationBearer sp_tok_your_token

Request Body

Send a JSON body with the Content-Type: application/json header.

FieldTypeRequiredDescription
media_idstringYesThe ID of the media file to delete, as returned by Upload Media or Media Library.

Example Request

curl -X DELETE "https://api.schedpilot.com/developers/v1/media/delete" \
-H "X-API-KEY: smm_your_key_here" \
-H "Content-Type: application/json" \
-d '{"media_id": "image-42"}'

Response

HTTP 200 OK

{
"message": "Media deleted successfully."
}

Constraints

Cannot delete media attached to a scheduled post

If the media file is currently referenced by one or more scheduled posts, the request will be rejected with a 409 Conflict response. Remove or reschedule those posts first, then retry the deletion.

Error Responses

StatusCodeMeaning
400 Bad Request400media_id was not provided or is not a string.
401 Unauthorized401No API key or token was provided.
403 Forbidden403The API key or token is invalid or has been revoked.
404 Not Found404No media file with the given media_id exists in your library.
409 Conflict409The file is attached to one or more scheduled posts and cannot be deleted yet.

Example 409 response

{
"code": 409,
"message": "Cannot delete media that is currently attached to a scheduled post."
}