# IP Filters

## Create

`teams.ip_filters.create(strteam_id, IPFilterCreateParams**kwargs)  -> IPFilterCreateResponse`

**post** `/teams/{teamId}/ip-filters`

Create a custom IP-detection filter for a team (built-in filters are toggled via PUT /teams/{teamId}/ip-filters/{filterId})

### Parameters

- `team_id: str`

- `category: Literal["artist-style", "brand-trademark", "celebrity-likeness", 2 more]`

  Filter category; use "custom" for customer-authored filters

  - `"artist-style"`

  - `"brand-trademark"`

  - `"celebrity-likeness"`

  - `"custom"`

  - `"fictional-character"`

- `name: str`

  Display name for the filter

- `enabled: Optional[bool]`

  Whether the filter is active

- `instruction: Optional[str]`

  Natural-language detection instruction (required for custom filters)

- `source_asset_ids: Optional[Sequence[str]]`

  Optional reference assets used only to generate the instruction

### Returns

- `class IPFilterCreateResponse: …`

  - `filter: object`

    The created custom filter, including its enabled state

### Example

```python
import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
ip_filter = client.teams.ip_filters.create(
    team_id="teamId",
    category="artist-style",
    name="name",
)
print(ip_filter.filter)
```

#### Response

```json
{
  "filter": {}
}
```

## Delete

`teams.ip_filters.delete(strfilter_id, IPFilterDeleteParams**kwargs)  -> IPFilterDeleteResponse`

**delete** `/teams/{teamId}/ip-filters/{filterId}`

Delete a custom IP-detection filter for a team

### Parameters

- `team_id: str`

- `filter_id: str`

### Returns

- `class IPFilterDeleteResponse: …`

  - `deleted: bool`

    True when the filter was deleted

### Example

```python
import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
ip_filter = client.teams.ip_filters.delete(
    filter_id="filterId",
    team_id="teamId",
)
print(ip_filter.deleted)
```

#### Response

```json
{
  "deleted": true
}
```

## Draft Instruction

`teams.ip_filters.draft_instruction(strteam_id, IPFilterDraftInstructionParams**kwargs)  -> IPFilterDraftInstructionResponse`

**post** `/teams/{teamId}/ip-filters/draft-instruction`

Draft a custom IP-detection filter instruction from reference assets (the caller must have read access to every asset)

### Parameters

- `team_id: str`

- `asset_ids: Sequence[str]`

  Reference assets whose imagery seeds the drafted detection instruction

### Returns

- `class IPFilterDraftInstructionResponse: …`

  - `instruction: str`

    Drafted natural-language detection instruction derived from the reference assets

### Example

```python
import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
response = client.teams.ip_filters.draft_instruction(
    team_id="teamId",
    asset_ids=["string"],
)
print(response.instruction)
```

#### Response

```json
{
  "instruction": "instruction"
}
```

## List

`teams.ip_filters.list(strteam_id)  -> IPFilterListResponse`

**get** `/teams/{teamId}/ip-filters`

List the built-in and custom IP-detection filters available to a team, with their enabled state

### Parameters

- `team_id: str`

### Returns

- `class IPFilterListResponse: …`

  - `filters: List[object]`

    Built-in and custom IP-detection filters for the team, each with its enabled state

### Example

```python
import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
ip_filters = client.teams.ip_filters.list(
    "teamId",
)
print(ip_filters.filters)
```

#### Response

```json
{
  "filters": [
    {}
  ]
}
```

## Update

`teams.ip_filters.update(strfilter_id, IPFilterUpdateParams**kwargs)  -> IPFilterUpdateResponse`

**put** `/teams/{teamId}/ip-filters/{filterId}`

Enable, disable, or override a built-in or custom IP-detection filter for a team

### Parameters

- `team_id: str`

- `filter_id: str`

- `enabled: Optional[bool]`

  Whether the filter is active

- `instruction: Optional[str]`

  Natural-language detection instruction

- `name: Optional[str]`

  Display name for the filter

### Returns

- `class IPFilterUpdateResponse: …`

  - `filter: object`

    The updated filter, including its enabled state

### Example

```python
import os
from scenario_sdk import Scenario

client = Scenario(
    api_key=os.environ.get("SCENARIO_SDK_API_KEY"),  # This is the default and can be omitted
    api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"),  # This is the default and can be omitted
)
ip_filter = client.teams.ip_filters.update(
    filter_id="filterId",
    team_id="teamId",
)
print(ip_filter.filter)
```

#### Response

```json
{
  "filter": {}
}
```

## Domain Types

### IP Filter Create Response

- `class IPFilterCreateResponse: …`

  - `filter: object`

    The created custom filter, including its enabled state

### IP Filter Delete Response

- `class IPFilterDeleteResponse: …`

  - `deleted: bool`

    True when the filter was deleted

### IP Filter Draft Instruction Response

- `class IPFilterDraftInstructionResponse: …`

  - `instruction: str`

    Drafted natural-language detection instruction derived from the reference assets

### IP Filter List Response

- `class IPFilterListResponse: …`

  - `filters: List[object]`

    Built-in and custom IP-detection filters for the team, each with its enabled state

### IP Filter Update Response

- `class IPFilterUpdateResponse: …`

  - `filter: object`

    The updated filter, including its enabled state
