# Spam Reports

> \[!WARNING]
>
> To access all the latest features and upcoming developments, please see our [v3 API](/docs/sendgrid/api-reference). For assistance with transitioning, refer to our [migration guide](/docs/sendgrid/for-developers/migration-guides/v2-to-v3-api).

Retrieve and delete entries in the Spam Reports list.

## Get

| URI Parameter | Required | Requirements                                                                   | Description                                                                                                                  |
| ------------- | -------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| date          | No       | Must be set to 1                                                               | Retrieve the timestamp of the spam report records. It will return a date in a MySQL timestamp format - `YYYY-MM-DD HH:MM:SS` |
| days          | No       | If specified, must be an integer greater than 0                                | Number of days in the past for which to retrieve spam reports (includes today)                                               |
| 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 spam reports.                                                              |
| 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 spam reports.                                                                |
| limit         | No       | Some integer                                                                   | Optional field to limit the number of results returned.                                                                      |
| offset        | No       | Some integer                                                                   | Optional beginning point in the list to retrieve from.                                                                       |
| email         | No       | Email address e.g. [testing@example.com](mailto:testing@example.com)           | Optional email addresses to search for.                                                                                      |

## JSON

### Call

| `GET`      | `https://api.sendgrid.com/api/spamreports.get.json`                     |
| ---------- | ----------------------------------------------------------------------- |
| `GET` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password&date=1` |

### Response

```javascript
[
  {
    "ip": "174.36.80.219",
    "email": "someone@example.com",
    "created": "2009-12-06 15:45:08"
  },
  {
    "ip": "74.63.202.105",
    "email": "example@example.com",
    "created": "2009-12-08 07:43:01"
  }
]
```

## XML

### Call \[#call-2]

| `GET`      | `https://api.sendgrid.com/api/spamreports.get.xml`                      |
| ---------- | ----------------------------------------------------------------------- |
| `GET` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password&date=1` |

### Response \[#response-2]

```xml
<spamreports>
   <spamreport>
      <ip>174.36.80.219</ip>
      <email>someone@example.com</email>
      <created>2009-12-06 15:45:08</created>
   </spamreport>
   <spamreport>
      <ip>74.63.202.105</ip>
      <email>example@example.com</email>
      <created>2009-12-08 07:43:01</created>
   </spamreport>
</spamreports>
```

***

## Count

Retrieve the count of Spam Reports.

| URI Parameter | Required | Requirements                                                                   | Description                                                     |
| ------------- | -------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------- |
| 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 spam reports. |
| 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 spam reports.   |

## JSON

### Call \[#call-3]

| `GET`      | `https://api.sendgrid.com/api/spamreports.count.json`            |
| ---------- | ---------------------------------------------------------------- |
| `GET` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password` |

### Response \[#response-3]

```javascript
{
  "count": 2
}
```

## XML

### Call \[#call-4]

| `GET`      | `https://api.sendgrid.com/api/spamreports.count.xml`             |
| ---------- | ---------------------------------------------------------------- |
| `GET` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password` |

### Response \[#response-4]

```xml
<result>
   <count>2</count>
   <result> </result>
</result>
```

***

## Delete

Delete an address from the Spam Reports list.

| URI Parameter | Required | Requirements                                                              | Description                                                   |
| ------------- | -------- | ------------------------------------------------------------------------- | ------------------------------------------------------------- |
| start\_date   | No       | Date must be in YYYY-mm-dd format and be before the end\_date parameter.  | Optional date to start deleting from.                         |
| end\_date     | No       | Date must be in YYYY-mm-dd format and be after the start\_date parameter. | Optional date to end deleting from.                           |
| email         | No       | Must be a valid user account email                                        | Email spam reports address to remove.                         |
| delete\_all   | No       | value=1                                                                   | This will delete the bounce list and will not be retrievable. |

## JSON

### Call \[#call-5]

| `POST`      | `https://api.sendgrid.com/api/spamreports.delete.json`                                          |
| ----------- | ----------------------------------------------------------------------------------------------- |
| `POST` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password&email=emailToDelete@domain.com` |

### Response \[#response-5]

```javascript
{
  "message": "success"
}
```

## XML

### Call \[#call-6]

| `POST`      | `https://api.sendgrid.com/api/spamreports.delete.xml`                                           |
| ----------- | ----------------------------------------------------------------------------------------------- |
| `POST` Data | `api_user=your_sendgrid_username&api_key=your_sendgrid_password&email=emailToDelete@domain.com` |

### Response \[#response-6]

```xml
<result>
   <message>success</message>
</result>
```
