Travis Badge

This library allows you to quickly and easily use the SendGrid Web API via Ruby.


BREAKING CHANGE as of 2016.06.14

Version 2.0.0 is a breaking change for the entire library.

Version 2.0.0 brings you full support for all Web API v3 endpoints. We have the following resources to get you started quickly:

Thank you for your continued support!

All updates to this library is documented in our CHANGELOG.


Setup Environment Variables

First, get your free SendGrid account here.

Next, update your environment with your SENDGRID_API_KEY.

echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env

Install Package

Add this line to your application's Gemfile:

gem 'sendgrid-ruby'

And then execute:


Or install it yourself using:

gem install sendgrid-ruby


Quick Start

Hello Email

require 'sendgrid-ruby'
include SendGrid

from = '')
subject = 'Hello World from the SendGrid Ruby Library'
to = '')
content = 'text/plain', value: 'some text here')
mail =, subject, to, content)

response = sg.client.mail._('send').post(request_body: mail.to_json)
puts response.status_code
puts response.body
puts response.headers

General v3 Web API Usage

require 'sendgrid-ruby'
response = sg.client.api_keys.get()
puts response.status_code
puts response.body
puts response.headers



If you are interested in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.

How to Contribute

We encourage contribution to our libraries, please see our CONTRIBUTING guide for details.


sendgrid-ruby is guided and supported by the SendGrid Developer Experience Team.

sendgrid-ruby is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of SendGrid, Inc.

SendGrid Logo