Skip to main content
GET
/
blogs
/
search
Search Blogs
curl --request GET \
  --url https://api.stru.ai/blogs/search
{
  "400": {},
  "500": {},
  "blogs": [
    {}
  ],
  "total": 123,
  "page": 123,
  "limit": 123,
  "pages": 123,
  "query": "<string>"
}

Overview

Search for blog posts using full-text search across titles and content. Perfect for implementing search functionality in your blog application.

Query Parameters

q
string
required
Search query (minimum 1 character)
?q=ETABS
page
integer
default:"1"
Page number (must be ≥ 1)
?page=2
limit
integer
default:"20"
Items per page (1-100)
?limit=10
published_only
boolean
default:"true"
Show only published blogs (set to false to include drafts)
?published_only=false

Response

Returns search results with the query information.
blogs
array
Array of blog posts matching the search querySee BlogResponse for complete object schema
total
number
Total number of blogs matching the search
page
number
Current page number
limit
number
Items per page
pages
number
Total number of pages
query
string
The search query that was executed

Example Requests

# Search for "ETABS"
curl "https://api.stru.ai/blogs/search?q=ETABS"

Example Response

{
  "blogs": [
    {
      "id": "ec94c8ac-44a2-4093-acce-548905684ddf",
      "title": "ETABS Python API Tutorial",
      "content": "# Full markdown content...",
      "author": "John Doe",
      "description": "Learn how to automate ETABS...",
      "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"
    },
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "title": "ETABS Automation Best Practices",
      "content": "# Best Practices...",
      "author": "Jane Smith",
      "description": "Essential tips for ETABS automation",
      "tags": ["etabs", "best-practices", "automation"],
      "thumbnail": "https://example.com/etabs-bp.jpg",
      "slug": "etabs-automation-best-practices",
      "published": true,
      "created_at": "2025-10-09T14:20:00.000000",
      "updated_at": "2025-10-09T14:20:00.000000"
    }
  ],
  "total": 5,
  "page": 1,
  "limit": 20,
  "pages": 1,
  "query": "ETABS"
}
Status Code: 200 OK

Error Responses

400
Bad Request
Missing or invalid query parameter
{
  "detail": "Query parameter 'q' is required"
}
500
Internal Server Error
Search failed
{
  "detail": "Search failed: [error message]"
}

Search Features

Search is case-insensitive for better user experience.
# These return the same results
curl "https://api.stru.ai/blogs/search?q=ETABS"
curl "https://api.stru.ai/blogs/search?q=etabs"
Use spaces for multi-word searches. All words must match (AND logic).
# Finds blogs containing both "structural" AND "analysis"
curl "https://api.stru.ai/blogs/search?q=structural%20analysis"
Search results are paginated just like the list endpoint.
# Navigate through search results
curl "https://api.stru.ai/blogs/search?q=python&page=2&limit=10"

Best Practices

Implement debouncing - When building search UIs, debounce user input to avoid excessive API calls.
Show query in UI - Display the query field from the response to confirm what was searched.
Handle empty results - Check if total is 0 and show a “No results found” message.
Use pagination - For queries with many results, implement pagination controls.
For search-as-you-type functionality, set a minimum query length of 3 characters to reduce noise.
The search query parameter q is required. Requests without it will return a 400 error.