0.0
The project is in a healthy, maintained state
SendX is an email marketing product. It helps you convert website visitors to customers, send them promotional emails, engage with them using drip sequences and craft custom journeys using powerful but simple automations.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.6, >= 3.6.0

Runtime

~> 1.0, >= 1.0.1
 Project Readme

SendX Ruby SDK

SendX REST API Documentation

🚀 Introduction

The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Key Features:

  • 🔒 Security: Team-based authentication with optional member-level access
  • 🎯 Resource-Oriented: RESTful design with clear resource boundaries
  • 📊 Rich Data Models: Three-layer model system (Input/Output/Internal)
  • 🔗 Relationships: Automatic prefix handling for resource relationships
  • 📈 Scalable: Built for high-volume email marketing operations

🏗️ Architecture Overview

SendX uses a three-layer model architecture:

  1. Input Models (RestE*): For API requests
  2. Output Models (RestR*): For API responses with prefixed IDs
  3. Internal Models: Core business logic (not exposed in API)

🔐 Security & Authentication

SendX uses API key authentication:

Team API Key

X-Team-ApiKey: YOUR_TEAM_API_KEY
  • Required for all requests
  • Team-level access to resources
  • Available in SendX Settings → Team API Key

🆔 Encrypted ID System

SendX uses encrypted IDs for security and better developer experience:

  • Internal IDs: Sequential integers (not exposed)
  • Encrypted IDs: 22-character alphanumeric strings
  • Prefixed IDs: Resource-type prefixes in API responses (contact_<22-char-id>)

ID Format

All resource IDs follow this pattern:

<resource_prefix>_<22_character_alphanumeric_string>

Example:

{
  "id": "contact_BnKjkbBBS500CoBCP0oChQ",
  "lists": ["list_OcuxJHdiAvujmwQVJfd3ss", "list_0tOFLp5RgV7s3LNiHrjGYs"],
  "tags": ["tag_UhsDkjL772Qbj5lWtT62VK", "tag_fL7t9lsnZ9swvx2HrtQ9wM"]
}

📚 Resource Prefixes

Resource Prefix Example
Contact contact_ contact_BnKjkbBBS500CoBCP0oChQ
Campaign campaign_ campaign_LUE9BTxmksSmqHWbh96zsn
List list_ list_OcuxJHdiAvujmwQVJfd3ss
Tag tag_ tag_UhsDkjL772Qbj5lWtT62VK
Sender sender_ sender_4vK3WFhMgvOwUNyaL4QxCD
Template template_ template_f3lJvTEhSjKGVb5Lwc5SWS
Custom Field field_ field_MnuqBAG2NPLm7PZMWbjQxt
Webhook webhook_ webhook_9l154iiXlZoPo7vngmamee
Post post_ post_XyZ123aBc456DeF789GhI
Post Category post_category_ post_category_YzS1wOU20yw87UUHKxMzwn
Post Tag post_tag_ post_tag_123XyZ456AbC
Member member_ member_JkL012MnO345PqR678

🎯 Best Practices

Error Handling

  • Always check status codes: 2xx = success, 4xx = client error, 5xx = server error
  • Read error messages: Descriptive messages help debug issues
  • Handle rate limits: Respect API rate limits for optimal performance

Data Validation

  • Email format: Must be valid email addresses
  • Required fields: Check documentation for mandatory fields
  • Field lengths: Respect maximum length constraints

Performance

  • Pagination: Use offset/limit for large datasets
  • Batch operations: Process multiple items when supported
  • Caching: Cache responses when appropriate

🛠️ SDKs & Integration

Official SDKs available for:

📞 Support

Need help? Contact us:

  • 💬 Website Chat: Available on sendx.io
  • 📧 Email: hello@sendx.io
  • 📚 Documentation: Full guides at help.sendx.io

API Endpoint: https://api.sendx.io/api/v1/rest

Installation

To install the gem:

Install via command line

gem install sendx-ruby-sdk

Install via Gemfile

source "https://rubygems.pkg.github.com/sendx" do
gem "sendx-ruby-sdk", "1.1.0"
end

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'sendx-ruby-sdk'

# Setup authorization
SendX.configure do |config|
  # Configure API key authorization: TeamApiKey
  config.api_key['X-Team-ApiKey'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['X-Team-ApiKey'] = 'Bearer'
end

api_instance = SendX::ContactApi.new
contact_request = SendX::ContactRequest.new(
  email: "john@doe.com",
  first_name: "John",
  last_name: "Doe",
  company: "SendX",
  last_tracked_ip: "34.94.159.140",
  tags: ["tag_MKdhTovsTJDetCyrJmRySL"],
  custom_fields: {
        'custom_field_MKdhTovsTJDetCyrJmRySe' => "VIP",
        "custom_field_MKdhTovsTFDetCyrJerRySL"=> "Subscribers"
    },
)

begin
  # Create a contact
  result = api_instance.create_contact(contact_request)
  p result
rescue SendX::ApiError => e
  puts "Error when calling ContactApi->create_contact: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.sendx.io/api/v1/rest

Class Method HTTP request Description
SendX::CampaignApi create_campaign POST /campaign Create campaign
SendX::CampaignApi delete_campaign DELETE /campaign/{identifier} Delete campaign
SendX::CampaignApi get_all_campaigns GET /campaign Get all campaigns
SendX::CampaignApi get_campaign GET /campaign/{identifier} Get campaign by ID
SendX::ContactApi create_contact POST /contact Create a new contact
SendX::ContactApi delete_contact DELETE /contact/{identifier} Delete contact
SendX::ContactApi get_all_contacts GET /contact Get all contacts
SendX::ContactApi get_contact GET /contact/{identifier} Get contact by ID
SendX::ContactApi unsubscribe_contact POST /contact/unsubscribe/{identifier} Unsubscribe contact
SendX::ContactApi update_contact PUT /contact/{identifier} Update contact
SendX::CustomFieldApi create_custom_field POST /customfield Create custom field
SendX::CustomFieldApi delete_custom_field DELETE /customfield/{identifier} Delete custom field
SendX::CustomFieldApi get_all_custom_fields GET /customfield Get all custom fields
SendX::CustomFieldApi get_custom_field GET /customfield/{identifier} Get custom field by ID
SendX::CustomFieldApi update_custom_field PUT /customfield/{identifier} Update custom field
SendX::EmailSendingApi send_email POST /send/email Send transactional email
SendX::EmailSendingApi send_email_with_template POST /send/template Send email using template
SendX::EventApi events_custom_postback_get GET /events/custom/postback Custom Event Postback URL
SendX::EventApi events_revenue_postback_get GET /events/revenue/postback Revenue Event Postback URL
SendX::EventsApi track_custom_event POST /events/custom Track custom event
SendX::EventsApi track_revenue_event POST /events/revenue Track revenue event
SendX::ListApi create_list POST /list Create list
SendX::ListApi delete_list DELETE /list/{identifier} Delete list
SendX::ListApi get_all_lists GET /list Get all lists
SendX::ListApi get_list GET /list/{identifier} Get list by ID
SendX::ListApi update_list PUT /list/{identifier} Update list
SendX::PostApi create_post POST /post Create blog post
SendX::PostApi delete_post DELETE /post/{identifier} Delete post
SendX::PostApi get_all_posts GET /post Get all posts
SendX::PostApi get_post GET /post/{identifier} Get post by ID
SendX::PostApi update_post PUT /post/{identifier} Update post
SendX::PostCategoryApi create_post_category POST /post/category Create post category
SendX::PostCategoryApi delete_post_category DELETE /post/category/{identifier} Delete post category
SendX::PostCategoryApi get_all_post_categories GET /post/category Get all post categories
SendX::PostCategoryApi get_post_category GET /post/category/{identifier} Get post category by ID
SendX::PostCategoryApi update_post_category PUT /post/category/{identifier} Update post category
SendX::PostTagApi create_post_tag POST /post/tag Create post tag
SendX::PostTagApi delete_post_tag DELETE /post/tag/{identifier} Delete post tag
SendX::PostTagApi get_all_post_tags GET /post/tag Get all post tags
SendX::PostTagApi get_post_tag GET /post/tag/{identifier} Get post tag by ID
SendX::PostTagApi update_post_tag PUT /post/tag/{identifier} Update post tag
SendX::ReportApi get_campaign_report GET /report/campaign/{identifier} Get campaign report
SendX::SenderApi create_sender POST /sender Create sender
SendX::SenderApi get_all_senders GET /sender Get all senders
SendX::TagApi create_tag POST /tag Create tag
SendX::TagApi delete_tag DELETE /tag/{identifier} Delete tag
SendX::TagApi get_all_tags GET /tag Get all tags
SendX::TagApi get_tag GET /tag/{identifier} Get tag by ID
SendX::TagApi update_tag PUT /tag/{identifier} Update tag
SendX::TeamMemberApi get_all_team_members GET /team/member Get all team members
SendX::TeamMemberApi get_team_member GET /team/member/{identifier} Get a team member by ID
SendX::TemplateApi create_email_template POST /template/email Create email template
SendX::TemplateApi delete_email_template DELETE /template/email/{identifier} Delete template
SendX::TemplateApi get_all_email_templates GET /template/email Get all templates
SendX::TemplateApi get_email_template GET /template/email/{identifier} Get template by ID
SendX::TemplateApi update_email_template PUT /template/email/{identifier} Update template
SendX::TrackingApi identify_contact POST /contact/identify Identify contact
SendX::TrackingApi track_contact POST /contact/track Track contact
SendX::WebhookApi create_webhook POST /webhook Create webhook
SendX::WebhookApi delete_webhook DELETE /webhook/{identifier} Delete webhook
SendX::WebhookApi get_all_webhooks GET /webhook Get all webhooks
SendX::WebhookApi get_webhook GET /webhook/{identifier} Get webhook by ID
SendX::WebhookApi update_webhook PUT /webhook/{identifier} Update webhook

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

TeamApiKey

  • Type: API key
  • API key parameter name: X-Team-ApiKey
  • Location: HTTP header