Skip to main content
NPM downloads

Installation

Install the package from npm:
npm install loops
You can install Loops skills to help your coding agents use the Loops CLI, API and SDKs to create campaigns, manage contacts, send events, and send transactional emails.
Minimum Node version required: 18.0.0. You will need a Loops API key to use the SDK. In your Loops account, go to the API Settings page and click Generate key. Copy this key and save it in your application code (for example as LOOPS_API_KEY in an .env file).

Next.js guide

Read our guide for sending email from Next.js projects.

Usage

import { LoopsClient, APIError } from "loops";

const loops = new LoopsClient(process.env.LOOPS_API_KEY);

try {
  const resp = await loops.createContact("test@example.com");
  // resp.success and resp.id available when successful
} catch (error) {
  if (error instanceof APIError) {
    console.log(error.json);
    console.log(error.statusCode);
  }
}
Import RateLimitExceededError to handle rate limits. See the SDK docs for every method, TypeScript types, rate limiting, and error handling. See the API documentation to learn more about rate limiting and error handling.

npm package

View the full documentation on npm.

GitHub

View the source code and release notes.

Loops API

Read the Loops API reference.
Last modified on June 2, 2026