> ## 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 a MicroVault delegation

Prepare an authorization to install, replace, or revoke a bounded manager policy.

<Note>
  MicroVaults are in private preview for enabled sandbox organizations on Ethereum Sepolia.
</Note>


## OpenAPI

````yaml swagger/swagger-combined.yaml POST /v2/microvaults/vaults/{vaultId}/delegations
openapi: 3.0.0
info:
  title: Ground API
  description: Core API for Portfolio Wallets, gVaults, MicroVaults, 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: gVaults
    description: App-specific Ground vaults with customer access and fee sharing.
  - name: MicroVaults
    description: >-
      Customer-owned onchain vaults with externally held ERC-20 shares. Private
      preview in sandbox on Ethereum Sepolia.
  - name: Webhook Endpoints
    description: Webhook endpoint management for portfolio wallet notifications.
paths:
  /v2/microvaults/vaults/{vaultId}/delegations:
    parameters:
      - name: vaultId
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/UuidV4'
    post:
      tags:
        - MicroVaults
      summary: Prepare a delegation policy update
      operationId: updateMicrovaultDelegation
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 200
          description: Reuse only when retrying the identical mutation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MicroVaultDelegationRequest'
      responses:
        '200':
          description: Existing authorization returned for an identical idempotent replay.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroVaultAuthorization'
        '201':
          description: Delegation authorization prepared.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroVaultAuthorization'
        '400':
          description: Invalid policy or action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroVaultError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: Idempotency conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroVaultError'
components:
  schemas:
    UuidV4:
      type: string
      format: uuid
      pattern: >-
        ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
      example: 8f4c52d7-62ab-4db9-a964-92f481f6b851
    MicroVaultDelegationRequest:
      oneOf:
        - $ref: '#/components/schemas/MicroVaultInstallDelegationRequest'
        - $ref: '#/components/schemas/MicroVaultReplaceDelegationRequest'
        - $ref: '#/components/schemas/MicroVaultRevokeDelegationRequest'
        - $ref: '#/components/schemas/MicroVaultRevokeAllDelegationsRequest'
      discriminator:
        propertyName: action
    MicroVaultAuthorization:
      type: object
      required:
        - id
        - status
        - signingPayload
        - signingPayloadHash
        - summary
        - predictedEffects
        - simulation
      additionalProperties: true
      properties:
        id:
          $ref: '#/components/schemas/UuidV4'
        status:
          type: string
        signingPayload:
          type: object
          additionalProperties: true
        signingPayloadHash:
          $ref: '#/components/schemas/MicroVaultBytes32'
        summary:
          type: object
          additionalProperties: true
        predictedEffects:
          type: array
          items:
            type: object
            additionalProperties: true
        simulation:
          type: object
          additionalProperties: true
        turnkeyActivityId:
          type: string
          nullable: true
        turnkeyStatus:
          type: string
          nullable: true
        directTransaction:
          $ref: '#/components/schemas/MicroVaultDirectTransaction'
      example:
        id: 4f36d486-58c9-441b-8535-6097ad3f1832
        status: awaiting_signature
        signingPayload:
          action: set_source_mode
          chainId: 11155111
          vault: '0x2222222222222222222222222222222222222222'
          parameters:
            sourceId: '0x1111111111111111111111111111111111111111111111111111111111111111'
            mode: active
        signingPayloadHash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        summary:
          text: Set Morpho Steakhouse USDC Prime to active
        predictedEffects:
          - kind: source_mode
            sourceId: '0x1111111111111111111111111111111111111111111111111111111111111111'
            mode: active
        simulation:
          ok: true
        turnkeyActivityId: null
        turnkeyStatus: null
    MicroVaultError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Stable machine-readable error code.
        message:
          type: string
          nullable: true
        details:
          nullable: true
      example:
        error: microvaults_not_enabled
        message: MicroVaults are not enabled for this organization
    MicroVaultInstallDelegationRequest:
      title: Install delegation
      type: object
      additionalProperties: false
      required:
        - action
        - delegateAddress
        - leaves
        - validAfter
        - validUntil
      properties:
        action:
          type: string
          enum:
            - install
        delegateAddress:
          $ref: '#/components/schemas/NonzeroEvmAddress'
        leaves:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/MicroVaultDelegationLeaf'
        policyRoot:
          $ref: '#/components/schemas/MicroVaultBytes32'
        validAfter:
          type: integer
          minimum: 0
        validUntil:
          type: integer
          minimum: 0
        nonce:
          $ref: '#/components/schemas/MicroVaultUint256'
        deadline:
          type: integer
      example:
        action: install
        delegateAddress: '0x7777777777777777777777777777777777777777'
        leaves:
          - kind: 1
            sourceId: '0x1111111111111111111111111111111111111111111111111111111111111111'
            maxAmountPerOperation: '1000000000'
            minimumOutputBps: 9950
            minimumAllocationBps: 0
            maximumAllocationBps: 8000
            mayServiceRedemptions: true
            allowedRecipient: '0x2222222222222222222222222222222222222222'
            allowedPauseFlags: 3
        validAfter: 1789066800
        validUntil: 1791658800
        nonce: '16'
        deadline: 1789088400
    MicroVaultReplaceDelegationRequest:
      title: Replace delegation
      type: object
      additionalProperties: false
      required:
        - action
        - delegateAddress
        - leaves
        - validAfter
        - validUntil
      properties:
        action:
          type: string
          enum:
            - replace
        delegateAddress:
          $ref: '#/components/schemas/NonzeroEvmAddress'
        leaves:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/MicroVaultDelegationLeaf'
        policyRoot:
          $ref: '#/components/schemas/MicroVaultBytes32'
        validAfter:
          type: integer
          minimum: 0
        validUntil:
          type: integer
          minimum: 0
        nonce:
          $ref: '#/components/schemas/MicroVaultUint256'
        deadline:
          type: integer
      example:
        action: replace
        delegateAddress: '0x7777777777777777777777777777777777777777'
        leaves:
          - kind: 1
            sourceId: '0x1111111111111111111111111111111111111111111111111111111111111111'
            maxAmountPerOperation: '2000000000'
            minimumOutputBps: 9950
            minimumAllocationBps: 0
            maximumAllocationBps: 9000
            mayServiceRedemptions: true
            allowedRecipient: '0x2222222222222222222222222222222222222222'
            allowedPauseFlags: 3
        validAfter: 1789066800
        validUntil: 1791658800
        nonce: '17'
        deadline: 1789088400
    MicroVaultRevokeDelegationRequest:
      title: Revoke delegation
      type: object
      additionalProperties: false
      required:
        - action
        - delegateAddress
      properties:
        action:
          type: string
          enum:
            - revoke
        delegateAddress:
          $ref: '#/components/schemas/NonzeroEvmAddress'
        nonce:
          $ref: '#/components/schemas/MicroVaultUint256'
        deadline:
          type: integer
      example:
        action: revoke
        delegateAddress: '0x7777777777777777777777777777777777777777'
        nonce: '18'
        deadline: 1789088400
    MicroVaultRevokeAllDelegationsRequest:
      title: Revoke all delegations
      type: object
      additionalProperties: false
      required:
        - action
      properties:
        action:
          type: string
          enum:
            - revoke_all
        nonce:
          $ref: '#/components/schemas/MicroVaultUint256'
        deadline:
          type: integer
      example:
        action: revoke_all
        nonce: '19'
        deadline: 1789088400
    MicroVaultBytes32:
      type: string
      pattern: ^0x[0-9a-fA-F]{64}$
      example: '0x1111111111111111111111111111111111111111111111111111111111111111'
    MicroVaultDirectTransaction:
      type: object
      required:
        - to
        - data
        - value
      properties:
        to:
          $ref: '#/components/schemas/NonzeroEvmAddress'
        data:
          type: string
          pattern: ^0x[0-9a-fA-F]*$
        value:
          $ref: '#/components/schemas/MicroVaultUint256'
      example:
        to: '0x2222222222222222222222222222222222222222'
        data: '0x12345678'
        value: '0'
    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.
    NonzeroEvmAddress:
      type: string
      description: >-
        Valid nonzero EVM EOA or contract address. Mixed-case values must use a
        valid EIP-55 checksum.
      minLength: 42
      maxLength: 42
      pattern: ^0x(?!0{40}$)[0-9a-fA-F]{40}$
      example: '0x3bf25a73a1f1033c2d50ac65f3c9d6a44123db81'
    MicroVaultDelegationLeaf:
      type: object
      additionalProperties: false
      required:
        - kind
        - sourceId
        - maxAmountPerOperation
        - minimumOutputBps
        - minimumAllocationBps
        - maximumAllocationBps
        - mayServiceRedemptions
        - allowedRecipient
        - allowedPauseFlags
      properties:
        kind:
          type: integer
          minimum: 0
          maximum: 255
        sourceId:
          $ref: '#/components/schemas/MicroVaultBytes32'
        maxAmountPerOperation:
          $ref: '#/components/schemas/MicroVaultUint256'
        minimumOutputBps:
          type: integer
          minimum: 0
          maximum: 10000
        minimumAllocationBps:
          type: integer
          minimum: 0
          maximum: 10000
        maximumAllocationBps:
          type: integer
          minimum: 0
          maximum: 10000
        mayServiceRedemptions:
          type: boolean
        allowedRecipient:
          $ref: '#/components/schemas/NonzeroEvmAddress'
        allowedPauseFlags:
          type: integer
          minimum: 0
          maximum: 31
    MicroVaultUint256:
      type: string
      pattern: ^(0|[1-9][0-9]*)$
      description: >-
        Unsigned base-10 integer string. Asset and share amounts use token base
        units.
      example: '1000000'
  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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````