| layout | page | ||
|---|---|---|---|
| weight | 0 | ||
| title | Unsubscribes | ||
| navigation |
|
Retrieve, delete and add entries in the Unsubscribes list.
{% anchor h2 %} get {% endanchor %}
Retrieve a list of Unsubscribes with addresses and optionally with dates.
{% parameters get %}
{% parameter date No 'Must 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.' %}
{% parameter days No 'If specified, must be an integer greater than 0.' 'Number of days in the past for which to retrieve unsubscribes (includes today).' %}
{% parameter start_date No 'Date 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.' %}
{% parameter end_date No 'Date 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.' %}
{% parameter limit No 'Some integer.' 'Optional field to limit the number of results returned.' %}
{% parameter offset No 'Some integer.' 'Optional beginning point in the list to retrieve from.' %}
{% parameter email No 'Email address eg [email protected].' 'Optional email addresses to search for.' %}
{% endparameters %}
{% apiexample get GET https://api.sendgrid.com/api/unsubscribes.get api_user=your_sendgrid_username&api_key=your_sendgrid_password&date=1 %} {% response json %} [ { "email": "[email protected]", "created": "2012-09-06 14:03:18" } ] {% endresponse %} {% response xml %} [email protected] 2012-09-06 14:03:18
{% endresponse %} {% endapiexample %}
{% anchor h2 %} delete {% endanchor %}
Delete an address from the Unsubscribe list. Use delete_all=1 in order to delete all addresses from your unsubscribe list.
{% parameters delete %} {% parameter email No 'Must be a valid user account email.' 'Unsubscribed email address to remove.' %} {% endparameters %}
{% apiexample delete POST https://api.sendgrid.com/api/unsubscribes.delete api_user=your_sendgrid_username&api_key=your_sendgrid_password&email=[email protected] %} {% response json %} { "message": "success" } {% endresponse %} {% response xml %} success
{% endresponse %} {% endapiexample %}
{% anchor h2 %} add {% endanchor %}
Add email addresses to the Unsubscribe list.
{% parameters add %} {% parameter email Yes 'Must be a valid email address.' 'Email address to add to unsubscribe list.' %} {% endparameters %}
{% apiexample add POST https://api.sendgrid.com/api/unsubscribes.add api_user=your_sendgrid_username&api_key=your_sendgrid_password&email=[email protected] %} {% response json %} { "message": "success" } {% endresponse %} {% response xml %} success
{% endresponse %} {% endapiexample %}