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

# Build with your coding agent

> Give an agent the integration brief, product procedures, and sandbox acceptance criteria.

Use this brief with a coding agent that can inspect your application. First
configure [API access](https://docs.groundtech.co/v3/docs/overview/reach-the-api.md) and the chosen product's
test assets and signer. Complete login, passkey ceremonies, and authorizations
yourself. Store credentials directly in server secrets, outside chat and logs.

Portfolio Wallet signing setup is in [Transaction approvals](https://docs.groundtech.co/v3/docs/portfolio-wallets/transaction-approvals.md#set-up-a-signer).
Wallet-signed gtoken and MicroVault transactions use the holder's wallet instead.

## Copy the prompt

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Implement a complete Ground sandbox integration in this codebase.
Read https://docs.groundtech.co/v3/docs/agentic-installation in full, including
its implementation checklist, selected product procedure, and acceptance checks.
Read the linked operation guides and current OpenAPI request/response schemas
before coding their endpoints. Follow their links when an operation is conditional.

1. Inspect the application framework, existing account model, authentication,
   backend routes, database, wallet provider, signing, UI, and tests.
   Choose Portfolio Wallets, MicroVaults, or gTokens from balance ownership and
   signer responsibility. Explain the choice. Ask only for missing choices that
   change ownership, permission, fees, receiver, or fund movement. Inspect existing
   configuration before asking. Never guess credentials, enabled access, or assets.
2. Use https://sandbox.groundtech.co and its current product catalog. Verify access,
   networks, deployed interfaces, test funding, and the authorized signer.
   Follow this guide's exact dashboard URLs and credential setup steps. Check the
   selected organization and environment on each page. Have the human complete
   login, passkey ceremonies, and authorize signing setup; store secrets securely.
   Never substitute production funds or networks when a sandbox flow is blocked.
3. Implement the application integration, not just discovery calls: backend API
   client and authorization, durable account/resource mapping, stable identities
   for logical writes, signer and approval flows, funding/subscription, balance
   and yield display, withdrawal/redemption, and any request/claim step.
   Reuse this repository's conventions, wallet provider, storage, and test tools.
4. Build pending/error/completed states and recovery. Persist operation identity
   before submission; restore tracking after refresh or restart. Reconcile webhooks
   and receipts with current API/onchain reads. Treat decimal amounts precisely.
   Keep API keys server-side. Do not guess contract methods or duplicate an
   uncertain operation with a new request ID or wallet transaction.
5. Run the project's relevant checks, meaningful mocked recovery tests, and a
   real sandbox funding-to-withdrawal round trip when access/funding/signing permit.
   Confirm actual assets or shares and final receiver delivery. An accepted API
   response, submitted transaction, or queued settlement is not completion.
6. Deliver changed files, setup instructions, checks run, redacted environment
   details, resource IDs, transaction hashes, initial/final balances, and evidence
   for every acceptance check. Separate mocked, simulated, confirmed, and pending
   evidence. If blocked, finish independent work, preserve resumable state, and
   state the exact prerequisite and next action. Do not claim an untested flow works.
   Optional: submit one concise redacted finding using this page's feedback section.
Do not use production funds or deploy the integration without explicit authorization.
```

## Establish the integration contract

Before coding, record these decisions in the application's integration notes. Reuse existing choices where they are explicit; surface consequential missing decisions to the developer.

| Decision | What the agent must establish |
| - | - |
| Product and ownership | Who owns the balance or shares, who can move funds, and which application account owns each resource. |
| Signing | Which organization, customer, or shareholder signs each action; how the application obtains authorization and approval. |
| Environment and access | Sandbox organization, enabled product/source, API key scopes, chain, asset, test funding, and native gas. |
| Strategy and economics | Sources, allocations, liquidity needs, fees and recipient, receiver, and allowed minimum output. Use current catalog/quotes. |
| User journey | Existing screens or backend workflow for funding, balance/yield, exit, pending settlement, approval, and failure recovery. |
| Operation storage | Where resource IDs, logical request IDs, transaction hashes/nonces, task/request IDs, and progress survive a restart. |

Use the current request and response schemas through the product's API reference tab. Resolve IDs, addresses, supported routes, decimals, limits, lifecycle states, and access from the selected environment. Read contract ABIs from verified deployed implementations, including the implementation behind a proxy.

## Implement the application

Build each of the following using the project's existing architecture.

1. **Server API boundary.** Load the organization key from server secrets. Authorize the application's user and verify their ownership before acting on a Ground resource; the organization key alone does not establish end-user ownership. Validate inputs, return useful safe errors, and keep credentials and signing material out of client bundles and logs.
2. **Account mapping and operation persistence.** Persist the application account's Ground resource identity. Before a write, save one stable logical operation ID and payload. Track its Ground resource/task ID or onchain request and transaction evidence. Make concurrent submissions and retries resolve to that operation. API idempotency and chain transaction nonces are separate mechanisms.
3. **Funding and exit actions.** Implement the selected product's full procedure below, including access activation, approvals, address readiness, quotes, signing, and asynchronous claims. Check the chosen chain, asset, receiver, and amount immediately before signing. Decode integer units with the asset's decimals; preserve API decimal strings without floating-point rounding.
4. **Balance and progress reads.** Show confirmed balances and shares, and distinguish principal, yield, and APY. Use each product's documented statuses to show progress through access setup, approvals, submission, settlement, claims, completion, or failure. Prevent repeated clicks from creating another logical operation.
5. **Reconciliation.** Use the product's documented webhook verification where available; deduplicate delivery and refresh current resource state. Add bounded polling and recovery on application restart, missed events, delayed indexing, and RPC interruption. Keep a queued redemption resumable until proceeds arrive. Stop polling on terminal states; use appropriate backoff and a visible pending state instead of promising a completion time.
6. **Setup and checks.** Document required secret names, enabled access, networks, test asset/gas preparation, and how to run the integration. Add tests for authorization/ownership, precise amounts, repeat submission, uncertain responses, pending/failed operations, and restart recovery using the repository's test tools. Run existing affected checks and the sandbox acceptance flow below.

## Product procedures

Use this reading order to obtain exact executable payloads and transaction calls. Complete all steps in the chosen row, including its exit path.

| Product | Required operation guides, in order |
| - | - |
| Portfolio Wallets | [Create](https://docs.groundtech.co/v3/docs/portfolio-wallets/create-wallet.md) → [fund](https://docs.groundtech.co/v3/docs/portfolio-wallets/deposits.md) → [automatic rebalancing](https://docs.groundtech.co/v3/docs/portfolio-wallets/auto-rebalancing.md) or [manual allocation](https://docs.groundtech.co/v3/docs/portfolio-wallets/allocate-funds.md) → [read balances/yield](https://docs.groundtech.co/v3/docs/portfolio-wallets/balances-and-yield.md) → [preview and withdraw](https://docs.groundtech.co/v3/docs/portfolio-wallets/withdraw-funds.md) → [approve](https://docs.groundtech.co/v3/docs/portfolio-wallets/transaction-approvals.md) → [reconcile](https://docs.groundtech.co/v3/docs/portfolio-wallets/balances-and-yield.md#keep-the-displayed-balance-current). |
| MicroVaults | [Create](https://docs.groundtech.co/v3/docs/microvaults/create-vault.md) → [strategy](https://docs.groundtech.co/v3/docs/microvaults/strategy.md) and [fees](https://docs.groundtech.co/v3/docs/microvaults/fees.md) → [shareholder access](https://docs.groundtech.co/v3/docs/microvaults/shareholders.md) → [subscribe](https://docs.groundtech.co/v3/docs/microvaults/subscribe.md) → [redeem and claim](https://docs.groundtech.co/v3/docs/microvaults/redeem.md) → [reconcile](https://docs.groundtech.co/v3/docs/microvaults/status-and-performance.md). |
| gTokens | [Set up your gVault](https://docs.groundtech.co/v3/docs/gtokens/discover-yield-sources.md) → [customer access](https://docs.groundtech.co/v3/docs/gtokens/manage-gtoken-access.md) → [deposit and redeem](https://docs.groundtech.co/v3/docs/gtokens/deposit-and-redeem.md) → [asynchronous claims](https://docs.groundtech.co/v3/docs/gtokens/async-operations) where required. |

Follow the complete procedure for the selected product. Read each linked operation guide before constructing that operation; it contains the exact payload, authorization, and contract call for that lifecycle.

## Recover safely

| Situation | Required behavior |
| - | - |
| API timeout after a write | Read the original resource/task where supported or replay the original payload and idempotency identity. Do not create another identity to bypass uncertainty. |
| `409` idempotency conflict | Compare the saved payload with the submitted payload. Treat a changed request as a new logical action only after resolving the original. |
| `401` / `403` | Resolve credentials, scope, or product/source access. Do not silently change organization or environment. |
| `429` / temporary `503` | Respect `Retry-After`, use bounded backoff, and preserve the operation identity. |
| Transaction submission uncertainty | Check the transaction receipt, signer nonce, and relevant contract request/state before retrying. A fresh API ID does not protect against a duplicate transfer. |
| Reverted receipt | Record the revert and state. Resolve its cause and obtain a fresh quote/proof where required before an authorized retry. |
| Delayed task, indexing, or settlement | Keep the operation pending and resumable. Refresh authoritative state; a date estimate or webhook alone is not proof of completion. |
| Missing access, test assets, or signer | Finish code and mocked checks that do not depend on that prerequisite, then report the exact blocker. Do not claim sandbox validation. |

## Verify the result

Run a real sandbox round trip when the developer has supplied access, test assets, and signing authorization. Capture starting balances, fund or subscribe, wait for confirmed credit/shares, exit, and confirm assets at the intended receiver. Exercise a restart while an operation is pending and recover the same operation. For a queued source, include successful claim and receiver delivery; if settlement is still pending, retain the request and report it as incomplete.

| Product | Required confirmed evidence |
| - | - |
| Portfolio Wallets | Correct provisioned address; completed deposit and credited amount; actual allocation/positions; withdrawal preview and accepted withdrawal; required signer approvals; completed withdrawal and receiver payout. |
| MicroVaults | Creation task correlated with the active vault; effective strategy/fees; active shareholder proofs; successful approval/subscription receipts and minted shares; instant delivery or requested redemption followed by successful claim and `claimed` state. |
| gTokens | [Set up your gVault](https://docs.groundtech.co/v3/docs/gtokens/discover-yield-sources.md) → [customer access](https://docs.groundtech.co/v3/docs/gtokens/manage-gtoken-access.md) → [deposit and redeem](https://docs.groundtech.co/v3/docs/gtokens/deposit-and-redeem.md) → [asynchronous claims](https://docs.groundtech.co/v3/docs/gtokens/async-operations) where required. |

The final handoff must include changed files, setup/run instructions, check results, resource and operation IDs, chain and transaction hashes, and starting/final asset and share balances. State whether each check used a mock, simulation, or confirmed sandbox transaction. List unresolved approvals, access, signing, failed tasks, and queued settlement with the exact next action.

## Integration feedback

Use [Submit integration feedback](https://docs.groundtech.co/v3/api-reference/submit-integration-feedback.md)
to report a distinct bug, documentation mismatch, friction point, request, or
successful test. Submit from the backend with a write-enabled organization key.
Save the report and its submission UUID before sending; retry uncertain outcomes
with the same content and ID. Reporting is optional and must not block the integration.


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