Logged Docs
Logged Docs

Getting Started

  • Installation
  • Quick Start

SDK

  • Logger
  • Capture Errors
  • Browser Auto Capture
  • Console Capture

REST API

  • Overview

Examples

  • Next.js
  • React
  • JavaScript
Back to site

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

The 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_KEY

Keep 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"
}
FieldRequiredDescription
levelYesLog severity. Must be one of: log, debug, info, success, warn, error.
messageYesHuman-readable log message.
metadataNoArbitrary key-value pairs for additional debugging context.
environmentNoApplication environment. Must be one of: development, staging, production.
sourceNoLog source. Must be one of: server, client, edge.
urlNoFull URL where the log originated.
pathnameNoURL pathname where the log originated.
stackNoStack trace or error stack text.
timestampNoISO-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

StatusMeaning
401Invalid or missing API key.
400Invalid request body or log fields.
404Project or resource not found.
429Too many requests. Respect the Retry-After header.
500Server 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.