Skip to contentSkip to navigationSkip to topbar
On this page

Unsubscribes


(warning)

This documentation is for the SendGrid Web API v2

We will deprecate this version on February 10, 2025. To access all the latest features and upcoming developments, please see our v3 API. For assistance with transitioning, refer to our migration guide.

Retrieve, delete, and add entries in the Unsubscribes list.


Get

get page anchor

Retrieve a list of Unsubscribes with addresses and optionally with dates.

URI ParameterRequiredRequirementsDescription
dateNoMust be set to 1.Retrieve the timestamp of the unsubscribe records. It will return a date in a MySQL timestamp format - YYYY-MM-DD HH:MM:SS.
daysNoIf specified, must be an integer greater than 0.Number of days in the past for which to retrieve unsubscribes (includes today).
start_dateNoDate must be in YYYY-MM-DD format and be earlier than the end_date parameter.The start of the date range for which to retrieve unsubscribes.
end_dateNoDate must be in YYYY-MM-DD format and be later than the start_date parameter.The end of the date range for which to retrieve unsubscribes.
limitNoSome integer.Optional field to limit the number of results returned.
offsetNoSome integer.Optional beginning point in the list to retrieve from.
emailNoEmail address (e.g. testing@example.com).Optional email addresses to search for.
JSONXML

Call

GEThttps://api.sendgrid.com/api/unsubscribes.get.json
GET Dataapi_user=apikey&api_key=your_sendgrid_api_key&date=1

Response

1
[
2
{
3
"email": "example@example.com",
4
"created": "2012-09-06 14:03:18"
5
}
6
]

Delete an address from the Unsubscribe list. Use delete_all=1 in order to delete all addresses from your unsubscribe list.

URI ParameterRequiredRequirementsDescription
emailNoMust be a valid user account email.Unsubscribed email address to remove.
JSONXML
POSThttps://api.sendgrid.com/api/unsubscribes.delete.json
POST Dataapi_user=apikey&api_key=your_sendgrid_api_key&email=emailToDelete@domain.com
1
{
2
"message": "success"
3
}

Add email addresses to the Unsubscribe list.

URI ParameterRequiredRequirementsDescription
emailYesMust be a valid email address.Email address to add to unsubscribe list.
JSONXML
POSThttps://api.sendgrid.com/api/unsubscribes.add.json
POST Dataapi_user=apikey&api_key=your_sendgrid_api_key&email=email2@domain.com
1
{
2
"message": "success"
3
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.