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

# Sell tokens

> Mirrors GraphQL `sellTokens`.



## OpenAPI

````yaml https://mcp.echozero.app/api/docs-json post /api/v1/wallet/sell
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
  - name: Admin
    description: Admin-only endpoints for review, approval, and platform management
  - name: Webhooks
    description: >-
      Inbound provider webhooks (no API key). Telegram signal-bot uses
      `X-Telegram-Bot-Api-Secret-Token` when configured.
paths:
  /api/v1/wallet/sell:
    post:
      tags:
        - Wallet
      summary: Sell tokens
      description: Mirrors GraphQL `sellTokens`.
      operationId: McpWalletController_sell
      parameters:
        - name: x-signature
          in: header
          required: false
          description: >-
            HMAC-SHA256 signature: HMAC-SHA256(secretKey, timestamp + METHOD +
            path + body). Optional -- when omitted, HMAC verification is
            skipped.
          schema:
            type: string
        - name: x-timestamp
          in: header
          required: false
          description: >-
            Request timestamp in epoch milliseconds. Required when x-signature
            is provided. Rejected if drift exceeds 5 minutes.
          schema:
            type: string
      requestBody:
        required: true
        description: >-
          OpenAPI: `McpWalletBuySellBodyDto`. GraphQL:
          `WalletBuySellOperationArgs`. Sell with SL/TP requires exactly one
          open BUY for the mint unless using linked manage-trade flows.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/McpWalletBuySellBodyDto'
            examples:
              minimal:
                summary: Amount + mint (no risk fields)
                value:
                  amount: 0.5
                  tokenMint: So11111111111111111111111111111111111111112
              fullAllFields:
                summary: All body fields including SL + TP
                value:
                  amount: 1
                  tokenMint: So11111111111111111111111111111111111111112
                  toAddress: So11111111111111111111111111111111111111112
                  stopLoss:
                    type: FIXED
                    percentage: 10
                    triggerPrice: 0.15
                    trailDistance: 5
                  takeProfit:
                    type: FIXED
                    fixedTargetUsd: 500
                    targetPercentage: 25
                    triggerPrice: 0.22
      responses:
        '200':
          description: Operation result.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/McpSuccessResponseDto'
                  - properties:
                      data:
                        $ref: '#/components/schemas/McpWalletOperationDataDto'
      security:
        - api-key: []
components:
  schemas:
    McpWalletBuySellBodyDto:
      type: object
      properties:
        amount:
          type: number
          description: Amount for the operation
        tokenMint:
          type: string
          description: Token mint address (optional; defaults to SOL)
        toAddress:
          type: string
          description: Destination address (required for withdraw)
        stopLoss:
          description: Optional stop-loss on the open BUY affected by this operation
          allOf:
            - $ref: '#/components/schemas/McpTradeStopLossBodyDto'
        takeProfit:
          description: Optional take-profit on the open BUY for this mint
          allOf:
            - $ref: '#/components/schemas/McpTradeTakeProfitBodyDto'
      required:
        - amount
    McpSuccessResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          description: Endpoint-specific payload
          additionalProperties: true
      required:
        - success
        - data
    McpWalletOperationDataDto:
      type: object
      properties:
        success:
          type: boolean
        transactionId:
          type: string
        amount:
          type: number
        tokenSymbol:
          type: string
        message:
          type: string
        timestamp:
          type: string
          format: date-time
        tradeId:
          type: string
          description: >-
            Trade document id for buy/sell (open BUY on buy; sell leg or linked
            open BUY on sell)
        openTradeUpdatePending:
          type: boolean
          description: >-
            True when a linked open-trade row updates only after on-chain swap
            finality
      required:
        - success
        - transactionId
        - amount
        - tokenSymbol
        - message
        - timestamp
    McpTradeStopLossBodyDto:
      type: object
      properties:
        type:
          type: string
          description: 'Stop-loss type: FIXED, TRAILING, PERCENTAGE, or NONE'
        percentage:
          type: number
          description: Percentage drawdown from entry (e.g. 10 for 10% below)
        triggerPrice:
          type: number
          description: >-
            Absolute token USD price at which the stop triggers (optional if
            percentage is used)
        trailDistance:
          type: number
          description: Trail distance percentage for TRAILING stop
      required:
        - type
    McpTradeTakeProfitBodyDto:
      type: object
      properties:
        type:
          type: string
          description: 'Take-profit type: FIXED, TIERED, NONE, or MANUAL'
        fixedTargetUsd:
          type: number
          description: Close when position value in USD reaches this target
        targetPercentage:
          type: number
          description: Target profit percentage above average entry (e.g. 25)
        triggerPrice:
          type: number
          description: >-
            Optional explicit token USD trigger price (frontend may compute from
            %)
      required:
        - type
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````