Skip to content

Hybrid Search

Request

The Search API is a hybrid search service that combines semantic understanding with keyword precision to deliver fast, contextual, and relevant results from your enterprise knowledge base. It enables secure, role-aware access to articles, FAQs, and documentation across customer, agent, and employee interfaces. Each query returns a ranked list of results with snippets, metadata, and relevance scores.

Security
oAuthUser(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthCustomer(Required scopes:
https://api.egain.cloud/auth/kno...
)
or oAuthAnonymousCustomer(Required scopes:
https://api.egain.cloud/auth/kno...
)
Path
portalIDstring, [ 7 .. 20 ] characters^[a-zA-Z0-9]{2,4}-\d{4,15}$required

The ID of the portal being accessed.

A portal ID is composed of a 2-4 letter prefix, followed by a dash and 4-15 digits.

Example:PROD-1000
Query
qstring, [ 1 .. 1024 ] characters^[\w\W]+$required

The search query string. The string must be escaped as required by the URL syntax rules.

Example:q=What is a loan?
$filter[userProfileID]string, [ 7 .. 20 ] characters^[a-zA-Z0-9]{2,4}-\d{4,15}$

The ID of the user profile.

Example:$filter[userProfileID]=PROD-1030
$langstring(languageCode)required

The language used for a resource. Resources available in different languages may differ from each other.

Enum:"en-US""fr-FR""en-GB""es-ES""it-IT""nl-NL""da-DA""sv-SE""pt-PT""fi-FI"
Example:$lang=en-US
$filter[tags]object, [ 1 .. 20 ] properties

An object where each key is a Category Tag ID (numeric string),
and each value is an array of Tag IDs for that category. Note:

  • The '$filter[tags]' query parameter JSON value should be url encoded.
  • Some developer tools for invoking APIs may not url encode the '$filter[tags]' query parameter JSON value by default. Ensure that only url encoded values are used.
  • Example of JSON value: {"BASE-40845":["BASE-40849","BASE-40853"]}
  • Example of URL encoded value: %7B%22BASE-40845%22%3A%5B%22BASE-40849%22%2C%22BASE-40853%22%5D%7D
Example:PROD-1234=PROD-2000,PROD-2003&PROD-2005=PROD-2007
$filter[topicIds]Array of strings, [ 1 .. 20 ] items

An array of topic IDs. It is used to restrict search results to specific topics.

articleCustomAdditionalAttributesstring, [ 1 .. 4000 ] characters

One or more comma-separated names for article custom attributes defined by the user to be returned.

$pagenuminteger, (int64), [ 1 .. 1 ]

Pagination parameter that specifies the page number of results to be returned. Used in conjunction with $pagesize.

Default:1
$pagesizeinteger, (int64), [ 1 .. 30 ]

Pagination parameter that specifies the number of results per page. Used in conjunction with $pagenum.

Default:20
GET
/{portalID}/search
curl -i -X GET \
  'https://api.egain.cloud/knowledge/portalmgr/v4/PROD-1000/search?q=What%20is%20a%20loan%3F&%24filter%5BuserProfileID%5D=PROD-1030&%24lang=en-US&%24filter%5Btags%5D=PROD-1234%3DPROD-2000%2CPROD-2003%26PROD-2005%3DPROD-2007&%24filter%5BtopicIds%5D=string&articleCustomAdditionalAttributes=string&%24pagenum=1&%24pagesize=20' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

Successful response

Bodyapplication/json
searchResultsobjectrequired

Top search results with relevance scores

paginationInfoobject(PaginationInfo)
Response
{ "searchResults": { "article": [] } }