> 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/authentication.md).

# Authentication

{% hint style="info" %}
This is only required for making changes to your Cluster. Querying does not require authentication.
{% endhint %}

1. Get signing message
2. Sign the message with an EVM or Solana wallet
3. Get authentication key with the signature of the signed message
4. Using authenticate key with endpoints that require wallet authentication

***

**Get Signing Message**

Get the signing message used for wallet signature authentication

**Example**

```javascript
const data = await clusters.getAuthMessage()
```

**Response**

> The message to sign and the corresponding signing date

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

```json
{
  "message": "clusters.xyz verification\n\nBefore interacting with certain functionality, we require a wallet signature for verification.\n\n2024-05-14T19:08:27.985Z",
  "signingDate": "2024-05-14T19:08:27.985Z"
}
```

{% endtab %}
{% endtabs %}

***

**Get Authentication Token**

Authenticate the ownership of a specific wallet

| Name          | Description                                      |
| ------------- | ------------------------------------------------ |
| `signature`   | Signed message signature                         |
| `signingDate` | Date given by signing message response           |
| `type`        | `evm` or `solana` (wallet type used for signing) |
| `wallet`      | Wallet that signed the message                   |

**Example**

<pre class="language-javascript"><code class="lang-javascript">const data = await clusters.getAuthToken(
<strong>    '0x0000000000000000000000000000000000000001',
</strong><strong>    '2025-03-26T14:56:07.601Z',
</strong>    'evm',
    '0x5cff9c1362a71247da33887be2a44ac36a8724bb',
);
</code></pre>

**Response**

> The auth key used for authenticated responses

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

```json
{
  "token": "eyJzaWduYXR1cmUiOiJhYmMxMjMiLCJzaWduaW5nRGF0ZSI6IjIwMjQtMDUtMTRUMTk6MDg6MjcuOTg1WiIsInR5cGUiOiJldm0iLCJ3YWxsZXQiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ=="
}
```

{% endtab %}
{% endtabs %}

***

**Validate Authentication Token**

Authenticate if a authentication key is valid or not

<table><thead><tr><th width="380.63671875">Name</th><th>Description</th></tr></thead><tbody><tr><td> <code>authToken</code></td><td>Authentication token</td></tr></tbody></table>

**Example**

```javascript
const check = await clusters.validateAuthToken(authToken)
```

**Response**

> The auth key used for authenticated responses

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

```json
{
  "signature": "abc123",
  "signingDate": "2024-05-14T19:08:27.985Z",
  "type": "evm",
  "wallet": "0x0000000000000000000000000000000000000000",
  "isValid": false
}
```

{% endtab %}
{% endtabs %}
