> ## 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.

# Export Analytics Data

> Export analytics data in various formats (Excel, CSV, or JSON)

Export analytics data for questions, out-of-context queries, and referenced sources. The data can be exported in different formats and filtered based on various criteria.

## 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>

## Request Body

<ParamField body="export_type" type="string" default="xlsx" required>
  Format of the export file. Possible values: `xlsx`, `csv`, `json`

  * `xlsx`: Microsoft Excel format
  * `csv`: Compressed ZIP containing CSV files
  * `json`: JSON format
</ParamField>

<ParamField body="interval" type="string" default="today">
  Time period for the analytics data. Possible values:

  * `today`: Current day
  * `yesterday`: Previous day
  * `7d`: Last 7 days
  * `30d`: Last 30 days
  * `3m`: Last 3 months
  * `6m`: Last 6 months
  * `12m`: Last 12 months
</ParamField>

<ParamField body="filters" type="object">
  Filters for different types of data

  <Expandable title="Filter options">
    <ParamField body="questions" type="string" default="all">
      Filter for questions data. Possible values:

      * `all`: All sources
      * `widget`: Widget source
      * `user`: Gurubase UI source
      * `api`: API source
      * `discord`: Discord source
      * `slack`: Slack source
      * `github`: GitHub source
    </ParamField>

    <ParamField body="out_of_context" type="string" default="all">
      Filter for out-of-context queries. Same values as questions filter.
    </ParamField>

    <ParamField body="referenced_sources" type="string" default="all">
      Filter for referenced sources. Possible values:

      * `all`: All sources
      * `github_repo`: GitHub repositories
      * `website`: Websites
      * `youtube`: YouTube videos
      * `pdf`: PDF documents
    </ParamField>
  </Expandable>
</ParamField>

### Response

The response will be a file download with the appropriate content type header based on the export\_type:

* XLSX: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`
* CSV: `application/zip`
* JSON: `application/json`

<ResponseExample>
  ```json 200 (JSON) theme={null}
  {
    "questions": [
      {
        "datetime": "2025-04-10 07:06",
        "source": "Gurubase UI",
        "question": "details for self hosted",
        "trust_score": 0.6,
        "follow_up": true,
        "url": "https://app.gurubase.io/g/gurubase/what-is-gurubase/binge/0f973a34-7867-46ca-9c38-896d4b644d63?question_slug=details-for-self-hosting-gurubase-6014cb17-1a95-4308-969d-b61cf435f312"
      }
    ],
    "out_of_context": [
      {
        "datetime": "2025-04-08 06:45",
        "source": "Github",
        "question": "who made gurubase?"
      }
    ],
    "referenced_sources": [
      {
        "last_update_date": "2025-04-04 12:23",
        "data_source_type": "Website",
        "data_source_title": "Quickstart - Gurubase",
        "referenced_count": 187,
        "url": "https://docs.gurubase.ai/quickstart"
      }
    ]
  }
  ```

  ```binary 200 (XLSX) theme={null}
  [Binary Excel file content]
  ```

  ```binary 200 (ZIP/CSV) theme={null}
  [Binary ZIP file containing CSV files]
  ```

  ```json 404 theme={null}
  {
      "msg": "No data found to export"
  }
  ```

  ```json 400 theme={null}
  {
      "msg": "Invalid request"
  }
  ```

  ```json 500 theme={null}
  {
      "msg": "Internal server error"
  }
  ```
</ResponseExample>
