Skip to content

hiko1981/langr-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@langr/sdk

npm version TypeScript License: MIT

Official TypeScript SDK for the LANGR API — one API for email, SMS, auth, payments, SEO, content, and i18n.

Features

  • Mail API — Send transactional email via Resend. 8 verified domains. Inbox reading.
  • SMS API — Send SMS messages and OTP codes. Europe-optimized delivery.
  • Auth API — OTP (email + SMS), magic links, Google OAuth, session management.
  • Payment API — Stripe checkout, billing portal, webhook event tracking.
  • SEO API — Domain audits, keyword tracking, rankings, backlinks, Lighthouse scans.
  • Content API — AI content generation via Claude (blog posts, SEO copy, product descriptions).
  • i18n API — Translate text or JSON to 120+ locales. 9 RTL languages. Batch up to 50 locales.
  • Zero dependencies — Pure TypeScript, no runtime dependencies.
  • Full type safety — Complete TypeScript types for all requests and responses.

Install

npm install @langr/sdk

Quick Start

import { LangrClient } from "@langr/sdk";

const langr = new LangrClient({ apiKey: "lk_live_..." });

// Send an email
await langr.mail.send({
  from: "hello@yourdomain.com",
  to: "user@example.com",
  subject: "Welcome",
  html: "<h1>Hello!</h1>",
});

// Send SMS OTP and verify
await langr.sms.sendOtp({ to: "+4512345678" });
await langr.sms.verifyOtp({ to: "+4512345678", code: "123456" });

// Authenticate with magic link
await langr.auth.magicLink({
  email: "user@example.com",
  redirect_url: "https://example.com/auth/callback",
});

// Create a payment checkout
const checkout = await langr.payment.checkout({
  success_url: "https://example.com/success",
  cancel_url: "https://example.com/cancel",
  lookup_key: "pro_monthly",
});

// Generate AI content
const content = await langr.content.generate({
  type: "blog_post",
  prompt: "Write about modern web development",
  locale: "en",
});

// Translate to multiple languages
const result = await langr.i18n.translate({
  text: "Hello, world!",
  target_locales: ["da", "de", "ar", "ja"],
});

// SEO audit
await langr.seo.audit({ domain: "example.com" });

Services

Service Methods
mail send, inbox, message, domains
sms send, sendOtp, verifyOtp, stats
auth sendOtp, verifyOtp, magicLink, magicLinkVerify, googleAuthorize, googleCallback, validateSession, listSessions, revokeSession, revokeAllSessions
payment checkout, portal, events
seo audit, getAudit, projects, keywords, rankings, backlinks, competitors, analyst, crawl, fixes, customerOverview, lighthouse, bootstrap, pipelineTrigger, autoFix, health
content generate, usage
i18n translate, locales
keys list, create, update, revoke, rotate

47 endpoints across 11 services — all accessible from one client instance.

Why LANGR?

One API instead of many. Stop juggling Twilio, SendGrid, Resend, and Auth0. LANGR unifies email, SMS, auth, payments, SEO, content generation, and translation into a single API with one key.

  • 47 REST endpoints, one SDK
  • 120+ locales with 9 RTL languages
  • Europe-hosted, GDPR-compliant
  • Free tier: 100 requests/day, all services included
  • Pro: 10,000 requests/day, $49/month

Looking for a Twilio, SendGrid, or Resend alternative?

LANGR covers what you'd typically need 3-4 vendors for. See the full comparison.

Error Handling

import { LangrClient, LangrAPIError } from "@langr/sdk";

try {
  await langr.mail.send({ /* ... */ });
} catch (err) {
  if (err instanceof LangrAPIError) {
    console.error(err.code, err.message, err.status);
  }
}

Configuration

const langr = new LangrClient({
  apiKey: "lk_live_...",
  baseUrl: "https://api.langr.org", // default
});

Links

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors