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

# Save AI draft as trading bot

> Mirrors GraphQL `saveStrategyAsBot` — persists a `CreateTradingBotInput` configuration.



## OpenAPI

````yaml https://mcp.echozero.app/api/docs-json post /api/v1/ai/strategy/save
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/ai/strategy/save:
    post:
      tags:
        - AI
      summary: Save AI draft as trading bot
      description: >-
        Mirrors GraphQL `saveStrategyAsBot` — persists a `CreateTradingBotInput`
        configuration.
      operationId: McpAiController_saveStrategyAsBot
      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: >-
          Same body as `POST /v1/strategies` / GraphQL `CreateTradingBotInput` —
          see **McpCreateTradingBotBodyDto**.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/McpCreateTradingBotBodyDto'
            examples:
              minimal:
                summary: Minimal create (draft)
                description: >-
                  Required base fields: `status` (from GraphQL `BaseUserInput`)
                  and `agentId`. Add more fields from **fullAllFields** as
                  needed.
                value:
                  status: DRAFT
                  agentId: 507f1f77bcf86cd799439011
              fullAllFields:
                summary: All top-level fields (nested stubs)
                description: >-
                  Every property on `CreateTradingBotInput` is shown. Nested
                  `ConditionInput` includes all condition fields; deep
                  validation rules live in
                  `apps/gql-main/src/tradingBot/inputs/createTradingBot.input.ts`.
                value:
                  status: DRAFT
                  botId: 507f1f77bcf86cd799439012
                  agentId: 507f1f77bcf86cd799439011
                  templateId: 507f1f77bcf86cd799439013
                  name: Example strategy
                  description: Short public description
                  tags:
                    - SOL
                    - DEFI
                  riskLevel: MID RISK
                  tradingGoal: CATCH_PUMPS
                  tokenSectorFocus:
                    - SOL_ECOSYSTEM
                    - MEME_NANO_CAP
                  creationMethod: LOGIC_BASED
                  botTradeType: SPOT
                  imageUrl: https://cdn.example/bot.png
                  style: PROFESSIONAL
                  customInstructions: Risk-off in high volatility.
                  bio: Automated momentum bot
                  interests:
                    - TECH
                    - SCIENCE
                  isPublic: true
                  feeConfiguration:
                    feePercentage: 5
                    chargeOnPerformance: true
                    hideFromPublic: false
                  tokenSelection:
                    selectionType: SPECIFIC
                    tokenAddresses:
                      - So11111111111111111111111111111111111111112
                    tokens:
                      - 507f1f77bcf86cd799439014
                    targetToken: 507f1f77bcf86cd799439015
                    chain: SOLANA
                  conditionGroups:
                    - name: Entry group
                      operator: AND
                      decision: OR
                      conditions:
                        - type: TOKEN_PRICE
                          conditionType: PRICE
                          indicator: RSI
                          sentiment: IS_BULLISH
                          riskSentiment: IS_RISK_ON
                          graduationStatus: IS_GRADUATED
                          pumpFunLogic: TRADING_VOLUME
                          cryptoLogic: BTC_DOMINANCE
                          economyLogic: VIX
                          amount: 1.5
                          operator: GREATER_THAN
                          decision: AND
                          value: '100'
                          unit: '%'
                          secondValue: '200'
                          timeWindowHours: 24
                          timeFrame: HOURS_4
                          volumeType: TOTAL
                          walletActionType: BUYS
                          transactionType: BUY
                          specificTokenAddress:
                            - So11111111111111111111111111111111111111112
                          tokenRef: 507f1f77bcf86cd799439016
                          walletAddress: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
                          tokenSelection:
                            selectionType: ALL
                            chain: SOLANA
                          expanded: true
                  groupsOperator: AND
                  execution:
                    mode: AUTO_TRADING
                    environment: REAL
                  executionMode: AUTO_TRADING
                  alertsMode: true
                  fullMode: false
                  riskManagement:
                    tradeSize:
                      type: FIXED
                      fixedAmountUsd: 100
                      percentageOfBalance: 10
                    stopLoss:
                      type: FIXED
                      percentage: 5
                      isAboveEntryPrice: false
                      trailDistance: 2
                      enableLossAlert: true
                      lossAlertThreshold: true
                    profitTaking:
                      type: TIERED
                      fixedTargetUsd: 500
                      tiers:
                        - action: CLOSE_PART
                          whenClosePart: 25
                          whenPosition: 10
                          isIncrease: true
                      enableProfitAlert: true
                      profitAlertThreshold: 15
                    leverage: 3
                    drawdownProtection: 20
                    positionType: LONG
                  allocationConstraints:
                    minPercentage: 1
                    maxPercentage: 50
                    minAmountUsd: 10
      responses:
        '200':
          description: Created trading bot id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: string
                    example: 507f1f77bcf86cd799439011
                required:
                  - success
                  - data
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/McpErrorResponseDto'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/McpErrorResponseDto'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/McpErrorResponseDto'
      security:
        - api-key: []
components:
  schemas:
    McpCreateTradingBotBodyDto:
      type: object
      properties: {}
    McpErrorResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          $ref: '#/components/schemas/McpErrorBodyDto'
      required:
        - success
        - error
    McpErrorBodyDto:
      type: object
      properties:
        code:
          type: string
          example: NOT_FOUND
        message:
          type: string
          example: Resource not found
      required:
        - code
        - message
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: x-api-key

````