API Overview
The Logstyx API provides a simple HTTP endpoint for sending logs from your applications to your Logstyx instance. This guide covers the core concepts and architecture of the API.
Base URL
When self-hosting Logstyx, your API base URL will be:
https://your-domain.com/apiFor local development:
http://localhost:5000/apiAPI Architecture
The Logstyx API uses an asynchronous processing model:
- Gateway Layer: Receives HTTP requests and performs initial validation
- Message Queue: Logs are pushed to RabbitMQ for reliable processing
- Consumer Layer: Processes logs asynchronously and performs authorization checks
- Storage: Logs are encrypted and stored in MongoDB
This architecture ensures high availability and allows the API to handle bursts of log traffic without blocking.
Available Endpoints
Currently, Logstyx provides one public endpoint:
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/logs | Submit log entries to your project |
Response Format
All API requests return a 200 OK status code, regardless of success or failure. This is by design to prevent client-side retry logic from overwhelming the system. The request is queued for processing, and authorization/validation occurs asynchronously.
{
"error": 200,
"message:"Success"
}Rate Limiting
The API implements rate limiting at the nginx level to protect the infrastructure:
- Rate: 20 requests per second per IP address
- Burst: Up to 50 requests can burst above the rate limit
- Behavior: Excess requests are rejected immediately (nodelay)
When rate limits are exceeded, you'll receive a 503 Service Unavailable or 429 Too Many Requests response.
Client Types
Logstyx supports three types of clients, each with different authentication mechanisms:
1. Browser Clients
For web applications running in browsers. Authentication is done via origin validation.
Use case: Frontend web applications, SPAs
2. Mobile Clients
For mobile applications (iOS, Android, React Native). Authentication uses an application ID.
Use case: Native mobile apps, React Native apps
3. Server Clients
For backend services and server-side applications. Authentication uses HMAC-SHA256 signature verification.
Use case: Node.js services, backend APIs, microservices
SDK vs Direct API Usage
Using the SDK (Recommended)
For most use cases, we recommend using our official SDKs:
- React: logstyx-js-react
- React Native: logstyx-js-react-native
- Node.js: logstyx-js-node
- Browser: logstyx-js-browser
- Express: logstyx-js-express
- Core SDK: logstyx-js-core
The SDKs handle authentication, payload formatting, and error handling automatically.
Direct API Usage
Use the API directly when:
- Building a custom SDK for a different language/platform
- Integrating with systems that can't use JavaScript
- You need fine-grained control over the logging implementation
- Building platform-specific integrations (Python, Go, Rust, etc.)
Next Steps
- Learn about Authentication methods
- Explore the Endpoints documentation
- Understand Error Handling
- Review example implementations in different languages
Security Considerations
- Always use HTTPS in production environments
- Keep your project secrets secure and never expose them in client-side code
- For browser clients, configure allowed origins in your project settings
- For mobile clients, use application IDs and configure them properly
- For server clients, implement signature generation correctly to prevent replay attacks
Getting Help
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions and share ideas
- Documentation: Main documentation site