> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hedgin.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

> Make a first read, build a swap, and send it with the Hedgin manager bot API.

This page takes you from a new API key to one confirmed Jupiter swap. Each step shows the call and what you should get back.

<Warning>
  The last two steps move real funds on Solana mainnet-beta. Run them only against a dedicated vault with a small balance.
</Warning>

You need:

* An API key from a Hedgin administrator with scopes `read`, `send`, and `jupiter/swap`.
* The manager keypair that is the vault's current on-chain authority.
* `curl` and Node.js 18 or later.

<Steps>
  <Step title="Store the API key">
    Keep the key in your bot's secret store, not in source code. For a shell session, load it into an environment variable:

    ```sh theme={null}
    export HEDGIN_API_KEY="hv1_..."
    ```

    Every request sends it as `Authorization: Bearer $HEDGIN_API_KEY`.
  </Step>

  <Step title="List your vaults">
    ```sh theme={null}
    curl --fail-with-body \
      -H "Authorization: Bearer $HEDGIN_API_KEY" \
      https://hedgin.xyz/api/external/v1/vaults
    ```

    You get `{ "vaults": [...] }`. Each entry has an `address`, a `depositMint`, and `depositDecimals`. Copy the `address` of the vault you want to use. An empty list means the key's manager is not the authority of any vault in the key's scope.
  </Step>

  <Step title="Get a quote">
    Amounts are integer strings in token base units. For a token with 6 decimals, `"1000000"` is 1 token.

    ```sh theme={null}
    curl --fail-with-body --get \
      -H "Authorization: Bearer $HEDGIN_API_KEY" \
      --data-urlencode "vault=$VAULT" \
      --data-urlencode "inputMint=$SOURCE_MINT" \
      --data-urlencode "outputMint=$DESTINATION_MINT" \
      --data-urlencode "amount=1000000" \
      --data-urlencode "slippageBps=50" \
      https://hedgin.xyz/api/external/v1/jupiter/quote
    ```

    You get `{ "vault": "...", "data": { "inAmount", "outAmount", "priceImpactPct", "routeLabels", "slippageBps" } }`. A quote does not reserve a price.
  </Step>

  <Step title="Build the swap">
    ```sh theme={null}
    curl --fail-with-body \
      -H "Authorization: Bearer $HEDGIN_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"vault":"'$VAULT'","sourceMint":"'$SOURCE_MINT'","destinationMint":"'$DESTINATION_MINT'","amount":"1000000","slippageBps":50}' \
      https://hedgin.xyz/api/external/v1/transactions/jupiter/swap
    ```

    You get `{ "vault": "...", "result": { "transaction", "simulation", "ticket", "blockhash", ... } }`. `transaction` is an unsigned base64 Solana v0 transaction. The ticket expires 90 seconds after the build, so sign and send promptly. Do not put `payer` in the body. The API sets it from your key.
  </Step>

  <Step title="Sign, send, and confirm">
    Sign the transaction locally with the manager keypair. Then post the signed bytes and the ticket to `POST /transactions/send`, and poll `GET /transactions/status` with the returned `receipt` until it reports `confirmed`. [Examples](/api-reference/examples) has the complete TypeScript code for this step.

    The swap happened only when status is `confirmed`. If send returns `status: "unknown"`, keep polling the same receipt. Do not build the swap again until the status is `expired` or `failed`.

    If the build result has a `next` field, the swap needs a follow-up transaction. After the first one confirms, build `next.path` with `next.body`. That follow-up is `jupiter/swap` again or `jupiter/sweep`, and the key needs that scope too.
  </Step>
</Steps>

## Next steps

* Read [Send and status](/api-reference/send-and-status) before you handle batches or `next` steps.
* Ask your administrator for each additional builder action your bot needs. [Authentication](/api-reference/authentication) lists the continuation scopes some actions require.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.