Search API
The Search API provides full-text search across blog posts, services, portfolio projects, and case studies powered by Sanity's GROQ queries.
Endpoint
GET /api/search?q={query}&locale={locale}
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
q | string | Yes | — | Search query (min 2 characters) |
locale | string | No | ua | Content locale (ua, en, ru) |
Response
{
"posts": [
{
"_id": "post-123",
"title": "Building AI Chatbots with RAG",
"slug": "building-ai-chatbots-rag",
"summary": "A guide to retrieval-augmented generation...",
"publishedAt": "2025-12-15"
}
],
"services": [
{
"_id": "service-1",
"name": "AI Integration",
"slug": "ai-integration",
"shortDescription": "Custom AI solutions..."
}
],
"portfolios": [],
"caseStudies": []
}
Result Categories
The API searches across four content types simultaneously:
- Posts — Blog articles matching title or summary
- Services — Service pages matching name or description
- Portfolios — Project pages matching name, description, or industry
- Case Studies — Case study pages matching title, summary, client, or industry
Frontend Integration
The search is accessible via the Cmd+K / Ctrl+K keyboard shortcut on the website, which opens the SearchModal component.