<commit_before>---
layout: page
weight: 0
title: Blocks
navigation:
  show: true
---

<p>This endpoint allows you to retrieve and delete entries in the Blocks list.</p>

{% anchor h2 %}
get 
{% endanchor %}
Retrieve a list of Blocks with addresses and response codes, optionally with dates.

  <table class="table table-bordered table-striped"><tbody>
<tr>
<th>Parameter</th>

        <th>Required</th>

        <th>Requirements</th>

        <th>Description</th>
      </tr>
<tr>
<td>date</td>

        <td>No</td>

        <td>Must be set to 1</td>

        <td>Retrieve the timestamp of the Block records. It will return a date in a MySQL
        timestamp format - YYYY-MM-DD HH:MM:SS</td>
      </tr>
<tr>
<td>days</td>

        <td>No</td>

        <td>If specified, must be an integer greater than 0</td>

        <td>Number of days in the past for which to retrieve blocks (includes today)</td>
      </tr>
<tr>
<td>start_date</td>

        <td>No</td>

        <td>Date must be in YYYY-MM-DD format and be earlier than the end_date
        parameter.</td>

        <td>The start of the date range for which to retrieve blocks.</td>
      </tr>
<tr>
<td>end_date</td>

        <td>No</td>

        <td>Date must be in YYYY-MM-DD format and be later than the start_date
        parameter.</td>

        <td>The end of the date range for which to retrieve blocks.</td>
      </tr>
       <tr> 
      <td>limit</td> 
      <td>No</td> 
      <td>some integer</td> 
      <td>Optional field to limit the number of results returned.</td> 
    </tr> 
    <tr> 
      <td>offset</td> 
      <td>No</td> 
      <td>some integer</td> 
      <td>optional beginning point in the list to retrieve from.</td> 
    </tr> 

</tbody></table>
{% apiexample get GET https://api.sendgrid.com/api/blocks.get api_user=your_sendgrid_username&amp;api_key=your_sendgrid_password&amp;date=1 %}
  {% response json %}
{
  "status": "4.0.0",
  "created": "2012-09-02 00:12:12",
  "reason": "550 Access denied...04d52d35b93501d500a9bca895ddad5cddd1a9f8486c89ace8c5e959398198cd49cd58288c9d11313975284d852811... (throttled)",
  "email": "<EMAIL>"
},
{
  "status": "4.0.0",
  "created": "2012-09-02 00:21:29",
  "reason": "Connection timed out",
  "email": "<EMAIL>"
},
{
  "status": "4.0.0",
  "created": "2012-09-02 00:25:33",
  "reason": "Unable to resolve MX record for exampledomain.com: nxdomain",
  "email": "<EMAIL>"
}
  {% endresponse %}
  {% response xml %}
<blocks>
   <block>
      <email><EMAIL></email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: <EMAIL></reason>
      <created>2009-06-10 12:40:30</created>
   </block>
   <block>
      <email><EMAIL></email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: <EMAIL></reason>
      <created>2009-08-01 10:16:30</created>
   </block>
</blocks>
  {% endresponse %}
{% endapiexample %}

<hr class="docs-separator">

{% anchor h2 %}
delete 
{% endanchor %}Delete an address from the Block list.

<table class="table table-bordered table-striped"><tbody>
<tr>
<th>Parameter</th>

        <th>Required</th>

        <th>Requirements</th>

        <th>Description</th>
      </tr>
<tr>
<td>email</td>

        <td>Yes</td>

        <td>Must be a valid user account email</td>

        <td>Email block address to remove</td>
      </tr>
</tbody></table>

{% apiexample delete POST https://api.sendgrid.com/api/blocks.delete api_user=your_sendgrid_username&amp;api_key=your_sendgrid_password&amp;email=<EMAIL>.<EMAIL>%}
  {% response json %}
//success
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."<commit_msg>cleanup markup<commit_after>---
layout: page
weight: 0
title: Blocks
navigation:
  show: true
---

<p>This endpoint allows you to retrieve and delete entries in the Blocks list.</p>

{% anchor h2 %}
get 
{% endanchor %}
Retrieve a list of Blocks with addresses and response codes, optionally with dates.
  <table class="table table-bordered table-striped">
  <tbody>
      <tr>
        <th>Parameter</th>

        <th>Required</th>

        <th>Requirements</th>

        <th>Description</th>
      </tr>

      <tr>
        <td>date</td>

        <td>No</td>

        <td>Must be set to 1</td>

        <td>Retrieve the timestamp of the Block records. It will return a date in a MySQL
        timestamp format - YYYY-MM-DD HH:MM:SS</td>
      </tr>

      <tr>
        <td>days</td>

        <td>No</td>

        <td>If specified, must be an integer greater than 0</td>

        <td>Number of days in the past for which to retrieve blocks (includes today)</td>
      </tr>

      <tr>
        <td>start_date</td>

        <td>No</td>

        <td>Date must be in YYYY-MM-DD format and be earlier than the end_date
        parameter.</td>

        <td>The start of the date range for which to retrieve blocks.</td>
      </tr>

      <tr>
        <td>end_date</td>

        <td>No</td>

        <td>Date must be in YYYY-MM-DD format and be later than the start_date
        parameter.</td>

        <td>The end of the date range for which to retrieve blocks.</td>
      </tr>

      <tr>
        <td>limit</td>

        <td>No</td>

        <td>some integer</td>

        <td>Optional field to limit the number of results returned.</td>
      </tr>

      <tr>
        <td>offset</td>

        <td>No</td>

        <td>some integer</td>

        <td>optional beginning point in the list to retrieve from.</td>
      </tr>
    </tbody>
  </table>

{% apiexample get GET https://api.sendgrid.com/api/blocks.get api_user=your_sendgrid_username&amp;api_key=your_sendgrid_password&amp;date=1 %}
  {% response json %}
{
  "status": "4.0.0",
  "created": "2012-09-02 00:12:12",
  "reason": "550 Access denied...04d52d35b93501d500a9bca895ddad5cddd1a9f8486c89ace8c5e959398198cd49cd58288c9d11313975284d852811... (throttled)",
  "email": "<EMAIL>"
},
{
  "status": "4.0.0",
  "created": "2012-09-02 00:21:29",
  "reason": "Connection timed out",
  "email": "<EMAIL>"
},
{
  "status": "4.0.0",
  "created": "2012-09-02 00:25:33",
  "reason": "Unable to resolve MX record for exampledomain.com: nxdomain",
  "email": "<EMAIL>"
}
  {% endresponse %}
  {% response xml %}
<blocks>
   <block>
      <email><EMAIL></email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: <EMAIL></reason>
      <created>2009-06-10 12:40:30</created>
   </block>
   <block>
      <email><EMAIL></email>
      <status>5.1.1</status>
      <reason>host [127.0.0.1] said: 550 5.1.1 unknown or illegal user: <EMAIL></reason>
      <created>2009-08-01 10:16:30</created>
   </block>
</blocks>
  {% endresponse %}
{% endapiexample %}

<hr class="docs-separator">

{% anchor h2 %}
delete 
{% endanchor %}Delete an address from the Block list.

  <table class="table table-bordered table-striped">
    <tbody>
      <tr>
        <th>Parameter</th>

        <th>Required</th>

        <th>Requirements</th>

        <th>Description</th>
      </tr>

      <tr>
        <td>email</td>

        <td>Yes</td>

        <td>Must be a valid user account email</td>

        <td>Email block address to remove</td>
      </tr>
    </tbody>
  </table>

{% apiexample delete POST https://api.sendgrid.com/api/blocks.delete api_user=your_sendgrid_username&amp;api_key=your_sendgrid_password&amp;email=<EMAIL>%}
  {% response json %}
//success
{
  "message": "success"
}

//error
{
  "message": "error",
  "errors": [
    "...error messages..."
{'fraction_non_alphanumeric': 0.163927908825868, 'fraction_numerical': 0.04797243572753777, 'mean_word_length': 2.6248799231508166, 'pattern_counts': {'":': 30, '<': 266, '<?xml version=': 0, '>': 266, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6706723', 'n_tokens_mistral': 2994, 'n_tokens_neox': 2677, 'n_words': 668}