Skip to content

API Reference

Complete REST API documentation for SealTrail.

Base URL

All API requests are made to:

https://api.sealtrail.dev
All endpoints require authentication via API key. See Authentication for details.

Response format

All successful responses follow a consistent envelope:

success-response.json
// Single resource
{ "data": { "id": "evt_...", "actor": "user_123", ... } }

// Collection (paginated)
{ "data": [{ ... }, { ... }], "nextCursor": "eyJjcmVhdGVk..." }

Error responses use a separate structure:

error-response.json
{ "error": { "code": "VALIDATION_ERROR", "message": "...", "details": { ... } } }

Cursor pagination

List endpoints use cursor-based pagination. The cursor is a Base64-encoded, opaque string — do not parse or construct it yourself.

  • nextCursor is only present when more results exist.
  • Pass it as ?cursor=... to fetch the next page.
  • Combine with ?limit=N to control page size (default: 50, max: 200).

Events

POST /v1/events #

Log a new audit event. The event is appended to a hash chain, ensuring cryptographic integrity. Returns the created event with its computed hash and chain position.

Request body

NameTypeRequiredDescription
actorstringRequiredWho performed the action (user ID, email, service name)
actionstringRequiredWhat happened (e.g. invoice.approved, user.deleted)
resourcestringOptionalWhat was acted upon (e.g. inv_456, user_789)
contextobjectOptionalAdditional metadata as key-value pairs
chainstringOptionalChain name for partitioning (default: "default")

Response

NameTypeRequiredDescription
idstringRequiredEvent ID (evt_ prefix)
actorstringRequiredActor from the request
actionstringRequiredAction from the request
resourcestring | nullRequiredResource from the request
contextobject | nullRequiredContext metadata
chainobjectRequiredChain info: { id, name, position }
hashstringRequiredSHA-256 hash of this event
previousHashstringRequiredHash of the previous event in the chain
timestampstringRequiredISO 8601 timestamp
createdAtstringRequiredServer-side insertion time (ISO 8601, used for cursor pagination)

Example

terminal
curl -X POST https://api.sealtrail.dev/v1/events \
  -H "Authorization: Bearer stl_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "actor": "user_123",
    "action": "invoice.approved",
    "resource": "inv_456",
    "context": { "ip": "192.168.1.1", "amount": 1500 }
  }'
GET /v1/events #

Query your audit events with optional filters. Supports cursor-based pagination for efficient iteration over large datasets.

Query parameters

NameTypeRequiredDescription
actorstringOptionalFilter by actor
actionstringOptionalFilter by action
resourcestringOptionalFilter by resource
chain_idstringOptionalFilter by chain ID (use GET /v1/chains to find IDs by name)
afterstringOptionalEvents after this ISO 8601 datetime
beforestringOptionalEvents before this ISO 8601 datetime
limitnumberOptionalPage size (default: 50, max: 200)
cursorstringOptionalCursor for next page (from previous response)

Example

terminal
curl "https://api.sealtrail.dev/v1/events?actor=user_123&limit=10" \
  -H "Authorization: Bearer stl_live_..."
GET /v1/events/:id #

Retrieve a single event by its ID. Returns the full event data including hash chain information.

Example

terminal
curl "https://api.sealtrail.dev/v1/events/evt_abc123" \
  -H "Authorization: Bearer stl_live_..."

Verification

GET /v1/events/:id/verify #

Verify a single event's hash integrity. Re-computes the expected hash from the event payload and previous hash, then compares it with the stored hash. Detects any tampering.

Response

NameTypeRequiredDescription
validbooleanRequiredWhether the event hash is valid
errorsstring[]RequiredList of integrity errors (empty if valid)
eventHashstringRequiredThe stored hash
computedHashstringRequiredThe re-computed hash
chainIntactbooleanRequiredWhether the chain link is valid
verifiedAtstringRequiredISO 8601 timestamp of verification

Example

terminal
curl "https://api.sealtrail.dev/v1/events/evt_abc123/verify" \
  -H "Authorization: Bearer stl_live_..."

Chains

GET /v1/chains #

List all hash chains for your account. Each chain is an independent, ordered sequence of events. Chains are created automatically when you log an event with a new chain name.

Response

NameTypeRequiredDescription
idstringRequiredChain ID
namestringRequiredChain name
lastHashstringRequiredHash of the latest event
lastPositionnumberRequiredPosition of the latest event
eventCountnumberRequiredTotal events in this chain
createdAtstringRequiredISO 8601 creation date

Example

terminal
curl "https://api.sealtrail.dev/v1/chains" \
  -H "Authorization: Bearer stl_live_..."
GET /v1/chain/:chainId/status #

Get the current status of a specific hash chain, including its latest hash, position, and total event count.

Response

NameTypeRequiredDescription
idstringRequiredChain ID
namestringRequiredChain name
lastHashstringRequiredHash of the latest event
lastPositionnumberRequiredPosition of the latest event
eventCountnumberRequiredTotal events in this chain
createdAtstringRequiredISO 8601 creation date

Example

terminal
curl "https://api.sealtrail.dev/v1/chain/chn_abc123/status" \
  -H "Authorization: Bearer stl_live_..."