Using the REST API for Custom Integrations
Send logs from any language or system using the REST API.
When to Use the REST API
Use the REST API when:
- Your language doesn't have an official SDK
- You're integrating from a CI/CD pipeline or shell script
- You want fine-grained control over the HTTP request
- You're building a custom integration
Sending a Log
Terminal
curl -X POST $LOGNITOR_API_URL/ingest \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"batch_id": "batch-001",
"logs": [{
"level": "info",
"message": "Deployment complete",
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%S.000Z)'",
"service": "deploy-script"
}]
}'Required Fields
Only three fields are required per log entry:
level— debug, info, warn, error, fatalmessage— the log messagetimestamp— ISO 8601 format
Everything else (metadata, tags, user, request, error, etc.) is optional.
Batch Multiple Logs
Send up to 100 logs in a single request by adding more entries to the logs array. This reduces HTTP overhead.
Error Handling
| Status | Meaning |
|---|---|
| 200 | Logs accepted |
| 401 | Invalid API key |
| 422 | Validation error (check response body for details) |
| 429 | Rate limited (check Retry-After header) |
See the API Reference for complete endpoint documentation.