POST /api/ingest
Stream log data to the ingestion endpoint.
Example Request
curl -X POST https://guardian.azimuthpro.com/api/ingest \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/x-ndjson" \
-H "Content-Encoding: gzip" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
-H "X-Session-ID: my-session-123" \
--data-binary @logs.jsonl.gzRequest Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes* | Bearer token: Bearer <api-key> |
| X-API-Key | Yes* | Alternative to Authorization header |
| Content-Type | Recommended | application/json, application/x-ndjson, application/jsonl, text/plain, or application/octet-stream |
| Content-Encoding | Optional | gzip, br, or deflate for compressed payloads |
| Idempotency-Key | Optional | UUID v4 for request deduplication (24h window) |
| X-Session-ID | Optional | Custom session identifier for tracking |
*Either Authorization or X-API-Key must be provided
Successful Response (202 Accepted)
{
"status": "accepted",
"message": "Ingest pipeline running",
"traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"sessionId": "my-session-123"
}Response Headers
X-Request-ID: Unique request identifierX-Trace-ID: Trace ID for observabilityX-RateLimit-Limit: Maximum requests per minuteX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Unix timestamp when rate limit resets
Error Responses
401 Unauthorized
{
"error": "Missing authentication. Provide Authorization: Bearer <token> or x-api-key header",
"traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}403 Forbidden
{
"error": "Invalid API key",
"traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}413 Payload Too Large
{
"error": "Payload too large: 60000000 bytes (max: 52428800)",
"traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}429 Too Many Requests
{
"error": "Too many requests",
"traceId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"retryAfter": 45
}Response includes Retry-After header with seconds to wait before retrying
Data Formats
JSONL (Newline-Delimited JSON)
Each line is a valid JSON object:
{"timestamp": "2025-10-08T12:00:00Z", "level": "info", "message": "User logged in", "userId": 123}
{"timestamp": "2025-10-08T12:00:01Z", "level": "warn", "message": "High memory usage", "memoryMB": 1024}
{"timestamp": "2025-10-08T12:00:02Z", "level": "error", "message": "API timeout", "endpoint": "/api/users"}Plain Text
Any UTF-8 text stream:
2025-10-08 12:00:00 INFO User logged in
2025-10-08 12:00:01 WARN High memory usage: 1024MB
2025-10-08 12:00:02 ERROR API timeout on /api/usersCompression
The API supports automatic decompression of the following formats:
- gzip:
Content-Encoding: gzip - brotli:
Content-Encoding: br - deflate:
Content-Encoding: deflate
Example with gzip compression:
# Compress logs
gzip -c logs.jsonl > logs.jsonl.gz
# Send compressed logs
curl -X POST https://guardian.azimuthpro.com/api/ingest \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/x-ndjson" \
-H "Content-Encoding: gzip" \
--data-binary @logs.jsonl.gzRate Limits & Idempotency
Rate Limits
- Default: 120 requests per minute per API key
- Uses token bucket algorithm with Upstash Redis
- Rate limit headers included in all responses
- 429 responses include
Retry-Afterheader
Idempotency
Use the Idempotency-Key header to prevent duplicate processing:
curl -X POST https://guardian.azimuthpro.com/api/ingest \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
--data '{"message": "test log"}'- Idempotency keys must be UUID v4 format
- Duplicate requests (same key + API key) within 24 hours return cached response
- Cached responses include
X-Idempotent-Replay: trueheader
System Limits
| Limit | Default Value | Configurable |
|---|---|---|
| Max payload size | 50 MB | Yes (MAX_PAYLOAD_SIZE) |
| Max duration | 13.3 minutes (800s) | No (Vercel maximum) |
| Idle timeout | 30 seconds | No |
| Rate limit | 120 req/min | Yes (RATE_LIMIT_RPM) |
Security Features
✓HTTPS only (HSTS enforced)
✓API key authentication
✓Rate limiting per API key
✓Request size limits (50MB max)
✓Idle timeout (30s)
✓Content-Type validation
✓CORS configured for API routes
✓Security headers (CSP, X-Frame-Options)