> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.partnerpage.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.partnerpage.io/_mcp/server.

# Create a filter

POST https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/{directoryId}/filters/
Content-Type: application/json

Create a filter within a directory

Reference: https://docs.partnerpage.io/api-reference/directory/filters/create-a-filter

## Authentication

- `Authorization` header (required) (prefixed with ` Token   `) — Your API key, sent as `Authorization: Token <your API key>`

## Request

### Path parameters

- `directoryId` (string, required) — ID of the directory containing the filter

### Body (application/json)

This endpoint expects a FilterSerializerReaderRequest.

- `id` (string, required)
- `type` (string, required)
- `name` (string, required)
- `slug` (string, required)
- `order` (integer, required)
- `parentFilterId` (string, required)
- `parentFilterSlug` (string, required)
- `multipleSelectFromDashboard` (boolean, required)
- `multipleSelectFromDirectory` (boolean, required)
- `userAssignable` (boolean, required)
- `displayInDirectory` (boolean, required)
- `displayInInternalDirectory` (boolean, required)
- `displayInEntryProfile` (boolean, required)
- `displayInInternalEntryProfile` (boolean, required)
- `displayInEntryProfileMainArea` (boolean, required)
- `required` (boolean, required)
- `overrides` (FilterOverridesRequest, required, nullable) — Visibility rule of the filter, or null when it has none.
- `assignmentDescription` (string, optional, nullable)
- `multipleLimit` (integer, optional, nullable)
- `isLocation` (boolean, optional, default: false) — Whether this is one of the Country, Region and City filters, which visitors pick from as one Location filter.

## Response

### 201

Details of the filter

- `name` (string, required)
- `order` (integer, optional)
- `assignmentDescription` (string, optional, nullable)
- `multipleSelectFromDashboard` (boolean, optional)
- `multipleLimit` (integer, optional, nullable)
- `multipleSelectFromDirectory` (boolean, optional)
- `userAssignable` (boolean, optional)
- `displayInDirectory` (boolean, optional)
- `displayInInternalDirectory` (boolean, optional)
- `displayInEntryProfile` (boolean, optional)
- `displayInInternalEntryProfile` (boolean, optional)
- `displayInEntryProfileMainArea` (boolean, optional)
- `required` (boolean, optional)
- `overrides` (FilterOverrides, optional, nullable) — A filter's visibility rule, in the same shape as a form field's overrides: when the conditions are met the filter takes the hidden value, otherwise the opposite one.

## Errors

### 400 Bad Request Error

- `map from string to any`

## Types

### FilterOverridesRequest

A filter's visibility rule, in the same shape as a form field's overrides: when the conditions are met the filter takes the hidden value, otherwise the opposite one.

- `attributes` (list of FilterOverrideAttributeRequest, required)
- `conditions` (list of FilterOverrideConditionRequest, required)
- `conditionCombinator` (enum, optional, default: and) — * `and` - and * `or` - or
  - Allowed values: `and`, `or`

### FilterOverrides

A filter's visibility rule, in the same shape as a form field's overrides: when the conditions are met the filter takes the hidden value, otherwise the opposite one.

- `attributes` (list of FilterOverrideAttribute, required)
- `conditions` (list of FilterOverrideCondition, required)
- `conditionCombinator` (enum, optional, default: and) — * `and` - and * `or` - or
  - Allowed values: `and`, `or`

### FilterOverrideAttributeRequest

- `attribute` (string, required)
- `value` (boolean, required)

### FilterOverrideConditionRequest

- `key` (string, required) — Id of the filter the condition reads.
- `operator` (enum, required) — * `equals` - equals * `not_equals` - not_equals
  - Allowed values: `equals`, `not_equals`
- `value` (string, required) — Id of an option of that filter.

### FilterOverrideAttribute

- `attribute` (string, required)
- `value` (boolean, required)

### FilterOverrideCondition

- `key` (string, required) — Id of the filter the condition reads.
- `operator` (enum, required) — * `equals` - equals * `not_equals` - not_equals
  - Allowed values: `equals`, `not_equals`
- `value` (string, required) — Id of an option of that filter.

## Examples

**Request**

```json
{
  "id": "string",
  "type": "string",
  "name": "string",
  "slug": "string",
  "order": 1,
  "parentFilterId": "string",
  "parentFilterSlug": "string",
  "multipleSelectFromDashboard": true,
  "multipleSelectFromDirectory": true,
  "userAssignable": true,
  "displayInDirectory": true,
  "displayInInternalDirectory": true,
  "displayInEntryProfile": true,
  "displayInInternalEntryProfile": true,
  "displayInEntryProfileMainArea": true,
  "required": true,
  "overrides": {
    "attributes": [
      {
        "attribute": "string",
        "value": true
      }
    ],
    "conditions": [
      {
        "key": "string",
        "operator": "equals",
        "value": "string"
      }
    ]
  }
}
```

**Response**

```json
{
  "name": "Filter 1",
  "order": 0,
  "assignmentDescription": "Assignment description",
  "multipleSelectFromDashboard": false,
  "multipleLimit": null,
  "multipleSelectFromDirectory": false,
  "displayInDirectory": true,
  "displayInInternalDirectory": false,
  "required": false,
  "filterOptions": [],
  "genericDirectory": "969d9b77-c063-4101-b534-63071317ddbd",
  "href": "/api/directory/private/v1alpha/filters/006059d7-4d1e-4ace-b816-32fa9a9659ac/",
  "id": "006059d7-4d1e-4ace-b816-32fa9a9659ac",
  "slug": "filter-1",
  "type": "user",
  "userEnabled": true
}
```

**SDK Code**

```python application/json example
import requests

url = "https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/directoryId/filters/"

payload = {
    "id": "string",
    "type": "string",
    "name": "string",
    "slug": "string",
    "order": 1,
    "parentFilterId": "string",
    "parentFilterSlug": "string",
    "multipleSelectFromDashboard": True,
    "multipleSelectFromDirectory": True,
    "userAssignable": True,
    "displayInDirectory": True,
    "displayInInternalDirectory": True,
    "displayInEntryProfile": True,
    "displayInInternalEntryProfile": True,
    "displayInEntryProfileMainArea": True,
    "required": True,
    "overrides": {
        "attributes": [
            {
                "attribute": "string",
                "value": True
            }
        ],
        "conditions": [
            {
                "key": "string",
                "operator": "equals",
                "value": "string"
            }
        ]
    }
}
headers = {
    "Authorization": "Token  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript application/json example
const url = 'https://v1.api.partnerpage.io/api/directory/private/v1alpha/directories/directoryId/filters/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"id":"string","type":"string","name":"string","slug":"string","order":1,"parentFilterId":"string","parentFilterSlug":"string","multipleSelectFromDashboard":true,"multipleSelectFromDirectory":true,"userAssignable":true,"displayInDirectory":true,"displayInInternalDirectory":true,"displayInEntryProfile":true,"displayInInternalEntryProfile":true,"displayInEntryProfileMainArea":true,"required":true,"overrides":{"attributes":[{"attribute":"string","value":true}],"conditions":[{"key":"string","operator":"equals","value":"string"}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```