This feature only works with for calls to the /search endpoint using the outputType sourcedAnswer.

This guide includes an overview of error codes you might see from both the API and our SDKs.

Overview

Our /search endpoint allows for restricting its search scope. It supports the following:

  • Restrictions: restrict the search to a set list of sources
  • Exclusions: exclude a set list of sources from the search
  • Prioritization: create a prioritized list of sources to search on. The information will be looked for on the sources by order of priority

To filter, we use an XML format that must be appended to the natural language q parameter passed to the /search endpoint.

For example:

<guidance>
  <restriction>
    Use only the sources listed here. Do not rely on any external references.
      - wikipedia.org
  </restriction>
</guidance>
Your search goes here

Exclusions

Exclusions can be used to block the /search endpoint from returning information from a given list of sources. It should be used in the format of the example below:

<guidance>
  <exclusion>
    Do not use any of the sources listed here.
      - buzzfeed.com
  </exclusion>
</guidance>
Your search goes here

Prioritization

Prioritization can be used to favor some sources. The /search endpoint will try to find the requested information in the favored sources. If unsuccessful, it will fall back to other sources. Prioritization can be used in tiers.

<guidance>
  <priority>
    - wikipedia.org
  </priority>
</guidance>
Your search goes here
<guidance>
  <priority level='1'>
    - wikipedia.org
  </priority>
  <priority level='2'>
    - buzzfeed.com
  </priority>
</guidance>
Your search goes here

Examples

The different restrictions can be used together.

Exclusion + Prioritization

<guidance>
  <exclusion>Do not use any of the sources listed here.
    - buzzfeed.com
  </exclusion>
  <priority level='1'>
    - wikipedia.org
  </priority>
  <priority level='2'>
    - imdb.com
  </priority>
</guidance>
Your search goes here

Restriction + Prioritization

<guidance>
  <restriction>Use only the sources listed here. Do not rely on any external references.
    - wikipedia.org
    - sec.gov
  </restriction>
  <priority>
    - wikipedia.org
  </priority>
</guidance>
Your search goes here