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

# Create a MicroVault

> Create a vault and track its deployment.

Creating a MicroVault deploys a non-upgradeable vault with its own ERC-20 share token. The vault contract address is also the share-token address.

## Prerequisites

* MicroVaults enabled for your organization
* A base asset returned by `GET /v2/microvaults/yield-sources?chainId=11155111`
* A fee recipient address

## 1. Submit the vault settings

Fees use basis points: `100` is `1%`. Use `0` for no fee.

| Field               | Meaning                                                                                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `baseAsset`         | Token shareholders deposit and receive on redemption. It must match an available MicroVault yield source on the selected chain. |
| `name`              | Full ERC-20 name shown for the share token.                                                                                     |
| `symbol`            | Short ERC-20 ticker shown for the share token.                                                                                  |
| `feeRecipient`      | Address that receives fee shares when fees accrue.                                                                              |
| `managementFeeBps`  | Annual management fee in basis points.                                                                                          |
| `performanceFeeBps` | Fee on gains above the vault's high-water NAV, in basis points.                                                                 |

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://sandbox.groundtech.co/v2/microvaults/vaults" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "baseAsset":"0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
    "name":"Acme Treasury MicroVault",
    "symbol":"acmeUSDC",
    "feeRecipient":"0x76f8fc6667e239f83a547d4e16225d6a34f6fa22",
    "managementFeeBps":0,
    "performanceFeeBps":0
  }'
```

The response describes the asynchronous creation task. Save `task.id` to identify this creation attempt.

## 2. Track provisioning

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
async function waitForVault(name) {
  for (;;) {
    const response = await fetch(`${process.env.GROUND_API}/v2/microvaults/vaults`, {
      headers: { Authorization: `Bearer ${process.env.GROUND_API_KEY}` },
    });
    if (!response.ok) throw new Error(await response.text());
    const result = await response.json();
    const vault = result.items.find((item) => item.shareName === name);
    if (vault) return vault;
    const pending = result.provisionings.find((item) => item.shareName === name);
    if (pending?.status === "failed") throw new Error(pending.error);
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}
```

## Confirm creation

Creation is complete when the vault appears in `items` with `status: "active"`. Save its `id` for API calls. Its `address` is both the vault contract address and the ERC-20 share-token address.

If the provisioning entry reports `failed`, do not create a duplicate vault with the same settings. Record its task ID and error, correct the reported cause, and retry with a new idempotency key.
