Filtering Capabilities
The Search API provides powerful filtering options to help narrow down search results and ensure that users only see the most relevant knowledge content. Filters can be applied at request time to refine results based on topics, tags, user profiles, or language codes. This ensures a more contextual and precise search experience across customer and agent-facing applications.
Supported Filters
1. Topic IDs ($filter[topicIds]
)
- Restricts the search scope to only the provided topic IDs.
- Accepts an array of IDs (1–20) for multi-topic filtering.
- Useful for targeting content within specific knowledge areas, product lines, or support categories.
-
Example:
curl -X POST "https://<API_DOMAIN>/system/ws/v20/search/<PORTAL_ID>?q=<YOUR_QUERY>&$filter[topicIds]=<YOUR_TOPIC_ID>" \ -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \ -H "Content-Type: application/json"
2. Tags ($filter[tags]
)
- Restricts search results using hierarchical category tags.
- Each key is a Category Tag ID, and each value is an array of Tag IDs under that category.
- Supports up to 15 categories, each with up to 200 tags.
- Ideal for narrowing results to specific business units, regions, or products.
-
Example:
curl -X POST "https://<API_DOMAIN>/system/ws/v20/search/<PORTAL_ID>?q=<YOUR_QUERY>" \ -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "$filter[tags]": { "YOUR_CATEGORY_TAG_ID": ["YOUR_TAG_IDS"] } }'
3. User Profile ID ($filter[userProfileID]
)
- Restricts results to content available for a specific user profile.
- Ensures that customers, partners, and agents only see articles aligned with their access level.
- Commonly used to differentiate between customer-facing and internal-only knowledge.
-
Example:
curl -X POST "https://<API_DOMAIN>/system/ws/v20/search/<PORTAL_ID>?q=<YOUR_QUERY>" \ -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "$filter[userProfileID]": "YOUR_USER_PROFILE_ID" }'
4. Language Code ($lang
)
- Restricts search results to a specific language.
- Ensures users receive localized content, improving the multilingual self-service experience.
- Accepts standard ISO language codes (e.g., en-us, es-es, fr-fr).
-
Example:
curl -X POST "https://<API_DOMAIN>/system/ws/v20/search/<PORTAL_ID>?q=<YOUR_QUERY>&$lang=en-us" \ -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \ -H "Content-Type: application/json"
Combining Filters
Filters can be combined in a single request for fine-grained control. For example, filtering by topic IDs, user profile, tags, and language simultaneously:
curl -X POST "https://<API_DOMAIN>/system/ws/v20/search/<PORTAL_ID>?q=<YOUR_QUERY>&$filter[topicIds]=<YOUR_TOPIC_ID>&$lang=en-us" \
-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"$filter[userProfileID]": "YOUR_USER_PROFILE_ID",
"$filter[tags]": {
"YOUR_CATEGORY_TAG_ID": ["YOUR_TAG_IDS"]
}
}'
Placeholders to Replace
- <API_DOMAIN>: Your API’s domain.
- <PORTAL_ID>: The portal where the search will be executed.
- <YOUR ACCESS TOKEN>: Your OAuth 2.0 access token.
- <YOUR_QUERY>: The search query string.
- <YOUR TOPIC ID>: One or more topic IDs to scope results.
- YOUR USER PROFILE_ID: The user profile ID for persona-based filtering.
- YOUR CATEGORY TAG_ID: The category tag ID for tag-based filtering.
- YOUR TAG IDS: The tag IDs under the provided category.
- $lang: ISO code for filtering results by language (e.g., en-us).