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

# Update wallet strategy

> Replaces the included token strategy groups and preserves omitted groups. Idempotent on `requestId` — if a strategy update with the same `requestId` and identical allocations already exists, the canonical strategy allocations are returned. If `requestId` was used with different allocations, a `409 request_id_conflict` is returned.



## OpenAPI

````yaml swagger/swagger-combined.yaml PATCH /v2/wallets/{id}/strategy
openapi: 3.0.0
info:
  title: Ground API
  description: Core API for portfolio wallets, deposits, withdrawals, and webhooks.
  version: 2.0.0
servers:
  - url: https://sandbox.groundtech.co
  - url: https://production.groundtech.co
security:
  - bearerAuth: []
tags:
  - name: System
    description: System health and utility endpoints.
  - name: Sandbox Faucets
    description: Sandbox-only test token faucets.
  - name: Portfolio Wallets
    description: >-
      Portfolio wallets with strategy allocation, deposits, withdrawals, and
      yield positions.
  - name: Webhook Endpoints
    description: Webhook endpoint management for portfolio wallet notifications.
paths:
  /v2/wallets/{id}/strategy:
    patch:
      tags:
        - Portfolio Wallets
      summary: Update wallet strategy
      description: >-
        Replaces the included token strategy groups and preserves omitted
        groups. Idempotent on `requestId` — if a strategy update with the same
        `requestId` and identical allocations already exists, the canonical
        strategy allocations are returned. If `requestId` was used with
        different allocations, a `409 request_id_conflict` is returned.
      operationId: patchWalletStrategyV2
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Wallet ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - requestId
                - allocations
              properties:
                requestId:
                  type: string
                  format: uuid
                  description: Client-generated idempotency key (UUID v4).
                allocations:
                  $ref: '#/components/schemas/TokenStrategyAllocationsInput'
            example:
              requestId: c3d4e5f6-0000-4000-8000-000000000001
              allocations:
                usdt:
                  - yieldSourceId: cash
                    pct: 100
      responses:
        '200':
          description: Strategy updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StrategyUpdateResponse'
              example:
                strategyAllocations:
                  usdc:
                    - yieldSourceId: syrup-usdc
                      targetWeightBps: 4000
                    - yieldSourceId: morpho-gauntlet-usdc
                      targetWeightBps: 3000
                    - yieldSourceId: morpho-steakhouse-usdc
                      targetWeightBps: 3000
                  usdt:
                    - yieldSourceId: cash
                      targetWeightBps: 10000
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_allocation:
                  value:
                    error: Allocation percentages must sum to 100
                    code: validation_error
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Wallet not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                wallet_not_found:
                  value:
                    error: Wallet not found
                    code: wallet_not_found
        '409':
          description: requestId conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                request_id_conflict:
                  value:
                    error: requestId has already been used with a different payload
                    code: request_id_conflict
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    TokenStrategyAllocationsInput:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        usdc:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/AllocationInput'
          description: USDC-compatible allocations. Percentages must sum to 100.
        usdt:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/AllocationInput'
          description: USDT-compatible allocations. Percentages must sum to 100.
      description: >-
        Token-keyed allocation groups. Each included token lane must
        independently sum to 100 percent.
    StrategyUpdateResponse:
      type: object
      required:
        - strategyAllocations
      additionalProperties: false
      properties:
        strategyAllocations:
          $ref: '#/components/schemas/StrategyUpdateAllocationGroups'
    ErrorResponse:
      type: object
      required:
        - error
        - code
      properties:
        error:
          type: string
          description: >-
            Human-readable error message. May change without notice; do not
            parse programmatically.
        code:
          type: string
          description: >-
            Machine-readable error code. Stable across API versions — safe to
            switch on in client code.
          enum:
            - validation_error
            - unknown_parameters
            - unsupported_chain
            - unsupported_token
            - invalid_destination_address
            - precision_overflow
            - invalid_cursor
            - unauthenticated
            - forbidden
            - wallet_not_found
            - wallet_limit_reached
            - withdrawal_not_found
            - deposit_not_found
            - yield_source_not_found
            - wallet_projection_unavailable
            - insufficient_funds
            - duplicate_request_id
            - request_id_conflict
            - invalid_position_weight
            - invalid_withdrawal_plan
            - payout_not_found
            - webhook_not_found
            - webhook_duplicate_url
            - withdrawal_not_cancellable
            - withdrawal_already_cancelled
            - withdrawal_payout_in_progress
            - withdrawal_policy_required
            - workflow_conflict
            - payout_already_terminal
            - payout_in_progress
            - payout_not_retryable
            - address_book_entry_not_found
            - address_book_duplicate_entry
            - address_book_whitelist_violation
            - rate_limited
            - rate_limit_exceeded
            - internal_error
            - wallet_creation_failed
            - service_temporarily_unavailable
    AllocationInput:
      type: object
      required:
        - yieldSourceId
        - pct
      additionalProperties: false
      properties:
        yieldSourceId:
          $ref: '#/components/schemas/PortfolioWalletYieldSourceId'
        pct:
          type: number
          multipleOf: 0.1
          minimum: 0
          maximum: 100
          description: >-
            Percentage of the token lane to allocate to this yield source or to
            cash when `yieldSourceId` is `cash`. Supports 0.1% increments.
    StrategyUpdateAllocationGroups:
      type: object
      properties:
        usdc:
          type: array
          items:
            $ref: '#/components/schemas/StrategyUpdateAllocation'
        usdt:
          type: array
          items:
            $ref: '#/components/schemas/StrategyUpdateAllocation'
      description: Canonical desired strategy targets grouped by stablecoin.
    AuthErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Authentication or authorization error message.
        message:
          type: string
          nullable: true
          description: Additional auth middleware detail, when present.
        code:
          type: string
          nullable: true
          enum:
            - unauthenticated
            - forbidden
          description: >-
            Some auth and scope failures include a stable code; middleware
            errors may omit it.
    PortfolioWalletYieldSourceId:
      type: string
      description: >-
        Stable yield source ID from `GET /v2/wallets/yield-sources`, or the
        special `cash` id for cash held in the allocation's token lane. The live
        yield source catalog is environment-specific; fetch it before creating
        or updating a yield allocation.
    StrategyUpdateAllocation:
      type: object
      required:
        - yieldSourceId
        - targetWeightBps
      additionalProperties: false
      properties:
        yieldSourceId:
          $ref: '#/components/schemas/PortfolioWalletYieldSourceId'
        targetWeightBps:
          type: integer
          minimum: 0
          maximum: 10000
          description: Target weight within this token lane, in basis points.
  responses:
    Unauthorized:
      description: >-
        The request is missing a valid bearer token, or the token is invalid or
        expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthErrorResponse'
          example:
            error: Unauthenticated request
            message: Missing or invalid bearer token
    TooManyRequests:
      description: >-
        Rate limit exceeded. Limits are enforced by API key/customer identity
        and by endpoint class. Retry with backoff; rate-limit headers are not
        currently emitted.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Rate limit exceeded
            code: rate_limited
    InternalServerError:
      description: >-
        An unexpected error occurred while processing the request. The request
        can be safely retried with the same `requestId`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Internal server error
            code: internal_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````