Skip to main content
Gem Total Downloads

Installation

Add the gem to your Gemfile:
bundle add loops_sdk
Or install it directly:
gem install loops_sdk
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.
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 in an environment variable).

Usage

Configure the SDK in an initializer:
config/initializers/loops.rb
require "loops_sdk"

LoopsSdk.configure do |config|
  config.api_key = ENV["LOOPS_API_KEY"]
end
Then call SDK methods in your application:
begin
  response = LoopsSdk::Contacts.create(
    email: "test@example.com",
    properties: { firstName: "John" }
  )
rescue LoopsSdk::APIError => e
  puts "Loops API Error: #{e.json['message']} (Status: #{e.statusCode})"
end
See the SDK docs for every method, rate limiting, and error handling. See the API documentation to learn more about rate limiting and error handling.

RubyGems

View the gem on RubyGems.

GitHub

View the documentation and source code.

Loops API

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