openapi: 3.0.0
info:
  title: Moonlist Intelligence API
  description: >
    The Moonlist Intelligence API is an institutional-grade gateway for autonomous agents and decentralized finance operations.
    It provides a unified interface for NLP intent detection, multi-chain swap routing, and high-performance on-chain auditing.
    
    ### Getting Started
    1. Register at the [Developer Dashboard](https://moonlist.app/developer.html).
    2. Activate your Institutional Subscription ($100/mo) via USDT/USDC.
    3. Include your `X-MOONLIST-KEY` in every request header.
    
    ### Agentic Capabilities
    - **Brain**: Parse natural language into on-chain actions.
    - **Swaps**: Aggregate liquidity from 0x (Solana) and OpenOcean (EVM).
    - **Audit**: Fetch multi-chain metadata and balances via Alchemy.
    - **News**: Get official Moonlist market insights.
  version: 1.0.0
  contact:
    name: Moonlist Support
    url: https://moonlist.app/developer.html
servers:
  - url: https://endpoint.moonlist.app
    description: Production Gateway

paths:
  /v1:
    post:
      summary: Unified Intelligence Gateway
      description: Routes requests to specialized blockchain and AI engines based on the `target` parameter.
      parameters:
        - in: header
          name: X-MOONLIST-KEY
          required: true
          schema:
            type: string
          description: Your unique production API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - target
              properties:
                target:
                  type: string
                  enum: [brain, openocean, alchemy, zerox, news, ping]
                  description: The specialized service to engage.
                path:
                  type: string
                  description: Internal API path for the target service.
                  example: "/solana/swap/v1/quote"
                method:
                  type: string
                  enum: [GET, POST]
                  default: POST
                params:
                  type: object
                  description: Query parameters for the target service.
                body:
                  type: object
                  description: JSON payload for the target service.
            examples:
              AI_Intent:
                summary: AI Brain Query
                value:
                  target: "brain"
                  body:
                    query: "Analyze my portfolio risk"
                    portfolio: []
              Solana_Swap:
                summary: Solana Swap (0x)
                value:
                  target: "zerox"
                  path: "/solana/swap/v1/quote"
                  method: "GET"
                  params:
                    sellToken: "So11111111111111111111111111111111111111112"
                    buyToken: "EPjFWdd5AufqztqjnqAv3S4wd3ldYyombl63GF8Vgcyq"
                    sellAmount: "1000000000"
                    taker: "SOLANA_WALLET_ADDRESS"
              EVM_Swap:
                summary: EVM Swap (OpenOcean)
                value:
                  target: "openocean"
                  path: "/1/swap"
                  params:
                    inTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
                    outTokenAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
                    amountDecimals: "1000000000000000000"
                    account: "0x..."
                    referrer: "0xC4DcEF92c168256BA9463EB6f96aD3dEfba0Be58"
              Official_News:
                summary: Fetch Moonlist News
                value:
                  target: "news"
                  method: "GET"
      responses:
        '200':
          description: Successful Operation
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Unauthorized - Invalid or missing API key.
        '402':
          description: Payment Required - Subscription not active.
        '500':
          description: Gateway error or upstream service failure.

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-MOONLIST-KEY
