Skip to content

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/api

For local development:

http://localhost:5000/api

API Architecture ​

The Logstyx API uses an asynchronous processing model:

  1. Gateway Layer: Receives HTTP requests and performs initial validation
  2. Message Queue: Logs are pushed to RabbitMQ for reliable processing
  3. Consumer Layer: Processes logs asynchronously and performs authorization checks
  4. 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:

MethodEndpointDescription
POST/v1/logsSubmit 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.

json
{
  "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 ​

For most use cases, we recommend using our official SDKs:

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 ​

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 ​

Released under the MIT License.