Skip to main content

GET /api/search

Search across multiple collections including services, events, resources, news, photos, jobs, and documentation.

Query Parameters

string
required
Search query string (minimum 2 characters)
string
Comma-separated list of collections to search.Default: services,events,resources,news,photos,jobs,docsAvailable collections:
  • services
  • events
  • resources
  • news
  • photos
  • jobs
  • docs
number
Maximum number of results per collectionDefault: 10

Response Format

string
required
Status of the API response (“success” or “error”)
string
required
The original search query
number
required
Total number of results across all collections
object
required
Search results organized by collectionEach collection key (e.g., “services”, “events”) contains an array of result objects:
string
Unique identifier/slug for the item
string
Item title or name
string
Item description
string
Item category
string
Collection name
string
Relative URL to the item
string
URL to item image or logo
Whether the item is featured
boolean
Whether the results were served from cache
number
Age of cached results in milliseconds (only present if cached: true)

Caching

Search results are cached for 5 minutes to improve performance. Cache headers are included in responses:
  • X-Cache: “HIT” (cached) or “MISS” (fresh query)
  • Cache-Control: public, max-age=300 (5 minutes)

Error Responses

string
“error”
string
Error message description
string
Detailed error information
Status Codes:
  • 200 - Success
  • 400 - Bad request (query too short or invalid)
  • 429 - Rate limit exceeded (60 requests per minute)
  • 500 - Internal server error

Rate Limiting

All API endpoints are rate-limited to 60 requests per minute per IP address. Rate limit headers are included in responses:
  • X-RateLimit-Limit: Maximum requests per window
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Timestamp when the rate limit resets
  • Retry-After: Seconds to wait before retrying (only on 429 responses)

Example Request

Search all collections:
Search specific collections:

Example Response

Example Cached Response

Implementation Details

The Search API implementation includes:
  • Query Parsing: Searches across common fields (title, name, description, category, tags) - src/pages/api/search.ts:154
  • Result Caching: 5-minute TTL with max 100 cached queries - src/pages/api/search.ts:14
  • Cache Key Generation: Based on query + collections + limit - src/pages/api/search.ts:24
  • Automatic Cleanup: Expired cache entries removed every 10 minutes - src/pages/api/search.ts:81
Source code: src/pages/api/search.ts:92