v2 API Go Code Example

We recommend using SendGrid Go, our client library, available on GitHub, with full documentation.

The library does not officially support the V2 API, but you can use V2 with an older version of the library. For more information, see Continue Using V2 in Go.

Using SendGrid's Go Library

// using SendGrid's Go Library
// https://github.com/sendgrid/sendgrid-go
package main

import (

func main() {
	sg := sendgrid.NewSendGridClientWithApiKey("SENDGRID_APIKEY")

	message := sendgrid.NewMail()
	message.SetSubject("Sending with SendGrid is Fun")
	message.SetHTML("and easy to do anywhere, even with Go")

See a mistake? Edit this page