You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@kraiter/sdk

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kraiter/sdk

TypeScript SDK for the Kraiter email platform

Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
14
-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

@kraiter/sdk

TypeScript SDK for the Kraiter email platform. A thin, no-magic client with no hidden retries and no client-side state.

Installation

npm install @kraiter/sdk

Quick start

import { Mailer } from "@kraiter/sdk";

const mailer = new Mailer({
  apiKey: process.env.KRAITER_API_KEY,
});

// Create a contact
const contact = await mailer.contacts.create({
  email: "user@example.com",
  properties: { firstName: "John" },
});

// Track an event
await mailer.events.track({
  contactId: contact.contactId,
  event: "user_signed_up",
});

// Send a transactional email
await mailer.send.transactional({
  to: "user@example.com",
  templateId: "welcome-email",
});

Resources

The SDK provides the following resources:

ResourceDescription
mailer.contactsCreate, update, delete, and list contacts
mailer.eventsTrack and query events
mailer.templatesManage email templates
mailer.sequencesManage automated sequences
mailer.campaignsManage campaigns
mailer.segmentsCreate and manage segments
mailer.domainsManage sending domains
mailer.sendSend transactional emails

Configuration

const mailer = new Mailer({
  // Required: your API key
  apiKey: "kr_live_...",

  // Optional: override the base URL (defaults to https://api.kraiter.com)
  baseUrl: "https://api.kraiter.com",

  // Optional: request timeout in ms (default: 30000)
  timeout: 10000,

  // Optional: custom fetch implementation
  fetch: myCustomFetch,
});

Error handling

import { Mailer, MailerError, MailerTimeoutError } from "@kraiter/sdk";

try {
  await mailer.contacts.create({ email: "user@example.com" });
} catch (error) {
  if (error instanceof MailerError) {
    console.error(error.message);    // Human-readable message
    console.error(error.statusCode); // HTTP status code
    console.error(error.code);       // Error code from the API
  }

  if (error instanceof MailerTimeoutError) {
    console.error("Request timed out");
  }
}

Documentation

Full documentation is available at kraiter.com/docs/sdk-reference.

Licence

MIT

Keywords

kraiter

FAQs

Package last updated on 11 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts