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

# Get the sources and documents answers cited

> How many answered questions cited each of your knowledge sources, and which documents in them, over a trailing or explicit window. Names sources and documents only.

Returns, for your organization only, which knowledge sources and documents the answers in a window cited, most cited first. It names sources and documents and nothing else: there is no question, answer or passage in the response, and no field says who asked. See [Analytics](/administration/analytics#source-analytics) for how to read it.

Choose the window as for [Get usage](/api-reference/analytics/get-usage): `days` for a trailing window ending now, or an explicit `start` and `end` pair. Sending both forms returns `400`. With neither, you get the last 30 days. The window is half-open, `[start, end)`, and may span at most 366 days.

Every `share` is a fraction of `answered_questions`, and the shares do not add up to `1`: an answer that cites two sources counts for both. A share is `null`, not `0`, when nothing was answered in the window.

A document that has been deleted since it was cited is still counted, with `removed` set to `true`. A document that can no longer be traced to a source, because it or its source is gone, is collected under one entry whose `source_id` is `null` and whose `removed` is `true`. That entry is always last.

The response is bounded. Each source lists its 50 most cited documents, and `documents_truncated` says when there were more. One request attributes at most 1,000 distinct documents to their sources; when more were cited, the top-level `truncated` is `true` and the least cited are left out of the per-source counts.

Requires the owner, admin or editor role, because the caller must be able to read usage, collections and documents. Members and dataset operators receive `403`.

<ParamField query="days" type="integer" default="30">
  Length of a trailing window ending now, from 1 to 366. ASCII digits only. Cannot be combined with
  `start` or `end`.
</ParamField>

<ParamField query="start" type="string">
  Start of an explicit window, as an ISO 8601 timestamp with a UTC offset (for example
  `2026-09-01T00:00:00Z`). A timestamp without an offset is refused. Requires `end`.
</ParamField>

<ParamField query="end" type="string">
  End of an explicit window, exclusive, as an ISO 8601 timestamp with a UTC offset. Must be after
  `start`, and no more than 366 days after it. Requires `start`.
</ParamField>

<ParamField query="assistant_id" type="string">
  Limit the report to one assistant (UUID). A malformed ID returns `400`; an ID from another
  organization matches nothing.
</ParamField>

## Response

<ResponseField name="window" type="object" required>
  The window the report covers.

  <Expandable title="properties">
    <ResponseField name="start" type="string" required>
      Inclusive start, ISO 8601 in UTC.
    </ResponseField>

    <ResponseField name="end" type="string" required>
      Exclusive end, ISO 8601 in UTC.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="answered_questions" type="integer" required>
  Finished answers in the window that neither abstained nor failed.
</ResponseField>

<ResponseField name="cited_answers" type="integer" required>
  Of those, the answers that cited at least one source.
</ResponseField>

<ResponseField name="unattributed_answers" type="integer" required>
  Of the cited answers, those whose citations name no document, so they are counted here and under
  no source.
</ResponseField>

<ResponseField name="cited_documents" type="integer" required>
  Distinct documents cited in the window.
</ResponseField>

<ResponseField name="truncated" type="boolean" required>
  `true` when more than 1,000 distinct documents were cited and the least cited were left out of the
  per-source counts.
</ResponseField>

<ResponseField name="sources" type="object[]" required>
  One entry per cited source, most cited first, with the removed entry last.

  <Expandable title="properties">
    <ResponseField name="source_id" type="string | null" required>
      Source ID (a UUID). `null` on the entry that collects what no longer exists.
    </ResponseField>

    <ResponseField name="name" type="string | null" required>
      The source's display name. `null` on the removed entry.
    </ResponseField>

    <ResponseField name="source_type" type="string | null" required>
      The source's `source_type`, as [List sources](/api-reference/knowledge/list-sources) spells
      it. `null` on the removed entry.
    </ResponseField>

    <ResponseField name="removed" type="boolean" required>
      `true` on the entry that collects documents that can no longer be traced to a source.
    </ResponseField>

    <ResponseField name="cited_answers" type="integer" required>
      Answers that cited at least one document of this source.
    </ResponseField>

    <ResponseField name="share" type="number | null" required>
      `cited_answers` divided by the top-level `answered_questions`. `null` when that is `0`.
    </ResponseField>

    <ResponseField name="document_count" type="integer" required>
      Distinct documents of this source that were cited, including any not listed.
    </ResponseField>

    <ResponseField name="documents_truncated" type="boolean" required>
      `true` when `document_count` is greater than the number of `documents` listed.
    </ResponseField>

    <ResponseField name="documents" type="object[]" required>
      The source's most cited documents, at most 50.

      <Expandable title="properties">
        <ResponseField name="document_id" type="string" required>
          Document ID.
        </ResponseField>

        <ResponseField name="title" type="string | null" required>
          The document's title. `null` when the document no longer exists.
        </ResponseField>

        <ResponseField name="path" type="string | null" required>
          The document's path within its source. `null` when the document no longer exists.
        </ResponseField>

        <ResponseField name="source_url" type="string | null" required>
          Where the document was read from, when it has an address.
        </ResponseField>

        <ResponseField name="removed" type="boolean" required>
          `true` when the document has been deleted since it was cited.
        </ResponseField>

        <ResponseField name="cited_answers" type="integer" required>
          Answers that cited this document.
        </ResponseField>

        <ResponseField name="share" type="number | null" required>
          `cited_answers` divided by the top-level `answered_questions`. `null` when that is `0`.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl --request GET "$MITHUNAI_URL/mithunai/api/v1/analytics/sources?days=30" \
    --header "Authorization: Bearer $MITHUNAI_API_KEY"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os, requests

  response = requests.get(
      f"{os.environ['MITHUNAI_URL']}/mithunai/api/v1/analytics/sources",
      headers={"Authorization": f"Bearer {os.environ['MITHUNAI_API_KEY']}"},
      params={"days": 30},
      timeout=60,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const params = new URLSearchParams({ days: '30' })
  const response = await fetch(
    `${process.env.MITHUNAI_URL}/mithunai/api/v1/analytics/sources?${params}`,
    {
      headers: { Authorization: `Bearer ${process.env.MITHUNAI_API_KEY}` },
    },
  )
  console.log(await response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "window": {
      "start": "2026-09-12T10:00:03.214557+00:00",
      "end": "2026-10-12T10:00:03.214557+00:00"
    },
    "answered_questions": 40,
    "cited_answers": 36,
    "unattributed_answers": 0,
    "cited_documents": 3,
    "truncated": false,
    "sources": [
      {
        "source_id": "5d1e7a90-3c4b-4f2a-8e61-7b9c0d2f4a13",
        "name": "Product documentation site",
        "source_type": "website",
        "removed": false,
        "cited_answers": 30,
        "share": 0.75,
        "document_count": 2,
        "documents_truncated": false,
        "documents": [
          {
            "document_id": "c41d8f06-2b7e-4a95-8d13-6e0f9a5b7c21",
            "title": "Rate limits",
            "path": "/guides/rate-limits",
            "source_url": "https://docs.example.com/guides/rate-limits",
            "removed": false,
            "cited_answers": 22,
            "share": 0.55
          },
          {
            "document_id": "9a3e5b70-1c8d-4f26-b4a9-07d2e6c8f135",
            "title": "Authentication",
            "path": "/guides/authentication",
            "source_url": "https://docs.example.com/guides/authentication",
            "removed": false,
            "cited_answers": 12,
            "share": 0.3
          }
        ]
      },
      {
        "source_id": null,
        "name": null,
        "source_type": null,
        "removed": true,
        "cited_answers": 8,
        "share": 0.2,
        "document_count": 1,
        "documents_truncated": false,
        "documents": [
          {
            "document_id": "2f6c9d14-8e3a-4b07-a5d1-3c7b0e9f4a68",
            "title": null,
            "path": null,
            "source_url": null,
            "removed": true,
            "cited_answers": 8,
            "share": 0.2
          }
        ]
      }
    ]
  }
  ```

  ```json 400 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "code": "validation_error",
    "message": "Ask for either 'days' or a 'start' and 'end' pair, not both."
  }
  ```

  ```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "code": "authorization_error", "message": "You do not have permission to perform this action." }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.