Skip to main content
PUT
/
blogs
/
{blog_id}
Update Blog
curl --request PUT \
  --url https://api.stru.ai/blogs/{blog_id} \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "<string>",
  "content": "<string>",
  "author": "<string>",
  "description": "<string>",
  "tags": [
    {}
  ],
  "thumbnail": "<string>",
  "slug": "<string>",
  "published": true
}'
{
  "404": {},
  "422": {},
  "500": {},
  "id": "<string>",
  "title": "<string>",
  "content": "<string>",
  "author": {},
  "description": {},
  "tags": [
    {}
  ],
  "thumbnail": {},
  "slug": "<string>",
  "published": true,
  "created_at": "<string>",
  "updated_at": "<string>"
}

Overview

Update an existing blog post by its UUID. Supports partial updates - only include fields you want to change.
Partial Updates: You don’t need to send all fields. Only include the fields you want to update.

Path Parameters

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

Request Body

All fields are optional - include only what you want to update.
title
string
New blog title (1-500 characters)
"title": "Updated Blog Title"
content
string
Updated blog content in markdown (minimum 1 character)
"content": "# Updated Content\n\nNew content here..."
author
string
Updated author name
"author": "Jane Doe"
description
string
Updated description
"description": "Updated description text"
tags
array
Updated tags array (replaces existing tags)
"tags": ["python", "automation", "advanced"]
thumbnail
string
Updated thumbnail URL
"thumbnail": "https://example.com/new-thumb.jpg"
slug
string
Updated URL-friendly slug
"slug": "updated-blog-slug"
published
boolean
Updated publication status
"published": true

Response

Returns the updated blog post object with new updated_at timestamp.
id
string
Blog post UUID (unchanged)
title
string
Updated or existing title
content
string
Updated or existing content
author
string | null
Updated or existing author
description
string | null
Updated or existing description
tags
array
Updated or existing tags
thumbnail
string | null
Updated or existing thumbnail
slug
string
Updated or existing slug
published
boolean
Updated or existing publication status
created_at
string
Original creation timestamp (unchanged)
updated_at
string
New update timestamp (auto-updated)

Example Requests

# Update just the title
curl -X PUT https://api.stru.ai/blogs/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Advanced SAP2000 API Tutorial"
  }'

Example Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "title": "Advanced SAP2000 API Tutorial",
  "content": "# Introduction\n\nThis tutorial covers...",
  "author": "Jane Smith",
  "description": "A comprehensive guide to SAP2000 automation",
  "tags": ["sap2000", "api", "automation", "advanced"],
  "thumbnail": "https://example.com/sap2000-thumb.jpg",
  "slug": "getting-started-with-sap2000-api",
  "published": true,
  "created_at": "2025-10-11T10:30:00.000000",
  "updated_at": "2025-10-11T11:45:00.000000"
}
Status Code: 200 OKNote: updated_at is automatically updated to the current timestamp.

Error Responses

404
Not Found
Blog post not found
{
  "detail": "Blog not found"
}
422
Validation Error
Validation error (invalid field values)
{
  "detail": [
    {
      "loc": ["body", "title"],
      "msg": "ensure this value has at most 500 characters",
      "type": "value_error.any_str.max_length"
    }
  ]
}
500
Internal Server Error
Server error occurred
{
  "detail": "Failed to update blog: [error message]"
}

Common Update Workflows

Change a draft to published status.
PUT /blogs/{blog_id}
{
  "published": true
}
Update blog content while keeping other fields unchanged.
PUT /blogs/{blog_id}
{
  "content": "# Updated Content\n\nNew information..."
}
Replace existing tags with new ones.
PUT /blogs/{blog_id}
{
  "tags": ["python", "automation", "advanced"]
}
Update title, description, and slug for better SEO.
PUT /blogs/{blog_id}
{
  "title": "Best ETABS Tutorial 2025",
  "description": "Complete guide to ETABS automation",
  "slug": "best-etabs-tutorial-2025"
}

Best Practices

Partial updates - Only send fields you’re changing to reduce payload size and avoid accidental overwrites.
Validate before updating - Check field constraints (title length, content presence) client-side.
Handle 404 errors - Always check if the blog exists before attempting updates.
Track updated_at - Use updated_at to detect conflicts in concurrent editing scenarios.
Draft → Review → Publish workflow: Create with published: false, update content, then update to published: true.
Tags replacement: The tags field replaces all existing tags. To add a tag, include all existing tags plus the new one.