Overview
The Haystack API uses Bearer token authentication to secure API requests. Most API endpoints require a valid authentication token in theAuthorization header.
Two Types of API Access
Haystack provides two separate APIs for different use cases:Search API (Public, No Authentication)
- Purpose: Search your content library from anywhere, including public websites
- Authentication: None required
- Base URL:
https://{your-church-shortname}.thehaystack.ai/api - Use from: Frontend JavaScript, mobile apps, any public-facing application
Private API (Authenticated)
- Purpose: Manage your library, access analytics, update settings
- Authentication: API key required (Bearer token)
- Base URL:
https://api.thehaystack.ai/v2/bevly - Use from: Backend servers only (never from frontend code)
Getting Your Search API Base URL
The Search API base URL is specific to your organization:- Log in to your Haystack Dashboard
- Navigate to Developer → API
- Find your Search API Base URL in the Search API section
- Click Copy to copy the URL to your clipboard
The Search API does not require authentication. You can use it directly from frontend JavaScript without exposing any credentials.
Getting Your Private API Token
To create a Private API token for authenticated requests:- Log in to your Haystack Dashboard
- Navigate to Developer → API
- In the Private API section, click New key
- Enter a descriptive name for your key (e.g., “Production Server”)
- Choose whether to enable Admin privileges (only if needed for user/billing management)
- Click Submit
- Important: Copy your API key immediately - you won’t be able to see it again!
Making Authenticated Requests (Private API)
For Private API endpoints, include your API token in theAuthorization header using the Bearer authentication scheme:
Example Private API Request
Example Search API Request (No Authentication)
Which API Should I Use?
Choose the appropriate API based on where your code runs:| Scenario | API to Use | Base URL | Authentication |
|---|---|---|---|
| Search from website | Search API | https://{your-shortname}.thehaystack.ai/api | None |
| Search from mobile app | Search API | https://{your-shortname}.thehaystack.ai/api | None |
| Manage content from backend | Private API | https://api.thehaystack.ai/v2/bevly | API Key required |
| Upload media from backend | Private API | https://api.thehaystack.ai/v2/bevly | API Key required |
| Access analytics from backend | Private API | https://api.thehaystack.ai/v2/bevly | API Key required |
Authentication Errors
The API returns specific error responses for authentication issues:401 Unauthorized
Returned when your API token is missing, invalid, or expired.Authorization header.
403 Forbidden
Returned when your token is valid but you don’t have permission to access the requested resource.Next Steps
Now that you understand authentication, you’re ready to make your first API call:Quickstart Guide
Follow our quickstart tutorial to make your first authenticated API request

