# Defendant Level

## Filter by defendant level ID (integer).

<mark style="color:blue;">`GET`</mark> `https://clearinghouse.net/api/v2p1/cases?defendant_type=defendant_level_id`

#### Query Parameters

| Name                                                   | Type    | Description                                                                    |
| ------------------------------------------------------ | ------- | ------------------------------------------------------------------------------ |
| defendant\_level\_id<mark style="color:red;">\*</mark> | integer | Defendent level ID (see list below for list of integers and its mapped values) |

#### Headers

| Name                                            | Type   | Description                                                                                                                    |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Authorization</p><p><code>Token XXXXXXXXXXX</code></p><p>where</p><p><code>XXXXXXXXXXX</code></p><p>is the token string</p> |

{% tabs %}
{% tab title="200 Cases successfully retrieved" %}

{% endtab %}

{% tab title="400: Bad Request No results, key not found, or invalid parameter" %}

```javascript
\\ Examples of:
\\ No results, key not found, or invalid parameter

\\ No results
\\ Example query endpoint: /api/v2p1/cases/?case_id=1&case_ongoing=1
["No results for {'case_id': '1', 'case_ongoing': '1'}"]

\\ Key not found
\\ Example query endpoint: /api/v2p1/cases?test_key=1
["API Error: Key: test_key, Value: 1 not found."]

\\ Example query endpoint: /api/v2p1/cases/?case_id=xyz
["API Error: xyz is not an integer."]
```

{% endtab %}

{% tab title="401 Permission denied" %}

```javascript
{
    "detail":"Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

This will filter cases that contain a defendant with the queried defendant level.

Supported defendant level IDs (defendant\_level\_id):

| 6149 | Federal                |
| ---- | ---------------------- |
| 6147 | City                   |
| 6148 | County                 |
| 6156 | Non-profit or advocacy |
| 6151 | Political Party        |
| 6150 | Private Entity/Person  |
| 6154 | Regional               |
| 6152 | School District        |
| 6146 | State                  |
| 6153 | Tribe                  |
| 6155 | Union                  |

For more information about defendant levels, see [#defendant\_level](https://api.clearinghouse.net/objects/defendant#defendant_level "mention").

**Example**

{% tabs %}
{% tab title="URL" %}

```
https://clearinghouse.net/api/v2p1/cases?defendant_level=6147
```

{% endtab %}

{% tab title="python" %}

```
import requests

url = "https://clearinghouse.net/api/v2p1/cases?defendant_level=6147"
headers = { 'Authorization': 'Token XXXXXXXXXX',
'User-Agent': 'Chrome v22.2 Linux Ubuntu'
}
response = requests.request("GET", url, headers=headers, data={})

print(response.text)
```

{% endtab %}
{% endtabs %}
