Skip to main content

Rail Deck is being prepared for an invitation-only Alpha. Check current availability

Developer documentation

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.listShareGroups

Lists share groups for one layout.

const result = await client.sharing.listShareGroups(
  "account 1",
  "layout-1"
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout whose share groups should be listed.

Returns Promise<RailDeckLayoutShareGroupListResponse>.

Example evidence: Retained SDK transport fixture.

sharing.createShareGroup

Creates one share group for a layout.

const result = await client.sharing.createShareGroup(
  "account 1",
  "layout-1",
  {
    "name": "Exhibition Operators",
    "accessLevel": "operator",
    "expiresAt": "2030-06-24T18:00:00.000Z"
  }
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout receiving the share group.

input · required
CreateRailDeckLayoutShareGroupInput

Share group name, access level, expiry, and metadata.

Returns Promise<RailDeckLayoutShareGroup>.

Example evidence: Retained SDK transport fixture.

sharing.updateShareGroup

Updates one share group for a layout.

const result = await client.sharing.updateShareGroup(
  "account 1",
  "layout-1",
  "share-2",
  {
    "accessLevel": "viewer"
  }
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the share group.

shareGroupId · required
RailDeckIdentifier

Share group to update.

input · required
UpdateRailDeckLayoutShareGroupInput

Partial share group update.

Returns Promise<RailDeckLayoutShareGroup>.

Example evidence: Retained SDK transport fixture.

sharing.revokeShareGroup

Revokes one share group while keeping the audit-friendly record.

const result = await client.sharing.revokeShareGroup(
  "account 1",
  "layout-1",
  "share-2"
);
TypeScript parameters and return type
accountId · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the share group.

shareGroupId · required
RailDeckIdentifier

Share group to revoke.

Returns Promise<RailDeckLayoutShareGroup>.

Example evidence: Retained SDK transport fixture.

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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout receiving the guest session.

input · required
CreateRailDeckLayoutGuestSessionInput

Share 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the guest session.

guestSessionId · required
RailDeckIdentifier

Guest session to update.

input · required
UpdateRailDeckLayoutGuestSessionInput

Partial 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the guest session.

guestSessionId · required
RailDeckIdentifier

Guest 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the guest session.

guestSessionId · required
RailDeckIdentifier

Guest 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the guest session.

guestSessionId · required
RailDeckIdentifier

Scanned 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 · required
RailDeckIdentifier

Guest session id encoded in the QR URL.

input · required
RedeemRailDeckLayoutGuestSessionInput

Plain 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout receiving the invitation.

input · required
CreateRailDeckLayoutInvitationInput

Invite 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the invitation.

invitationId · required
RailDeckIdentifier

Invitation 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the invitation.

invitationId · required
RailDeckIdentifier

Invitation 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the invitation.

invitationId · required
RailDeckIdentifier

Invitation 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 · required
RailDeckIdentifier

Invitation to accept.

input · optional
RespondRailDeckLayoutInvitationInput

The 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 · required
RailDeckIdentifier

Invitation to decline.

input · optional
RespondRailDeckLayoutInvitationInput

The 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the member.

memberUserId · required
RailDeckIdentifier

User id for the layout member.

input · required
UpdateRailDeckLayoutMemberInput

Role 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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout containing the member.

memberUserId · required
RailDeckIdentifier

User 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.

Handle errors and uncertain outcomes

Choose another feature

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

Information reviewed .