Docs

API Reference

The LogStitch API is a RESTful JSON API. All endpoints are served from the base URL:

https://logstitch.io/api/v1

Authentication#

Most endpoints require an Authorization: Bearer <key> header. LogStitch supports master keys, project keys, and viewer tokens, each with different permission scopes. See the authentication guide for details.

Request Format#

Send request bodies as JSON with the Content-Type: application/json header. All request bodies are validated with Zod schemas and return structured validation errors if the input is invalid.

Response Format#

Every response includes a request_id field for tracing and support. Error responses use a consistent structure:

Error response format
{
  "error": {
    "code": "validation_error",
    "message": "Invalid request body",
    "details": [
      { "field": "action", "message": "Required" }
    ]
  },
  "request_id": "req_abc123"
}

Pagination#

All list endpoints use cursor-based pagination. Responses include a cursor string and a has_more boolean. Pass the cursor as a query parameter to fetch the next page. LogStitch never uses offset-based pagination.

Paginated request
curl https://logstitch.io/api/v1/events?limit=50&cursor=eyJv... \
  -H "Authorization: Bearer pk_..."

Endpoints#

Events

POST
/api/v1/events

Send a single event or batch of up to 100 events.

Auth: Project key or Master key

GET
/api/v1/events

Retrieve events with filtering and cursor-based pagination.

Auth: Project key, Master key, or Viewer token

API Keys

POST
/api/v1/keys

Create a new project API key. Requires a master key.

Auth: Master key

GET
/api/v1/keys

List all API keys for your organization.

Auth: Master or project key

DELETE
/api/v1/keys/:id

Permanently revoke an API key. The key becomes immediately unusable.

Auth: Master or project key

Redaction Rules

GET
/api/v1/redaction/rules

List all redaction rules (built-in + custom) for the project.

Auth: Master or project key

POST
/api/v1/redaction/rules

Create a custom redaction rule. Requires a master key.

Auth: Master key

PUT
/api/v1/redaction/rules/:id

Update a custom or built-in redaction rule. For built-in rules, you can change behavior and enabled status. Requires a master key.

Auth: Master key

DELETE
/api/v1/redaction/rules/:id

Delete a custom redaction rule. Built-in rules cannot be deleted — disable them with PUT instead. Requires a master key.

Auth: Master key

POST
/api/v1/redaction/test

Test your redaction rules against a sample event payload without persisting anything.

Auth: Master or project key

Viewer Tokens

POST
/api/v1/viewer-tokens

Generate a short-lived JWT for the embeddable log viewer. Requires a live project key.

Auth: Project key (live only)

Alerts

GET
/api/v1/alerts/rules

List all alert rules (built-in + custom) for the project.

Auth: Master or project key

POST
/api/v1/alerts/rules

Create a custom alert rule. Requires a paid plan.

Auth: Master key

PATCH
/api/v1/alerts/rules/:id

Update an existing alert rule. For built-in rules, only enabled and cooldown_seconds can be changed.

Auth: Master key

DELETE
/api/v1/alerts/rules/:id

Delete a custom alert rule. Built-in rules cannot be deleted — disable them with PATCH instead.

Auth: Master key

GET
/api/v1/alerts

List alerts that have been triggered, with filtering and cursor-based pagination.

Auth: Master or project key

PATCH
/api/v1/alerts/:id

Transition an alert from open to acknowledged, or from open/acknowledged to resolved.

Auth: Master or project key

GET
/api/v1/alerts/webhooks

List all webhook endpoints configured for alert delivery.

Auth: Master key

POST
/api/v1/alerts/webhooks

Register a webhook endpoint for alert delivery. Requires a paid plan.

Auth: Master key

PATCH
/api/v1/alerts/webhooks/:id

Update an existing webhook endpoint.

Auth: Master key

DELETE
/api/v1/alerts/webhooks/:id

Permanently delete a webhook endpoint. It will no longer receive alert deliveries.

Auth: Master key

Streams

POST
/api/v1/streams/:token/events

Send events to an anonymous stream. No authentication required. The stream is auto-created on first request.

Auth: None (unauthenticated)

GET
/api/v1/streams/:token/info

Get metadata about a stream (event count, status, expiry). No event data is returned.

Auth: None (unauthenticated)

POST
/api/v1/streams/claim

Bind an anonymous stream to a project. Migrates all stream events into the project's event table atomically.

Auth: Master key