> For the complete documentation index, see [llms.txt](https://docs.clusters.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clusters.xyz/getting-started/javascript/clusters.md).

# Clusters

### Create a Cluster

Create a cluster

<table><thead><tr><th width="385.23046875">Name</th><th>Description</th></tr></thead><tbody><tr><td> <code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
const data = await clusters.createCluster(authToken);
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "id": "0x000049d953f88ab10f1b2778275028894602c41bbe6ea42bf46695d4edc5b6d6",
}
```

{% endtab %}
{% endtabs %}

***

### Cluster by ID

Get the cluster from an id

| Name | Description   |
| ---- | ------------- |
| `id` | ID of cluster |

**Example**

```javascript
const cluster = await clusters.getClusterById(id);
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "id": "0xa8d12b92b91fe0db3651ff2d45c1f47b1bb343054e9cd1e556c73f2330269224",
  "createdBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
  "createdAt": "2024-02-14 21:39:05+00",
  "wallets": [
    {
      "address": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
      "name": "main",
      "isVerified": true,
      "isPrivate": false,
      "isBackedUp": false,
      "updatedAt": "2024-02-09 15:21:22+00",
      "updatedBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
      "createdAt": "2024-02-09 15:21:22+00"
    }
  ],
  "isTestnet": false
}
```

{% endtab %}
{% endtabs %}

***

### Cluster by Name

Get the cluster from a name

| Name   | Description  |
| ------ | ------------ |
| `name` | Cluster name |

**Example**

```javascript
const cluster = await clusters.getClusterByName(name);
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "id": "0xa8d12b92b91fe0db3651ff2d45c1f47b1bb343054e9cd1e556c73f2330269224",
  "createdBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
  "createdAt": "2024-02-14 21:39:05+00",
  "wallets": [
    {
      "address": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
      "name": "main",
      "isVerified": true,
      "isPrivate": false,
      "isBackedUp": false,
      "updatedAt": "2024-02-09 15:21:22+00",
      "updatedBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
      "createdAt": "2024-02-09 15:21:22+00"
    }
  ],
  "isTestnet": false
}
```

{% endtab %}
{% endtabs %}

***

### Cluster ID by address

Get the cluster from an id

| Name      | Description                   |
| --------- | ----------------------------- |
| `address` | Verified address of a cluster |

**Example**

```javascript
const data = await clusters.getClusterIdByAddress(address);
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "clusterId": "0xa8d12b92b91fe0db3651ff2d45c1f47b1bb343054e9cd1e556c73f2330269224"
}
```

{% endtab %}
{% endtabs %}

***

### Add wallets

Add wallets to the cluster the authenticated wallet is in

<table><thead><tr><th width="375.26171875">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>wallets</code></td><td>{ address: string, name: string, isPrivate: boolean }[]</td></tr><tr><td><code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
await clusters.addWallets(
    [{ address: '0x0000000000000000000000000000000000000011', name: 'new', isPrivate: true }],
    authToken,
 );
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
}
```

{% endtab %}
{% endtabs %}

***

### Generate wallet

Generate a wallet in a cluster that the authenticated wallet is in

<table><thead><tr><th width="385.23046875">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>wallets</code></td><td>{ address: string, name: string, isPrivate: boolean }[]</td></tr><tr><td><code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
await clusters.generateWallet(
    [{ address: '0x0000000000000000000000000000000000000011', name: 'test', isPrivate: false }],
    authToken,
  );
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  type: "evm",
  address: "0x9D212340B4E5F3a38B171b2971D678B95083d928",
  name: "test",
  share: "0xdb87682d04e71c99bf8964e51cf5ec4843f2c588946bf749324819df0ba9ee1fb66e67bc21b440817310724abd1fb41676f6e2b30923819cf647bcb94a097c2b148257c58f38280682419af6c1fdab21cb94827bab4c0c4fa1d6ce153635b591a8b5c706f2db8307d08bc54022d381599a661c11dc5ab39fd0fbc167aac81ed48b211e98192cb0b6344232a4c577a7754339be",
}
```

{% endtab %}
{% endtabs %}

***

### Update wallets

Update wallets in a cluster that the authenticated wallet is in

<table><thead><tr><th width="385.23046875">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>wallets</code></td><td>{ address: string, name: string }[]</td></tr><tr><td><code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
await clusters.updateWalletNames(
    [{ address: '0x0000000000000000000000000000000000000011', name: 'new2' }],
    authToken,
  );
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
}
```

{% endtab %}
{% endtabs %}

***

### Remove wallets

Remove an array of addresses from the cluster of the authenticated wallet

<table><thead><tr><th width="385.23046875">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>wallets</code></td><td>string[]</td></tr><tr><td><code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
await clusters.removeWallets(['0x0000000000000000000000000000000000000011'], authToken)
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
}
```

{% endtab %}
{% endtabs %}

***

### Verify wallet

Verify the authenticated wallet in a specific cluster

<table><thead><tr><th width="385.23046875">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>clusterId</code></td><td>The cluster id you want to verify the wallet in</td></tr><tr><td><code>authToken</code></td><td><a href="/pages/6AGkfCSOcnx2jBGZ0ljQ">Authentication from wallet</a></td></tr></tbody></table>

**Example**

```javascript
await clusters.verifyWallet(clusterId, authToken);
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
}
```

{% endtab %}
{% endtabs %}
