# Custom Liquid Staking APIs

Custom Liquid Staking (CLS) allows you to liquid stake to specific validators! The SOL deposited to the pool during a CLS transaction will be delegated to the specified validator as long as the bSOL stays in the user's control (either through staying in the wallet or being used in a supported DeFi integration like Orca, Raydium, and Saber).

## Gets a list of eligible validators for Custom Liquid Staking

<mark style="color:blue;">`GET`</mark> `stake.solblaze.org/api/v1/cls_eligible_validators`

Not all validators are eligible! For example, validators that are offline or take 100% of staking rewards in fees are automatically disqualified.

{% tabs %}
{% tab title="200: OK success - returns the supported validators" %}

```javascript
{
    success: "true",
    "vote_accounts": [...]
}
```

{% endtab %}
{% endtabs %}

## Submits a stake transaction to CLS from the TypeScript SDK

<mark style="color:blue;">`GET`</mark> `stake.solblaze.org/api/v1/cls_stake`

#### Query Parameters

| Name                                        | Type   | Description                                                 |
| ------------------------------------------- | ------ | ----------------------------------------------------------- |
| txid<mark style="color:red;">\*</mark>      | String | The txid(s) of the staking transaction(s) (comma-separated) |
| validator<mark style="color:red;">\*</mark> | String | The vote account of the validator                           |

{% tabs %}
{% tab title="200: OK success - submits the transaction to CLS" %}

```javascript
{
    "success": true
}
```

{% endtab %}

{% tab title="200: OK error - missing parameters" %}

```javascript
{
    "success": false,
    "error": "Missing parameters, endpoint requires the following fields: txid, validator."
}
```

{% endtab %}

{% tab title="200: OK error - unable to submit transaction" %}

```javascript
{
    "success": false,
    "error": "Unable to add transaction to CLS, please try again later."
}
```

{% endtab %}

{% tab title="200: OK error - unknown error" %}

```javascript
{
    "success": false,
    "error": "An unknown error occurred, please try again in a few minutes."
}
```

{% endtab %}
{% endtabs %}

## Submits an unstake transaction to CLS from the TypeScript SDK

<mark style="color:blue;">`GET`</mark> `stake.solblaze.org/api/v1/cls_unstake`

#### Query Parameters

| Name                                        | Type   | Description                                                 |
| ------------------------------------------- | ------ | ----------------------------------------------------------- |
| txid<mark style="color:red;">\*</mark>      | String | The txid(s) of the staking transaction(s) (comma-separated) |
| validator<mark style="color:red;">\*</mark> | String | The vote account of the validator                           |

{% tabs %}
{% tab title="200: OK success - submits the transaction to CLS" %}

```javascript
{
    "success": true
}
```

{% endtab %}

{% tab title="200: OK error - missing parameters" %}

```javascript
{
    "success": false,
    "error": "Missing parameters, endpoint requires the following fields: txid, validator."
}
```

{% endtab %}

{% tab title="200: OK error - unable to submit transaction" %}

```javascript
{
    "success": false,
    "error": "Unable to add transaction to CLS, please try again later."
}
```

{% endtab %}

{% tab title="200: OK error - unknown error" %}

```javascript
{
    "success": false,
    "error": "An unknown error occurred, please try again in a few minutes."
}
```

{% endtab %}
{% endtabs %}

## Gets the target stakes for a user

<mark style="color:blue;">`GET`</mark> `https://stake.solblaze.org/api/v1/cls_user_target`

There may be a delay of up to 1 epoch in calculating new target stakes. These stakes may or may not be applied exactly based on whether enough bSOL is in the user's wallet to back those stakes.

#### Query Parameters

| Name                                      | Type   | Description             |
| ----------------------------------------- | ------ | ----------------------- |
| address<mark style="color:red;">\*</mark> | String | The address of the user |

{% tabs %}
{% tab title="200: OK success - returns the target stakes" %}

```javascript
{
    "success": true,
    "stakes": {
        "validator_vote_account": decimal_sol_amount,
        ...
    }
}
```

{% endtab %}

{% tab title="200: OK error - missing parameters" %}

```javascript
{
    "success": false,
    "error": "Missing parameters, endpoint requires the following fields: address."
}
```

{% endtab %}

{% tab title="200: OK error - unable to query target stakes" %}

```javascript
{
    "success": false,
    "error": "Unable to query target stakes, please try again later."
}
```

{% endtab %}

{% tab title="200: OK error - unknown error" %}

```javascript
{
    "success": false,
    "error": "An unknown error occurred, please try again in a few minutes."
}
```

{% endtab %}
{% endtabs %}

We will be adding more API methods over the next few days, stay tuned!
