Skip to Content
LYNKORIADocs

Server SDK reference

Every method of @lynkoria/server, for Node.js backends holding a service key.

import { createLynkoriaServer } from '@lynkoria/server';

const lynkoria = createLynkoriaServer({
  baseUrl: 'https://api.lynkoria.com',
  serviceKey: process.env.LYNKORIA_SERVICE_KEY!, // must start with lynk_live_ or lynk_test_
  webhookSecret: process.env.LYNKORIA_WEBHOOK_SECRET, // optional; string or string[]
  timeoutMs: 10_000, // optional, per attempt
  maxRetries: 2, // optional; idempotent operations retry on network errors, 429, 502, 503, 504
  fetch, // optional custom fetch
});

All methods return promises and throw a LynkoriaError (with code, status, message and requestId) on failure. See errors.

Calls (scope calls:write)

MethodReturnsNotes
calls.create(input)Call{ productCallId, type?, tenantId?, maxParticipants?, emptyTimeoutSec?, departureTimeoutSec? }. Idempotent per active productCallId.
calls.get(callId)CallStatus active or ended.
calls.joinToken({ callId, userId, deviceId, displayName, role? }){ url, token, identity, expiresAt }5-minute join window. Roles other than participant are for livestreams.
calls.end(callId)CallEnds for everyone; stops new tokens.
calls.removeParticipant(callId, identity)voidDisconnects one device.
calls.setRole(callId, identity, role)voidLivestream only: host, speaker, viewer, participant.
calls.signal(callId, { type, toUserIds, fromUserId?, data? })voidinvited, ringing, accepted, declined, ended to connected devices.

Call defaults: type: 'group', tenantId: 'default', emptyTimeoutSec: 300 (10–3600), departureTimeoutSec: 20 (0–3600).

Sessions (scope messaging:write)

MethodReturns
sessions.messagingToken({ userId, deviceId, tenantId? }){ token, expiresAt } (10 minutes)

Conversations (scope messaging:write)

MethodReturnsNotes
conversations.create({ type, memberIds, tenantId?, productConversationId?, title? })Conversationtype: dm, group, channel, session. Idempotent per productConversationId.
conversations.addMembers(id, userIds)voidUp to 1000 per call. Not allowed for dm.
conversations.removeMember(id, userId)void

Users (scope users:write)

MethodEffect
users.suspend(userId)Stops new tokens, disconnects sockets and removes the user from calls.
users.unsuspend(userId)Restores access.

Notifications (scope messaging:write)

MethodReturnsNotes
notifications.send(input){ queued }Queues push notifications to users' registered devices; needs the push feature. See push notifications.

Recordings (scope calls:write)

Needs the recording feature and LiveKit Egress; never available for end-to-end encrypted calls. See recording and egress.

MethodReturnsNotes
recordings.start(callId, input)RecordingRoom composite (default) or participant recording; optional RTMP(S) stream
recordings.list(callId)Recording[]
recordings.get(recordingId)Recording
recordings.stop(recordingId)Recording
recordings.download(recordingId, file)RecordingDownload5-minute signed URL for one output file of a completed recording
recordings.delete(recordingId)voidDeletes a finished recording and every stored file

Webhooks

MethodReturns
webhooks.verify(rawBody, signatureHeader, now?)WebhookEvent
verifyWebhook(rawBody, header, secrets, now?)WebhookEvent (standalone, no client needed)

Both throw if the signature is missing, malformed, invalid, or more than 5 minutes old. See webhooks.

Identifiers

userId, deviceId, tenantId, productCallId and productConversationId are 1–128 characters of A-Z a-z 0-9 . _ @ -. Colons are not allowed because Lynkoria builds identities like project:user:device.

API reference

Every export with its signature, generated from the package build: server reference.

On this page