Retrieve Bounces

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 bounces from
task Yes Must be set to get This will allow you to retrieve the bounces 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

POST https://api.sendgrid.com/apiv2/reseller.manageSubuser.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&method=bounces&user=example@example.com&task=get&date=

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
  {
    "email": "email1@domain.com",
    "status": "5.1.1",
    "reason": "host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: email1@domain.com",
    "created": "2009-06-01 19:41:39"
  },
  {
    "email": "email2@domain2.com",
    "status": "5.1.1",
    "reason": "host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: email2@domain2.com",
    "created": "2009-06-01 19:41:39"
  }
]

Call

POST https://api.sendgrid.com/apiv2/reseller.manageSubuser.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&method=bounces&user=example@example.com&task=get&date=

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="ISO-8859-1"?>

<bounces>
   <bounce>
      <email>email1@domain.com</email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: email1@domain.com</reason>
      <created>2009-06-10 12:40:30</created>
   </bounce>
   <bounce>
      <email>email2@domain2.com</email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: email2@domain2.com</reason>
      <created>2009-06-10 12:40:30</created>
   </bounce>
</bounces>

Delete Bounces

Since SendGrid does not re-deliver to bounced addresses, users can remove bounces from their list at any time if redelivery to a bounced address is desired.

Parameter Required Requirements Description
user Yes Subuser must be registered under your account The subuser we are retrieving bounces from
task Yes Must be set to delete This will allow you to delete the bounces for the specified user
email No Bounce email address you want to delete You must specify the bounced email message to remove

Call

POST https://api.sendgrid.com/apiv2/reseller.manageSubuser.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&method=bounces&user=example@example.com&task=delete&email=bounce@example.com

Response

1
2
3
4
5
6
7
8
{
  "message": "success"
}

//error
{
  "message": "Email does not exist"
}

Call

POST https://api.sendgrid.com/apiv2/reseller.manageSubuser.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&method=bounces&user=example@example.com&task=delete&email=bounce@example.com

Response

1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>success</message>
</result>

<!-- error -->
<?xml version="1.0" encoding="ISO-8859-1"?>

<result>
   <message>Email does not exist</message>
</result>