Sharing and guest access
Manage layout invitations, members, share groups and guest access.
Source 0.1.0 Private source package
How the calls fit together
Choose management or guest authority before creating a client. Guest access is current-state-only; retain short-lived capabilities in memory.
JavaScript examples
Supply your configured client. Each call awaits a decoded result; errors pass to your caller. These identifiers and values are fictional. Use selected development records and review every change before running it. Opening this page sends no API requests.
See the complete TypeScript workflow · Explore the Node starter
sharing.listGuestSessions
Lists guest QR sessions for one layout.
const result = await client.sharing.listGuestSessions(
"account 1",
"layout-1"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout whose guest sessions should be listed.
Returns Promise<RailDeckLayoutGuestSessionListResponse>.
Example evidence: Retained SDK transport fixture.
sharing.createGuestSession
Creates one guest QR session and returns its one-time plain code.
const result = await client.sharing.createGuestSession(
"account 1",
"layout-1",
{
"shareGroupId": "share-2",
"displayName": "{{fixtureDisplayName}}",
"accessLevel": "operator",
"expiresInSeconds": 600,
"autoRegenerate": true,
"regenerateAfterScanSeconds": 30
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout receiving the guest session.
input· requiredCreateRailDeckLayoutGuestSessionInputShare group, display name, access level, expiry, regeneration, and metadata.
Returns Promise<RailDeckCreatedLayoutGuestSession>.
Example evidence: Retained SDK transport fixture.
sharing.updateGuestSession
Updates one guest QR session for a layout.
const result = await client.sharing.updateGuestSession(
"account 1",
"layout-1",
"guest-session-2",
{
"autoRegenerate": false
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the guest session.
guestSessionId· requiredRailDeckIdentifierGuest session to update.
input· requiredUpdateRailDeckLayoutGuestSessionInputPartial guest session update.
Returns Promise<RailDeckLayoutGuestSession>.
Example evidence: Retained SDK transport fixture.
sharing.revokeGuestSession
Revokes one guest QR session so it can no longer be redeemed.
const result = await client.sharing.revokeGuestSession(
"account 1",
"layout-1",
"guest-session-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the guest session.
guestSessionId· requiredRailDeckIdentifierGuest session to revoke.
Returns Promise<RailDeckLayoutGuestSession>.
Example evidence: Retained SDK transport fixture.
sharing.regenerateGuestSession
Regenerates one guest QR session and returns the replacement's plain code.
const result = await client.sharing.regenerateGuestSession(
"account 1",
"layout-1",
"guest-session-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the guest session.
guestSessionId· requiredRailDeckIdentifierGuest session to regenerate.
Returns Promise<RailDeckCreatedLayoutGuestSession>.
Example evidence: Retained SDK transport fixture.
sharing.autoRegenerateGuestSession
Regenerates a scanned guest QR session after its countdown is due.
const result = await client.sharing.autoRegenerateGuestSession(
"account 1",
"layout-1",
"guest-session-3"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the guest session.
guestSessionId· requiredRailDeckIdentifierScanned guest session to auto-regenerate when due.
Returns Promise<RailDeckCreatedLayoutGuestSession>.
Example evidence: Retained SDK transport fixture.
sharing.redeemGuestSession
Redeems a public guest QR code and returns scoped guest current-state access.
const result = await client.sharing.redeemGuestSession(
"session-1",
{
"code": "{{setupOrRedemptionCode}}"
}
);TypeScript parameters and return type
guestSessionId· requiredRailDeckIdentifierGuest session id encoded in the QR URL.
input· requiredRedeemRailDeckLayoutGuestSessionInputPlain guest code from the QR URL.
Returns Promise<RailDeckGuestSessionRedemption>.
Example evidence: Retained SDK transport fixture.
sharing.listLayoutInvitations
Lists layout invitations managed from one layout.
const result = await client.sharing.listLayoutInvitations(
"account 1",
"layout-1"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout whose invitations should be listed.
Returns Promise<RailDeckLayoutInvitationListResponse>.
Example evidence: Retained SDK transport fixture.
sharing.createLayoutInvitation
Creates a layout invitation and queues its email.
const result = await client.sharing.createLayoutInvitation(
"account 1",
"layout-1",
{
"email": "{{fixtureEmail}}",
"role": "operator",
"expiresAt": "2030-06-24T18:00:00.000Z",
"metadata": {
"note": "Club friend"
}
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout receiving the invitation.
input· requiredCreateRailDeckLayoutInvitationInputInvite email, role, optional expiry, and metadata.
Returns Promise<RailDeckCreatedLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.cancelLayoutInvitation
Cancels a pending layout invitation.
const result = await client.sharing.cancelLayoutInvitation(
"account 1",
"layout-1",
"layout-invitation-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the invitation.
invitationId· requiredRailDeckIdentifierInvitation to cancel.
Returns Promise<RailDeckLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.resendLayoutInvitation
Resends a pending layout invitation email.
const result = await client.sharing.resendLayoutInvitation(
"account 1",
"layout-1",
"layout-invitation-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the invitation.
invitationId· requiredRailDeckIdentifierInvitation to resend.
Returns Promise<RailDeckCreatedLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.regenerateLayoutInvitation
Regenerates a pending layout invitation by creating a replacement invitation.
const result = await client.sharing.regenerateLayoutInvitation(
"account 1",
"layout-1",
"layout-invitation-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the invitation.
invitationId· requiredRailDeckIdentifierInvitation to regenerate.
Returns Promise<RailDeckCreatedLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.listMyLayoutInvitations
Lists pending layout invitations for the signed-in user's email address.
const result = await client.sharing.listMyLayoutInvitations(
);TypeScript parameters and return type
Returns Promise<RailDeckMyLayoutInvitationListResponse>.
Example evidence: Retained SDK transport fixture.
sharing.acceptMyLayoutInvitation
Accepts one layout invitation for the signed-in user.
const result = await client.sharing.acceptMyLayoutInvitation(
"layout-invitation-3",
{
"invitationCode": "{{setupOrRedemptionCode}}"
}
);TypeScript parameters and return type
invitationId· requiredRailDeckIdentifierInvitation to accept.
input· optionalRespondRailDeckLayoutInvitationInputThe operation input. Use the complete typed shape shown in the example and retain reviewed versions for writes.
Returns Promise<RailDeckAcceptedLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.declineMyLayoutInvitation
Declines one layout invitation for the signed-in user.
const result = await client.sharing.declineMyLayoutInvitation(
"layout-invitation-4",
{
"invitationCode": "{{setupOrRedemptionCode}}"
}
);TypeScript parameters and return type
invitationId· requiredRailDeckIdentifierInvitation to decline.
input· optionalRespondRailDeckLayoutInvitationInputThe operation input. Use the complete typed shape shown in the example and retain reviewed versions for writes.
Returns Promise<RailDeckLayoutInvitation>.
Example evidence: Retained SDK transport fixture.
sharing.listLayoutMembers
Lists layout members for one layout.
const result = await client.sharing.listLayoutMembers(
"account 1",
"layout-1"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout whose members should be listed.
Returns Promise<RailDeckLayoutMemberListResponse>.
Example evidence: Retained SDK transport fixture.
sharing.updateLayoutMember
Updates one layout member.
const result = await client.sharing.updateLayoutMember(
"account 1",
"layout-1",
"user-2",
{
"role": "setup"
}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the member.
memberUserId· requiredRailDeckIdentifierUser id for the layout member.
input· requiredUpdateRailDeckLayoutMemberInputRole or metadata changes.
Returns Promise<RailDeckLayoutMember>.
Example evidence: Retained SDK transport fixture.
sharing.revokeLayoutMember
Revokes one layout member.
const result = await client.sharing.revokeLayoutMember(
"account 1",
"layout-1",
"user-2"
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout containing the member.
memberUserId· requiredRailDeckIdentifierUser id for the layout member.
Returns Promise<RailDeckLayoutMember>.
Example evidence: Retained SDK transport fixture.
Download all TypeScript method examples
JavaScript calls and TypeScript downloads are checked through the real SDK using local response fixtures. This verifies the calls and decoding for those fixtures.
The complete TypeScript workflow
Follow how the calls fit together, including the review and recovery steps. Supply your configured client and explicitly selected development records. Importing the download performs no requests; mutations are never retried automatically.
import { createRailDeckPublicClient } from '@raildeck/frontend-sdk/public';
/**
* Redeem a guest code and read only its authorised layout with an in-memory token.
* @param baseUrl - Explicit caller-owned value for this operation.
* @param guestSessionId - Explicit caller-owned value for this operation.
* @param code - Explicit caller-owned value for this operation.
* @param signal - Caller-owned cancellation signal.
* @returns The scoped decoded snapshot; no token is returned, logged or persisted.
*/
export async function readGuestLayoutOnce(
baseUrl: string,
guestSessionId: string,
code: string,
signal: AbortSignal,
) {
let guestToken: string | null = null;
const client = createRailDeckPublicClient({
baseUrl,
getGuestAccessToken: () => guestToken,
});
try {
const redemption = await client.sharing.redeemGuestSession(guestSessionId, { code });
guestToken = redemption.guestAccessToken.accessToken;
const { accountId, layoutId } = redemption.guestAccess;
return await client.currentState.getLayoutSnapshot(accountId, layoutId, {
signal, timeoutMs: 15_000,
});
} finally {
// Clear the capability after this one read, including cancellation or decode failure.
guestToken = null;
}
}
Download TypeScript example