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)
| Method | Returns | Notes |
|---|---|---|
calls.create(input) | Call | { productCallId, type?, tenantId?, maxParticipants?, emptyTimeoutSec?, departureTimeoutSec? }. Idempotent per active productCallId. |
calls.get(callId) | Call | Status 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) | Call | Ends for everyone; stops new tokens. |
calls.removeParticipant(callId, identity) | void | Disconnects one device. |
calls.setRole(callId, identity, role) | void | Livestream only: host, speaker, viewer, participant. |
calls.signal(callId, { type, toUserIds, fromUserId?, data? }) | void | invited, 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)
| Method | Returns |
|---|---|
sessions.messagingToken({ userId, deviceId, tenantId? }) | { token, expiresAt } (10 minutes) |
Conversations (scope messaging:write)
| Method | Returns | Notes |
|---|---|---|
conversations.create({ type, memberIds, tenantId?, productConversationId?, title? }) | Conversation | type: dm, group, channel, session. Idempotent per productConversationId. |
conversations.addMembers(id, userIds) | void | Up to 1000 per call. Not allowed for dm. |
conversations.removeMember(id, userId) | void |
Users (scope users:write)
| Method | Effect |
|---|---|
users.suspend(userId) | Stops new tokens, disconnects sockets and removes the user from calls. |
users.unsuspend(userId) | Restores access. |
Notifications (scope messaging:write)
| Method | Returns | Notes |
|---|---|---|
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.
| Method | Returns | Notes |
|---|---|---|
recordings.start(callId, input) | Recording | Room 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) | RecordingDownload | 5-minute signed URL for one output file of a completed recording |
recordings.delete(recordingId) | void | Deletes a finished recording and every stored file |
Webhooks
| Method | Returns |
|---|---|
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.