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 Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' Contacts API, Lists API, and Segments API to manage your contacts.

See Migrating from Legacy Marketing Campaigns for more information.

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:27.724777Z[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
AddRecipientAddRecipientPost /v3/contactdb/recipientsAdd recipients
AddRecipientToContactDbListAddRecipientToContactDbListPost /v3/contactdb/lists/{ListId}/recipients/{RecipientId}Add a Single Recipient to a List
AddRecipientsToContactDbListAddRecipientsToContactDbListPost /v3/contactdb/lists/{ListId}/recipientsAdd Multiple Recipients to a List
CreateContactDbListCreateContactDbListPost /v3/contactdb/listsCreate a List
CreateCustomFieldCreateCustomFieldPost /v3/contactdb/custom_fieldsCreate a Custom Field
CreateSegmentCreateSegmentPost /v3/contactdb/segmentsCreate a Segment
DeleteContactDbListDeleteContactDbListDelete /v3/contactdb/lists/{ListId}Delete a List
DeleteContactDbListsDeleteContactDbListsDelete /v3/contactdb/listsDelete Multiple lists
DeleteCustomFieldDeleteCustomFieldDelete /v3/contactdb/custom_fields/{CustomFieldId}Delete a Custom Field
DeleteRecipientDeleteRecipientDelete /v3/contactdb/recipients/{RecipientId}Delete a Recipient
DeleteRecipientFromContactDbListDeleteRecipientFromContactDbListDelete /v3/contactdb/lists/{ListId}/recipients/{RecipientId}Delete a Single Recipient from a Single List
DeleteRecipientsDeleteRecipientsDelete /v3/contactdb/recipientsDelete Recipients
DeleteSegmentDeleteSegmentDelete /v3/contactdb/segments/{SegmentId}Delete a segment
ExportRecipientExportRecipientPost /v3/contactdb/exportsExport Recipients
GetBillableGetBillableGet /v3/contactdb/recipients/billable_countRetrieve the count of billable recipients
GetContactDbListGetContactDbListGet /v3/contactdb/lists/{ListId}Retrieve a single list
GetCustomFieldGetCustomFieldGet /v3/contactdb/custom_fields/{CustomFieldId}Retrieve a Custom Field
GetExportRecipientGetExportRecipientGet /v3/contactdb/exports/{Id}Export Recipients Status
GetRecipientGetRecipientGet /v3/contactdb/recipients/{RecipientId}Retrieve a single recipient
GetRecipientListGetRecipientListGet /v3/contactdb/recipients/{RecipientId}/listsRetrieve the lists that a recipient is on
GetSegmentGetSegmentGet /v3/contactdb/segments/{SegmentId}Retrieve a segment
ListContactDbListListContactDbListGet /v3/contactdb/listsRetrieve all lists
ListCustomFieldListCustomFieldGet /v3/contactdb/custom_fieldsRetrieve all custom fields
ListExportRecipientListExportRecipientGet /v3/contactdb/exportsGet All Existing Exports
ListRecipientListRecipientGet /v3/contactdb/recipientsRetrieve recipients
ListRecipientCountListRecipientCountGet /v3/contactdb/recipients/countRetrieve a Count of Recipients
ListRecipientForSegmentListRecipientForSegmentGet /v3/contactdb/segments/{SegmentId}/recipientsRetrieve recipients on a segment
ListRecipientsFromContactDbListListRecipientsFromContactDbListGet /v3/contactdb/lists/{ListId}/recipientsRetrieve all recipients on a List
ListReservedFieldListReservedFieldGet /v3/contactdb/reserved_fieldsRetrieve reserved fields
ListSearchRecipientListSearchRecipientGet /v3/contactdb/recipients/searchSearch recipients
ListSegmentListSegmentGet /v3/contactdb/segmentsRetrieve all segments
ListStatusListStatusGet /v3/contactdb/statusGet Recipient Upload Status
SearchRecipientSearchRecipientPost /v3/contactdb/recipients/searchSearch recipients
UpdateContactDbListUpdateContactDbListPatch /v3/contactdb/lists/{ListId}Update a List
UpdateRecipientUpdateRecipientPatch /v3/contactdb/recipientsUpdate Recipient
UpdateSegmentUpdateSegmentPatch /v3/contactdb/segments/{SegmentId}Update a segment

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)