Skip to main content
DELETE
/
blogs
/
{blog_id}
Delete Blog
curl --request DELETE \
  --url https://api.stru.ai/blogs/{blog_id}
{
  "404": {},
  "500": {}
}

Overview

Permanently delete a blog post by its UUID. This action is irreversible.
Permanent Deletion: This operation cannot be undone. Consider unpublishing (published: false) instead of deleting if you might need the content later.

Path Parameters

blog_id
string
required
Blog post UUID to delete
a1b2c3d4-e5f6-7890-abcd-ef1234567890

Response

Returns an empty response body on successful deletion.
Status Code: 204 No ContentThe response body is empty on success.

Example Requests

curl -X DELETE https://api.stru.ai/blogs/a1b2c3d4-e5f6-7890-abcd-ef1234567890

Success Response

HTTP/1.1 204 No Content
Empty response body. Check for status code 204 to confirm successful deletion.

Error Responses

404
Not Found
Blog post not found
{
  "detail": "Blog not found"
}
500
Internal Server Error
Server error occurred
{
  "detail": "Failed to delete blog: [error message]"
}

Alternatives to Deletion

Instead of deleting, consider unpublishing to preserve content.
# Unpublish (convert to draft)
curl -X PUT https://api.stru.ai/blogs/{blog_id} \
  -H "Content-Type: application/json" \
  -d '{"published": false}'
Benefits:
  • Content is preserved
  • Can be re-published later
  • Reversible action
Implement your own archive system instead of deleting.
# Instead of deleting, mark as archived in your database
def archive_blog(blog_id):
    # Update in your database
    db.update(blog_id, archived=True)

    # Unpublish from API
    requests.put(
        f"https://api.stru.ai/blogs/{blog_id}",
        json={"published": False}
    )
Use a soft delete flag in your application layer.
# Keep blog in API but mark as deleted in your DB
def soft_delete_blog(blog_id):
    # Mark as deleted in your database
    db.update(blog_id, deleted=True, deleted_at=now())

    # Optionally unpublish from API
    requests.put(
        f"https://api.stru.ai/blogs/{blog_id}",
        json={"published": False}
    )

Deletion Workflows

1

Fetch Blog Details

Before deleting, fetch the blog to show what will be deleted.
GET /blogs/{blog_id}
2

Confirm with User

Display blog details and ask for confirmation.
"Are you sure you want to delete:
Title: ETABS Tutorial
Author: John Doe
This action cannot be undone."
3

Delete Blog

Execute the delete request.
DELETE /blogs/{blog_id}
4

Update UI

Remove the blog from your UI and show confirmation.
"Blog successfully deleted"

Best Practices

Always confirm - Implement confirmation dialogs before deleting to prevent accidental deletions.
Fetch before delete - Show users what they’re deleting by fetching the blog first.
Consider alternatives - Evaluate if unpublishing or archiving is better than permanent deletion.
Log deletions - Keep audit logs of deleted blogs in your application for accountability.
Best practice: Implement a two-step delete process: first unpublish, then delete after a waiting period (e.g., 30 days).
Irreversible: Once deleted via the API, the blog post cannot be recovered. Ensure proper confirmation workflows.
Related URLs: If you’re using the slug in URLs, remember to handle 404s after deletion. Consider redirects or “content removed” pages.