Authentication
Authentication
Section titled “Authentication”To use the Koral API, you’ll need to authenticate your requests. This guide explains how to obtain and use API keys for authentication.
API Keys
Section titled “API Keys”Koral uses a search id to authenticate requests. You can view and manage your search id in the Koral Dashboard.
Getting Your API Key
Section titled “Getting Your API Key”- Sign in to your Koral Dashboard
- Navigate to Settings > API Keys
- Create a new API key or use an existing one
- Copy your API key for use in your applications
Authentication Methods
Section titled “Authentication Methods”Search id
Section titled “Search id”Our endpoints require a search id to authenticate requests. You can pass the search id in the request header or as a body parameter.
GET /api/v1/search/imageAuthorization: Bearer <search_id>
The search id is a unique identifier for one of your feeds and is used to track usage and billing. It is also tied to a list of domains that you also manage in the dashboard.
Example Request 1
Section titled “Example Request 1”Here’s an example of how to authenticate a request to the Koral API using JavaScript:
// Using fetch with Bearer Token authenticationasync function searchImages(query) { const response = await fetch('https://api.koral.com/api/v1/search/image', { method: 'POST', headers: { 'Content-Type': 'application/json' 'Authorization': `Bearer <search_id>` }, body: JSON.stringify({ imageData: "<base64_encoded_image_data>", limit: 10, offset: 0, }) });
return await response.json();}
Example Request 2
Section titled “Example Request 2”// Using fetch with Bearer Token authenticationasync function searchImages(query) { const response = await fetch('https://api.koral.com/api/v1/search/image', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ imageData: "<base64_encoded_image_data>", limit: 10, offset: 0, searchId: "<customer feed id>" }) });
return await response.json();}
Rate Limiting
Section titled “Rate Limiting”API requests are subject to rate limiting based on your subscription plan. The current limits are:
Plan | Rate Limit |
---|---|
Free | 100 requests/hour |
Pro | 1,000 requests/hour |
Enterprise | Custom |
When you exceed your rate limit, the API will return a 429 Too Many Requests
response.
Next Steps
Section titled “Next Steps”- Explore the API Endpoints
- Learn how to handle API Errors
- See Examples of the API in use