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

# Quickstart

> A working deposit, in three curl commands.

You need a Console account and a Stellar account that can sign. Everything below runs on mainnet; swap in `?network=testnet` to try it on the [Sandbox](/integration-guide/sandbox) first.

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/gz6GU5kAUXY?si=54lqva3t6lzKjvdH&start=145" title="Integration walkthrough" frameBorder="0" allowFullScreen />

## 1. Get an API key and a vault

Open the [Console](https://console.defindex.io), create an account, go to **API Keys** and generate one. It looks like `sk_...` and it is the only credential your backend needs. You hold one active key at a time: generating a new one revokes the old one.

Create your vault in the same place, or point at one that already exists. Either way you end up with a vault address. The longer walkthrough is in [Getting your API key](/integration-guide/guides-and-tutorials/getting-api-key).

## 2. Build a deposit

The API returns an unsigned transaction for the user. Amounts are in the asset's smallest unit, 7 decimals for USDC and XLM.

```bash theme={null}
curl -X POST "https://api.defindex.io/vault/VAULT_ADDRESS/deposit?network=mainnet" \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "amounts": [10000000], "caller": "GUSER...", "invest": true }'
```

The response carries `xdr`, the transaction to sign.

## 3. Sign and send

Sign `xdr` with the user's key, in your wallet stack or with the Stellar SDK, and send it back:

```bash theme={null}
curl -X POST "https://api.defindex.io/send?network=mainnet" \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{ "xdr": "SIGNED_XDR" }'
```

Then read the balance:

```bash theme={null}
curl "https://api.defindex.io/vault/VAULT_ADDRESS/balance?from=GUSER...&network=mainnet" \
  -H "Authorization: Bearer sk_..."
```

`underlyingBalance` is what the user holds, in the vault's asset. Withdraw is the same flow against `/withdraw`.

## The same thing in TypeScript

One client class covers every call. `POST /send` sits at the API root rather than under a vault path, which is the only shape that differs.

```typescript theme={null}
class ApiClient {
    private readonly apiUrl = "api.defindex.io";
    constructor(private readonly apiKey: string) {}

    private headers() {
        return {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${this.apiKey}`
        };
    }

    async postData(endpoint: string, vaultAddress: string, params: Record<string, any>) {
        const res = await fetch(`https://${this.apiUrl}/vault/${vaultAddress}/${endpoint}`, {
            method: 'POST', headers: this.headers(), body: JSON.stringify(params)
        });
        return res.json();
    }

    async getData(endpoint: string, vaultAddress: string, params?: Record<string, any>) {
        const qs = params ? `?${new URLSearchParams(params)}` : '';
        const res = await fetch(`https://${this.apiUrl}/vault/${vaultAddress}/${endpoint}${qs}`, {
            method: 'GET', headers: this.headers()
        });
        return res.json();
    }

    async send(signedXdr: string) {
        const res = await fetch(`https://${this.apiUrl}/send`, {
            method: 'POST', headers: this.headers(), body: JSON.stringify({ xdr: signedXdr })
        });
        return res.json();
    }
}
```

## Next

* [Vault Operations](/integration-guide/vault-operations/index): deposit, withdraw, balance and APY, one page each.
* [API reference](https://api.defindex.io/docs): every route and every parameter.
* [Fees and revenue](/intro/fees): set your fee and see what you keep.
