> ## 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.

# Webhooks

> Register webhooks and receive real-time Portfolio Wallet events.

Subscribe to webhooks to receive real-time notifications about wallet workflow, deposit, rebalance, withdrawal, payout, and strategy lifecycle changes.

Registrations created through v3 receive v3 payloads and are managed through v3. Existing v2 registrations retain v2 payloads and are managed through v2.

## Register a webhook

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "$BASE_URL/v3/webhooks" \
  -H "Authorization: Bearer $GROUND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://example.com/ground/webhook",
  "events": [
    "portfolio_wallet.status_changed",
    "portfolio_wallet.deposit.status_changed",
    "portfolio_wallet.withdrawal.status_changed",
    "portfolio_wallet.withdrawal.payout.status_changed",
    "portfolio_wallet.approval.status_changed",
    "portfolio_wallet.strategy.status_changed",
    "portfolio_wallet.rebalance.status_changed",
    "portfolio_wallet.risk.alert.triggered",
    "portfolio_wallet.risk.alert.resolved",
    "portfolio_wallet.risk.action.status_changed",
    "portfolio_wallet.risk.unwind.completed"
  ],
  "description": "Production webhook endpoint"
}'
```

The create response includes `id`, `url`, `events`, `createdAt`, and `secret`. Store `secret` on the server only (env var / secret manager). The `secret` field is **only returned on create** -- it is not included when listing endpoints.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "a1b2c3d4-0000-4000-8000-000000000001",
  "url": "https://example.com/ground/webhook",
  "events": [
    "portfolio_wallet.deposit.status_changed",
    "portfolio_wallet.rebalance.status_changed"
  ],
  "createdAt": "2026-02-05T08:00:00.000Z",
  "secret": "a1b2c3d4e5f60718293a4b5c6d7e8f90112233445566778899aabbccddeeff00"
}
```

Only `portfolio_wallet.*` event types are accepted. Requests that include event types outside the `portfolio_wallet.*` namespace will be rejected with a validation error.

## List webhooks

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X GET "$BASE_URL/v3/webhooks?limit=25" \
  -H "Authorization: Bearer $GROUND_API_KEY"
```

The list is returned under `data`. Pass a non-null `nextCursor` as `cursor` to fetch the next page. Note that `secret` is **not** included in list responses. See [API Conventions](https://docs.groundtech.co/v3/docs/portfolio-wallets/api-conventions.md) for the list envelope.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "data": [
    {
      "id": "a1b2c3d4-0000-4000-8000-000000000001",
      "url": "https://example.com/ground/webhook",
      "events": [
        "portfolio_wallet.deposit.status_changed",
        "portfolio_wallet.rebalance.status_changed"
      ],
      "createdAt": "2026-02-05T08:00:00.000Z"
    }
  ],
  "nextCursor": null
}
```

## Delete a webhook

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X DELETE "$BASE_URL/v3/webhooks/$ENDPOINT_ID" \
  -H "Authorization: Bearer $GROUND_API_KEY"
```

A successful response confirms the deleted registration ID with `deleted: true`.

## Portfolio Wallet events

| Event | Fires when |
| - | - |
| `portfolio_wallet.status_changed` | The wallet's lifecycle status changes (e.g. `creating` -> `idle`, `rebalance_active`, `withdrawal_active`, or `failed`) |
| `portfolio_wallet.deposit.status_changed` | A deposit posts to the wallet after observed finality and ledger accounting |
| `portfolio_wallet.withdrawal.status_changed` | A withdrawal workflow changes status or step progress |
| `portfolio_wallet.withdrawal.payout.status_changed` | An individual withdrawal payout leg changes status or step progress |
| `portfolio_wallet.approval.status_changed` | An organization approval becomes pending, approved, rejected, expired, or failed |
| `portfolio_wallet.strategy.status_changed` | A strategy update is applied |
| `portfolio_wallet.rebalance.status_changed` | A rebalance workflow transitions status |
| `portfolio_wallet.risk.alert.triggered` | A portal-configured risk rule triggers an alert |
| `portfolio_wallet.risk.alert.resolved` | A risk alert is resolved |
| `portfolio_wallet.risk.action.status_changed` | A risk action changes status |
| `portfolio_wallet.risk.unwind.completed` | A risk-triggered unwind finishes moving value to cash |

## Handle an event

1. [Verify the signature](https://docs.groundtech.co/v3/docs/portfolio-wallets/webhook-signature-verification.md)
   against the raw request body before parsing it.
2. Use `Ground-Event-Id` to recognize duplicate deliveries.
3. Queue processing and respond with `200` promptly.
4. Read the latest wallet or operation state before updating your application.
   Reconcile periodically to recover missed updates.

## Event payloads

See [Webhook payload examples](https://docs.groundtech.co/v3/docs/portfolio-wallets/webhook-payload-examples.md) for complete bodies for each event, including risk actions and settled stock trades.

## Error responses

Webhook registration and management endpoints return errors in a consistent `{error, code}` structure:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "error": "Unsupported event types: portfolio_wallet.legacy_event",
  "code": "validation_error"
}
```

## Stock conversion details

For a completed stock conversion, a rebalance or withdrawal leg can include `assetTrades`. Each entry identifies the stock, buy or sell side, exact stock and USDC native quantities, chain, and transaction hash. It appears after finalized settlement; an indicative quote is not a completed trade. See [webhook payload examples](https://docs.groundtech.co/v3/docs/portfolio-wallets/webhook-payload-examples.md).


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