LinkDen
API

API Endpoints

Complete reference for all LinkDen tRPC API procedures.

API Endpoints

LinkDen exposes 48 tRPC procedures organized into 8 routers. All endpoints are available at /trpc/<router>.<procedure>.

Public procedures require no authentication. Protected procedures require either a Clerk JWT token or a valid Cloudflare Access header.


Manage link blocks on your page.

ProcedureTypeAuthDescription
links.listQueryPublicGet all active links in display order (live data only)
links.listAllQueryProtectedGet all links with draft overlays merged
links.draftCountQueryProtectedCount links with unpublished changes
links.createMutationProtectedCreate a new link block
links.updateMutationProtectedUpdate a link (writes to draft, not live)
links.deleteMutationProtectedDelete a link by ID
links.reorderMutationProtectedBatch update sort orders
links.toggleActiveMutationProtectedToggle visibility via draft
links.publishMutationProtectedPublish all link drafts to live
links.trackClickMutationPublicRecord a link click for analytics
// Input
{
  type: "link" | "heading" | "text" | "spacer" | "divider" | "image" | "video" | "html" | "email" | "phone" | "vcard" | "wallet" | "contact_form" | "social_button",
  title: string,
  url?: string,
  icon?: string,
  iconType?: "lucide" | "brand" | "url",
  isActive?: boolean,
  metadata?: Record<string, unknown>
}
// Input
{
  id: string,
  title?: string,
  url?: string,
  icon?: string,
  iconType?: "lucide" | "brand" | "url",
  isActive?: boolean,
  metadata?: Record<string, unknown>
}

Settings

Manage site-wide configuration.

ProcedureTypeAuthDescription
settings.getAllQueryProtectedGet all settings (draft values preferred)
settings.getPublicQueryPublicGet live settings only
settings.draftCountQueryProtectedCount settings with unpublished changes
settings.updateMutationProtectedUpdate settings (writes to draft)
settings.publishMutationProtectedPublish all setting drafts, purge edge cache

Available Settings Keys

KeyDescriptionExample
profileNameDisplay name"John Doe"
profileBioBio text"Developer & creator"
profileImageAvatar URL"https://..."
themeTheme ID"midnight-glass"
themeModeDefault mode"dark" / "light" / "system"
accentColorPrimary color"#0FACED"
backgroundColorPage background"#091533"
textColorText color"rgba(255,255,255,0.95)"
contactEnabledContact form toggle"true" / "false"
contactEmailNotification email"you@example.com"
captchaTypeCAPTCHA mode"none" / "math" / "turnstile" / "recaptcha"
captchaSiteKeyTurnstile or reCAPTCHA site key"0x4AAAAAAA..."
captchaSecretKeyTurnstile or reCAPTCHA secret"0x4AAAAAAA..."
brandNameWhitelabel name"My Brand"
brandLogoLogo URL"https://..."
metaTitleSEO title"My Page"
metaDescriptionSEO description"My link page"
metaImageOG image URL"https://..."
verifiedBadgeShow badge"true" / "false"

Analytics

Track and query page view and click data.

ProcedureTypeAuthDescription
analytics.trackPageViewMutationPublicRecord a page view with user-agent and country
analytics.overviewQueryProtectedTotal views, clicks, and CTR for a period
analytics.timeSeriesQueryProtectedDaily event counts for charting
analytics.byLinkQueryProtectedClick counts per link
analytics.topReferrersQueryProtectedTop 20 referrer domains
analytics.countriesQueryProtectedCountry breakdown of views
analytics.clearMutationProtectedDelete all analytics data

Overview Input

{
  period: "7d" | "30d" | "90d"
}

Overview Response

{
  totalViews: number,
  totalClicks: number,
  ctr: string  // e.g. "12.5"
}

Contact

Handle contact form submissions.

ProcedureTypeAuthDescription
contact.submitMutationPublicSubmit a message (validates CAPTCHA)
contact.listQueryProtectedPaginated list with unread count
contact.getByIdQueryProtectedGet a single submission
contact.markReadMutationProtectedMark submission as read
contact.deleteMutationProtectedDelete a submission

Submit Input

{
  name: string,
  email: string,
  message: string,
  captchaToken?: string,  // Turnstile or reCAPTCHA token (omit for Simple Math)
  mathAnswer?: number     // Answer to the server-side math question (Simple Math mode only)
}

The server determines which CAPTCHA mode is active from the captchaType setting and validates accordingly. If captchaType is "none", neither field is required.


Pages

Manage custom content pages (e.g., /p/about).

ProcedureTypeAuthDescription
pages.listQueryProtectedGet all pages
pages.getBySlugQueryPublicGet a published page by slug
pages.createMutationProtectedCreate a page (validates slug uniqueness)
pages.updateMutationProtectedUpdate a page
pages.deleteMutationProtectedDelete a page

Create/Update Input

{
  title: string,
  slug: string,       // URL-safe, unique
  content: string,    // Markdown
  isPublished: boolean
}

vCard

Manage and download vCard contact files.

ProcedureTypeAuthDescription
vcard.getQueryProtectedGet vCard configuration
vcard.updateMutationProtectedCreate or update vCard data
vcard.downloadQueryPublicDownload generated .vcf file

Wallet

Manage Apple Wallet pass configuration.

ProcedureTypeAuthDescription
wallet.getQueryProtectedGet wallet pass config
wallet.updateMutationProtectedCreate or update wallet config
wallet.generateQueryProtectedGenerate .pkpass file (requires Apple signing)
wallet.statusQueryProtectedCheck whether all required Apple signing env vars are present

wallet.status Response

{
  configured: boolean,    // true if all 6 required env vars are set and non-empty
  missingVars: string[]  // list of variable names that are absent or empty
}

Required variables checked by wallet.status:

  • APPLE_PASS_TYPE_ID
  • APPLE_TEAM_ID
  • APPLE_WWDR_CERT
  • APPLE_SIGNER_CERT
  • APPLE_SIGNER_KEY
  • APPLE_SIGNER_PASSPHRASE

The wallet drawer in the admin panel calls this endpoint on open and displays a warning banner listing any missing variables.


Export

Import and export all data.

ProcedureTypeAuthDescription
export.exportAllQueryProtectedExport everything as JSON
export.importAllMutationProtectedReplace all data from JSON
export.importFromLinkStackMutationProtectedImport from LinkStack format

System

ProcedureTypeAuthDescription
system.checkUpdateQueryProtectedCheck for new releases on GitHub

On this page