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

# Fetch kmeans clusters

> # Description

Get correlation analysis for scale, numeric and grid questions.

# Payload

```json
{
  "filter": [],
  "questionNames": [string],
  "questions": [string],
  "clusterCount": number,
  "toDate": string,
  "fromDate": string
}
```

where:

* `fromDate`: start date in ISO format. __(Required)__.
* `toDate`: end date in ISO format. __(Required)__.
* `filter`: array of filters to filter the responses. (Optional).
* `questionNames`: Array from names of the cluster to be created based on questions selected.  
* `clusterCount`: Number of clusters to create.  
* `questions`: Array from ids of questions selected.  
# Response 

## 200 OK

```json
{
  "projectId": string,
  "questionFilter": object,
  "dateFilters": object,
  "response": object
}
```
where:

* `projectId`: Id of the project this analysis belongs to.
* `dateFilters`: Start and end date filters applied to the data.
* `questionFilter`: Filters used calculate the data.
* `response`: Correlation data for the clusters created.
* `response.questions`: List of questionsIds 
of  questions used for cluster.  
* `response.result`: Object with means, variances and clusters generated.  
* `response.iterations`: Array with objects containing means, variances and clusters for each iteration.
* `response.iterationCount`: Number of iterations done.

## 400 Bad Request
> Missing or invalid `fromDate`/`toDate`/`projectId` fields.

## 401 Unauthorized
> Invalid authorization.

## 404 Not Found
> Resource not found.

## 500 Internal Server Error
> Error occurred in the service.

# Description

Get correlation analysis for scale, numeric and grid questions.

# Payload

```json theme={null}
{
  "filter": [],
  "questionNames": [string],
  "questions": [string],
  "clusterCount": number,
  "toDate": string,
  "fromDate": string
}
```

where:

* `fromDate`: start date in ISO format. **(Required)**.
* `toDate`: end date in ISO format. **(Required)**.
* `filter`: array of filters to filter the responses. (Optional).
* `questionNames`: Array from names of the cluster to be created based on questions selected.
* `clusterCount`: Number of clusters to create.
* `questions`: Array from ids of questions selected.

# Response

## 200 OK

```json theme={null}
{
  "projectId": string,
  "questionFilter": object,
  "dateFilters": object,
  "response": object
}
```

where:

* `projectId`: Id of the project this analysis belongs to.
* `dateFilters`: Start and end date filters applied to the data.
* `questionFilter`: Filters used calculate the data.
* `response`: Correlation data for the clusters created.
* `response.questions`: List of questionsIds
  of  questions used for cluster.
* `response.result`: Object with means, variances and clusters generated.
* `response.iterations`: Array with objects containing means, variances and clusters for each iteration.
* `response.iterationCount`: Number of iterations done.

## 400 Bad Request

> Missing or invalid `fromDate`/`toDate`/`projectId` fields.

## 401 Unauthorized

> Invalid authorization.

## 404 Not Found

> Resource not found.

## 500 Internal Server Error

> Error occurred in the service.

##### Query Parameters

| Parameter   | Description | Required | Example |
| ----------- | ----------- | -------- | ------- |
| `projectId` | —           | No       | —       |


## OpenAPI

````yaml POST /correlation-service/kMeans
openapi: 3.0.3
info:
  title: SightX API
  version: 1.0.0
  description: >-
    SightX REST API documentation. Most responses are JSON; some export
    endpoints return files. API access is a paid add-on — contact
    sales@sightx.io for details.
servers:
  - url: https://auth.admin.sightx.io
    description: Authentication (Production)
  - url: https://auth.staging-admin.sightx.io
    description: Authentication (Staging)
security:
  - AuthorizationHeader: []
paths:
  /correlation-service/kMeans:
    post:
      summary: Fetch kmeans clusters
      description: >-
        # Description


        Get correlation analysis for scale, numeric and grid questions.


        # Payload


        ```json

        {
          "filter": [],
          "questionNames": [string],
          "questions": [string],
          "clusterCount": number,
          "toDate": string,
          "fromDate": string
        }

        ```


        where:


        * `fromDate`: start date in ISO format. __(Required)__.

        * `toDate`: end date in ISO format. __(Required)__.

        * `filter`: array of filters to filter the responses. (Optional).

        * `questionNames`: Array from names of the cluster to be created based
        on questions selected.  

        * `clusterCount`: Number of clusters to create.  

        * `questions`: Array from ids of questions selected.  

        # Response 


        ## 200 OK


        ```json

        {
          "projectId": string,
          "questionFilter": object,
          "dateFilters": object,
          "response": object
        }

        ```

        where:


        * `projectId`: Id of the project this analysis belongs to.

        * `dateFilters`: Start and end date filters applied to the data.

        * `questionFilter`: Filters used calculate the data.

        * `response`: Correlation data for the clusters created.

        * `response.questions`: List of questionsIds 

        of  questions used for cluster.  

        * `response.result`: Object with means, variances and clusters
        generated.  

        * `response.iterations`: Array with objects containing means, variances
        and clusters for each iteration.

        * `response.iterationCount`: Number of iterations done.


        ## 400 Bad Request

        > Missing or invalid `fromDate`/`toDate`/`projectId` fields.


        ## 401 Unauthorized

        > Invalid authorization.


        ## 404 Not Found

        > Resource not found.


        ## 500 Internal Server Error

        > Error occurred in the service.
      operationId: fetch-kmeans-clusters-post-correlation-service-kmeans
      parameters:
        - name: Authorization
          in: header
          required: true
          description: Authorization token
          schema:
            type: string
        - name: projectId
          in: query
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      servers:
        - url: https://correlation.sightx.io
components:
  securitySchemes:
    AuthorizationHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Access token obtained from the m2m-token endpoint.

````