> ## Documentation Index
> Fetch the complete documentation index at: https://docs.echozero.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview allocation withdraw payout

> Gross − pending fees − slippage − dust − success fee = you receive. Success fee is 8% EchoZero + creator% of net realized profit only (max(0, equity − deposit)), never of principal. Query `fullExit=true` for the unsubscribe sheet; `closeAllTrades=true` for the close-all rows. Schema: **McpPreviewAgentAllocationWithdrawResponseDto**.



## OpenAPI

````yaml https://mcp.echozero.app/api/docs-json get /api/v1/users/me/subscriptions/{agentId}/allocation/withdraw/preview
openapi: 3.0.0
info:
  title: EchoZero MCP API
  description: >-
    EchoZero MCP Server - Developer API for agent management, trading,
    marketplace, and AI chat.


    **Rate Limiting:** All endpoints enforce per-API-key rate limits. Tiers:
    free (60 req/min), standard (300 req/min), premium (1000 req/min). Every
    response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`,
    `X-RateLimit-Reset` headers. Exceeding the limit returns `429 Too Many
    Requests` with a `Retry-After` header.
  version: '1.0'
  contact: {}
servers:
  - url: https://mcp.echozero.app
    description: Production
security: []
tags:
  - name: MCP Protocol
    description: >-
      Model Context Protocol (Streamable HTTP): `/mcp`, `/mcp/sse` — not under
      `/api`; same API key as REST
  - name: Health
    description: Server health check
  - name: API Keys
    description: API key generation, listing, and revocation
  - name: User
    description: >-
      User profile, sessions, social, onboarding, internal agent subscriptions,
      and bot activations (v1: /v1/users/me)
  - name: Token
    description: Token data and trending
  - name: Trade
    description: Trade execution and history
  - name: Strategy
    description: Strategy (trading bot) configuration and control
  - name: Agent
    description: Agent registration and management
  - name: AI
    description: AI chat, intent, and insights
  - name: Wallet
    description: Wallet operations, deposits, and withdrawals
  - name: Notification
    description: Notification management and settings
  - name: Auth
    description: >-
      Public authentication: signup / login lookup, code verification, Google
      OAuth, refresh, and sign-out. Returns `accessToken` / `refreshToken` in
      the JSON body.
  - name: OAuth
    description: >-
      OAuth 2.1 authorization-code + PKCE for AI assistant clients:
      `/oauth/authorize`, `/oauth/token`, `/oauth/introspect`, `/status`.
  - name: Activity
    description: User trade activity list and search
  - name: Feed
    description: Social activity feed timeline
  - name: Earn
    description: Leaderboard, rewards, and referrals
  - name: Statics
    description: Countries, languages, and static data
  - name: Misc
    description: File uploads and utility endpoints
  - name: Developer
    description: Developer registration and profile
  - name: Developer dashboard
    description: >-
      Per-agent dashboard: subscribers (anonymized), performance detail, signal
      history (v1)
  - name: Developer Agent
    description: Developer agent listings and management
  - name: Developer Agents (Marketplace)
    description: Public browse, search, and subscribe to external developer-listed agents
paths:
  /api/v1/users/me/subscriptions/{agentId}/allocation/withdraw/preview:
    get:
      tags:
        - User
      summary: Preview allocation withdraw payout
      description: >-
        Gross − pending fees − slippage − dust − success fee = you receive.
        Success fee is 8% EchoZero + creator% of net realized profit only
        (max(0, equity − deposit)), never of principal. Query `fullExit=true`
        for the unsubscribe sheet; `closeAllTrades=true` for the close-all rows.
        Schema: **McpPreviewAgentAllocationWithdrawResponseDto**.
      operationId: McpUserController_previewWithdrawFromAllocation
      parameters:
        - name: agentId
          required: true
          in: path
          schema:
            type: string
        - name: amountUsd
          required: true
          in: query
          description: >-
            USD amount to preview. Gross − pending fees − slippage − dust −
            success fee = you receive.
          schema:
            minimum: 0.01
            type: number
        - name: closeAllTrades
          required: false
          in: query
          description: >-
            When true, preview the close-all sheet (no staying-in-open-trades;
            full-exit fee). Default keep-open.
          schema:
            type: boolean
        - name: fullExit
          required: false
          in: query
          description: >-
            When true, preview the unsubscribe sheet: full idle equity (not
            amountUsd) and the entire outstanding success fee.
          schema:
            type: boolean
        - name: x-signature
          in: header
          required: true
          description: >-
            Required for API-key authenticated requests. HMAC-SHA256(secretKey,
            timestamp + METHOD + path + body) as lowercase hex. Omit only for
            JWT/OAuth session tokens or public routes.
          schema:
            type: string
        - name: x-timestamp
          in: header
          required: true
          description: >-
            Required with x-signature. Epoch milliseconds; rejected if drift
            exceeds 5 minutes. Omit only for JWT/OAuth session tokens or public
            routes.
          schema:
            type: string
      responses:
        '200':
          description: Payout preview.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/McpSuccessResponseDto'
                  - properties:
                      data:
                        $ref: >-
                          #/components/schemas/McpPreviewAgentAllocationWithdrawResponseDto
      security:
        - bearer-jwt: []
        - api-key: []
components:
  schemas:
    McpSuccessResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          description: Endpoint-specific payload
          additionalProperties: true
      required:
        - success
        - data
    McpPreviewAgentAllocationWithdrawResponseDto:
      type: object
      properties:
        requestedUsd:
          type: number
        grossBalanceUsd:
          type: number
        pendingFeesUsd:
          type: number
        slippageUsd:
          type: number
        dustRetainedUsd:
          type: number
        remainingRequiredUsd:
          type: number
        netPayoutUsd:
          type: number
          description: 'You receive: gross − bridge fees − slippage − dust − success fee.'
        ledgerAvailableUsd:
          type: number
        venueFreeMarginUsd:
          type: number
        feeDisclosure:
          type: string
        agentBalanceUsd:
          type: number
          description: Agent NAV (ledger current + unrealized) for the confirm sheet.
        stayingInOpenTradesUsd:
          type: number
          description: >-
            Capital staying in open trades when keep-open is on. 0 when
            close-all.
        successFeeDueUsd:
          type: number
          description: >-
            Success fee due on this exit (0 at/below HWM). Taken from the
            withdrawal.
        remainingInAgentUsd:
          type: number
          description: Remaining in agent after the gross leaves. Fee does not reduce this.
        successFeeRule:
          type: string
          description: >-
            8% EchoZero + creator% on net realized profit (max(0, equity −
            deposit)), never on principal.
        depositedUsd:
          type: number
          description: Confirmed deposited capital (allocatedUsd).
        realizedPnlUsd:
          type: number
          description: currentBalanceUsd − allocatedUsd (realized).
        unrealizedPnlUsd:
          type: number
          description: Open-trade mark P&L (not a success-fee base).
        netRealizedProfitUsd:
          type: number
          description: max(0, realized PnL). Performance fee applies only to this amount.
        feeBaseUsd:
          type: number
          description: Profit base used for this exit’s new success-fee accrual.
        platformFeeUsd:
          type: number
          description: EchoZero 8% slice of this exit’s success fee.
        creatorFeeUsd:
          type: number
          description: Creator slice of this exit’s success fee.
        netUserPayoutUsd:
          type: number
          description: Gross − this exit’s success fee (before bridge/slippage/dust).
      required:
        - requestedUsd
        - grossBalanceUsd
        - pendingFeesUsd
        - slippageUsd
        - dustRetainedUsd
        - remainingRequiredUsd
        - netPayoutUsd
        - ledgerAvailableUsd
        - feeDisclosure
        - agentBalanceUsd
        - stayingInOpenTradesUsd
        - successFeeDueUsd
        - remainingInAgentUsd
        - successFeeRule
        - depositedUsd
        - realizedPnlUsd
        - unrealizedPnlUsd
        - netRealizedProfitUsd
        - feeBaseUsd
        - platformFeeUsd
        - creatorFeeUsd
        - netUserPayoutUsd
  securitySchemes:
    bearer-jwt:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        User JWT access token issued by `POST /api/auth/verify` or `POST
        /api/auth/social/verify`. Routes that accept both auth modes declare
        `api-key` *and* `bearer-jwt` security schemes.
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````