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
| Header | Value |
|---|---|
X-API-KEY | smm_your_key_here |
Authorization | Bearer sp_tok_your_token |
Request Body
Send a JSON body with the Content-Type: application/json header.
| Field | Type | Required | Description |
|---|---|---|---|
media_id | string | Yes | The 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
| Status | Code | Meaning |
|---|---|---|
400 Bad Request | 400 | media_id was not provided or is not a string. |
401 Unauthorized | 401 | No API key or token was provided. |
403 Forbidden | 403 | The API key or token is invalid or has been revoked. |
404 Not Found | 404 | No media file with the given media_id exists in your library. |
409 Conflict | 409 | The 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."
}