Skip to main content
GET
Search content
No Authentication Required: This endpoint does NOT require authentication. Never include your API token when calling this endpoint, especially from client-side JavaScript, as this would expose your credentials to all users.
Using “Try It Out”: This endpoint requires a church-specific base URL. To test this endpoint:
  1. Click the server dropdown and select “Your church-specific Search API”
  2. Replace {churchShortname} with your actual church shortname
  3. Find your shortname in the Haystack Dashboard under DeveloperAPI
Example: If your Search API URL is https://gracechurch.thehaystack.ai/api, your shortname is gracechurch.

Response Format

The search endpoint supports two response formats:

Standard JSON Response (Default)

Fast, simple response with search results only. Best for most use cases.

Streaming Response with AI Overview (Advanced)

For an AI-generated overview of results, add ?stream=true to receive a Server-Sent Events stream. This feature is best suited for advanced integrations that need real-time AI summaries.
Event Types:
  • results: Search results (same structure as JSON response)
  • overview: Chunks of AI-generated summary as they’re generated
  • complete: Stream finished successfully
  • error: An error occurred
Example Implementations:
Popular SSE Libraries:
  • Python: sseclient-py, aiohttp-sse-client
  • PHP: mpociot/php-sse-client, artax/sse
  • Ruby: celluloid-eventsource, sse-client
  • Node.js: eventsource, built-in fetch with stream handling
  • Go: r3labs/sse, standard http package

Query Parameters

q
string
required

Natural-language search query

surface
enum<string>
required
Available options:
embed,
connect,
console
embedToken
string

Required when surface=embed

collectionId
integer

Scope search to a single collection

stream
boolean

When true, responds with Server-Sent Events streaming the AI overview as it is generated

overviewFormat
string

Format hint for the AI overview

Response

Search results. Returns JSON by default, or Server-Sent Events stream when stream=true.

query
string
queryAnalyticsId
string
items
object[]
scriptures
object[]
series
object[]
itemDescriptor
enum<string>

Descriptor inherited from the searched collection

Available options:
sermon,
message,
teaching,
episode