> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gurubase.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic Search

> Fetch related sources for a question

Retrieve sources that are most relevant to a given question. This endpoint fetches from all data source types.

## Path Parameters

<ParamField path="guru_slug" type="string" required>
  The slug of the Guru to query sources from
</ParamField>

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication. You can obtain your API key from the [Gurubase dashboard](https://app.gurubase.io/api-keys).
</ParamField>

### Body Parameters

<ParamField body="question" type="string" required>
  The question to find related sources for
</ParamField>

<ParamField body="labels" type="array" default={[]}>
  Array of labels to filter sources by. If provided, only sources with matching labels will be returned. If multiple labels are provided, they are OR'ed. Meaning data sources belonging to any of those labels are returned.
</ParamField>

<ParamField body="external_user_id" type="string">
  External user identifier. This allows you to track search queries per user in your analytics. It should be UUID.
</ParamField>

### Response

The response contains an array of source objects and total count.

<ResponseField name="sources" type="object[]">
  Array of source objects relevant to the question (maximum 10)

  Each source object contains:

  * `title` (string): The title of the source document or page
  * `link` (string): The URL link to the source (can be null for internal sources)
  * `display_link` (boolean): Whether to display the link in the UI
  * `icon_url` (string): URL of the icon representing the source
  * `labels` (array): Array of labels associated with this source
</ResponseField>

<ResponseField name="total_sources" type="number">
  Total number of sources returned
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "sources": [
      {
        "title": "Slack Bot Integration - Gurubase",
        "link": "https://docs.gurubase.ai/integrations/slack-bot",
        "display_link": true,
        "labels": [
          "integrations",
          "slack",
          "bots"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "GitHub Bot Integration - Gurubase",
        "link": "https://docs.gurubase.ai/integrations/github-bot",
        "display_link": true,
        "labels": [
          "integrations",
          "github",
          "bots"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "Welcome to Gurubase - Gurubase",
        "link": "https://docs.gurubase.ai/introduction",
        "display_link": true,
        "labels": [
          "documentation",
          "getting-started"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "Quickstart - Gurubase",
        "link": "https://docs.gurubase.ai/quickstart",
        "display_link": true,
        "labels": [
          "documentation",
          "getting-started",
          "tutorial"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "Create Your First Guru - Gurubase",
        "link": "https://docs.gurubase.ai/guides/create-guru",
        "display_link": true,
        "labels": [
          "documentation",
          "guides",
          "tutorial"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "head.html",
        "link": "https://github.com/gurubase/gurubase-widget/tree/master/examples/retype/_includes/head.html",
        "display_link": true,
        "labels": [
          "code",
          "github",
          "widget",
          "examples"
        ],
        "icon_url": "https://github.com/favicon.ico"
      },
      {
        "title": "widget.js",
        "link": "https://github.com/gurubase/gurubase-widget/tree/master/src/widget.js",
        "display_link": true,
        "labels": [
          "code",
          "github",
          "widget",
          "javascript"
        ],
        "icon_url": "https://github.com/favicon.ico"
      },
      {
        "title": "Website Widget Integration - Gurubase",
        "link": "https://docs.gurubase.ai/integrations/website-widget",
        "display_link": true,
        "labels": [
          "integrations",
          "widget",
          "website"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "Jira Integration - Gurubase",
        "link": "https://docs.gurubase.ai/integrations/jira-bot",
        "display_link": true,
        "labels": [
          "integrations",
          "jira",
          "bots"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      },
      {
        "title": "API Reference - Gurubase",
        "link": "https://docs.gurubase.ai/api-reference/introduction",
        "display_link": true,
        "labels": [
          "documentation",
          "api",
          "reference"
        ],
        "icon_url": "https://mintlify.s3-us-west-1.amazonaws.com/gurubase/_generated/favicon/favicon-32x32.png?v=3"
      }
    ],
    "total_sources": 10
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Question is required"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Invalid API key"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Guru not found"
  }
  ```

  ```json 429 theme={null}
  {
    "error": "Rate limit exceeded"
  }
  ```

  ```json 500 theme={null}
  {
    "error": "Error fetching sources: [error details]"
  }
  ```
</ResponseExample>
