The Hamsterlog HTTP API allows you to send logs from any programming language or platform. This guide shows you how to integrate directly with the API using simple HTTP requests.
All logs are sent to a single endpoint:
POST https://www.hamsterlog.dev/api/log
Content-Type: application/json
Send a JSON payload with your API key and an array of log entries:
{
"apiKey": "your-api-key-here",
"logs": [
{
"message": "User logged in successfully",
"tags": ["auth", "success"],
"timestamp": 1640995200000
},
{
"message": "API request processed",
"tags": ["api", "request"],
"timestamp": 1640995201000
}
]
}
For better performance, batch multiple logs in a single request:
{
"apiKey": "your-api-key-here",
"logs": [
{
"message": "User session started",
"tags": ["auth", "session"],
"timestamp": 1640995200000
},
{
"message": "Profile page loaded",
"tags": ["ui", "profile"],
"timestamp": 1640995201000
},
{
"message": "Settings updated",
"tags": ["user", "settings"],
"timestamp": 1640995202000
}
]
}
Status Code | Meaning | Description |
---|---|---|
200 | Success | Logs received and processed |
400 | Bad Request | Invalid JSON or missing required fields |
401 | Unauthorized | Invalid or missing API key |
429 | Rate Limit | Too many requests, slow down |
500 | Server Error | Internal server error, try again later |
Test your integration with a simple cURL command:
# Test with a simple log
curl -X POST https://www.hamsterlog.dev/api/log \
-H "Content-Type: application/json" \
-d '{
"apiKey": "your-api-key-here",
"logs": [
{
"message": "API test log",
"tags": ["test"],
"timestamp": '$(date +%s000)'
}
]
}'
# Expected response: HTTP 200 OK
Check our Troubleshooting guide or the FAQ. Or just email us. We're friendly hamsters who actually respond!