REST API
Send logs directly to Logged using the REST API. This is useful when you cannot use the SDK or need to debug ingestion outside your application.
Endpoint
http
POST /api/v1/logsThe API accepts single log objects as well as batches of logs.
Authentication
Include your project API key in the Authorization header as a Bearer token.
http
Authorization: Bearer YOUR_API_KEYKeep your key secret
Do not expose your API key in client-side code that runs in users' browsers. Use a backend proxy if you need to ingest logs from a public client.
Request body
Send a JSON object with at least a level and message.
json
{
"level": "error",
"message": "Database timeout",
"metadata": {
"query": "users"
},
"environment": "production",
"source": "server",
"url": "https://example.com/api/users",
"pathname": "/api/users",
"stack": "Error: Database timeout\n at ...",
"timestamp": "2026-08-28T16:00:00.000Z"
}| Field | Required | Description |
|---|---|---|
| level | Yes | Log severity. Must be one of: log, debug, info, success, warn, error. |
| message | Yes | Human-readable log message. |
| metadata | No | Arbitrary key-value pairs for additional debugging context. |
| environment | No | Application environment. Must be one of: development, staging, production. |
| source | No | Log source. Must be one of: server, client, edge. |
| url | No | Full URL where the log originated. |
| pathname | No | URL pathname where the log originated. |
| stack | No | Stack trace or error stack text. |
| timestamp | No | ISO-8601 timestamp. Defaults to server time if omitted. |
Batch ingestion
Send up to 100 logs in a single request by wrapping them in a logs array.
json
{
"logs": [
{
"level": "info",
"message": "Job started",
"environment": "production"
},
{
"level": "error",
"message": "Job failed",
"environment": "production"
}
]
}Success response
json
{
"success": true,
"id": "log_123"
}For batch requests, the response includes an accepted count and rejected count.
json
{
"success": true,
"accepted": 2,
"rejected": 0
}Errors
| Status | Meaning |
|---|---|
| 401 | Invalid or missing API key. |
| 400 | Invalid request body or log fields. |
| 404 | Project or resource not found. |
| 429 | Too many requests. Respect the Retry-After header. |
| 500 | Server error. Retry with backoff. |
cURL example
bash
curl -X POST https://localhost:3000/api/v1/logs \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"level": "error",
"message": "Database timeout",
"environment": "production"
}'Replace localhost:3000 with your Logged API host if different.