# /cluster

## location id, lnglat and label of cluster locations.

<mark style="color:blue;">`GET`</mark> `geolytix.xyz/api/location/select/cluster`

This endpoint queries a JSON array of ID and label from a cluster location.

#### Query Parameters

| Name   | Type   | Description                                             |
| ------ | ------ | ------------------------------------------------------- |
| locale | string | The locale (key) which contains the cluster layer.      |
| layer  | string | The cluster layer (key).                                |
| table  | string | The table which holds the cluster locations.            |
| lnglat | string | Comma seperated float for longitude and latitude.       |
| filter | string | A stringified JSON filter object.                       |
| count  | string | The maximum number of locations from cluster to return. |
| token  | string | A token is required to access private endpoints.        |

{% tabs %}
{% tab title="200 JSON array of ID, label, and location coordinates." %}
```javascript
[
  {
    "id": 8213,
    "label": "Cooltrader - Erdington",
    "lnglat": [
      -1.8388261591,
      52.5237149882455
    ]
  },
  {
    "id": 8853,
    "label": "Erdington",
    "lnglat": [
      -1.83784775521401,
      52.5235273833912
    ]
  },
  {...}
]
```
{% endtab %}

{% tab title="401 Returned when trying to access a private endpoint with an invalid or missing token." %}
```
'Invalid token.'
```
{% endtab %}

{% tab title="406 Will be returned if parameter are missing or don't match the workspace in memory." %}
```
'Invalid locale.'
​
'Invalid layer.'
​
'Missing table.'
​
'Missing lnglat.'
​
'Invalid parameter.'
```
{% endtab %}

{% tab title="500 Backend failed to fetch results from database table." %}
```
'Failed to query PostGIS table.'
```
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Access filter on the layer apply and the locations can not be returned if the access token does hold the required roles for private endpoints.
{% endhint %}
