Authentication
The Dzaleka Online Services API is currently a public API and does not require authentication keys or tokens.All endpoints are publicly accessible without API keys. Rate limiting is applied based on IP address.
Future Authentication
While the API is currently public, future versions may introduce optional API keys for:- Higher rate limits
- Access to advanced features
- Usage analytics
- Priority support
Any future authentication changes will be announced with ample notice and backward compatibility.
CORS Configuration
The API is configured to accept requests from any origin, making it easy to use in web applications.CORS Headers
All API responses include the following CORS headers fromsrc/utils/api-utils.ts:4-10:
What This Means
Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
Requests are accepted from any domain. You can call the API from:
- Frontend JavaScript applications
- Mobile apps
- Server-side applications
- Command-line tools
Access-Control-Allow-Methods
Access-Control-Allow-Methods
The API supports three HTTP methods:
GET- Fetch data from collectionsPOST- Fetch data with additional optionsOPTIONS- CORS preflight requests
Access-Control-Allow-Headers
Access-Control-Allow-Headers
Only the
Content-Type header is required for POST requests with JSON payloads.Required Headers
GET Requests
No special headers required:POST Requests
IncludeContent-Type: application/json when sending JSON data:
OPTIONS Requests
OPTIONS requests are handled automatically by browsers for CORS preflight. The server responds with a204 No Content status and appropriate CORS headers.
Client IP Detection
For rate limiting purposes, the API detects your client IP from various headers to support different proxy configurations (seesrc/utils/api-utils.ts:24-29):
x-forwarded-for(standard proxy header)x-real-ip(nginx)cf-connecting-ip(Cloudflare)- Direct connection IP
Usage Examples
JavaScript (Fetch API)
JavaScript (Axios)
Python (requests)
cURL
CORS in Different Environments
Browser Applications
Browsers automatically handle CORS preflight requests. No special configuration needed:Node.js Applications
Node.js doesn’t enforce CORS, so requests work without additional configuration:Mobile Applications
Mobile apps (React Native, Flutter, etc.) typically don’t have CORS restrictions:Security Considerations
Best Practices
- Don’t abuse the open CORS policy - Use the API responsibly
- Implement client-side rate limiting - Don’t wait for 429 errors
- Cache responses - Reduce unnecessary API calls
- Handle errors gracefully - Always check response status
- Monitor your usage - Track API calls in your application
Troubleshooting
Common CORS Issues
CORS Error in Browser Console
CORS Error in Browser Console
If you see CORS errors despite the permissive configuration:
- Ensure you’re using HTTPS in production
- Check that your request method is GET, POST, or OPTIONS
- Verify the Content-Type header is set correctly for POST requests
Preflight Request Failing
Preflight Request Failing
OPTIONS requests should return 204. If failing:
- Check network connectivity
- Verify the endpoint URL is correct
- Ensure no proxy is blocking OPTIONS requests
Rate Limit on Shared IP
Rate Limit on Shared IP