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

# v1

## API Endpoint

```
https://api.clusters.xyz/v1
```

#### API KEY

{% hint style="info" %}
You can get an API Key by visiting <https://clusters.xyz/developer>
{% endhint %}

If you have an API KEY, you can add it to the request headers like so:

```javascript
fetch(URL, { headers: { "X-API-KEY": "abc123" } }) 
```

***

## Authentication

{% hint style="info" %}
Currently, this is only required for [Managing Wallets](/getting-started/api/v0.1-deprecated/managing-wallets.md). If you do not need to manage wallets via the API, you can ignore this.
{% 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**

<mark style="color:green;">`GET`</mark> `/v1/auth/message`

Get the signing message used for wallet signature authentication

**Example**

```bash
curl -X GET 'https://api.clusters.xyz/v1/auth/message'
```

**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 Key**

<mark style="color:green;">`POST`</mark> `/v1/auth/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**

```bash
curl --request POST \
  --url https://api.clusters.xyz/v1/auth/token \
  --header 'Content-Type: application/json' \
  --data '{
  "signature": "abc123",
  "signingDate": "2024-05-14T19:08:27.985Z",
  "type": "evm",
  "wallet": "0x0000000000000000000000000000000000000000"
}'
```

**Response**

> The auth key used for authenticated responses

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

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

{% endtab %}
{% endtabs %}

***

**Validate Authentication Key**

<mark style="color:green;">`POST`</mark> `/v1/auth/validate`

Authenticate if a authentication key is valid or not

| Name                | Description        |
| ------------------- | ------------------ |
| HEADER `X-AUTH-KEY` | Authentication key |

**Example**

```bash
curl --request GET
--url https://api.clusters.xyz/v1/auth/validate
--header 'X-AUTH-KEY: eyJzaWduYXR1cmUiOiJhYmMxMjMiLCJzaWduaW5nRGF0ZSI6IjIwMjQtMDUtMTRUMTk6MDg6MjcuOTg1WiIsInR5cGUiOiJldm0iLCJ3YWxsZXQiOiIweDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAifQ=='
```

**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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clusters.xyz/getting-started/api/v1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
