# Try the Earn lifecycle

Discover a vault, create a sample position and follow its withdrawal through the sandbox API.

The sandbox is a working simulation for product and engineering teams. It creates sample positions and activity without connecting a wallet or moving assets. Use it to understand the response shapes and prototype the Earn journey.

## 1. Configure the sandbox connection

```bash
export THESAUROS_SANDBOX_BASE="https://developer.thesauros.io/api/v1"
export THESAUROS_SANDBOX_KEY="tsk_test_thesauros_sandbox_0000000000000000"
```

This is the shared sandbox test credential. It does not grant access to a Partner API account. A locally run sandbox exposes the same contract under its configured base URL.

## 2. Discover available sample vaults

```bash
curl --fail-with-body \
  "$THESAUROS_SANDBOX_BASE/vaults?asset=USDC" \
  -H "Authorization: Bearer $THESAUROS_SANDBOX_KEY"
```

The response contains a list in `data`. Use the available asset, vault and status fields when building the selection screen.

## 3. Create a sample position

```bash
curl --fail-with-body \
  -X POST "$THESAUROS_SANDBOX_BASE/positions" \
  -H "Authorization: Bearer $THESAUROS_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: earn-example-001" \
  -d '{"wallet":"0x0000000000000000000000000000000000000001","asset":"USDC","amount":1000,"strategy":"auto"}'
```

Save the returned `data.id`. The wallet address is an example input; this request does not ask that wallet to sign. Use a new idempotency key for a new intended operation, and reuse the same one when repeating the same request.

## 4. Inspect the position

Replace the value below with the ID from your response.

```bash
export POSITION_ID="your-returned-position-id"

curl --fail-with-body \
  "$THESAUROS_SANDBOX_BASE/positions/$POSITION_ID" \
  -H "Authorization: Bearer $THESAUROS_SANDBOX_KEY"
```

Follow the principal, current value, accrued yield and status. The position history endpoint provides events that can inform the activity view.

## 5. Try a withdrawal

```bash
curl --fail-with-body \
  -X POST "$THESAUROS_SANDBOX_BASE/positions/$POSITION_ID/withdraw" \
  -H "Authorization: Bearer $THESAUROS_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"all":true}'
```

Use the returned status and position history to represent the lifecycle in your product. Sandbox state can reset when the process restarts; it is not a persistent customer account.

## Continue with your business integration

The Partner API uses a separate contract for attribution, reporting and operations. Start the [Partner API quickstart](/start/quickstart/) when your account and connection details are available. The [environment comparison](/start/environments/) explains the differences that matter when moving beyond the prototype.
