Skip to main content

Overview

This guide will walk you through making your first API calls to Haystack. You’ll learn how to authenticate, retrieve content, and perform a search.
1

Get Your API Credentials

Haystack provides two APIs. Get the credentials you need from the Haystack Dashboard:For the Private API (content management, analytics):
  1. Navigate to DeveloperAPI
  2. In the Private API section, click New key
  3. Enter a name (e.g., “Development Server”) and click Submit
  4. Copy and save your API key securely (you won’t see it again!)
For the Search API (public search, no authentication):
  1. Navigate to DeveloperAPI
  2. In the Search API section, find your Search API Base URL
  3. Click Copy to copy your church-specific URL
Keep your Private API key secure. Never use it in frontend code or commit it to version control.
2

Set Up Your Environment

Store your credentials as environment variables:
Or create a .env file:
.env
3

Make Your First Request

Let’s retrieve your collections to verify authentication is working:
Expected Response:
4

Search Your Content

Now let’s perform a search query to find content:
No Authentication Required: The search endpoint uses your church-specific Search API URL and does not require authentication. It’s safe to call from public websites.
Want AI-generated search overviews? Add &stream=true to receive a streaming response with an AI summary of results. See the Search endpoint documentation for details.
Expected Response:
5

Create Content

Let’s create a new item in your library:
Expected Response:

Error Handling

Always check for errors in API responses. The API uses standard HTTP status codes:
Common HTTP status codes:
  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid or missing token)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found
  • 500 - Internal Server Error

Next Steps

Congratulations! You’ve made your first API calls to Haystack. Here’s what to explore next:

Content Model

Learn about items, collections, series, and how they relate

Media Management

Upload and manage video and audio files

Search & Discovery

Deep dive into semantic search capabilities

API Reference

Explore the complete API documentation