API Reference

Purl REST API

Ingest, search, and manage logs programmatically. Authenticate with API keys for ingest or session cookies for the dashboard.

Authentication

Purl supports two authentication methods:

API Key

For programmatic access and log ingestion

X-API-Key: your-api-key

Session Cookie

For browser-based dashboard access

POST /api/auth/login

Quick Start

Ingest logs

curl — ingest
curl -X POST http://your-purl:3000/api/logs \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "timestamp": "2026-02-18T10:30:00Z",
      "level": "error",
      "message": "Connection timeout to database",
      "source": "api-server",
      "host": "prod-01"
    }
  ]'

Search logs (KQL)

curl — search
curl -H "X-API-Key: your-api-key" \
  "http://your-purl:3000/api/logs?q=level:error AND source:api-server&range=1h&limit=50"

Ingest via OTLP (OpenTelemetry)

curl — OTLP
curl -X POST http://your-purl:3000/api/v1/otlp/logs \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceLogs": [{
      "resource": {
        "attributes": [
          {"key": "service.name", "value": {"stringValue": "my-app"}}
        ]
      },
      "scopeLogs": [{
        "logRecords": [{
          "timeUnixNano": "1708250000000000000",
          "severityText": "ERROR",
          "body": {"stringValue": "Connection refused"}
        }]
      }]
    }]
  }'

Health check

curl — health
curl http://your-purl:3000/api/health
# {"status":"ok","clickhouse":"connected","uptime_secs":86400}

Endpoint Reference

Click any section to expand the full list of endpoints. Endpoints marked with a feature badge require the corresponding license feature.

Response Format

Success response

json
{
  "hits": [...],
  "total": 1234,
  "query": "level:error"
}

Error response

json
{
  "error": "Invalid query syntax",
  "status": 400
}

Common headers

Response Headers
HeaderDescription
X-CacheHIT or MISS — indicates if response was served from cache
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRemaining requests in current window
Content-Typeapplication/json for all API responses

Feature Gates

Some endpoints require specific license features. Requests to gated endpoints without the required feature return 403 Forbidden.

License Features
FeaturePlanDescription
pattern_analysisPro+Log pattern detection and grouping
saved_searches_unlimitedPro+Unlimited saved searches
custom_dashboardsPro+Custom dashboard builder
pipelinesPro+Data processing pipelines
es_compatPro+Elasticsearch-compatible search API
ai_queryEnterpriseNatural language → SQL queries
ssoEnterpriseSAML 2.0 SSO authentication
ldap_authEnterpriseLDAP / Active Directory auth
audit_logsEnterpriseAudit trail for all actions
backupEnterpriseBackup and restore operations

Rate Limiting

All authenticated endpoints are rate-limited. When exceeded, you receive a 429 Too Many Requests response. Check the X-RateLimit-Remaining header to monitor your usage. The ingest endpoint accepts up to 10,000 records per batch.