Lucent Sdk API
The Sdk API from Lucent — 1 operation(s) for sdk.
The Sdk API from Lucent — 1 operation(s) for sdk.
openapi: 3.1.0
info:
title: Lucent Insights Sdk API
description: HTTP APIs for Lucent. The Data API reads Lucent data and updates issue status. The Ingest API receives rrweb batches from the @lucenthq/sdk browser package and custom integrations built on top of the same contract.
license:
name: MIT
version: 0.1.0
servers:
- url: https://app.lucenthq.com
description: Production app
tags:
- name: Sdk
paths:
/api/sdk/replay:
servers:
- url: https://batch-jobs-lucent.onrender.com
description: Production ingest
post:
summary: Submit a replay batch
description: Accepts a batch of rrweb events for a single session window. Batches are idempotent per `(sessionId, sequence)` — the same batch submitted twice is stored once. When `flush` is `final`, the server dispatches the session for processing immediately; otherwise the session is left in a `receiving` state until a scheduled finalizer picks it up.
operationId: sdkReplay
security:
- lucentApiKey: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ReplayBatch'
responses:
'200':
description: Batch accepted.
content:
application/json:
schema:
type: object
required:
- ok
properties:
ok:
type: boolean
const: true
'400':
description: Invalid replay batch.
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: string
example: Invalid replay batch
details:
type: array
description: Zod validation issues.
items:
type: object
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
'500':
description: Storage upload or server error.
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: string
tags:
- Sdk
components:
schemas:
RrwebEvent:
type: object
description: A single rrweb event. Opaque to Lucent — stored and replayed as-is.
required:
- timestamp
- type
- data
properties:
timestamp:
type: number
description: Epoch milliseconds when the event was captured.
type:
type: integer
description: rrweb event type discriminator.
data:
description: rrweb event payload. Shape depends on `type`.
ReplayBatch:
type: object
required:
- session
- user
- page
- replay
properties:
session:
type: object
required:
- id
- windowId
- startedAt
- lastActivityAt
- url
properties:
id:
type: string
minLength: 1
description: Stable session ID generated by the SDK. Shared across batches belonging to the same session.
windowId:
type: string
minLength: 1
description: Per-tab window ID. Distinguishes concurrent tabs within a session.
startedAt:
type: number
description: Epoch milliseconds when the session started.
lastActivityAt:
type: number
description: Epoch milliseconds of the most recent event in the session so far.
url:
type: string
description: URL the session started on.
user:
type: object
required:
- anonymousId
properties:
id:
type: string
nullable: true
description: Your internal user ID if `identify` has been called.
anonymousId:
type: string
minLength: 1
description: Anonymous ID generated by the SDK and persisted in localStorage.
properties:
type: object
additionalProperties: true
nullable: true
description: Arbitrary user properties. `email` and `name` are surfaced in the dashboard when present.
page:
type: object
required:
- url
properties:
url:
type: string
referrer:
type: string
nullable: true
viewport:
type: object
nullable: true
required:
- width
- height
properties:
width:
type: number
height:
type: number
replay:
type: object
required:
- events
- sequence
properties:
events:
type: array
minItems: 1
items:
$ref: '#/components/schemas/RrwebEvent'
description: rrweb events in chronological order.
sequence:
type: integer
minimum: 0
description: Monotonically increasing batch sequence number within a session. Used as an idempotency key together with `session.id`.
metadata:
type: object
nullable: true
properties:
userAgent:
type: string
nullable: true
language:
type: string
nullable: true
flush:
type: string
enum:
- normal
- final
default: normal
description: '`final` tells the server this is the last batch for the session — typically sent from a `beforeunload` handler. `final` batches trigger immediate session processing.'
responses:
RateLimited:
description: Rate limit exceeded (100 requests per minute per API key).
headers:
Retry-After:
description: Seconds until the rate limit resets.
schema:
type: integer
minimum: 1
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: string
const: Rate limit exceeded
Unauthorized:
description: Missing, invalid, or revoked API key.
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
type: string
enum:
- Missing API key
- Invalid or revoked API key
securitySchemes:
lucentApiKey:
type: apiKey
in: header
name: X-Lucent-Api-Key
description: Public key prefixed with `luc_pk_`. Safe to expose in client-side code. For `navigator.sendBeacon` callers that cannot set headers, the key may also be passed as the `api_key` query parameter.
lucentBearer:
type: http
scheme: bearer
description: API keys prefixed with `luc_api_` or OAuth access tokens prefixed with `luc_oat_`. Legacy static keys prefixed with `luc_mcp_` continue to work.