Skip to main content
GET
/
blogs
/
slug
/
{slug}
Get Blog by Slug
curl --request GET \
  --url https://api.stru.ai/blogs/slug/{slug}
{
  "404": {},
  "500": {},
  "id": "<string>",
  "title": "<string>",
  "content": "<string>",
  "author": {},
  "description": {},
  "tags": [
    {}
  ],
  "thumbnail": {},
  "slug": "<string>",
  "published": true,
  "created_at": "<string>",
  "updated_at": "<string>"
}

Overview

Retrieve a specific blog post using its URL-friendly slug. This is the recommended method for public-facing blog pages as it provides clean, SEO-friendly URLs.
Preferred for public URLs: Use slugs like /blog/etabs-python-tutorial instead of UUIDs like /blog/ec94c8ac-44a2-4093-acce-548905684ddf

Path Parameters

slug
string
required
URL-friendly slug (lowercase with hyphens)
etabs-python-api-tutorial

Response

Returns a single blog post object.
id
string
Unique blog post UUID
title
string
Blog post title
content
string
Full markdown content
author
string | null
Author name
description
string | null
Short description/excerpt
tags
array
Array of tag strings
thumbnail
string | null
Thumbnail image URL
slug
string
URL-friendly slug
published
boolean
Publication status
created_at
string
ISO 8601 creation timestamp
updated_at
string
ISO 8601 last update timestamp

Example Requests

curl https://api.stru.ai/blogs/slug/etabs-python-api-tutorial

Example Response

{
  "id": "ec94c8ac-44a2-4093-acce-548905684ddf",
  "title": "ETABS Python API Tutorial",
  "content": "# Introduction\n\nThis comprehensive tutorial will teach you how to automate ETABS using Python...\n\n## Getting Started\n\nFirst, install the required packages:\n\n```bash\npip install comtypes\n```\n\n## Connecting to ETABS\n\n...",
  "author": "John Doe",
  "description": "Learn how to automate ETABS with Python",
  "tags": ["python", "etabs", "automation"],
  "thumbnail": "https://example.com/thumb.jpg",
  "slug": "etabs-python-api-tutorial",
  "published": true,
  "created_at": "2025-10-11T01:48:25.067567",
  "updated_at": "2025-10-11T01:48:25.067567"
}
Status Code: 200 OK

Error Responses

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

Slug Format

Slugs are URL-friendly identifiers with these characteristics:
Lowercase - All characters are lowercase
Hyphens - Words separated by hyphens (not underscores)
No special characters - Only letters, numbers, and hyphens
Unique - Each slug is unique across all blog posts

Auto-generation Examples

TitleGenerated Slug
”ETABS Python Tutorial”etabs-python-tutorial
”Getting Started with SAP2000 API”getting-started-with-sap2000-api
”Top 10 Tips!”top-10-tips
”My Blog” (duplicate)my-blog-2

Use Cases

Use slugs for all public-facing blog URLs for better SEO and user experience.
Good: https://yourblog.com/blog/etabs-python-tutorial
Bad:  https://yourblog.com/blog/ec94c8ac-44a2-4093-acce-548905684ddf
Slugs make shared links more readable and clickable on social media.
Twitter: "Check out this tutorial! yourblog.com/blog/etabs-python-tutorial"
Search engines use slugs in ranking. Descriptive slugs improve SEO.
Google sees: "/blog/sap2000-automation-guide"
understands: Content about SAP2000 automation
Even if the blog title changes, the slug remains stable for permalinks.
# Title changed from "ETABS Tutorial" to "ETABS Advanced Tutorial"
# But slug stays: "etabs-tutorial"
# Old links still work!

Best Practices

Always use slugs for public URLs - Provide better UX and SEO than UUIDs
Cache blog content - Blog posts don’t change frequently. Cache for 5-10 minutes.
Handle 404 gracefully - Show a “Blog not found” page with suggestions for similar content.
Validate slug format - Ensure slugs match the expected format (lowercase, hyphens) before requests.
Store both the id and slug in your database. Use slug for public URLs and id for internal operations.
Slugs are case-sensitive in the API. Always use lowercase slugs as returned by the API.