Retrieve Unsubscribes
Note that you can use
either
the days parameter
or
the start_date and end_date parameter.
Parameter
Required
Requirements
Description
user
Yes
Customer subuser must be registered under
your account
The customer subuser we are retrieving
unsubscribes from
task
Yes
Must be set to
get
This will allow you to retrieve the
unsubscribes for the specified customer subuser
date
No
Must be set to 1
Retrieves the timestamps, it will return a
date in a MySQL timestamp format - YYYY-MM-DD HH:MM:SS
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.xml?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=get&date=
Response
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>
<unsubscribes>
<unsubscribe>
<email> email1@domain.com</email>
<created> 2009-06-10 12:40:30</created>
</unsubscribe>
<unsubscribe>
<email> email2@domain2.com</email>
<created> 2009-06-10 12:40:30</created>
</unsubscribe>
</unsubscribes>
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.xml?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=get&date=
Response
1
2
3
4
5
6
7
8
9
10
[
{
"email" : "email1@domain.com" ,
"created" : "2009-06-01 19:41:39"
},
{
"email" : "email2@domain2.com" ,
"created" : "2009-06-01 19:41:39"
}
]
Delete Unsubscribes
Since SendGrid does not deliver to unsubscribe addresses, users can remove unsubscribes from their list at any time if re-delivery to an unsubscribed address is desired.
Parameter
Required
Requirements
Description
user
Yes
Customer subuser must be registered under
your account
The customer subuser we are retrieving
unsubscribes from
task
Yes
Must be set to
delete
This will allow you to delete an unsubscribe
record for the specified customer subuser
email
No
Must be an unsubscribe record
You must specify the unsubscribe record to
remove
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.xml?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=delete&email=unsubscribe@sample.com
Response: Success
1
2
3
4
5
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message> success</message>
</result>
Response: Error
1
2
3
4
5
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message> Email does not exist</message>
</result>
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.json?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=delete&email=unsubscribe@sample.com
Response: Success
1
2
3
{
"message" : "success"
}
Response: Error
1
2
3
{
"message" : "Email does not exist"
}
Add Unsubscribes
Add unsubscribe email records to their account if they need to stop sending email messages to a specific recipient.
Parameter
Required
Requirements
Description
user
Yes
Customer subuser must be registered under
your account
The customer subuser we are retrieving
unsubscribes from
task
Yes
Must be set to
add
This will allow you to add an unsubscribe
record for the specified customer subuser
email
No
Must be an unsubscribe record
You must specify the unsubscribe record to
add
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.xml?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=add&email=unsubscribe@sample.com
Response: Success
1
2
3
4
5
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message> success</message>
</result>
Response: Error
1
2
3
4
5
<?xml version="1.0" encoding="ISO-8859-1"?>
<result>
<message> Email already exists</message>
</result>
Call
1
https://sendgrid.com/apiv2/reseller.manageSubuser.json?api_user=username&api_key=secureSecret&method=unsubscribes&user=example@example.com&task=add&email=unsubscribe@sample.com
Response: Success
1
2
3
{
"message" : "success"
}
Response: Error
1
2
3
{
"message" : "Email already exists"
}