package
4.0.0-rc.10
Repository: https://github.com/sendgrid/sendgrid-go.git
Documentation: pkg.go.dev

# README

Go API client for

The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as "active" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active.

This API provides operations to create and manage your templates as well as their versions.

Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts.

Overview

This API client was generated by the OpenAPI Generator project from the OpenAPI specs located at twilio/sendgrid-oai. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version:
  • Build date: 2025-08-18T08:58:25.187016Z[Etc/UTC]
  • Build package: com.sendgrid.oai.go.SendgridGoGenerator For more information, please visit https://support.sendgrid.com/hc/en-us

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./"

Documentation for API Endpoints

All URIs are relative to https://api.sendgrid.com

ClassMethodHTTP requestDescription
ActivateTemplateVersionActivateTemplateVersionPost /v3/templates/{TemplateId}/versions/{VersionId}/activateActivate a transactional template version.
CreateTemplateCreateTemplatePost /v3/templatesCreate a transactional template.
CreateTemplateVersionCreateTemplateVersionPost /v3/templates/{TemplateId}/versionsCreate a new transactional template version.
DeleteTemplateDeleteTemplateDelete /v3/templates/{TemplateId}Delete a template.
DeleteTemplateVersionDeleteTemplateVersionDelete /v3/templates/{TemplateId}/versions/{VersionId}Delete a transactional template version.
DuplicateTemplateDuplicateTemplatePost /v3/templates/{TemplateId}Duplicate a transactional template.
GetTemplateGetTemplateGet /v3/templates/{TemplateId}Retrieve a single transactional template.
GetTemplateVersionGetTemplateVersionGet /v3/templates/{TemplateId}/versions/{VersionId}Retrieve a specific transactional template version.
ListTemplateListTemplateGet /v3/templatesRetrieve paged transactional templates.
UpdateTemplateUpdateTemplatePatch /v3/templates/{TemplateId}Edit a transactional template.
UpdateTemplateVersionUpdateTemplateVersionPatch /v3/templates/{TemplateId}/versions/{VersionId}Edit a transactional template version.

Documentation For Models

Documentation For Authorization

BearerAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)