Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

328 lines (252 sloc) 7.424 kb
layout weight title seo navigation
page
0
Subuser Unsubscribes
robots
NOINDEX, FOLLOW
show
true

{% warning %} This feature is deprecated, please go to the v2 Customer Subuser API Subuser Unsubscribes page. {% endwarning %}

{% anchor h2 %} Retrieve Unsubscribes {% endanchor %} Note that you can use either the days parameter or the start_date and end_date parameter.

Parameter Required Requirements Description
user Yes Subuser must be registered under your account The subuser we are retrieving unsubscribes from
task Yes Must be set to *get* This will allow you to retrieve the unsubscribes for the specified 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

{% xmljsontabs get %}

### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.xml {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=get&date= {% endrequestdata %} {% endrequestblock %} ### Response {% codeblock lang:xml %} email1@domain.com 2009-06-10 12:40:30 email2@domain2.com 2009-06-10 12:40:30 {% endcodeblock %}
### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.xml {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=get&date= {% endrequestdata %} {% endrequestblock %} ### Response {% codeblock lang:json %} [ { "email": "email1@domain.com", "created": "2009-06-01 19:41:39" }, { "email": "email2@domain2.com", "created": "2009-06-01 19:41:39" } ] {% endcodeblock %}


{% anchor h2 %} Delete Unsubscribes {% endanchor %} 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 Subuser must be registered under your account The 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 subuser
email No Must be an unsubscribe record You must specify the unsubscribe record to remove

{% xmljsontabs delete %}

### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.xml {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=delete&email=unsubscribe@sample.com {% endrequestdata %} {% endrequestblock %} ### Response: Success {% codeblock lang:xml %} success {% endcodeblock %} ### Response: Error {% codeblock lang:xml %} Email does not exist {% endcodeblock %}
### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.json {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=delete&email=unsubscribe@sample.com {% endrequestdata %} {% endrequestblock %} ### Response: Success {% codeblock lang:json %} { "message": "success" } {% endcodeblock %} ### Response: Error {% codeblock lang:json %} { "message": "Email does not exist" } {% endcodeblock %}


{% anchor h2 %} Add Unsubscribes {% endanchor %} 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 Subuser must be registered under your account The 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 subuser
email No Must be an unsubscribe record You must specify the unsubscribe record to add

{% xmljsontabs add %}

### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.xml {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=add&email=unsubscribe@sample.com {% endrequestdata %} {% endrequestblock %} ### Response: Success {% codeblock lang:xml %} success {% endcodeblock %} ### Response: Error {% codeblock lang:xml %} Email already exists {% endcodeblock %}
### Call {% requestblock %} {% requesturl POST %}https://api.sendgrid.com/api/user.unsubscribes.json {% endrequesturl %} {% requestdata Data POST %}api_user=your_sendgrid_username&api_key=your_sendgrid_password&user=example@example.com&task=add&email=unsubscribe@sample.com {% endrequestdata %} {% endrequestblock %} ### Response: Success {% codeblock lang:json %} { "message": "success" } {% endcodeblock %} ### Response: Error {% codeblock lang:json %} { "message": "Email already exists" } {% endcodeblock %}

Jump to Line
Something went wrong with that request. Please try again.