# 📚 Direct Stake API (/power-users/direct-stake-api)





For developers who prefer not to use React or wish to integrate minting functionality in a custom manner, The Vault offers a direct API endpoint at `https://direct.vaultapi.dev`. This API enables you to mint [Liquid Staking](/stake/liquid-staking) Tokens (LSTs) by constructing transactions tailored to your application's requirements.

<img alt="Banner: A developer joins two orange puzzle connectors between a cream laptop with a blank screen and a small validator server, representing a staking API integration." src="__img0" />

For the code, see the GitHub repository [The Vault LST Creator Widget](https://github.com/SolanaVault/lst-minter-widget).

## API endpoint [#api-endpoint]

The endpoint that builds a stake transaction is `https://direct.vaultapi.dev/stake`.

## Required query parameters [#required-query-parameters]

To successfully create a transaction, the following parameters must be included in the request:

| Parameter | Type   | Description                                                                |
| --------- | ------ | -------------------------------------------------------------------------- |
| `mint`    | String | The mint address of the LST to be minted.                                  |
| `address` | String | The wallet address initiating the minting process.                         |
| `amount`  | Number | The amount of SOL to stake, in lamports.                                   |
| `balance` | Number | The wallet's SOL balance, in lamports. The API stakes at most this amount. |

## Optional parameter [#optional-parameter]

The `target` parameter (String) is used only when minting [vSOL](/about/vsol): set it to the vote account of the validator to direct the vSOL to. Without it, the vSOL is not directed to a validator and becomes [undirected stake](/stake/direct-vs-undirected-stake). With it, the transaction also sets the wallet to [direct stake](/stake/direct-staking) to that validator.

## API response [#api-response]

Upon sending a valid request, the API returns a base64-encoded transaction in the `transaction` field. The user's wallet must sign this transaction and then broadcast it to the Solana network to complete the minting process.

## Integrate the API [#integrate-the-api]

Integration takes five steps.

<Steps>
  <Step>
    ### Construct the API request [#construct-the-api-request]

    Gather the required parameters: `address`, `mint`, `amount` and `balance`. To direct the vSOL to a validator, also include the `target` parameter.
  </Step>

  <Step>
    ### Send the request [#send-the-request]

    Make a GET request with the collected parameters to:

    ```bash
    https://direct.vaultapi.dev/stake
    ```
  </Step>

  <Step>
    ### Handle the response [#handle-the-response]

    Receive a base64-encoded transaction in the API's `transaction` field.
  </Step>

  <Step>
    ### Sign the transaction [#sign-the-transaction]

    Prompt the user's wallet to sign the received transaction.
  </Step>

  <Step>
    ### Broadcast the transaction [#broadcast-the-transaction]

    Submit the signed transaction to the Solana network for processing.
  </Step>
</Steps>

## Example API call [#example-api-call]

You can test the API with the following example:

```bash
curl "https://direct.vaultapi.dev/stake?\
address=<Minter's wallet address>&\
mint=vSoLxydx6akxyMD9XEcPvGYNGq6Nn66oqVb3UkGkei7&\
amount=100000&\
balance=1000000"
```

If you run this, the `transaction` field contains a transaction that you can inspect and simulate by pasting it into the [Solana Transaction Inspector](https://explorer.solana.com/tx/inspector).

## Unstake endpoint [#unstake-endpoint]

To swap vSOL back to SOL, send a GET request to `https://direct.vaultapi.dev/unstake` with two parameters:

* `address`: the wallet that holds the vSOL.
* `amount`: the amount of vSOL to unstake, in raw units.

The API returns a transaction that unstakes through The Vault's [Unstake Pool](/products/unstake-pool) and falls back to a Jupiter swap when the pool lacks liquidity.

## Stake data [#stake-data]

The API builds transactions only; it doesn't serve stake data. The stakebot publishes its validated stake data, including direct stake per validator, in the [stakebot-data repository](https://github.com/SolanaVault/stakebot-data), and the [Dune dashboard](https://dune.com/kagren0/the-vault-validators) lists The Vault's validators.

## Get help [#get-help]

For any issues or questions, join our [Discord](https://discord.gg/thevaultfinance) community.
