Console
Taqlyn Docs/Server SDKs/Server SDKs
API v1.411 min read

Server SDKs

Complete multi-language guide to minting, signing, and managing short links across Node.js, Python, Go, Kotlin, Java, .NET, PHP, Ruby, and cURL.

SDK Language
LIVE SPECIMEN
Universal & Deferred Link Simulator
URLhttps://taqlyn.com/shop/checkout?cartId=cart_9841&promo=WELCOME20&aff=partner_8
Route: /shop/checkoutMode: Deferred Install

Taqlyn Server SDKs provide cryptographic link creation, parameter binding, and lifecycle routing for backend microservices and web servers. Unlike client-side mobile SDKs—which only use a public clientId and publicKeyId—server SDKs use asymmetric Ed25519 cryptographic signing with a private key to authenticate privileged operations.

Security Guardrail: The private key PEM (-----BEGIN PRIVATE KEY-----) must never be bundled into client-facing applications (iOS, Android, React Native, or web frontends). Keep it securely in your secret manager or environment variables.


#Installation

Install the official package for your runtime environment:

npm install @taqlyn/sdk-node
# or: pnpm add @taqlyn/sdk-node | bun add @taqlyn/sdk-node | yarn add @taqlyn/sdk-node

#Initialization

Initialize a shared client instance during service startup using your environment variables:

import { TaqlynClient } from "@taqlyn/sdk-node";

const taqlyn = new TaqlynClient({
  baseUrl: process.env.TAQLYN_BASE_URL || "https://api.taqlyn.com",
  clientId: process.env.TAQLYN_CLIENT_ID!,
  privateKey: process.env.TAQLYN_PRIVATE_KEY!,
});

#Configuration Parameters

Configure your backend server with three standard environment variables and optional transport settings:

ParameterTypeRequiredDescription
baseUrl / BaseURLstringNoTaqlyn API Gateway origin (defaults to https://api.taqlyn.com).
clientId / ClientIDstringYesApplication identifier handle (app_test_* or app_live_*).
privateKey / PrivateKeyPEMstringYesPKCS#8 Ed25519 private key PEM (-----BEGIN PRIVATE KEY-----).
httpClient / fetchobjectNoOptional custom HTTP client instance for proxy, mTLS, or custom timeout control.

Generate short links programmatically during checkout, invite flows, user referral generation, or marketing campaigns:

const link = await taqlyn.createShortLink({
  destinationWeb: "https://myshop.com/products/42",
  destinationPath: "/products/42",
  params: {
    productId: "42",
    promoCode: "SUMMER30",
    referrer: "marketing_email",
  },
  mode: "deferred_app",
});

console.log("Short URL:", link.shortUrl);
console.log("Link ID:  ", link.id);

When requesting a short link, configure the four primary routing properties:

FieldTypeRequiredDescription
destinationWebstringYesFallback HTTPS URL if the recipient opens the link on desktop or without the mobile app installed.
destinationPathstringNoIn-app deep route path (e.g. /items/42). Delivered directly to the mobile routing engine upon install or tap.
paramsmap<string, string>NoContextual key-value pairs restored by the mobile SDK on first open (affiliate IDs, promo codes, referral tokens).
modestring / enumNoRouting behavior across mobile and web targets. Default: deferred_app.

#Available Routing Modes

  • deferred_app: Standard universal deferred link. Attempts to open installed app; redirects to app store or web fallback if app is not installed.
  • web_only: Always redirects to destinationWeb regardless of device or app installation status.
  • app_only: Restricted strictly to installed mobile clients; returns an advisory fallback page on unsupported desktop platforms.

#Web Framework Integration

Integrate Taqlyn link creation directly into controllers, API routes, and dependency injection containers:

// Next.js Server Action: app/actions/invite.ts
"use server";

import { TaqlynClient } from "@taqlyn/sdk-node";

const taqlyn = new TaqlynClient({
  clientId: process.env.TAQLYN_CLIENT_ID!,
  privateKey: process.env.TAQLYN_PRIVATE_KEY!,
});

export async function createReferral(userId: string) {
  const link = await taqlyn.createShortLink({
    destinationWeb: `https://myapp.com/invite?from=${userId}`,
    destinationPath: "/invite/accept",
    params: { referrer: userId },
    mode: "deferred_app",
  });
  return link.shortUrl;
}

#Error Handling

When requests fail authentication, payload validation, or plan rate caps, the SDKs surface structured API exceptions:

import { TaqlynApiError } from "@taqlyn/sdk-node";

try {
  const link = await taqlyn.createShortLink(payload);
} catch (error) {
  if (error instanceof TaqlynApiError) {
    console.error("HTTP Status:", error.status); // e.g. 401, 403, 422
    console.error("Error Code: ", error.code);   // e.g. "INVALID_SIGNATURE"
    console.error("Message:    ", error.message);
  }
}

#Common Error Codes

StatusCodeMeaning & Solution
401INVALID_SIGNATUREPrivate key does not match the active public key registered in the Console.
401EXPIRED_TIMESTAMPServer clock drift exceeds ±300 seconds. Ensure host NTP daemon is synchronized.
403PLAN_CAP_EXCEEDEDMonthly link creation quota reached. Upgrade plan in Console Billing.
422INVALID_DESTINATIONdestinationWeb must be a valid, absolute HTTPS URL.

#Kotlin & Java (JVM) Interoperability

The JVM SDK (com.taqlyn:sdk) is written in Kotlin and targets Java 17 bytecode. Java applications can call all APIs directly without needing Kotlin runtime adapters:

  1. Both Kotlin DSL and Maven POM Supported: Works in modern Kotlin multiplatform builds and classic Maven Java enterprise stacks.
  2. Dual-Accessor Architecture: Java callers can access fields using either Java 16+ record accessors (link.shortUrl()) or classic JavaBean getters (link.getShortUrl()).
  3. Static Signer Methods: Cryptographic signing helpers use @JvmStatic, allowing Java classes to call Signer.loadPkcs8Pem(...) and Signer.signedHeaders(...) as regular static Java methods.
  4. Unchecked Exceptions: Exceptions inherit from java.lang.RuntimeException, giving you the choice of try-catch blocks or higher-level framework exception handlers.