How to Integrate AI Search Using the API
Step-by-step guide to integrate AI search functionality into your application using our API with Bearer token authentication.
Integration Steps
Step 1: Obtain Your API Token
Get your authentication credentials from your project dashboard.
- Navigate to your AI Search project dashboard
- Go to the 'API Tokens' section in your project settings
- Generate a new Bearer token for your project
- Copy and securely store your Bearer token
Step 2: Set Up Authentication Headers
Configure your HTTP requests with proper Bearer token authentication headers.
- Add the 'Authorization' header to all API requests
- Use the format: 'Authorization: Bearer YOUR_TOKEN'
- Replace 'YOUR_TOKEN' with your actual Bearer token from Step 1
- Ensure the Bearer token is kept secure and not exposed in client-side code
Step 3: Make Your First API Call
Send a test search query to verify your authentication setup.
- Use the '/search' endpoint for sending search queries
- Include required parameters: search_term, search_type ('keyword' or 'hybrid')
- Optionally include consumer_id for user-specific search tracking
- Send a POST request with your Bearer token authentication header
- Verify you receive a successful response with search results
Quick Start Example
A simple example of making an authenticated search API call:
curl -X POST "https://your-search-api-endpoint.com/search" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"search_term": "wireless headphones",
"search_type": "keyword",
"consumer_id": "user123"
}'
Important Security Notes
- Never expose your Bearer token in client-side code or public repositories
- Use environment variables or secure configuration for Bearer token storage
- Regenerate Bearer tokens if you suspect they have been compromised
- Each Bearer token is tied to a specific username and project
- Bearer tokens provide full access to your search service - treat them like passwords
Next Steps
After completing these steps, you can:
- Explore the detailed API reference in the 'API Integration' section
- Implement advanced search features like filters and facets
- Use hybrid search for semantic-keyword combined results
- Add consumer_id for user-specific search analytics