API Reference
The LogStitch API is a RESTful JSON API. All endpoints are served from the base URL:
https://logstitch.io/api/v1Authentication#
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": {
"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.
curl https://logstitch.io/api/v1/events?limit=50&cursor=eyJv... \
-H "Authorization: Bearer pk_..."Endpoints#
Events
/api/v1/eventsSend a single event or batch of up to 100 events.
Auth: Project key or Master key
/api/v1/eventsRetrieve events with filtering and cursor-based pagination.
Auth: Project key, Master key, or Viewer token
API Keys
/api/v1/keysCreate a new project API key. Requires a master key.
Auth: Master key
/api/v1/keysList all API keys for your organization.
Auth: Master or project key
/api/v1/keys/:idPermanently revoke an API key. The key becomes immediately unusable.
Auth: Master or project key
Redaction Rules
/api/v1/redaction/rulesList all redaction rules (built-in + custom) for the project.
Auth: Master or project key
/api/v1/redaction/rulesCreate a custom redaction rule. Requires a master key.
Auth: Master key
/api/v1/redaction/rules/:idUpdate 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
/api/v1/redaction/rules/:idDelete a custom redaction rule. Built-in rules cannot be deleted — disable them with PUT instead. Requires a master key.
Auth: Master key
/api/v1/redaction/testTest your redaction rules against a sample event payload without persisting anything.
Auth: Master or project key
Viewer Tokens
/api/v1/viewer-tokensGenerate a short-lived JWT for the embeddable log viewer. Requires a live project key.
Auth: Project key (live only)
Alerts
/api/v1/alerts/rulesList all alert rules (built-in + custom) for the project.
Auth: Master or project key
/api/v1/alerts/rulesCreate a custom alert rule. Requires a paid plan.
Auth: Master key
/api/v1/alerts/rules/:idUpdate an existing alert rule. For built-in rules, only enabled and cooldown_seconds can be changed.
Auth: Master key
/api/v1/alerts/rules/:idDelete a custom alert rule. Built-in rules cannot be deleted — disable them with PATCH instead.
Auth: Master key
/api/v1/alertsList alerts that have been triggered, with filtering and cursor-based pagination.
Auth: Master or project key
/api/v1/alerts/:idTransition an alert from open to acknowledged, or from open/acknowledged to resolved.
Auth: Master or project key
/api/v1/alerts/webhooksList all webhook endpoints configured for alert delivery.
Auth: Master key
/api/v1/alerts/webhooksRegister a webhook endpoint for alert delivery. Requires a paid plan.
Auth: Master key
/api/v1/alerts/webhooks/:idUpdate an existing webhook endpoint.
Auth: Master key
/api/v1/alerts/webhooks/:idPermanently delete a webhook endpoint. It will no longer receive alert deliveries.
Auth: Master key
Streams
/api/v1/streams/:token/eventsSend events to an anonymous stream. No authentication required. The stream is auto-created on first request.
Auth: None (unauthenticated)
/api/v1/streams/:token/infoGet metadata about a stream (event count, status, expiry). No event data is returned.
Auth: None (unauthenticated)
/api/v1/streams/claimBind an anonymous stream to a project. Migrates all stream events into the project's event table atomically.
Auth: Master key