# IP Filters

## Create

**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})

### Path Parameters

- `teamId: string`

### Body Parameters

- `category: "artist-style" or "brand-trademark" or "celebrity-likeness" or 2 more`

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

  - `"artist-style"`

  - `"brand-trademark"`

  - `"celebrity-likeness"`

  - `"custom"`

  - `"fictional-character"`

- `name: string`

  Display name for the filter

- `enabled: optional boolean`

  Whether the filter is active

- `instruction: optional string`

  Natural-language detection instruction (required for custom filters)

- `sourceAssetIds: optional array of string`

  Optional reference assets used only to generate the instruction

### Returns

- `filter: unknown`

  The created custom filter, including its enabled state

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/ip-filters \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "category": "artist-style",
          "name": "name"
        }'
```

#### Response

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

## Delete

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

Delete a custom IP-detection filter for a team

### Path Parameters

- `teamId: string`

- `filterId: string`

### Returns

- `deleted: boolean`

  True when the filter was deleted

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/ip-filters/$FILTER_ID \
    -X DELETE \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

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

## Draft Instruction

**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)

### Path Parameters

- `teamId: string`

### Body Parameters

- `assetIds: array of string`

  Reference assets whose imagery seeds the drafted detection instruction

### Returns

- `instruction: string`

  Drafted natural-language detection instruction derived from the reference assets

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/ip-filters/draft-instruction \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "assetIds": [
            "string"
          ]
        }'
```

#### Response

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

## List

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

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

### Path Parameters

- `teamId: string`

### Returns

- `filters: array of unknown`

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

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/ip-filters \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

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

## Update

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

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

### Path Parameters

- `teamId: string`

- `filterId: string`

### Body Parameters

- `enabled: optional boolean`

  Whether the filter is active

- `instruction: optional string`

  Natural-language detection instruction

- `name: optional string`

  Display name for the filter

### Returns

- `filter: unknown`

  The updated filter, including its enabled state

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/ip-filters/$FILTER_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{}'
```

#### Response

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

## Domain Types

### IP Filter Create Response

- `IPFilterCreateResponse object { filter }`

  - `filter: unknown`

    The created custom filter, including its enabled state

### IP Filter Delete Response

- `IPFilterDeleteResponse object { deleted }`

  - `deleted: boolean`

    True when the filter was deleted

### IP Filter Draft Instruction Response

- `IPFilterDraftInstructionResponse object { instruction }`

  - `instruction: string`

    Drafted natural-language detection instruction derived from the reference assets

### IP Filter List Response

- `IPFilterListResponse object { filters }`

  - `filters: array of unknown`

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

### IP Filter Update Response

- `IPFilterUpdateResponse object { filter }`

  - `filter: unknown`

    The updated filter, including its enabled state
