openapi: 3.1.0
info:
  title: FarmDash Agent API
  version: 2.0.0
  description: |
    WARNING: Running trade executions and cancellations places real perpetual futures trades and alters active market exposure, carrying significant risk of financial loss. Immediate, explicit manual end-user confirmation and consent is strictly required immediately before placing any execution or cancellation request. Do not allow autonomous agents to auto-run trade execution or cancellation without manual user approval.

    FarmDash is an intelligence and control layer for DeFi agents and serious airdrop farmers. This API covers swap transaction preparation (Signal Architect),
    protocol discovery intelligence (Trail Heat), perpetual futures (Futures Strategist), portfolio
    research, bounded autonomous sessions, x402 payment flows, and agent-readable opportunity intelligence.

    FarmDash does not request seed phrases or raw wallet private keys. Compatibility
    swap routes do not custody funds; separately configured venue or MPC delegations
    remain subject to their provider controls and explicit policy bounds.

    ## Authentication & Credential Lifecycle
    | Tier | Price | Auth | Rate Limit | Key Prefix | Entitlements | Best for |
    |------|-------|------|------------|------------|--------------|----------|
    | Scout | Free | None | 30 req / 24 h per IP | `fd_scout_free` | Keyless public discovery and quotes | Keyless discovery and quotes |
    | Pioneer | $39.99/mo USDC | `Authorization: Bearer <KEY>` | 1,500 req / day | `fd_pio_` | Premium research, full Trail Heat, wallet analytics, sybil audits | Serious farmers, full datasets, sybil audits, wallet analytics |
    | Syndicate | $199/mo USDC | `Authorization: Bearer <KEY>` | 50,000 req / day | `fd_syn_` | All Pioneer features plus advanced control tooling, bounded autopilot, webhooks, unrestricted CORS | Teams, serious agents, high-volume API use, webhooks, unrestricted CORS, advanced control/session tooling |

    ### Paid Entitlement & Key Issuance Sequence:
    1. **Pay**: Transfer USDC ($39.99/mo for Pioneer, $199/mo for Syndicate) on Base, Arbitrum, Optimism, Polygon, Ethereum, or Linea to the FarmDash treasury.
    2. **Verify**: Post transaction hash and wallet to `verify-payment` to record on-chain confirmation in `users` and `payment_events`.
    3. **Sign Proof**: Sign an EIP-712 `ApiKeyRequest` with the paying wallet (domain: `FarmDash`, intent: `Issue FarmDash API key`, single-use `nonce`).
    4. **Receive Credential**: Post the signed payload to `/api/v1/agent/api-key`. The credential tier is server-authoritative, derived exclusively from your active paid subscription (client input cannot downgrade or elevate your tier). The plaintext key is returned exactly once; FarmDash stores only a SHA-256 hash.
    5. **Authenticate**: Send `Authorization: Bearer <KEY>` on all requests. Daily limits reset every 24 hours (`X-RateLimit-Remaining`). Keys expire with your 30-day subscription; expired keys return HTTP 402 Payment Required. Higher-tier Syndicate capabilities (`advanced_control`) remain blocked for Pioneer subscribers.

    For SDK development without live data, use the deterministic sandbox on
    the two endpoints that explicitly support it (`/v1/agent/protocols` and
    `/v1/trail-heat`):
    `?mock=true`, `X-FarmDash-Mock: true`, or `Authorization: Bearer fd_sandbox_mock`
    Quote mock requests return typed `mock_not_supported` without contacting a live provider.

    Swap execution requires a fresh successful preflight simulation plus an EIP-191 agent wallet signature.
    Futures execution requires an EIP-712 Hyperliquid wallet signature.

    ## Dust Storm Protocol
    On upstream failure, FarmDash returns `ok:false` with a typed degraded state
    and a `warnings` array containing `{ kind: "dust_storm", message: "..." }`.
    Cached SDK responses may be returned as stale with explicit stale-data age.

    ## x402 Payment Wall
    When Scout limits are exceeded, FarmDash returns HTTP 402 with
    `code: free_quota_exhausted`, `instruction: STOP_RETRYING`, the UTC reset time,
    upgrade URL, and x402 payment instructions. Repeating the same unpaid request does
    not restore access and continued automated retries may result in temporary or
    permanent blocking. To unlock one additional request, send
    `X-Payment-Proof: 0x<txHash>` (or the x402 `PAYMENT-SIGNATURE`) for the
    route-specific USDC payment. The configured default overage is 0.01 USDC;
    premium routes return their own amount.

    ## Data Confidence
    Agent-facing research responses include `data_quality` and `scoring_methodology`
    where available. Trail Heat is a transparent heuristic, not a guaranteed yield,
    allocation, or airdrop outcome.

    ## Rate Limit Headers
    All responses include:
    - `X-RateLimit-Limit` — max requests for the current window
    - `X-RateLimit-Remaining` — remaining requests
    - `X-RateLimit-Reset` — UTC epoch seconds when the window resets
    - `X-Request-ID` — unique request trace ID (echo it for support)

    ## Versioned Signature Payload (v1)
    `v1:FARMDASH_SWAP:{fromChainId}:{toChainId}:{fromToken}:{toToken}:{fromAmount}:{agentAddress}:{toAddress}:{nonce}`
    Canonicalization is mandatory: lowercase every `0x`-prefixed field before joining, including
    token contract addresses as well as agent/destination addresses. Sign the exact resulting UTF-8
    string with EIP-191/personal_sign. A 428 simulation-gate response occurs before signature
    verification and therefore does not prove a signature is valid.

    ## Mandatory Swap Simulation Gate
    Do not use discovery GET `/agents/quote` to create execution state. POST
    `/v1/agent/quote-intent` with exact parameters, real wallet and idempotency key. Its top-level
    `intentId` is a `qi_*` quote-cache/idempotency identity; simulate with the separate
    `simulationRequirements.intent_id` (`fd_intent_*`). Then POST `/v1/simulate` with that
    `fd_intent_*` and wallet before calling `/agents/swap`.
    OpenAPI paths are relative to `https://www.farmdash.one/api`: `/agents/quote` means
    `https://www.farmdash.one/api/agents/quote`.
    For LI.FI native ETH routes, use the zero-address token sentinel rather than the WETH contract.
    `/agents/swap` rejects missing, failed, expired, or mismatched simulations.
  contact:
    name: FarmDash Engineering
    url: https://www.farmdash.one/agents
  license:
    name: MIT
servers:
  - url: https://www.farmdash.one/api
    description: Production
tags:
  - name: Swap
    description: Token swap quotes, execution, and confirmation
  - name: Intelligence
    description: Trail Heat protocol data and chain analytics
  - name: History
    description: Fee event history and revenue metrics
  - name: Research
    description: Futures market research — funding rates, technical indicators
  - name: Strategy
    description: Strategy analysis and position sizing
  - name: Execution
    description: Futures order execution and cancellation
  - name: Account
    description: Hyperliquid account state and risk management
  - name: Payments
    description: Payment kernel access rails — native-ETH payment intents, FarmDash prepaid credit, and the single-use execution-bootstrap grant. Describes settlement only; implies nothing about autonomous-execution readiness.
  - name: Session
    description: Bounded session management
  - name: Delegation
    description: Hyperliquid wallet delegation
  - name: Risk
    description: Pre-trade risk analysis, alerts, and execution guardrails
  - name: Autopilot
    description: Policy-bounded loop configuration and execution
x-agent-use-cases:
  - id: bounded-autopilot
    name: Bounded Autopilot
    tier: Syndicate
    cadence: Every 5 minutes
    purpose: Run an always-on loop inside explicit budgets, allowlists, cooldowns, quote freshness, and local-signing requirements.
    primaryTools:
      - agent_onboard
      - create_session
      - configure_autopilot
      - autopilot_cycle
      - session_heartbeat
    stopConditions:
      - Budget, allowlist, cooldown, quote freshness, or risk bound is violated.
      - Required local EIP-191 or EIP-712 signature is missing.
      - Realized performance degrades enough to require analysis_only mode.
  - id: airdrop-rotation
    name: Airdrop Rotation Desk
    tier: Pioneer
    cadence: Daily or event-driven
    purpose: Watch Trail Heat, snapshots, multiplier changes, wallet health, and costs before entering, waiting, rotating, or exiting.
    primaryTools:
      - get_trail_heat
      - get_historical_trailheat
      - get_agent_events
      - simulate_points
      - get_swap_quote
      - simulate_swap_execution
    stopConditions:
      - Expected point edge is unclear or negative after fees and gas.
      - Sybil risk exceeds the configured threshold.
      - User constraints do not allow the target chain or protocol.
  - id: cross-chain-roi
    name: Cross-Chain ROI Gate
    tier: Pioneer
    cadence: Before any bridge
    purpose: Bridge only when net expected edge remains positive after bridge fee, gas, slippage, and execution risk buffer.
    primaryTools:
      - get_chain_breakdown
      - get_wallet_balances
      - get_token_prices
      - get_swap_quote
      - simulate_swap_execution
      - optimize_portfolio
    stopConditions:
      - netEdgeUsd is not positive.
      - Quote age exceeds the configured freshness limit.
      - Target chain is not allowlisted.
  - id: perps-hedge
    name: Perps Hedge Co-Pilot
    tier: Syndicate
    cadence: Before exposure changes
    purpose: Evaluate whether a farming position needs a Hyperliquid hedge, with no_trade as a valid outcome.
    primaryTools:
      - scan_funding_rates
      - scan_market_conditions
      - get_futures_account
      - analyze_futures_strategy
      - calculate_position_size
    stopConditions:
      - Research gate expires.
      - Strategy confidence, liquidity, jurisdiction, or guardrails do not support execution.
      - Daily loss or drawdown limit is reached.
paths:
  /status:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getPublicSystemStatus
      summary: Get authoritative public system status and agent capability contract
      description: |
        Returns the real-time operational status of all 9 Trail Stack lifecycle stages,
        core infrastructure, and venue execution capabilities (e.g. EVM swaps LIVE,
        Hyperliquid perps LIVE, generic intents PREPARATION ONLY, Solana DISCOVERY ONLY).
        Zero authentication required. Autonomous AI agents can query this before
        initiating transactions.
      tags:
        - Intelligence
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Public system status and capability contract
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: getPublicSystemStatus HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '503':
          description: Major system outage detected
          x-farmdash-response-example:
            status: 503
            description: Major system outage detected
            body: null
            note: Documents status semantics without inventing a response payload.
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/status
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/billing-history:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getBillingHistory
      summary: Get your subscription state and payment history
      description: |
        Billing-portal-lite for paid agents. Requires a stored Pioneer or
        Syndicate API key (the key is bound to the paying wallet). Returns the
        current subscription state (tier, expiry, auto_renew=false — prepaid
        30-day terms) plus the append-only payment ledger: one row per
        verified on-chain USDC payment, newest first. Renewals append rows;
        history is never overwritten.
      tags:
        - Account
      security:
        - ApiKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Subscription state and payment ledger
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - wallet
                  - subscription
                  - payments
                properties:
                  ok:
                    type: boolean
                  wallet:
                    type: string
                    pattern: ^0x[a-fA-F0-9]{40}$
                  subscription:
                    type: object
                    properties:
                      tier:
                        type: string
                        nullable: true
                      expires_at:
                        type: string
                        format: date-time
                        nullable: true
                      active:
                        type: boolean
                      auto_renew:
                        type: boolean
                  payments:
                    type: array
                    items:
                      type: object
                      properties:
                        kind:
                          type: string
                        tier:
                          type: string
                          nullable: true
                        amount_usdc:
                          type: number
                          nullable: true
                        tx_hash:
                          type: string
                          nullable: true
                        chain_id:
                          type: integer
                          nullable: true
                        verified_at:
                          type: string
                          format: date-time
                        created_at:
                          type: string
                          format: date-time
              examples:
                success:
                  summary: getBillingHistory HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    wallet: '0x1111111111111111111111111111111111111111'
                    subscription:
                      tier: example
                      expires_at: '2026-10-30T12:00:00Z'
                      active: true
                      auto_renew: true
                    payments:
                      - kind: unknown
                        tier: example
                        amount_usdc: 1
                        tx_hash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
                        chain_id: 1
                        verified_at: '2026-10-30T12:00:00Z'
                        created_at: '2026-10-30T12:00:00Z'
        '402':
          description: Payment required (free tier has no billing history)
          headers:
            PAYMENT-REQUIRED:
              description: Base64-encoded x402 v2 PaymentRequired. Illustrative only; parse the live header.
              schema:
                type: string
              example: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfV0sInBheW1lbnRSZXF1aXJlbWVudHMiOnsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfSwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly93d3cuZmFybWRhc2gub25lL2FwaS92MS9hZ2VudC9wcm90b2NvbHMiLCJkZXNjcmlwdGlvbiI6IklsbHVzdHJhdGl2ZSBGYXJtRGFzaCBBUEkgYWNjZXNzIn0sImZhcm1kYXNoIjp7ImV4YW1wbGVfb25seSI6dHJ1ZSwiZ3JhbnRzX3RyYW5zYWN0aW9uX2F1dGhvcml0eSI6ZmFsc2V9fQ==
            X-Payment-Required:
              description: Compatibility signal for x402.
              schema:
                type: string
                enum:
                  - 'true'
              example: 'true'
            X-Payment-Amount:
              description: Illustrative Base USDC base units; live 402 is authoritative.
              schema:
                type: string
              example: '10000'
            X-Payment-Chain-Id:
              description: Illustrative payment chain.
              schema:
                type: string
              example: '8453'
            X-Payment-Address:
              description: Illustrative destination; verify live 402.
              schema:
                type: string
              example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
            X-Payment-Token:
              description: Illustrative Base USDC address; verify live 402.
              schema:
                type: string
              example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredError'
              examples:
                x402_payment_required:
                  summary: Illustrative x402 payment challenge
                  description: Live 402 and PAYMENT-REQUIRED are authoritative. Payment grants API capacity only, never execution authority.
                  value:
                    ok: false
                    error: payment_required
                    code: free_quota_exhausted
                    message: Illustrative x402 challenge; live 402 is authoritative for route-specific price and policy.
                    instruction: STOP_RETRYING
                    retry_same_request: false
                    next_action: Wait for quota reset, upgrade, or attach valid x402 payment evidence and retry once.
                    quota:
                      tier: scout
                      remaining: 0
                      reset_at: '2026-10-30T12:00:00Z'
                    retryable: false
                    payment_required:
                      amount: 0.01 USDC
                      chain: Base
                      destination: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
                      token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      chainId: '8453'
        '403':
          description: Pioneer or Syndicate subscription required
          x-farmdash-response-example:
            status: 403
            description: Pioneer or Syndicate subscription required
            body: null
            note: Documents status semantics without inventing a response payload.
        '503':
          description: Billing ledger temporarily unavailable
          x-farmdash-response-example:
            status: 503
            description: Billing ledger temporarily unavailable
            body: null
            note: Documents status semantics without inventing a response payload.
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/billing-history
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/status:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getAgentStatus
      summary: Get agent feature status and contracts
      description: |
        Public status endpoint for agent builders. Returns feature readiness,
        tier gates, data-confidence contract, structured-error contract, and
        deterministic sandbox instructions. This endpoint is not a trading or
        portfolio-data surface.
      tags:
        - Intelligence
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Agent status contract
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: getAgentStatus HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '405':
          $ref: '#/components/responses/BadRequest'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/status
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/payments/bootstrap:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getPaymentsBootstrap
      summary: Free payment bootstrap (no toll, no provider)
      description: |
        Free, provider-free bootstrap primitive. This is the one route that can
        never be behind the payment wall, so an agent holding only native Base ETH
        can always discover how to obtain access.

        Performs NO swap-provider call and is not rate-limited by the payment
        toll booth. Informational by default; every mutating action requires an
        explicit authenticated POST with a server-issued, purpose-specific
        challenge bound to the requesting wallet.
      tags:
        - Payments
      responses:
        '200':
          description: Bootstrap terms
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: getPaymentsBootstrap HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '405':
          $ref: '#/components/responses/BadRequest'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/payments/bootstrap
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: postPaymentsBootstrap
      summary: Request a native-ETH payment intent or an execution-bootstrap grant
      description: |
        Issues a native-ETH payment intent whose price, source, timestamp and
        pricing version are locked at issuance and recorded as evidence, or issues
        a single-use execution-bootstrap grant.

        An execution-bootstrap grant entitles exactly ONE firm quote-intent at
        /v1/agent/quote-intent. It is free, and it does NOT authorize autonomous
        execution. Read x-farmdash-capability-truth and the live status endpoint;
        commercial admission never grants the separately required wallet authority.

        Requires a wallet signature over a server-issued, purpose-specific
        challenge. The challenge is bound to a specific action and wallet; a
        signature captured for any other purpose or wallet does not verify.
      tags:
        - Payments
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Issued intent or grant
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: postPaymentsBootstrap HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          description: Challenge signature missing, invalid, or bound to another purpose
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                error:
                  summary: postPaymentsBootstrap HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error: auth_error
      x-farmdash-request-example:
        method: POST
        url: https://www.farmdash.one/api/v1/payments/bootstrap
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /agents/quote:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getSwapQuote
      summary: Get a token swap quote
      description: |
        Provider-neutral market estimate by default: returns an explicitly
        labelled `market_estimate` (reference price, approximate output,
        server fee tier, route compatibility, freshness) WITHOUT calling 0x,
        LI.FI, or Relay trading APIs. Browsing, polling, previews, and
        wallet-supplied GETs all receive estimation — a `walletAddress` alone
        is exploratory context, never execution intent, and never fans out
        into provider APIs. The estimate is intelligence, not a provider
        quote: no executable calldata, no provider attribution, no liquidity
        confirmation, never `executionReady: true`.
        For execution, POST `/v1/agent/quote-intent` with exact parameters, a
        real wallet, and an idempotency key to receive a firm single-provider
        quote bound to an `intentId`; then re-call this endpoint with the
        identical parameters plus `intentId` to serve the stored firm quote
        with zero new provider calls. Changed parameters never reuse a stale
        quote (`intent_params_changed`); unknown/expired intents return
        `intent_not_found`. One intent contacts exactly one primary provider;
        a sequential alternate follows only a genuine primary failure.
        0x quotes use the AllowanceHolder flow (standard approve + plain
        transaction); FarmDash does not support Permit2 EIP-712 signatures.
        `mock=true` is not supported and returns a typed 400 without contacting a provider.
      tags:
        - Swap
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - $ref: '#/components/parameters/FromChainId'
        - $ref: '#/components/parameters/ToChainId'
        - $ref: '#/components/parameters/FromToken'
        - $ref: '#/components/parameters/ToToken'
        - $ref: '#/components/parameters/FromAmount'
        - name: protocol
          in: query
          schema:
            type: string
            enum:
              - lifi
              - relay
          description: Force a specific routing protocol (auto-selected if omitted)
        - name: mock
          in: query
          schema:
            type: string
            enum:
              - 'true'
          description: Unsupported for quotes. Returns HTTP 400 mock_not_supported and never contacts a live quote provider.
        - name: walletAddress
          in: query
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Optional real wallet. Exploratory context only — a wallet alone never triggers provider quoting. For execution, POST /api/v1/agent/quote-intent.
        - name: toAddress
          in: query
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Optional destination wallet override. Must exactly match the stored intent when serving via intentId.
        - name: slippage
          in: query
          schema:
            type: number
            minimum: 0.01
            maximum: 5
          description: Optional slippage tolerance in percent
        - name: expectedUpsideUsd
          in: query
          schema:
            type: number
          description: Optional upside estimate used to enforce positive net edge
        - name: riskBufferUsd
          in: query
          schema:
            type: number
          description: Optional execution-risk haircut added to total route cost
        - name: healthFactor
          in: query
          schema:
            type: number
          description: Optional health factor used for halt checks
        - name: liquidationBufferPct
          in: query
          schema:
            type: number
          description: Optional liquidation buffer percentage used for halt checks
        - name: safetyMode
          in: query
          schema:
            $ref: '#/components/schemas/SwapSafetyMode'
          description: '`strict` halts on severe quote decay, `balanced` downgrades that condition to a warning'
        - name: intentId
          in: query
          schema:
            type: string
          description: Execution-intent ID from POST /api/v1/agent/quote-intent. Serves the stored firm quote with zero new provider calls when all other parameters exactly match the intent; mismatches return intent_params_changed, unknown IDs return intent_not_found.
      responses:
        '200':
          description: Swap quote
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/MarketEstimateResponse'
                  - $ref: '#/components/schemas/FirmQuoteResponse'
              examples:
                success:
                  summary: getSwapQuote HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    quoteKind: market_estimate
                    executionReady: false
                    liquidityConfirmed: false
                    priceUnknown: true
                    feeTierBps: 1
                    volumeUnknown: true
                    compatibleProviders:
                      - example
                    routeSupported: true
                    sources:
                      - example
                    confidence: high
                    observedAt: example
                    cached: true
                    stale: true
                    unsigned: true
                    broadcast_by_farmdash: false
                    execution_boundary:
                      state: unknown
                      simulation_required: true
                      local_signature_required: true
                      farmdash_broadcasts_transaction: true
                    note: Illustrative FarmDash API example.
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '404':
          description: Unknown/expired intentId (intent_not_found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSwapQuote HTTP 404
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: not_found
                    ok: false
                    code: not_found
                    message: Unknown/expired intentId (intent_not_found)
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: Typed live quote provider degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSwapQuote HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed live quote provider degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '504':
          $ref: '#/components/responses/ProviderTimeout'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/agents/quote?fromChainId=1&toChainId=1&fromToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&toToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&fromAmount=1
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/market-estimate:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getMarketEstimate
      summary: Get a provider-neutral market estimate
      description: |
        Discovery intelligence for browsing, previews, polling, and walletless
        exploration. Returns an explicitly labelled market_estimate (reference
        price, approximate output, server fee tier, route compatibility,
        freshness) WITHOUT calling 0x, LI.FI, or Relay trading APIs. Never
        executable, never attributed, never liquidity-confirmed. For
        execution, POST /v1/agent/quote-intent.
      tags:
        - Swap
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - $ref: '#/components/parameters/FromChainId'
        - $ref: '#/components/parameters/ToChainId'
        - $ref: '#/components/parameters/FromToken'
        - $ref: '#/components/parameters/ToToken'
        - $ref: '#/components/parameters/FromAmount'
      responses:
        '200':
          description: Market estimate
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketEstimateResponse'
              examples:
                success:
                  summary: getMarketEstimate HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    quoteKind: market_estimate
                    executionReady: false
                    liquidityConfirmed: false
                    priceUnknown: true
                    feeTierBps: 1
                    volumeUnknown: true
                    compatibleProviders:
                      - example
                    routeSupported: true
                    sources:
                      - example
                    confidence: high
                    observedAt: example
                    cached: true
                    stale: true
                    unsigned: true
                    broadcast_by_farmdash: false
                    execution_boundary:
                      state: unknown
                      simulation_required: true
                      local_signature_required: true
                      farmdash_broadcasts_transaction: true
                    note: Illustrative FarmDash API example.
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/market-estimate?fromChainId=1&toChainId=1&fromToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&toToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&fromAmount=1
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/continuation:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: selectExecutionContinuation
      summary: Select server-issued execution context without granting authority
      description: Returns a stored, capability-rechecked context and its canonical next operation. This does not quote, prepare, admit, debit, sign, or submit; unknown/expired IDs fail closed. The request accepts only the server-issued continuationId.
      tags:
        - Execution
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecutionContinuationSelectionRequest'
            examples:
              default:
                summary: selectExecutionContinuation request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  continuationId: 11111111-1111-4111-8111-111111111111
      responses:
        '200':
          description: Read-only selected continuation and machine-readable operation prerequisites
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecutionContinuationSelection'
              examples:
                success:
                  summary: selectExecutionContinuation HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    continuation:
                      schema: farmdash.execution-continuation.v1
                      continuation_id: 11111111-1111-4111-8111-111111111111
                      source:
                        type: market_estimate
                        ref: example
                      execution_domain: spot
                      network: Base
                      protocol_id: hyperliquid
                      assets:
                        - namespace: eip155
                          network: Base
                          identifier: example
                          kind: native
                      action_kind: swap
                      lifecycle_id: 11111111-1111-4111-8111-111111111111
                      trail_id: example_001
                      next_operation:
                        method: POST
                        endpoint: /api/v1/agent/quote-intent
                        parameters:
                          example_001: example
                          example_002: example
                        required_fields:
                          - example
                      available_execution_modes:
                        - USER_SIGNED
                      authority: NOT_GRANTED
                      prerequisites:
                        - example
                      scout_trial:
                        exists: true
                        domain: spot
                        daily_limit: 0
                        remaining: null
                        status: unknown
                        after_exhaustion: authoritative_admission
                      expires_at: '2026-10-30T12:00:00Z'
                    next_operation:
                      method: POST
                      endpoint: /api/v1/agent/quote-intent
                      parameters:
                        example_001: example
                        example_002: example
                      required_fields:
                        - example
                    correlation:
                      continuation_id: 11111111-1111-4111-8111-111111111111
                      source_type: market_estimate
                      source_ref: example
                      lifecycle_id: 11111111-1111-4111-8111-111111111111
                      trail_id: example_001
                      execution_domain: spot
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          description: Unknown continuation ID
          x-farmdash-response-example:
            status: 404
            description: Unknown continuation ID
            body: null
            note: Documents status semantics without inventing a response payload.
        '410':
          description: Continuation expired
          x-farmdash-response-example:
            status: 410
            description: Continuation expired
            body: null
            note: Documents status semantics without inventing a response payload.
        '503':
          description: Required capability or canonical resolver unavailable
          x-farmdash-response-example:
            status: 503
            description: Required capability or canonical resolver unavailable
            body: null
            note: Documents status semantics without inventing a response payload.
  /v1/agent/quote-intent:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: createQuoteIntent
      summary: Create an execution intent with a firm single-provider quote
      description: |
        Explicit execution intent. Requires exact chain pair, token pair,
        amount, real wallet/taker, destination, slippage, and a client
        idempotency key; the fee tier is resolved server-side before any
        provider call. One intent contacts exactly one primary provider; a
        sequential alternate follows only a genuine primary failure.
        Identical intents reuse the stored firm quote (HTTP 200 reused:true);
        changed parameters never reuse a stale quote. The firm quote flows
        through simulate, approval, and prepare without further provider
        quote requests. Quote is not execution; FarmDash never signs or
        broadcasts.
        Provider prerequisites (compatibility swaps):
        A firm quote reports readiness plus any provider prerequisite that must be
        satisfied before simulation. A prerequisite recipe is NOT an executable swap
        transaction and must never be passed directly into simulation.

        LI.FI: when approval.required is true, approval.spender is the spender
        FarmDash observed. FarmDash does not build or broadcast the ERC-20 approval
        transaction: the customer-controlled wallet must satisfy the ERC-20 allowance
        locally (standard approve(spender, amount)), wait for that transaction to
        confirm, then request a FRESH firm quote so FarmDash re-checks the wallet
        balance and allowance. Proceed only when executionReady is true. The zero
        address 0x0000000000000000000000000000000000000000 is the LI.FI native-token
        sentinel and requires no ERC-20 allowance; it is not WETH.

        Relay: providerExecutionPlan is an ORDERED recipe whose steps have kind
        approve, transaction, signature or unknown, and carry status, to, data,
        value and chainId; approve steps also carry approvalSpender and
        approvalAmount, and signature steps carry signatureKind with sign/post/check.
        Follow planContinuation: "re_quote_after_approval" means complete the
        approval locally then obtain a fresh quote;
        "execute_provider_plan_and_check" means execute the ordered sign/post/check
        recipe exactly as returned; "provider_recipe_unsupported" means stop and do
        not treat the recipe as executable. A required step of kind unknown remains
        blocking. Never flatten a multi-step recipe into its first transaction.
        When a value is unreadable FarmDash reports unknown rather than assuming the
        prerequisite is satisfied. Prerequisite completion is not settlement.
      tags:
        - Swap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - fromChainId
                - toChainId
                - fromToken
                - toToken
                - fromAmount
                - walletAddress
                - toAddress
                - slippage
                - idempotencyKey
              properties:
                fromChainId:
                  type: integer
                toChainId:
                  type: integer
                fromToken:
                  type: string
                toToken:
                  type: string
                fromAmount:
                  type: string
                walletAddress:
                  type: string
                toAddress:
                  type: string
                slippage:
                  type: number
                  minimum: 0.01
                  maximum: 5
                protocol:
                  type: string
                  enum:
                    - lifi
                    - relay
                idempotencyKey:
                  type: string
                continuationId:
                  type: string
                  format: uuid
                  description: Optional context correlation only; all existing admission and wallet authority requirements remain unchanged.
                executionTrialProof:
                  $ref: '#/components/schemas/ExecutionTrialProof'
                executionMode:
                  type: string
                  enum:
                    - USER_SIGNED
                    - BOUNDED_AUTONOMOUS
                sessionId:
                  type: string
                grantId:
                  type: string
                sessionToken:
                  type: string
            examples:
              default:
                summary: createQuoteIntent request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  fromChainId: 1
                  toChainId: 1
                  fromToken: USDC
                  toToken: USDC
                  fromAmount: '1'
                  walletAddress: '0x1111111111111111111111111111111111111111'
                  toAddress: '0x1111111111111111111111111111111111111111'
                  slippage: 0.01
                  idempotencyKey: fd-example-idempotency-001
                  protocol: lifi
                  executionMode: USER_SIGNED
      responses:
        '200':
          description: Stored firm quote reused for an identical intent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FirmQuoteResponse'
              examples:
                success:
                  summary: createQuoteIntent HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    intentId: fd_intent_abcd1234
                    quoteKind: firm_quote
                    reused: true
                    selectedProvider: lifi
                    firmQuote: {}
                    expiresAt: example
                    executionReady: true
                    simulationRequirements:
                      required: true
                      simulate_url: https://www.farmdash.one/
                      intent_id: fd_intent_abcd1234
                      valid_for_execution: true
                      plan: {}
                      signatures:
                        - '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
                    attempts:
                      - {}
                    alternateUsed: true
                    unsigned: true
                    broadcast_by_farmdash: false
                    executionAlpha:
                      selectedProtocol: lifi
                      routeReason: Illustrative FarmDash API example.
                      mevProtection:
                        safetyMode: strict
                        actualSlippageBps: 1
                        maxRecommendedSlippageBps: 1
                      candidates:
                        - protocol: lifi
                          estimatedOutput: '1'
                          feeAmountUsd: 1
                          gasEstimateUsd: 1
                          bridgeFeeUsd: 1
                          routeRiskScore: 1
                          selected: true
                      quoteDecay:
                        previousObservedAt: 1
                        quoteAgeMs: 1
                        outputDecayBps: 1
                        gasIncreaseBps: 1
                        severity: none
                      netEdge:
                        expectedUpsideUsd: 1
                        protocolFeeUsd: 1
                        gasUsd: 1
                        bridgeFeeUsd: 1
                        riskBufferUsd: 1
                        totalCostUsd: 1
                        netEdgeUsd: 1
                        positive: true
                    riskReport:
                      flags:
                        - code: request_failed
                          category: approval
                          severity: low
                          title: example
                          message: Illustrative FarmDash API example.
                      approval:
                        source: onchain
                      pegChecks:
                        - reference: USD
                      health:
                        alertLevel: none
                      shouldHalt: true
                      haltReasons:
                        - Illustrative FarmDash API example.
                    execution_boundary:
                      state: unknown
                      simulation_required: true
                      local_signature_required: true
                      farmdash_broadcasts_transaction: true
                    note: Illustrative FarmDash API example.
        '201':
          description: Firm quote bound to a new execution intent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FirmQuoteResponse'
              examples:
                success:
                  summary: createQuoteIntent HTTP 201
                  description: Illustrative successful response generated from the published schema.
                  value:
                    intentId: fd_intent_abcd1234
                    quoteKind: firm_quote
                    reused: true
                    selectedProvider: lifi
                    firmQuote: {}
                    expiresAt: example
                    executionReady: true
                    simulationRequirements:
                      required: true
                      simulate_url: https://www.farmdash.one/
                      intent_id: fd_intent_abcd1234
                      valid_for_execution: true
                      plan: {}
                      signatures:
                        - '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
                    attempts:
                      - {}
                    alternateUsed: true
                    unsigned: true
                    broadcast_by_farmdash: false
                    executionAlpha:
                      selectedProtocol: lifi
                      routeReason: Illustrative FarmDash API example.
                      mevProtection:
                        safetyMode: strict
                        actualSlippageBps: 1
                        maxRecommendedSlippageBps: 1
                      candidates:
                        - protocol: lifi
                          estimatedOutput: '1'
                          feeAmountUsd: 1
                          gasEstimateUsd: 1
                          bridgeFeeUsd: 1
                          routeRiskScore: 1
                          selected: true
                      quoteDecay:
                        previousObservedAt: 1
                        quoteAgeMs: 1
                        outputDecayBps: 1
                        gasIncreaseBps: 1
                        severity: none
                      netEdge:
                        expectedUpsideUsd: 1
                        protocolFeeUsd: 1
                        gasUsd: 1
                        bridgeFeeUsd: 1
                        riskBufferUsd: 1
                        totalCostUsd: 1
                        netEdgeUsd: 1
                        positive: true
                    riskReport:
                      flags:
                        - code: request_failed
                          category: approval
                          severity: low
                          title: example
                          message: Illustrative FarmDash API example.
                      approval:
                        source: onchain
                      pegChecks:
                        - reference: USD
                      health:
                        alertLevel: none
                      shouldHalt: true
                      haltReasons:
                        - Illustrative FarmDash API example.
                    execution_boundary:
                      state: unknown
                      simulation_required: true
                      local_signature_required: true
                      farmdash_broadcasts_transaction: true
                    note: Illustrative FarmDash API example.
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '409':
          description: This idempotencyKey was already used for a materially different request (idempotency_conflict). Generate a new key for a new logical swap; retrying the same key never merges them.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: createQuoteIntent HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: conflict
                    ok: false
                    code: conflict
                    message: This idempotencyKey was already used for a materially different request (idempotency_conflict). Generate a new key for a new logical swap; retrying the same key never merges them.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '413':
          description: Request body too large. Execution-facing bodies are capped at 32 KB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: createQuoteIntent HTTP 413
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: payload_too_large
                    ok: false
                    code: payload_too_large
                    message: Request body too large. Execution-facing bodies are capped at 32 KB.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: Typed live quote provider degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: createQuoteIntent HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed live quote provider degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
  /agents/solana-quote:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getSolanaQuotePreview
      summary: Get a read-only Solana swap quote preview
      description: |
        Returns explicitly non-authoritative Solana pricing intelligence via Jupiter. No authentication required.
        PREVIEW ONLY: the response cannot be executed through the compatibility swap API (Solana execution
        remains preview in the capability registry until an authoritative simulation adapter, Solana signing
        flow, receipt binding, and mainnet integration tests land). FarmDash never signs, builds, or broadcasts
        a transaction from this route.
        `mock=true` is not supported and returns a typed 400 without contacting a provider.
      tags:
        - Swap
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: inputMint
          in: query
          required: true
          schema:
            type: string
            pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
          description: Input token mint (base58 Solana address)
        - name: outputMint
          in: query
          required: true
          schema:
            type: string
            pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
          description: Output token mint (base58 Solana address)
        - name: amount
          in: query
          required: true
          schema:
            type: string
            pattern: ^[1-9][0-9]*$
          description: Input amount as a canonical base-unit integer string (no leading zeros)
        - name: slippageBps
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 500
          description: Optional slippage tolerance in basis points (default 50)
        - name: mock
          in: query
          schema:
            type: string
            enum:
              - 'true'
          description: Unsupported for previews. Returns HTTP 400 mock_not_supported and never contacts a live quote provider.
      responses:
        '200':
          description: Non-authoritative Solana quote preview
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - preview_only
                  - authoritative
                  - submissionAvailable
                  - source
                  - inputMint
                  - outputMint
                  - inAmount
                  - outAmount
                properties:
                  ok:
                    type: boolean
                  continuation:
                    $ref: '#/components/schemas/ExecutionContinuation'
                  next_operation:
                    $ref: '#/components/schemas/ExecutionContinuationNextOperation'
                  preview_only:
                    type: boolean
                  authoritative:
                    type: boolean
                  submissionAvailable:
                    type: boolean
                  source:
                    type: string
                  inputMint:
                    type: string
                  outputMint:
                    type: string
                  inAmount:
                    type: string
                  outAmount:
                    type: string
                  priceImpactPct:
                    type: string
                    nullable: true
                  routeHops:
                    type: integer
                    nullable: true
                  quotedAt:
                    type: string
                    format: date-time
                  unsigned:
                    type: boolean
                  broadcast_by_farmdash:
                    type: boolean
              examples:
                success:
                  summary: getSolanaQuotePreview HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    preview_only: true
                    authoritative: true
                    submissionAvailable: true
                    source: example
                    inputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                    outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                    inAmount: '1'
                    outAmount: '1'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '503':
          description: Typed Jupiter preview degradation (dust-storm contract)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSolanaQuotePreview HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed Jupiter preview degradation (dust-storm contract)
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '504':
          description: Jupiter preview timed out (dust-storm contract, retryable)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSolanaQuotePreview HTTP 504
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Jupiter preview timed out (dust-storm contract, retryable)
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/agents/solana-quote?inputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/simulate:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: simulateSwapExecution
      summary: Simulate a wallet-bound swap intent
      description: |
        Mandatory pre-execution simulation gate for Signal Architect. The caller
        submits `simulationRequirements.intent_id` (`fd_intent_*`) returned by
        `POST /v1/agent/quote-intent` plus the signing wallet. Do not submit the
        top-level `intentId` (`qi_*`), which is the quote-cache/idempotency identity.
        FarmDash simulates the bound execution intent, caches the result for 60 seconds,
        and returns a `simulation_id` that `/agents/swap` requires.
      tags:
        - Swap
        - Risk
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapSimulationRequest'
            examples:
              default:
                summary: simulateSwapExecution request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  intent_id: fd_intent_7f3a
                  wallet_address: '0x1111111111111111111111111111111111111111'
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Simulation report
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapSimulationResponse'
              examples:
                success:
                  summary: simulateSwapExecution HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    simulation_id: sim_9b2e
                    intent_id: fd_intent_abcd1234
                    success: true
                    gas_used: 1
                    gas_cost_usd: 1
                    output_amount: '1'
                    mev_risk: low
                    valid_until: '2026-10-30T12:00:00Z'
                    wallet_address: '0x1111111111111111111111111111111111111111'
                    selected_protocol: lifi
                    required_for_execution: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '409':
          description: Intent and wallet mismatch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: simulateSwapExecution HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: conflict
                    ok: false
                    code: conflict
                    message: Intent and wallet mismatch
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-simulation:
        kind: execution_preflight
        side_effects: none
        authoritative_for_execution: true
        required_before_execution: true
        grants_execution_authority: false
        broadcasts_transaction: false
        proves_settlement: false
        next_step: Use the returned fresh simulation_id with the exact wallet-bound quote intent when preparing /agents/swap.
  /agents/swap:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: executeSwap
      summary: Prepare a signed compatibility-swap transaction
      description: |
        Compatibility transaction-preparation endpoint. It requires a fresh successful
        `simulationId`, authenticates the customer wallet with EIP-191, validates the released
        provider boundary, and returns the exact prepared transaction payload.

        FarmDash does not broadcast the returned compatibility-swap transaction. The customer
        wallet signs and submits the transaction directly to the target network. The chosen
        aggregator or router protocol (automatic multi-provider routing:
        same-chain LI.FI + Relay; cross-chain LI.FI + Relay; 0x is operator-paused
        until reinstated and is never primary or fallback)
        executes the swap.

        **Signature canonicalization**: construct
        `v1:FARMDASH_SWAP:{fromChainId}:{toChainId}:{fromToken}:{toToken}:{fromAmount}:{agentAddress}:{toAddress}:{nonce}`
        after lowercasing every `0x`-prefixed field, including token addresses. Sign the exact
        UTF-8 string with EIP-191/personal_sign. A 428 simulation-gate response is evaluated before
        signature verification and does not prove the signature is valid.

        For LI.FI native ETH routes use the zero-address native-token sentinel, not the WETH contract.

        **Fee schedule** (combined routing target; LI.FI 25 bps platform component deducted, not stacked; gas/slippage excluded): 50 bps under $10k, 45 bps at $10k+, 40 bps at $100k+, 30 bps at $1M+.
      tags:
        - Swap
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRequest'
            examples:
              default:
                summary: executeSwap request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  fromChainId: 1
                  toChainId: 1
                  fromToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                  toToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                  fromAmount: '1'
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  toAddress: '0x1111111111111111111111111111111111111111'
                  simulationId: sim_example_001
                  nonce: '1'
                  signature: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
                  slippage: 0.5
                  protocol: lifi
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Executable swap with transaction calldata
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapResult'
              examples:
                success:
                  summary: executeSwap HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    protocol: lifi
                    estimatedOutput: '1'
                    feeBps: 1
                    feeAmountUSD: '1'
                    gasEstimate: '1'
                    txData:
                      to: example
                      data: example
                      value: '1'
                      chainId: 1
                    expiresAt: 1
                    confirmUrl: /api/agents/confirm
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          description: Invalid signature or expired nonce
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: executeSwap HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: auth_error
                    ok: false
                    code: auth_error
                    message: Invalid signature or expired nonce
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '409':
          description: Swap halted by Risk Sentinel guardrails
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapHaltResponse'
              examples:
                error:
                  summary: executeSwap HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: conflict
                    code: conflict
        '428':
          description: Missing, expired, failed, or mismatched preflight simulation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: executeSwap HTTP 428
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: precondition_required
                    ok: false
                    code: precondition_required
                    message: Missing, expired, failed, or mismatched preflight simulation
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
  /agents/confirm:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: confirmSwap
      summary: Confirm swap execution with on-chain tx hash
      description: |
        After broadcasting the swap transaction, confirm it here with the tx hash.
        FarmDash verifies the transaction on-chain (10s timeout with LRU cache)
        and marks the fee event as settled. Idempotent — safe to retry.
      tags:
        - Swap
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfirmRequest'
            examples:
              default:
                summary: confirmSwap request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  sessionId: session_example_001
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  feeEventId: 11111111-1111-4111-8111-111111111111
                  txHash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Confirmation result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfirmResponse'
              examples:
                success:
                  summary: confirmSwap HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    settlementStatus: confirmed
        '400':
          description: Malformed or invalid confirmation input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: invalid_request
                    ok: false
                    code: invalid_request
                    message: Malformed or invalid confirmation input.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '401':
          description: Missing or malformed session token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: auth_error
                    ok: false
                    code: auth_error
                    message: Missing or malformed session token.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Ownership or token authorization failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 403
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: forbidden
                    ok: false
                    code: forbidden
                    message: Ownership or token authorization failure.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '404':
          description: Session not found or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 404
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: not_found
                    ok: false
                    code: not_found
                    message: Session not found or expired.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '409':
          description: Settlement conflict. Either the exact expected fee transfer failed verification, or the fee event was already confirmed using a DIFFERENT transaction hash (code already_confirmed_conflict). In the latter case the existing settlement is NOT replaced, and this is not a retry-with-the-new-hash condition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: conflict
                    ok: false
                    code: conflict
                    message: Settlement conflict. Either the exact expected fee transfer failed verification, or the fee event was already confirmed using a DIFFERENT transaction hash (code already_confirmed_conflict). In the latter case the existing settlement is NOT replaced, and this is not a retry-with-the-new-hash condition.
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: Unexpected internal confirmation failure (typed dust_storm). Settlement was not recorded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: confirmSwap HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Unexpected internal confirmation failure (typed dust_storm). Settlement was not recorded.
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
  /agents/history:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getSwapHistory
      summary: Get your own fee event history (tenant-bound)
      description: |
        Returns paginated swap fee events owned by the wallet bound to your
        API key. Requires a Pioneer or Syndicate bearer key; anonymous and
        scout callers receive 401 authentication_required. The query is
        always forced to the authenticated wallet — any `agentAddress` that
        differs from it returns 403 cross_tenant_denied.
        Use `?metrics=true` for aggregate revenue metrics for your own wallet.
        For the public leaderboard view (server-aggregated totals only, no
        raw transactions), use GET /v1/agent/leaderboard.
      tags:
        - History
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: agentAddress
          in: query
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Optional. Must equal the wallet bound to your API key; any other value is rejected with 403 cross_tenant_denied.
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 200
        - name: offset
          in: query
          schema:
            type: integer
            default: 0
            maximum: 10000
          description: Pagination offset (capped at 10,000 for DoS protection)
        - name: metrics
          in: query
          schema:
            type: string
            enum:
              - 'true'
          description: Return aggregate revenue metrics (own wallet only) instead of events
      responses:
        '200':
          description: History events or aggregate metrics
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/HistoryResponse'
                  - $ref: '#/components/schemas/RevenueMetrics'
              examples:
                success:
                  summary: getSwapHistory HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    events:
                      - settlement_status: pending
                    total: 1
                    limit: 1
                    offset: 1
        '401':
          description: Authentication required — bind a Pioneer/Syndicate API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSwapHistory HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: auth_error
                    ok: false
                    code: auth_error
                    message: Authentication required — bind a Pioneer/Syndicate API key
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Cross-tenant denial — agentAddress does not match the authenticated wallet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getSwapHistory HTTP 403
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: forbidden
                    ok: false
                    code: forbidden
                    message: Cross-tenant denial — agentAddress does not match the authenticated wallet
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/agents/history
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /agents/vouch:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: vouchForAgent
      summary: Cast a signed weighted Trail Cred vouch
      description: |
        TollBooth rate limits apply; a paid bearer key is optional, not signer proof.
        Sign EIP-191 personal_sign over FARMDASH_VOUCH:{lowercase targetAddress}:{nonce}.
        With signatureType=eip712, sign AgentVouch(targetAddress address, nonce string)
        under domain name FarmDash, version 1, chainId 1 instead. The recovered signer
        is the voucher; no caller-supplied voucher address is accepted as authority.
        The voucher must already have at least one swap in fee_events. Rejects self
        vouches and seed/demo targets; permits at most 5 vouches per address per 24 hours.
        Each voucher/target pair is idempotent; duplicate upserts do not replace weight.
        Requires the fee_events, agent_vouches and agent_reputation stores. Paying for
        API access does not satisfy signer proof or the swap prerequisite.
      tags:
        - Account
      security:
        - {}
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - targetAddress
                - nonce
                - signature
              properties:
                targetAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                  description: Target agent wallet; normalized lowercase before signature recovery
                nonce:
                  type: string
                  minLength: 1
                  description: Millisecond timestamp string parsed with parseInt base 10; at most 60 seconds old and at most 5 seconds in the future. Freshness-only, not persisted; pair upsert is idempotent.
                signature:
                  type: string
                  minLength: 1
                  description: Wallet signature verified by EIP-191 recovery by default, or EIP-712 recovery when explicitly selected
                signatureType:
                  type: string
                  enum:
                    - eip191
                    - eip712
                  default: eip191
                  description: Supported signing modes; omission uses EIP-191
            examples:
              default:
                summary: vouchForAgent request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  targetAddress: '0x1111111111111111111111111111111111111111'
                  nonce: '1'
                  signature: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
                  signatureType: eip191
      responses:
        '200':
          description: Vouch pair recorded idempotently
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - voucher
                  - target
                  - weight
                properties:
                  ok:
                    type: boolean
                    const: true
                  voucher:
                    type: string
                    pattern: ^0x[a-f0-9]{40}$
                  target:
                    type: string
                    pattern: ^0x[a-f0-9]{40}$
                  weight:
                    type: number
                    minimum: 0.01
              examples:
                success:
                  summary: vouchForAgent HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    voucher: '0x1111111111111111111111111111111111111111'
                    target: '0x1111111111111111111111111111111111111111'
                    weight: 0.01
        '400':
          description: Missing fields, invalid target/nonce, stale_nonce, self_vouch or demo_target
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: vouchForAgent HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: invalid_request
                    ok: false
                    code: invalid_request
                    message: Missing fields, invalid target/nonce, stale_nonce, self_vouch or demo_target
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '401':
          description: invalid_signature or unrecoverable_signer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: vouchForAgent HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: auth_error
                    ok: false
                    code: auth_error
                    message: invalid_signature or unrecoverable_signer
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: vouch_sybil_gate — recovered voucher has no recorded swap in fee_events
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: vouchForAgent HTTP 403
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: forbidden
                    ok: false
                    code: forbidden
                    message: vouch_sybil_gate — recovered voucher has no recorded swap in fee_events
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '503':
          description: vouch_store_unavailable or vouch_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: vouchForAgent HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: vouch_store_unavailable or vouch_unavailable
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
  /agents/reputation:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getAgentReputation
      summary: Public single-address reputation lookup (Trail Cred)
      description: |
        Trail Cred score, badge, vouch count, on-chain score, and recent
        vouchers for one EVM address, plus a swap-activity summary. Public
        data beyond rate-limiting tiers; over-quota Scouts draw first from a
        small overflow bonus pool shared with the leaderboard (bonus 200s
        carry `scout_bonus` and X-Scout-Bonus-Remaining), then 402.
      tags:
        - Reputation
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: address
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: EVM agent address to look up.
        - name: voucher
          in: query
          required: false
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Optional voucher address; response includes whether it vouched for the target.
      responses:
        '200':
          description: Reputation record for the address
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            X-Scout-Bonus-Remaining:
              $ref: '#/components/headers/X-Scout-Bonus-Remaining'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReputationResponse'
              examples:
                success:
                  summary: getAgentReputation HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    reputation:
                      address: '0x1111111111111111111111111111111111111111'
                      trailCred: 1
                      badge: example
        '400':
          description: Missing or invalid ?address parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getAgentReputation HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: invalid_request
                    ok: false
                    code: invalid_request
                    message: Missing or invalid ?address parameter
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/agents/reputation?address=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/leaderboard:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getLeaderboard
      summary: Public leaderboard — server-aggregated per-agent totals
      description: |
        Per-agent aggregate totals (volume, fees, swap count) ranked by
        volume, top 50. Computed server-side over fee_events; returns
        aggregates ONLY — no raw transactions, tx hashes, or per-event
        timestamps. No API key required beyond rate-limiting tiers.
      tags:
        - History
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: limit
          in: query
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 50
      responses:
        '200':
          description: Aggregated leaderboard entries
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeaderboardResponse'
              examples:
                success:
                  summary: getLeaderboard HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    source: example
                    entries:
                      - address: '0x1111111111111111111111111111111111111111'
                        totalVolumeUSD: 1
                        totalFeeUSD: 1
                        swapCount: 1
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/leaderboard
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/balances:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getWalletBalances
      summary: Multi-chain wallet balance context for an agent address
      description: |
        Read-only multi-chain token balance context used to ground
        recommendations in the caller's actual wallet state. The queried
        address must match the authenticated tenant wallet when a bound
        API key is presented. Balances are directional reads, not custody.
        Eligible Scout users receive a bounded preview (top 3 assets, total value,
        asset count, active chains) prior to paywall; complete token inventory,
        full chain distribution, and idle-capital analysis are available via one-off
        x402 payment ($0.02) or Pioneer ($39.99/mo).
      tags:
        - Wallet
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: address
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: EVM wallet address.
        - name: chains
          in: query
          required: false
          schema:
            type: string
          description: Comma-separated chain filter.
        - name: summary
          in: query
          required: false
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
          description: Return the compact summary form.
      responses:
        '200':
          description: Wallet balance context (full paid result or bounded scout_preview; no custody)
          x-farmdash-response-example:
            status: 200
            description: Wallet balance context (full paid result or bounded scout_preview; no custody)
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Queried address does not match the bound tenant wallet.
          x-farmdash-response-example:
            status: 403
            description: Queried address does not match the bound tenant wallet.
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/balances?address=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/performance:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getAgentPerformance
      summary: Agent performance and protocol breakdown
      description: |
        Fee-event activity aggregates for the authenticated agent address:
        cumulative volume, fees, and protocol diversity context. It is not a
        fill-quality ledger; profitability cannot be inferred from it.
        Eligible Scout users receive a bounded preview (swap count, volume,
        active days, Trail Cred score, badge, position indicator) prior to paywall;
        complete 30-day dailyActivity series, protocol list, protocol diversity score,
        and full leaderboard percentile methodology are available via x402 ($0.02)
        or Pioneer ($39.99/mo).
      tags:
        - History
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: address
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: EVM agent/wallet address (must match bound tenant wallet when a key is presented).
      responses:
        '200':
          description: Aggregate performance context (full paid result or bounded scout_preview)
          x-farmdash-response-example:
            status: 200
            description: Aggregate performance context (full paid result or bounded scout_preview)
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Queried address does not match the bound tenant wallet.
          x-farmdash-response-example:
            status: 403
            description: Queried address does not match the bound tenant wallet.
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/performance?address=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/sybil-audit:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getSybilAudit
      summary: Wallet-cluster Sybil risk scoring (1-10 EVM addresses)
      description: |
        Heuristic defensive audit for timing clusters, shared funding,
        internal transfers, low diversity, and bot-like wallet patterns.
        This is a risk-management signal, NOT a protocol eligibility verdict:
        never call a low score "clean" and never prescribe activity designed
        to change detection outcomes.
        Eligible Scout callers querying a single wallet receive a bounded preview
        (risk score, coarse risk band, highest severity, findings count, summary)
        prior to paywall; detailed findings, wallet-pair graph, and evidence transaction
        hashes are available via one-off x402 payment ($0.05) or Pioneer ($39.99/mo) / Syndicate ($199/mo).
        Multi-wallet audits (2-10 addresses) require commercial payment ($0.05 single / $0.25 cluster).
      tags:
        - Risk
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: addresses
          in: query
          required: true
          schema:
            type: string
          description: Comma-separated EVM addresses (max 10; case-insensitive dedupe).
      responses:
        '200':
          description: Per-wallet Sybil risk findings with data-quality caveats (or bounded single-wallet Scout preview)
          x-farmdash-response-example:
            status: 200
            description: Per-wallet Sybil risk findings with data-quality caveats (or bounded single-wallet Scout preview)
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/sybil-audit?addresses=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/simulate-points:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: simulatePoints
      summary: FarmScore and points projection simulation
      description: |
        Projects FarmScore for a farming configuration so agents can compare
        projected points-per-dollar across protocols. Simulations are
        decision-support estimates, not guarantees.
      tags:
        - Planning
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                totalVolumeUsd:
                  type: number
                protocolPoints:
                  type: object
                txCount:
                  type: integer
                daysActive:
                  type: integer
                isCexFundingOnly:
                  type: boolean
            examples:
              default:
                summary: simulatePoints request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  totalVolumeUsd: 1
                  protocolPoints: {}
                  txCount: 1
                  daysActive: 1
      responses:
        '200':
          description: Projected FarmScore and per-protocol points comparison
          x-farmdash-response-example:
            status: 200
            description: Projected FarmScore and per-protocol points comparison
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-simulation:
        kind: research_projection
        side_effects: none
        authoritative_for_execution: false
        required_before_execution: false
        grants_execution_authority: false
        broadcasts_transaction: false
        proves_settlement: false
        next_step: Treat the result as research context only; independently evaluate costs, risk, policy, and any later execution preflight.
  /v1/agent/optimize-portfolio:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: optimizePortfolio
      summary: Portfolio optimization context
      description: |
        Personalized protocol-allocation recommendations based on current
        positions, budget, and risk preference. Planning output only — it
        does not authorize or execute any transaction.
      tags:
        - Planning
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                budget:
                  type: number
                chains:
                  type: array
                  items:
                    type: string
                currentProtocols:
                  type: array
                  items:
                    type: string
                riskPreference:
                  type: string
            examples:
              default:
                summary: optimizePortfolio request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  budget: 1
                  chains:
                    - example
                  currentProtocols:
                    - hyperliquid
                  riskPreference: '1'
      responses:
        '200':
          description: Ordered allocation recommendations with rationale
          x-farmdash-response-example:
            status: 200
            description: Ordered allocation recommendations with rationale
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
  /v1/agent/protocols:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getProtocolCatalog
      summary: Get catalog protocol directory (discovery heuristic scores)
      description: |
        Returns the curated FarmDash protocol catalog with EDITORIAL discovery
        heuristic scores. These are NOT live Trail Heat: values derive from
        static catalog TVL strings, status labels and hand-curated flags
        (methodology catalog-editorial-v1). The canonical quantitative Trail
        Scout tier: top 3 spotlight protocols with 100% unmasked quantitative scores (30 req/day).
        Pioneer/Syndicate: full dataset for the current FarmDash protocol registry (81 protocols at this build).
      tags:
        - Intelligence
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Protocol dataset
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProtocolsResponse'
              examples:
                success:
                  summary: getProtocolCatalog HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    tier: scout
                    count: 1
                    data:
                      - category: Perps
                        status: Confirmed Airdrop
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/protocols
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/trail-heat:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getLiveTrailHeat
      summary: Get live or deterministic mock Trail Heat scores
      description: |
        Returns DeFiLlama-backed Trail Heat scores with source, confidence, and
        methodology metadata. Aggregate responses also include agent recommendations
        derived from the same live scores. Commercial preference is transparent:
        FarmDash referral routes may move ahead only inside a 5-point Trail Heat
        quality band; materially stronger protocols always win and canonical scores
        are never changed. Campaign activity/eligibility is not inferred from protocol
        activity. Pioneer/Syndicate callers can use `?recommend=N` for a recommendation-only
        response; Scout callers continue to receive the bounded three-protocol spotlight preview
        with recommendations limited to that preview. `?mock=true` returns deterministic demo fixtures that are explicitly marked
        mock and not for trading.
      tags:
        - Intelligence
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: mock
          in: query
          schema:
            type: string
            enum:
              - 'true'
          description: Return deterministic, explicitly non-live demo data.
        - name: recommend
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 10
          description: Pioneer/Syndicate only — return N live protocol recommendations. Scout remains bounded to its three-protocol spotlight preview. Canonical Trail Heat is the primary signal; only owner-confirmed, non-wallet-bound FarmDash referral routes are eligible for the near-equivalent-quality tiebreaker.
      responses:
        '200':
          description: Live or deterministic mock Trail Heat response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: getLiveTrailHeat HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getLiveTrailHeat HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: auth_error
                    ok: false
                    code: auth_error
                    message: Invalid API key
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '503':
          description: Typed Trail Heat service degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getLiveTrailHeat HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed Trail Heat service degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/trail-heat
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/historical-trailheat:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getHistoricalTrailHeat
      summary: Query historical Trail Heat snapshots
      description: |
        Requires Pioneer or Syndicate access through the TollBooth, or an eligible Scout preview.
        Eligible Scout callers receive a bounded preview (top 3 snapshots for a single protocol,
        or top 3 protocols cross-protocol) prior to paywall; complete snapshot series and 30/90/365-day
        trend analytics are available via one-off x402 payment ($0.03) or Pioneer ($39.99/mo) / Syndicate ($199/mo).
        Requires the trail_heat_snapshots store; missing storage or query failures return 503 rather than
        fabricated history. With protocolId, returns that protocol's daily history; without it, returns
        the latest snapshot per protocol in the requested window. Legacy editorial and canonical-live
        vintages are not quantitatively comparable; inspect data_evidence, evidence_vintage and data_quality
        before trend analysis.
      tags:
        - Intelligence
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: protocolId
          in: query
          required: false
          description: Optional protocol identifier; runtime removes characters outside a-z, A-Z, 0-9 and underscore, then truncates to 64 characters. Omit or send empty for all protocols.
          schema:
            type: string
        - name: days
          in: query
          required: false
          description: Runtime uses parseInt base 10, defaults falsy or invalid results to 30, then clamps to 1 through 365; out-of-range input is normalized, not rejected.
          schema:
            type: integer
            default: 30
      responses:
        '200':
          description: Stored snapshots with explicit scoring provenance (or bounded Scout preview)
          content:
            application/json:
              schema:
                type: object
                required:
                  - snapshots
                  - count
                  - days
                  - score_semantics
                  - data_quality
                properties:
                  protocolId:
                    type: string
                    description: Present only for a specific protocol query; sanitized identifier
                  count:
                    type: integer
                  days:
                    type: integer
                    minimum: 1
                    maximum: 365
                  score_semantics:
                    type: string
                  data_quality:
                    type: object
                    required:
                      - mode
                      - vintage_mix_warning
                    properties:
                      mode:
                        type: string
                        enum:
                          - canonical
                          - vintage_mix
                          - legacy_only
                      vintage_mix_warning:
                        type:
                          - string
                          - 'null'
                  snapshots:
                    type: array
                    items:
                      type: object
                      required:
                        - protocolId
                        - protocolName
                        - score
                        - components
                        - metadata
                        - data_evidence
                        - evidence_vintage
                        - snapshotDate
                      properties:
                        protocolId:
                          type: string
                        protocolName:
                          type: string
                        score:
                          type:
                            - number
                            - 'null'
                        components:
                          description: Stored score components; historical rows may be null
                        metadata:
                          description: Stored snapshot metadata; historical rows may be null
                        data_evidence:
                          description: Stored canonical evidence, or null for legacy rows
                        evidence_vintage:
                          type: string
                          enum:
                            - canonical-live
                            - legacy-editorial-heuristic
                        snapshotDate:
                          type: string
                          format: date
              examples:
                success:
                  summary: getHistoricalTrailHeat HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    snapshots:
                      - protocolId: hyperliquid
                        protocolName: hyperliquid
                        score: 1
                        components: example
                        metadata: example
                        data_evidence: example
                        evidence_vintage: canonical-live
                        snapshotDate: '2026-10-30'
                    count: 1
                    days: 1
                    score_semantics: example
                    data_quality:
                      mode: canonical
                      vintage_mix_warning: example
        '402':
          description: Pioneer access required or TollBooth payment wall; payment does not change execution authority
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredError'
              examples:
                x402_payment_required:
                  summary: Illustrative x402 payment challenge
                  description: Live 402 and PAYMENT-REQUIRED are authoritative. Payment grants API capacity only, never execution authority.
                  value:
                    ok: false
                    error: payment_required
                    code: free_quota_exhausted
                    message: Illustrative x402 challenge; live 402 is authoritative for route-specific price and policy.
                    instruction: STOP_RETRYING
                    retry_same_request: false
                    next_action: Wait for quota reset, upgrade, or attach valid x402 payment evidence and retry once.
                    quota:
                      tier: scout
                      remaining: 0
                      reset_at: '2026-10-30T12:00:00Z'
                    retryable: false
                    payment_required:
                      amount: 0.01 USDC
                      chain: Base
                      destination: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
                      token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      chainId: '8453'
          headers:
            PAYMENT-REQUIRED:
              description: Base64-encoded x402 v2 PaymentRequired. Illustrative only; parse the live header.
              schema:
                type: string
              example: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfV0sInBheW1lbnRSZXF1aXJlbWVudHMiOnsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfSwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly93d3cuZmFybWRhc2gub25lL2FwaS92MS9hZ2VudC9wcm90b2NvbHMiLCJkZXNjcmlwdGlvbiI6IklsbHVzdHJhdGl2ZSBGYXJtRGFzaCBBUEkgYWNjZXNzIn0sImZhcm1kYXNoIjp7ImV4YW1wbGVfb25seSI6dHJ1ZSwiZ3JhbnRzX3RyYW5zYWN0aW9uX2F1dGhvcml0eSI6ZmFsc2V9fQ==
            X-Payment-Required:
              description: Compatibility signal for x402.
              schema:
                type: string
                enum:
                  - 'true'
              example: 'true'
            X-Payment-Amount:
              description: Illustrative Base USDC base units; live 402 is authoritative.
              schema:
                type: string
              example: '10000'
            X-Payment-Chain-Id:
              description: Illustrative payment chain.
              schema:
                type: string
              example: '8453'
            X-Payment-Address:
              description: Illustrative destination; verify live 402.
              schema:
                type: string
              example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
            X-Payment-Token:
              description: Illustrative Base USDC address; verify live 402.
              schema:
                type: string
              example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '503':
          description: Historical storage is not ready (feature_not_ready) or historical_trailheat_unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getHistoricalTrailHeat HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Historical storage is not ready (feature_not_ready) or historical_trailheat_unavailable
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/historical-trailheat
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/prices:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getTokenPrices
      summary: Get live token price context
      description: Returns live Alchemy USD prices. Provider failure is a typed ok:false degraded response, never a successful empty or zero price set.
      tags:
        - Intelligence
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: symbols
          in: query
          schema:
            type: string
            example: ETH,USDC
          description: Comma-separated token symbols; provide symbols or tokens.
        - name: tokens
          in: query
          schema:
            type: string
            example: base-mainnet:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
          description: Comma-separated network:address pairs; provide symbols or tokens.
      responses:
        '200':
          description: Live token prices with explicit data quality
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: getTokenPrices HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: Typed upstream price degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getTokenPrices HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed upstream price degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '503':
          description: Price provider is not configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getTokenPrices HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Price provider is not configured
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/prices
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/workflows:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: listAgentWorkflows
      summary: List supervised workflow templates
      description: Public catalog of planning and supervised workflow templates. Catalog registration does not enable the execution capabilities used by a workflow.
      tags:
        - Intelligence
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: filter
          in: query
          schema:
            type: string
          description: Optional case-insensitive catalog filter.
      responses:
        '200':
          description: Workflow catalog
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              examples:
                success:
                  summary: listAgentWorkflows HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/workflows
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/chain-breakdown:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getChainBreakdown
      summary: Get protocol distribution by chain
      description: |
        Aggregates the protocol directory by blockchain network.
        Returns per-chain protocol counts, confirmed airdrops, points programs,
        and category coverage.
      tags:
        - Intelligence
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Chain breakdown
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChainBreakdownResponse'
              examples:
                success:
                  summary: getChainBreakdown HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    tier: scout
                    data:
                      chains:
                        - chain: Base
                          protocol_count: 1
                          pct_of_total: 1
                          confirmed_airdrops: 1
                          points_programs: 1
                          categories:
                            - example
                      summary:
                        total_chains: 1
                        total_protocols: 1
                        dominant_chain: example
                        dominant_chain_pct: 1
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/chain-breakdown
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/futures/scan-funding:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: scanFundingRates
      summary: Scan Hyperliquid funding rates for arb opportunities
      description: |
        Returns current and predicted funding rates across all Hyperliquid perp
        markets. Cross-references with Binance and Bybit to identify arbitrage.
        Scout: top 3 with encrypted rates. Pioneer/Syndicate: full data.
      tags:
        - Research
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Funding rate scan
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanFundingResponse'
              examples:
                success:
                  summary: scanFundingRates HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    tier: scout
                    arbOpportunities:
                      - arbDirection: long_spot_short_perp
                    highFunding:
                      - arbDirection: long_spot_short_perp
                    totalScanned: 1
                    upgradeMessage: Illustrative FarmDash API example.
                    timestamp: 1
                    warnings:
                      - kind: dust_storm
                        message: Illustrative FarmDash API example.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '502':
          description: Typed Hyperliquid funding provider degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: scanFundingRates HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed Hyperliquid funding provider degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/futures/scan-funding
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/futures/market-conditions:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getMarketConditions
      summary: Get technical indicators for an asset
      description: |
        Returns EMA-8/34, RSI-14, MACD(12,26,9), ATR-14, Bollinger Bands(20,2),
        ADX-14, volume ratio, and Z-score using 4h candles.
        Includes a strategy hint based on indicator confluence.
      tags:
        - Research
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: coin
          in: query
          required: true
          schema:
            type: string
          description: Asset symbol (ETH, BTC, SOL, HYPE)
      responses:
        '200':
          description: Technical indicators
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketConditionsResponse'
              examples:
                success:
                  summary: getMarketConditions HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    strategyHint: momentum_long
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '502':
          description: Typed Hyperliquid candle provider degradation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: getMarketConditions HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: upstream_unavailable
                    ok: false
                    code: upstream_unavailable
                    message: Typed Hyperliquid candle provider degradation
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/futures/market-conditions?coin=ETH
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/futures/account-state:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getAccountState
      summary: Get Hyperliquid positions and risk state
      description: |
        Returns the agent's current positions, margin summary, equity,
        liquidation prices, and risk management state. Daily/weekly values are
        conservative loss-pressure metrics (rolling closed PnL minus absolute
        fill fees plus funding and negative current unrealized PnL only), not
        full period returns.
        Read-only lookup — no private key required.
      tags:
        - Account
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: agentAddress
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
          description: Agent's EVM address (Hyperliquid API wallet)
      responses:
        '200':
          description: Account state with risk info
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountStateResponse'
              examples:
                success:
                  summary: getAccountState HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    account:
                      equity: example
                      totalNotionalPosition: '1'
                      marginUsed: example
                      availableMargin: example
                      aggregateLeverage: example
                    positions:
                      - side: long
                    risk:
                      pnlSource: hyperliquid_venue_loss_pressure
                    guardrails:
                      maxLeverage: 5
                      maxRiskPerTrade: 2%
                      dailyLossLimit: '-3%'
                      weeklyLossLimit: '-7%'
                      maxDrawdown: '-15%'
                    timestamp: 1
                    warnings:
                      - kind: dust_storm
                        message: Illustrative FarmDash API example.
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/futures/account-state?agentAddress=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/futures/analyze-strategy:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: analyzeStrategy
      summary: Full research pipeline with adaptive strategy recommendation
      description: |
        Runs funding rates + technicals + order book liquidity + Trail Heat cross-ref.
        Returns a structured strategy object, confidence score, market regime,
        adaptive risk, portfolio context, pre-trade simulation, and explicit
        no-trade outcomes when no setup is valid. Scout may claim one bounded research
        result per durable free futures lifecycle (five per capital owner per UTC day),
        with locally signed commercial identity or validated owner-bound delegated authority.
        Paid Pioneer+ and eligible x402 admission remain available. This
        registers analysis for a 60-second execution window that binds side, maximum size, entry drift, leverage metadata, and stop-derived risk.
      tags:
        - Strategy
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - coin
                - agentAddress
              properties:
                coin:
                  type: string
                  description: Asset symbol (ETH, BTC, SOL)
                agentAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                riskMultiplier:
                  type: number
                  minimum: 0.1
                  maximum: 1
                  description: Optional flexibility modifier for risk tolerance. 1.0 keeps the full risk budget; lower values are more conservative.
                accountAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                idempotencyKey:
                  type: string
                  maxLength: 128
                executionTrialProof:
                  $ref: '#/components/schemas/ExecutionTrialProof'
                executionMode:
                  type: string
                  enum:
                    - USER_SIGNED
                    - BOUNDED_AUTONOMOUS
                sessionId:
                  type: string
                grantId:
                  type: string
                sessionToken:
                  type: string
            examples:
              default:
                summary: analyzeStrategy request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  coin: ETH
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  executionMode: USER_SIGNED
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Strategy recommendation
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyzeStrategyResponse'
              examples:
                success:
                  summary: analyzeStrategy HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    continuation:
                      schema: farmdash.execution-continuation.v1
                      continuation_id: 11111111-1111-4111-8111-111111111111
                      source:
                        type: market_estimate
                        ref: example
                      execution_domain: spot
                      network: Base
                      protocol_id: hyperliquid
                      assets:
                        - namespace: eip155
                          network: Base
                          identifier: example
                          kind: native
                      action_kind: swap
                      lifecycle_id: 11111111-1111-4111-8111-111111111111
                      trail_id: example_001
                      next_operation:
                        method: POST
                        endpoint: /api/v1/agent/quote-intent
                        parameters:
                          example_001: example
                          example_002: example
                        required_fields:
                          - example
                      available_execution_modes:
                        - USER_SIGNED
                      authority: NOT_GRANTED
                      prerequisites:
                        - example
                      scout_trial:
                        exists: true
                        domain: spot
                        daily_limit: 0
                        remaining: null
                        status: unknown
                        after_exhaustion: authoritative_admission
                      expires_at: '2026-10-30T12:00:00Z'
                    next_operation:
                      method: POST
                      endpoint: /api/v1/agent/quote-intent
                      parameters:
                        example_001: example
                        example_002: example
                      required_fields:
                        - example
                    ok: true
                    recommendation:
                      recommendedStrategy: funding_arb
                    account:
                      equity: example
                      availableMargin: example
                      openPositions: 1
                    guardrails:
                      maxLeverage: 5
                      maxRiskPerTrade: 2%
                      dailyLossLimit: '-3%'
                      weeklyLossLimit: '-7%'
                      maxDrawdown: '-15%'
                    timestamp: 1
                    warnings:
                      - kind: dust_storm
                        message: Illustrative FarmDash API example.
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-simulation:
        kind: heuristic_research
        side_effects: none
        authoritative_for_execution: false
        required_before_execution: false
        grants_execution_authority: false
        broadcasts_transaction: false
        proves_settlement: false
        next_step: If research supports action, obtain current account state, size the position, and use the separately authorized prepare/sign/execute flow.
  /v1/agent/futures/position-sizing:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: calculatePositionSize
      summary: Position size calculator with guardrail enforcement
      description: |
        Given entry price, stop price, equity, and risk, returns exact position
        size, leverage, and margin. All guardrails enforced server-side.
        Pioneer+ required.
      tags:
        - Strategy
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PositionSizingRequest'
            examples:
              default:
                summary: calculatePositionSize request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  equity: 1
                  entryPrice: 1
                  stopPrice: 1
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Position sizing result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionSizingResponse'
              examples:
                success:
                  summary: calculatePositionSize HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    sizing:
                      positionSize: 1
                      positionValueUsd: 1
                      leverage: 1
                      marginRequired: 1
                      riskAmount: 1
                      riskPercent: 1
                      stopDistance: 1
                      rewardRiskRatio: 1
                    guardrails:
                      maxLeverage: 1
                      maxRiskPerTrade: '1'
                      maxPositionValue: '1'
                      note: Illustrative FarmDash API example.
                    timestamp: 1
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
  /agents/solana-swap:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: prepareSolanaSwap
      summary: Prepare an unsigned Solana swap for local wallet signature
      description: Prepares a user-signable Solana transaction after server-side mint, quote, simulation, wallet, idempotency, trial-admission and authority checks. `continuationId` is optional non-authoritative context correlation only; it does not relax any existing requirement or grant signing/submission authority. An expired unsigned preparation returns non-retryable 410 `solana_preparation_expired`; obtain a fresh preparation with a new idempotency key. A submitted or ambiguous 409 is not safe to resubmit; reconcile authoritative state first. Retry a retryable 503 only with the same stable idempotency key.
      tags:
        - Swap
        - Execution
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SolanaSwapPrepareRequest'
            examples:
              default:
                summary: prepareSolanaSwap request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  wallet: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  inputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  amount: '1'
                  executionMode: USER_SIGNED
      responses:
        '200':
          description: Unsigned prepared transaction requiring the customer wallet signature
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SolanaSwapPrepareResponse'
              examples:
                success:
                  summary: prepareSolanaSwap HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    status: READY_FOR_USER_SIGNATURE
                    unsigned: true
                    serverSigned: false
                    requiresUserSignature: true
                    broadcastByFarmdash: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '409':
          description: Preparation conflict or submitted/ambiguous state; do not resubmit until authoritative reconciliation
          x-farmdash-response-example:
            status: 409
            description: Preparation conflict or submitted/ambiguous state; do not resubmit until authoritative reconciliation
            body: null
            note: Documents status semantics without inventing a response payload.
        '410':
          description: Unsigned preparation expired; obtain a fresh preparation with a new idempotency key
          x-farmdash-response-example:
            status: 410
            description: Unsigned preparation expired; obtain a fresh preparation with a new idempotency key
            body: null
            note: Documents status semantics without inventing a response payload.
        '503':
          description: Durable Solana preparation or canonical resolver unavailable; retry only with the same stable idempotency key
          x-farmdash-response-example:
            status: 503
            description: Durable Solana preparation or canonical resolver unavailable; retry only with the same stable idempotency key
            body: null
            note: Documents status semantics without inventing a response payload.
      x-farmdash-simulation:
        kind: embedded_execution_preflight
        side_effects: none
        authoritative_for_execution: true
        required_before_execution: true
        grants_execution_authority: false
        broadcasts_transaction: false
        proves_settlement: false
        next_step: Sign the returned prepared transaction locally and broadcast from the authorized Solana wallet; then verify finality separately.
  /v1/agent/futures/prepare-order:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: prepareFuturesOrder
      summary: Prepare an exact Hyperliquid order for local EIP-712 signing
      description: |
        Zero-custody execution bootstrap. FarmDash validates the market/account,
        fresh research gate for new risk, builder-fee approval and market_ioc price
        protection, then returns the exact Hyperliquid action, nonce, expiresAt,
        intentHash and EIP-712 typed data. FarmDash does not sign or submit.
        Sign typedData locally with agentAddress, then POST
        { ...executeRequest, signature } to /v1/agent/futures/execute-order.
        Commercial capacity never creates venue authority.
      tags:
        - Execution
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrepareOrderRequest'
            examples:
              default:
                summary: prepareFuturesOrder request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  coin: ETH
                  isBuy: true
                  size: '1'
                  price: '1'
                  orderType: limit_gtc
                  reduceOnly: false
                  executionMode: USER_SIGNED
      responses:
        '200':
          description: Exact signable order preparation; no venue submission occurred
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrepareOrderResponse'
              examples:
                success:
                  summary: prepareFuturesOrder HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    state: READY_FOR_LOCAL_SIGNATURE
                    executionMode: USER_SIGNED
                    preparation:
                      agentAddress: '0x1111111111111111111111111111111111111111'
                      coin: ETH
                      isBuy: true
                      size: '1'
                      price: '1'
                      orderType: limit_gtc
                      accountAddress: '0x1111111111111111111111111111111111111111'
                      reduceOnly: false
                      leverage: 0.000001
                      assetIndex: 0
                      signedAction: {}
                      nonce: 1
                      expiresAt: 1
                      intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      vaultAddress: '0x1111111111111111111111111111111111111111'
                      builder:
                        b: '0x1111111111111111111111111111111111111111'
                        f: 1
                        basisPoints: 0.1
                        approvedMaximumVenueUnitsTenthsBps: 1
                    typedData:
                      domain:
                        name: Exchange
                        version: '1'
                        chainId: 1337
                        verifyingContract: '0x0000000000000000000000000000000000000000'
                      types:
                        example_001:
                          - name: example
                            type: example
                        example_002:
                          - name: example
                            type: example
                      primaryType: Agent
                      message:
                        source: a
                        connectionId: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
                    executeRequest:
                      agentAddress: '0x1111111111111111111111111111111111111111'
                      coin: ETH
                      isBuy: true
                      size: '1'
                      price: '1'
                      orderType: limit_gtc
                      accountAddress: '0x1111111111111111111111111111111111111111'
                      reduceOnly: false
                      leverage: 0.000001
                      nonce: 1
                      expiresAt: 1
                      intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      signedAction: {}
                      executionMode: USER_SIGNED
                    next_action:
                      local: example
                      then: example
                    zeroCustody: true
                    privateKeyRequiredByFarmDash: false
                    timestamp: 1
        '400':
          description: Invalid market, account authority, or order parameters
          x-farmdash-response-example:
            status: 400
            description: Invalid market, account authority, or order parameters
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          description: Payment or tier capacity required
          headers:
            PAYMENT-REQUIRED:
              description: Base64-encoded x402 v2 PaymentRequired. Illustrative only; parse the live header.
              schema:
                type: string
              example: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfV0sInBheW1lbnRSZXF1aXJlbWVudHMiOnsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfSwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly93d3cuZmFybWRhc2gub25lL2FwaS92MS9hZ2VudC9wcm90b2NvbHMiLCJkZXNjcmlwdGlvbiI6IklsbHVzdHJhdGl2ZSBGYXJtRGFzaCBBUEkgYWNjZXNzIn0sImZhcm1kYXNoIjp7ImV4YW1wbGVfb25seSI6dHJ1ZSwiZ3JhbnRzX3RyYW5zYWN0aW9uX2F1dGhvcml0eSI6ZmFsc2V9fQ==
            X-Payment-Required:
              description: Compatibility signal for x402.
              schema:
                type: string
                enum:
                  - 'true'
              example: 'true'
            X-Payment-Amount:
              description: Illustrative Base USDC base units; live 402 is authoritative.
              schema:
                type: string
              example: '10000'
            X-Payment-Chain-Id:
              description: Illustrative payment chain.
              schema:
                type: string
              example: '8453'
            X-Payment-Address:
              description: Illustrative destination; verify live 402.
              schema:
                type: string
              example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
            X-Payment-Token:
              description: Illustrative Base USDC address; verify live 402.
              schema:
                type: string
              example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredError'
              examples:
                x402_payment_required:
                  summary: Illustrative x402 payment challenge
                  description: Live 402 and PAYMENT-REQUIRED are authoritative. Payment grants API capacity only, never execution authority.
                  value:
                    ok: false
                    error: payment_required
                    code: free_quota_exhausted
                    message: Illustrative x402 challenge; live 402 is authoritative for route-specific price and policy.
                    instruction: STOP_RETRYING
                    retry_same_request: false
                    next_action: Wait for quota reset, upgrade, or attach valid x402 payment evidence and retry once.
                    quota:
                      tier: scout
                      remaining: 0
                      reset_at: '2026-10-30T12:00:00Z'
                    retryable: false
                    payment_required:
                      amount: 0.01 USDC
                      chain: Base
                      destination: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
                      token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      chainId: '8453'
        '409':
          description: Fresh research or owner builder-fee approval required
          x-farmdash-response-example:
            status: 409
            description: Fresh research or owner builder-fee approval required
            body: null
            note: Documents status semantics without inventing a response payload.
        '422':
          description: Signed market_ioc limit violates live price protection
          x-farmdash-response-example:
            status: 422
            description: Signed market_ioc limit violates live price protection
            body: null
            note: Documents status semantics without inventing a response payload.
        '503':
          description: Preparation dependency unavailable
          x-farmdash-response-example:
            status: 503
            description: Preparation dependency unavailable
            body: null
            note: Documents status semantics without inventing a response payload.
  /v1/agent/futures/execute-order:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: executeOrder
      summary: Execute a pre-signed order on Hyperliquid
      description: |
        Forwards a pre-signed EIP-712 order to Hyperliquid. Requires prior
        execution-ready analyze-strategy call within 60 seconds for risk-increasing orders (parameter-bound research gate). Scout signed capacity or x402 overage applies; paid capacity never creates authority.
        FarmDash may receive routing compensation from supported venues. Risk guardrails enforced server-side.
        `nonce`, `expiresAt`, and `intentHash` are required for request-scoped
        expiry and auditability. `expiresAt` is forwarded as venue `expiresAfter`.
        `market_ioc` is a signed, price-protected IOC limit order with a live 100
        bps adverse-price cap, never an unbounded market order. It distinguishes
        full, partial, and zero fill; an IOC resting response is unknown/inconsistent.
        Venue nonce authority is `network + signer + nonce` across account and vault
        contexts. Durable replay control fails closed before submission.
        The signed order action discloses FarmDash builder `f=1`, which means
        0.1 bp (0.001%) of filled notional—not 1 bp. Resting/rejected/unfilled
        notional is not fee-bearing volume.
        WARNING: Real market actions can cause financial loss. USER_SIGNED requires fresh manual approval for each order/cancel. BOUNDED_AUTONOMOUS permits local agent signing without per-order confirmation only under a valid explicit owner-signed futures grant, authenticated session, venue delegation and all applicable gates. Futures bounded autonomy remains preparation_only until the production canary passes.
      tags:
        - Execution
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecuteOrderRequest'
            examples:
              default:
                summary: executeOrder request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  coin: ETH
                  isBuy: true
                  size: '1'
                  price: '1'
                  orderType: limit_gtc
                  nonce: 1
                  expiresAt: 1
                  intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  signature:
                    r: example
                    s: example
                    v: 1
                  executionMode: USER_SIGNED
                  reduceOnly: false
      parameters:
        - name: X-FarmDash-Session-Token
          in: header
          required: false
          schema:
            type: string
          description: Session capability for BOUNDED_AUTONOMOUS; does not grant venue signing authority
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Order execution result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteOrderResponse'
              examples:
                success:
                  summary: executeOrder HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    state: fully_filled
        '400':
          description: Risk check failed or research not performed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: executeOrder HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: invalid_request
                    ok: false
                    code: invalid_request
                    message: Risk check failed or research not performed
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
                    details:
                      ok: false
                      error: request_failed
        '402':
          $ref: '#/components/responses/PaymentRequired'
  /v1/agent/futures/cancel-order:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: cancelOrder
      summary: Cancel open Hyperliquid orders
      description: |
        Cancels one or more open orders (max 50 per request).
        Scout capacity is available inside the shared 30 requests / 24h quota; Pioneer is capped at 1,500/day and Syndicate at 50,000/day. The returned entitlement and rate-limit state is authoritative. EIP-712 signature is required on every request.
        Required `expiresAt` is forwarded as venue `expiresAfter`; required
        `intentHash` binds the FarmDash request for auditability.
        HTTP 202 is returned only for `accepted` application acknowledgement, not final venue cancellation.
        Reconcile every requested ID through `/api/v1/agent/futures/reconcile-order`
        before dependent action. Venue nonce authority is `network + signer + nonce`
        across account and vault contexts; durable replay control fails closed before submission.
        WARNING: Real market actions can cause financial loss. USER_SIGNED requires fresh manual approval for each order/cancel. BOUNDED_AUTONOMOUS permits local agent signing without per-order confirmation only under a valid explicit owner-signed futures grant, authenticated session, venue delegation and all applicable gates. Futures bounded autonomy remains preparation_only until the production canary passes.
      tags:
        - Execution
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelOrderRequest'
            examples:
              default:
                summary: cancelOrder request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  coin: ETH
                  orderIds:
                    - 1
                  nonce: 1
                  expiresAt: 1
                  intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  signature:
                    r: example
                    s: example
                    v: 1
                  executionMode: USER_SIGNED
      parameters:
        - name: X-FarmDash-Session-Token
          in: header
          required: false
          schema:
            type: string
          description: Session capability for BOUNDED_AUTONOMOUS; does not grant venue signing authority
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '202':
          description: Cancellation application acknowledgement; final venue cancellation requires reconciliation
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelOrderResponse'
              examples:
                success:
                  summary: cancelOrder HTTP 202
                  description: Illustrative successful response generated from the published schema.
                  value:
                    state: accepted
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
  /v1/agent/onboard:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getOnboardingGuide
      summary: Get bounded agent onboarding guide
      description: |
        Returns setup checklist, capability map, security model, and workflow loop.
        No auth required — entry point for new agents.
      tags:
        - Session
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Onboarding guide
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OnboardResponse'
              examples:
                success:
                  summary: getOnboardingGuide HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    welcome: example
                    version: example
                    quickStart:
                      summary: example
                      steps:
                        - step: 1
                          name: example
                          description: Illustrative FarmDash API example.
                          action: example
                          endpoint: example
                          required: true
                    capabilities: {}
                    security: {}
                    autonomousWorkflow: {}
                    discovery: {}
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/onboard
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/virtuals-acp:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: virtualsAcpTenderAction
      summary: Customer-owned zero-custody ACP tender workflow
      description: |
        TollBooth commercial access/rate limits apply; a paid bearer key is optional.
        Every supported action requires sessionId, agentAddress and a valid session
        capability: sessionToken in the body or X-FarmDash-Session-Token header.
        A nonempty header takes precedence over the body token. Authentication requires
        an unexpired non-terminal session (active or paused), bound to the agent or a registered team member.
        A session token authenticates the tenant; it is not customer-wallet signing authority.

        The public capability remains preparation_only: API access payment does not
        enable execution. Selection grants none_selection_only authority and V2
        preparation returns a non-spendable none_draft_only draft. FarmDash cannot
        spend the customer ACP wallet. A customer-owned connector creates/funds jobs
        locally only after the exact fresh customer-wallet EIP-712 approval and all
        applicable runtime prerequisites. This contract is not live qualification.

        create_tender is the legacy V1 draft flow; it returns 503
        acp_v1_creation_disabled unless V1 creation is explicitly enabled. It requires
        an evaluator configuration, serializable task and a fresh authoritative
        simulation (428 simulation_not_found_or_expired otherwise).
        select_provider_plan_v2 and prepare_tender_v2 require the enabled V2 rollout
        cohort and ready migrations. Selection additionally requires the authoritative
        evaluator adapter, Base RPC, registry, stake/identity ingestion and identity
        salt. Preparation requires evaluator identity, an unexpired unconsumed
        tenant/session-bound selectionId, matching provider-plan commitments, and
        tenant-bound authoritative simulation evidence. Optional providers must match
        the selection exactly; they do not override it. V2 accepts a local task hash,
        not plaintext task or caller-supplied economic baselines.

        authorize_tender and authorize_tender_v2 require the exact locally signed
        fresh V1 or Base-domain V2 tender approval, respectively. V2 also requires
        unexpired analysis evidence, matching providerSelectionId, fresh independent
        provider readiness and every paid-workflow prerequisite; incomplete deployment
        readiness returns 503 acp_v2_paid_workflow_unready. Neither preparation nor
        commercial payment bypasses those gates or grants swap/futures execution.
        cancel_tender cancels only a non-spendable draft. get_tender reads owned state.
        bind_job requires an authorized tender and a verified live OPEN job matching
        client, role provider and evaluator. reserve_funding_v2 requires an authorized
        V2 tender and that exact job budget; authority remains customer_wallet_only.
        record_funding_submission_v2 records hashes for an owned V2 reservation;
        submitted is not funding confirmation or evaluation availability.
        evaluate_tender requires jobs_created or settling state and authoritative
        committed evidence; it may queue/process evaluator settlement, not customer
        wallet spending. Dependencies/state conflicts fail closed.

        Removed shared-wallet SDK actions (browse_agents, initiate_job, respond_to_job,
        pay_and_accept_requirement, deliver_job, get_job_by_id, get_active_jobs,
        get_completed_jobs, get_cancelled_jobs, get_memo_by_id) are not accepted tender
        variants. After valid session authentication they return 410
        acp_legacy_shared_wallet_operation_removed, never shared-wallet execution.
      tags:
        - Session
      security:
        - {}
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: X-FarmDash-Session-Token
          in: header
          required: false
          description: Required capability if sessionToken is omitted; a nonempty trimmed header overrides the body token. Not wallet authority.
          schema:
            type: string
            minLength: 32
            maxLength: 256
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualsAcpRequest'
            examples:
              default:
                summary: virtualsAcpTenderAction request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  action: create_tender
                  sessionId: session_example_001
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  params:
                    idempotencyKey: fd-example-idempotency-001
                    task: example
                    simulationId: sim_example_001
                    expectedOutputAmount: '1'
                    expectedGasUsdCents: '1'
                    expectedYieldUsdCents: '1'
                    maxPaymentUnits: '1'
                    providers:
                      solidity_auditor: '0x1111111111111111111111111111111111111111'
                      defi_economist: '0x1111111111111111111111111111111111111111'
                      sentiment_analyst: '0x1111111111111111111111111111111111111111'
                    approvalNonce: '1111111111'
                    approvalExpiresAt: '2026-10-30T12:00:00Z'
      responses:
        '200':
          description: Action-dependent result — selected plan, owned state, authorization, cancellation, funding reservation/submission, or evaluation. Submission alone is not funding confirmation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpResult'
              examples:
                success:
                  summary: virtualsAcpTenderAction HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    spend_authority: none_selection_only
                    funding_confirmed: false
                    evaluation_available: false
        '201':
          description: Non-spendable draft plus approval_typed_data (create/prepare) or verified job binding (bind_job); not permission to spend the customer wallet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpResult'
              examples:
                success:
                  summary: virtualsAcpTenderAction HTTP 201
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    spend_authority: none_selection_only
                    funding_confirmed: false
                    evaluation_available: false
        '202':
          description: evaluate_tender settlement processing in progress; not final settlement proof
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpResult'
              examples:
                success:
                  summary: virtualsAcpTenderAction HTTP 202
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    spend_authority: none_selection_only
                    funding_confirmed: false
                    evaluation_available: false
        '400':
          description: invalid_request (unknown action, missing fields or strict-schema violation), invalid_tender_task, provider-selection mismatch, or rejected approval nonce
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: invalid_request
                      message: invalid_request (unknown action, missing fields or strict-schema violation), invalid_tender_task, provider-selection mismatch, or rejected approval nonce
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: invalid_request
                    message: invalid_request (unknown action, missing fields or strict-schema violation), invalid_tender_task, provider-selection mismatch, or rejected approval nonce
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '401':
          description: Missing or invalid session capability
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 401
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: auth_error
                      message: Missing or invalid session capability
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: auth_error
                    message: Missing or invalid session capability
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Session access/owner denied, V2 rollout cohort denied, selection tenant/session mismatch or invalid exact wallet approval
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 403
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: forbidden
                      message: Session access/owner denied, V2 rollout cohort denied, selection tenant/session mismatch or invalid exact wallet approval
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: forbidden
                    message: Session access/owner denied, V2 rollout cohort denied, selection tenant/session mismatch or invalid exact wallet approval
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '404':
          description: Session, owned tender or provider selection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 404
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: not_found
                      message: Session, owned tender or provider selection not found
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: not_found
                    message: Session, owned tender or provider selection not found
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '409':
          description: Tender/version/state/selection conflict, job not OPEN, budget mismatch, authorization or cancellation conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: conflict
                      message: Tender/version/state/selection conflict, job not OPEN, budget mismatch, authorization or cancellation conflict
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: conflict
                    message: Tender/version/state/selection conflict, job not OPEN, budget mismatch, authorization or cancellation conflict
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '410':
          description: acp_legacy_shared_wallet_operation_removed — authenticated legacy SDK action is permanently removed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 410
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: expired
                      message: acp_legacy_shared_wallet_operation_removed — authenticated legacy SDK action is permanently removed
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: expired
                    message: acp_legacy_shared_wallet_operation_removed — authenticated legacy SDK action is permanently removed
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '422':
          description: Evidence/disclosure/provider or committed-state validation failure; acp_tender_operation_failed otherwise
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 422
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: validation_failed
                      message: Evidence/disclosure/provider or committed-state validation failure; acp_tender_operation_failed otherwise
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: validation_failed
                    message: Evidence/disclosure/provider or committed-state validation failure; acp_tender_operation_failed otherwise
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '428':
          description: Fresh authoritative simulation, unexpired V2 analysis evidence or independent provider readiness required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 428
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: precondition_required
                      message: Fresh authoritative simulation, unexpired V2 analysis evidence or independent provider readiness required
                      retryable: false
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: precondition_required
                    message: Fresh authoritative simulation, unexpired V2 analysis evidence or independent provider readiness required
                    retryable: false
                    request_id: 11111111-1111-4111-8111-111111111111
        '429':
          description: Paid caller TollBooth quota exceeded; abbreviated object-valued error with code and message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 429
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: rate_limited
                      message: Paid caller TollBooth quota exceeded; abbreviated object-valued error with code and message
                      retryable: true
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: rate_limited
                    message: Paid caller TollBooth quota exceeded; abbreviated object-valued error with code and message
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
        '500':
          description: acp_unreachable_action_state — unexpected dispatch state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 500
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: upstream_unavailable
                      message: acp_unreachable_action_state — unexpected dispatch state
                      retryable: true
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: upstream_unavailable
                    message: acp_unreachable_action_state — unexpected dispatch state
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
        '503':
          description: V1 creation disabled, V2 disabled/migrations/provider-selection/paid-workflow unready, evaluator unconfigured or dependency unavailable. No customer-wallet authority exercised.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VirtualsAcpError'
              examples:
                error:
                  summary: virtualsAcpTenderAction HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error:
                      code: upstream_unavailable
                      message: V1 creation disabled, V2 disabled/migrations/provider-selection/paid-workflow unready, evaluator unconfigured or dependency unavailable. No customer-wallet authority exercised.
                      retryable: true
                      request_id: 11111111-1111-4111-8111-111111111111
                      details: Illustrative FarmDash API example.
                    code: upstream_unavailable
                    message: V1 creation disabled, V2 disabled/migrations/provider-selection/paid-workflow unready, evaluator unconfigured or dependency unavailable. No customer-wallet authority exercised.
                    retryable: true
                    request_id: 11111111-1111-4111-8111-111111111111
  /v1/agent/authority:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getExecutionAuthority
      summary: Get current execution authority configuration and bounded delegation status
      description: |
        Returns the dual execution-authority state (USER_SIGNED vs BOUNDED_AUTONOMOUS),
        zero-custody confirmation, and active delegation status if configured.
      tags:
        - ExecutionAuthority
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: ownerAddress
          in: query
          required: false
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
        - name: sessionId
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Authority discovery or active grant summary
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - mode
                  - supportedModes
                  - autonomousAvailable
                  - executionRole
                  - signingAuthority
                  - zeroCustody
                properties:
                  ok:
                    type: boolean
                  mode:
                    type: string
                    enum:
                      - USER_SIGNED
                      - BOUNDED_AUTONOMOUS
                  supportedModes:
                    type: array
                    items:
                      type: string
                  autonomousAvailable:
                    type: boolean
                  executionRole:
                    type: string
                  signingAuthority:
                    type: string
                  zeroCustody:
                    type: boolean
                  grant:
                    type: object
                    nullable: true
                  nextAction:
                    type: string
              examples:
                success:
                  summary: getExecutionAuthority HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    mode: USER_SIGNED
                    supportedModes:
                      - example
                    autonomousAvailable: true
                    executionRole: example
                    signingAuthority: example
                    zeroCustody: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/authority
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: manageExecutionAuthority
      summary: Manage independent spot delegation and owner-signed futures policies
      description: |
        Dual execution authority management. Actions: get_authority, request_delegation,
        register_delegation, prepare_autonomous_swap, confirm_autonomous_swap, release_autonomous_reservation, revoke.
        Futures actions request/register a policy or inspect/revoke exact session grants. Session tokens never create authority; registration requires the owner signature. Futures BOUNDED_AUTONOMOUS remains preparation_only.
        Zero key custody: calling agent local signer retains wallet authority.
      tags:
        - ExecutionAuthority
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
              properties:
                action:
                  type: string
                  enum:
                    - get_authority
                    - status
                    - request_delegation
                    - register_delegation
                    - prepare_autonomous_swap
                    - confirm_autonomous_swap
                    - release_autonomous_reservation
                    - release_reservation
                    - revoke
                    - request_futures_policy
                    - register_futures_policy
                    - get_futures_authority
                    - revoke_futures_policy
                policy:
                  $ref: '#/components/schemas/FuturesPolicy'
                signature:
                  type: string
                  description: Owner EIP-712 signature for register_futures_policy
                sessionToken:
                  type: string
                  description: Alternatively use X-FarmDash-Session-Token header
                ownerAddress:
                  type: string
                sessionId:
                  type: string
                grantId:
                  type: string
            examples:
              default:
                summary: manageExecutionAuthority request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  action: get_authority
      responses:
        '200':
          description: Authority operation success
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                properties:
                  ok:
                    type: boolean
              examples:
                success:
                  summary: manageExecutionAuthority HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Policy violation or structured authority rejection
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  details:
                    type: object
              examples:
                error:
                  summary: manageExecutionAuthority HTTP 403
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    error: forbidden
                    code: forbidden
                    details: {}
  /v1/agent/session:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: findSession
      summary: Find active session for an agent
      tags:
        - Session
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: agentAddress
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
      responses:
        '200':
          description: Session lookup result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  session:
                    $ref: '#/components/schemas/AgentSession'
              examples:
                success:
                  summary: findSession HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    session:
                      status: active
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/session?agentAddress=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: manageSession
      summary: Create, resume, heartbeat, or close a session
      description: |
        Multiplexed endpoint. Set `action` to one of:
        `create`, `resume`, `heartbeat`, `close`.
        `create` returns a one-time `sessionToken`. All mutating follow-up
        actions require `sessionId`, owning `agentAddress`, and `sessionToken`
        in the JSON body or the `X-FarmDash-Session-Token` header.
        Pioneer+ required.
      tags:
        - Session
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
              properties:
                action:
                  type: string
                  enum:
                    - create
                    - resume
                    - heartbeat
                    - close
                agentAddress:
                  type: string
                  description: Required for `create`, `resume`, `heartbeat`, and `close`
                sessionId:
                  type: string
                  description: Required for `resume`, `heartbeat`, `close`
                sessionToken:
                  type: string
                  description: Required for `resume`, `heartbeat`, and `close`; returned only once by `create`
                agentMeta:
                  $ref: '#/components/schemas/AgentMeta'
            examples:
              default:
                summary: manageSession request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  action: create
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Session action result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  session:
                    $ref: '#/components/schemas/AgentSession'
                  sessionToken:
                    type: string
                    description: One-time session capability returned only when action is `create`
                  auth:
                    type: object
                    properties:
                      scheme:
                        type: string
                        enum:
                          - session_capability_v1
                      header:
                        type: string
                        enum:
                          - X-FarmDash-Session-Token
                      bodyField:
                        type: string
                        enum:
                          - sessionToken
                      note:
                        type: string
              examples:
                success:
                  summary: manageSession HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    session:
                      status: active
                    sessionToken: USDC
                    auth:
                      scheme: session_capability_v1
                      header: X-FarmDash-Session-Token
                      bodyField: sessionToken
        '401':
          description: Missing or invalid session capability token
          x-farmdash-response-example:
            status: 401
            description: Missing or invalid session capability token
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Session owner or token verification failed
          x-farmdash-response-example:
            status: 403
            description: Session owner or token verification failed
            body: null
            note: Documents status semantics without inventing a response payload.
  /v1/agent/delegation:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getDelegationStatus
      summary: Check delegation status
      tags:
        - Delegation
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: agentAddress
          in: query
          required: true
          schema:
            type: string
            pattern: ^0x[a-fA-F0-9]{40}$
      responses:
        '200':
          description: Delegation status
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DelegationResponse'
              examples:
                success:
                  summary: getDelegationStatus HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    delegation:
                      ownerAddress: '0x1111111111111111111111111111111111111111'
                      apiWalletAddress: '0x1111111111111111111111111111111111111111'
                      verified: true
                      verifiedAt: '2026-10-30T12:00:00Z'
                    message: Illustrative FarmDash API example.
                    warning: example
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/delegation?agentAddress=0x1111111111111111111111111111111111111111
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: verifyDelegation
      summary: Verify wallet delegation for bounded execution
      description: |
        The API wallet can trade but CANNOT withdraw — zero-custody preserved.
        When `sessionId` is supplied, `sessionToken` is required to attach the
        delegation to that session.
        Syndicate required.
      tags:
        - Delegation
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agentAddress
                - apiWalletAddress
                - ownerAddress
              properties:
                agentAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                apiWalletAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                ownerAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                sessionId:
                  type: string
                sessionToken:
                  type: string
                  description: Required when `sessionId` is supplied
            examples:
              default:
                summary: verifyDelegation request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  apiWalletAddress: '0x1111111111111111111111111111111111111111'
                  ownerAddress: '0x1111111111111111111111111111111111111111'
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Delegation verification result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DelegationResponse'
              examples:
                success:
                  summary: verifyDelegation HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    delegation:
                      ownerAddress: '0x1111111111111111111111111111111111111111'
                      apiWalletAddress: '0x1111111111111111111111111111111111111111'
                      verified: true
                      verifiedAt: '2026-10-30T12:00:00Z'
                    message: Illustrative FarmDash API example.
                    warning: example
        '402':
          $ref: '#/components/responses/PaymentRequired'
  /v1/agent/autopilot:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getRecommendedAutopilotConfig
      summary: Get recommended autopilot configuration
      tags:
        - Autopilot
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: equity
          in: query
          required: true
          schema:
            type: number
        - name: riskPreference
          in: query
          schema:
            type: string
            enum:
              - conservative
              - balanced
              - aggressive
            default: balanced
      responses:
        '200':
          description: Recommended config
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  recommendedConfig:
                    type: object
              examples:
                success:
                  summary: getRecommendedAutopilotConfig HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    recommendedConfig: {}
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/autopilot?equity=1
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: manageAutopilot
      summary: Configure, run cycle, pause, or resume autopilot
      description: |
        Multiplexed endpoint. Set `action` to one of:
        `configure`, `cycle`, `pause`, `resume_autopilot`.
        All POST actions require `sessionId`, owning `agentAddress`, and
        `sessionToken` in the JSON body or `X-FarmDash-Session-Token` header.
        Syndicate required for configure/cycle/pause/resume.
      tags:
        - Autopilot
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
                - sessionId
                - agentAddress
              properties:
                action:
                  type: string
                  enum:
                    - configure
                    - cycle
                    - pause
                    - resume_autopilot
                sessionId:
                  type: string
                agentAddress:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                sessionToken:
                  type: string
                  description: Session capability returned by `create`
                config:
                  $ref: '#/components/schemas/AutopilotConfig'
                accountState:
                  type: object
                  description: Required for `cycle` action
                  properties:
                    equity:
                      type: number
                    dailyPnlPct:
                      type: number
                    weeklyPnlPct:
                      type: number
                    drawdownPct:
                      type: number
                    openPositionCount:
                      type: integer
                    aggregateLeverage:
                      type: number
                    markPrices:
                      type: object
                      additionalProperties:
                        type: number
                    healthFactor:
                      type: number
                    liquidationBufferPct:
                      type: number
                    stablecoinDepegPct:
                      type: number
                    quoteDecayBps:
                      type: number
                    gasPerActionUsd:
                      type: number
                    rebalanceContext:
                      $ref: '#/components/schemas/RebalanceContext'
            examples:
              default:
                summary: manageAutopilot request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  action: configure
                  sessionId: session_example_001
                  agentAddress: '0x1111111111111111111111111111111111111111'
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Autopilot action result
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  session:
                    $ref: '#/components/schemas/AgentSession'
                  actions:
                    type: array
                    items:
                      $ref: '#/components/schemas/AutopilotAction'
                  riskStatus:
                    $ref: '#/components/schemas/AutopilotRiskStatus'
              examples:
                success:
                  summary: manageAutopilot HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    session:
                      status: active
                    actions:
                      - type: analyze
                        priority: high
                    riskStatus:
                      dailyPnlPct: 1
                      weeklyPnlPct: 1
                      drawdownPct: 1
                      openPositions: 1
                      aggregateLeverage: 1
                      healthFactor: 1
                      liquidationBufferPct: 1
                      stablecoinDepegPct: 1
        '401':
          description: Missing or invalid session capability token
          x-farmdash-response-example:
            status: 401
            description: Missing or invalid session capability token
            body: null
            note: Documents status semantics without inventing a response payload.
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Session owner or token verification failed
          x-farmdash-response-example:
            status: 403
            description: Session owner or token verification failed
            body: null
            note: Documents status semantics without inventing a response payload.
  /v1/agent/risk-sentinel:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getRiskSentinelInfo
      summary: Describe Risk Sentinel usage
      description: |
        Returns a lightweight usage guide for the standalone risk-analysis endpoint.
        Use POST to inspect allowance state, token/bridge/contract risks, depeg checks,
        health-factor alerts, quote decay, and positive-net-edge enforcement.
      tags:
        - Risk
      security:
        - bearerAuth: []
        - {}
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Usage guide
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  description:
                    type: string
                  usage:
                    type: string
              examples:
                success:
                  summary: getRiskSentinelInfo HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    description: Illustrative FarmDash API example.
                    usage: example
        '402':
          $ref: '#/components/responses/PaymentRequired'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/v1/agent/risk-sentinel
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
    post:
      operationId: analyzeRiskSentinel
      summary: Analyze a route or account with Risk Sentinel
      description: |
        Accepts either a full swap-shaped payload or manual health/net-edge inputs.
        When swap fields are present, FarmDash auto-selects a route, computes
        Execution Alpha diagnostics, and returns a full Risk Sentinel report.
      tags:
        - Risk
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RiskSentinelRequest'
            examples:
              default:
                summary: analyzeRiskSentinel request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  fromChainId: 1
                  toChainId: 1
                  protocol: lifi
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Risk analysis
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RiskSentinelResponse'
              examples:
                success:
                  summary: analyzeRiskSentinel HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    mode: manual
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
  /v1/agent/receipts/share:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: createReceiptShare
      summary: Mint a public proof-of-outcome share link for a receipt
      description: |
        Creates an unguessable, revocable bearer token (fdrsh_…) over a
        TERMINAL intent receipt (CONFIRMED, FAILED, or REJECTED — in-flight
        receipts are rejected with 409). Only the SHA-256 of the token is
        stored; the token is returned once and cannot be recovered. The served
        projection is sanitized (credential-shaped fields stripped recursively
        and every stripped path disclosed), digest-bound (SHA-256 full + public
        digests), outcome classified, and Ed25519-signed. Requires session
        ownership of the receipt's parent intent.
      tags:
        - Proof
      security:
        - bearerAuth: []
        - {}
      servers:
        - url: https://www.farmdash.one
          description: Production (public proof paths live at the site root)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - receipt_id
                - sessionId
                - agentAddress
                - sessionToken
              properties:
                receipt_id:
                  type: string
                  description: Receipt id starting with fdrcpt_
                sessionId:
                  type: string
                agentAddress:
                  type: string
                sessionToken:
                  type: string
            examples:
              default:
                summary: createReceiptShare request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  receipt_id: example_001
                  sessionId: session_example_001
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  sessionToken: USDC
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '201':
          description: Share created — token shown once, never recoverable
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - token
                  - url
                  - receipt_id
                  - warning
                properties:
                  ok:
                    type: boolean
                    const: true
                  token:
                    type: string
                    description: fdrsh_-prefixed bearer token; store it now
                  url:
                    type: string
                    format: uri
                  receipt_id:
                    type: string
                  created_at:
                    type: string
                    format: date-time
                  warning:
                    type: string
              examples:
                success:
                  summary: createReceiptShare HTTP 201
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    token: USDC
                    url: https://www.farmdash.one/
                    receipt_id: example_001
                    warning: example
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '404':
          description: Receipt not found
          x-farmdash-response-example:
            status: 404
            description: Receipt not found
            body: null
            note: Documents status semantics without inventing a response payload.
        '409':
          description: Receipt not terminal (still in flight)
          x-farmdash-response-example:
            status: 409
            description: Receipt not terminal (still in flight)
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
    delete:
      operationId: revokeReceiptShare
      summary: Revoke a receipt share link
      description: |
        Revokes the share (public URL returns 410 afterwards). Only the
        creating agent (or internal service key) can revoke. Pass the token
        as ?token= or in the body, AND the session credentials used at
        creation (sessionId, agentAddress, and sessionToken via body or the
        X-FarmDash-Session-Token header). Revocation propagates immediately —
        share responses are served with Cache-Control: no-store.
      tags:
        - Proof
      security:
        - bearerAuth: []
        - {}
      servers:
        - url: https://www.farmdash.one
          description: Production (public proof paths live at the site root)
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: token
          in: query
          required: true
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                token:
                  type: string
                sessionId:
                  type: string
                agentAddress:
                  type: string
                sessionToken:
                  type: string
            examples:
              default:
                summary: revokeReceiptShare request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  token: USDC
                  sessionId: session_example_001
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  sessionToken: USDC
      responses:
        '200':
          description: Share revoked
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    const: true
                  revoked:
                    type: boolean
                    const: true
              examples:
                success:
                  summary: revokeReceiptShare HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    revoked: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: Unknown share, already revoked, or not the creator
          x-farmdash-response-example:
            status: 403
            description: Unknown share, already revoked, or not the creator
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
  /r/{token}:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: resolveReceiptShare
      summary: Resolve a public receipt share (agent JSON or human page)
      description: |
        Public, keyless, TOLL-FREE proof-of-outcome endpoint. Returns the sanitized
        receipt, outcome classification with retry guidance, dual integrity
        digests, and the Ed25519 signature block containing the detached
        signature bytes and the exact signed envelope — verify independently
        against /.well-known/farmdash-receipt-key.json. Responds JSON by
        default and a retro no-JS HTML card when Accept includes text/html.
        Revoked shares return 410. Responses are no-store (revocation is
        immediate); a `valid:true` signature flag is a server self-check —
        third parties MUST verify the signature themselves.
        Verification reads are never payment-walled but share the caller's
        daily booth budget and 429 past it, so spam burns its own bucket.
        Share tokens are unguessable 256-bit bearer secrets with no listing
        endpoint, so enumeration is infeasible. Minting (POST
        /api/v1/agent/receipts/share) remains session- and toll-gated.
      tags:
        - Proof
      security:
        - {}
      servers:
        - url: https://www.farmdash.one
          description: Production (public proof paths live at the site root)
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
        - name: token
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Shared receipt payload (JSON) or card (HTML)
          x-farmdash-response-example:
            status: 200
            description: Shared receipt payload (JSON) or card (HTML)
            body: null
            note: Documents status semantics without inventing a response payload.
        '404':
          description: Unknown share token
          x-farmdash-response-example:
            status: 404
            description: Unknown share token
            body: null
            note: Documents status semantics without inventing a response payload.
        '405':
          description: Method not allowed (resolve is GET-only)
          x-farmdash-response-example:
            status: 405
            description: Method not allowed (resolve is GET-only)
            body: null
            note: Documents status semantics without inventing a response payload.
        '410':
          description: Share revoked by its creator
          x-farmdash-response-example:
            status: 410
            description: Share revoked by its creator
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/r/USDC
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /.well-known/farmdash-receipt-key.json:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    get:
      operationId: getReceiptProofKey
      summary: Public Ed25519 key for verifying shared-receipt signatures
      description: |
        Publishes the JWK verification key ring (current key plus any
        retained/retired keys by kid) with the exact third-party verification
        recipe (canonicalize the share JSON receipt object, compare
        public_digest, verify the envelope signature with the key whose kid
        matches integrity.signature.kid). Long-cacheable.
        Key type is validated at load time (Ed25519 only).
      tags:
        - Proof
      security:
        - {}
      servers:
        - url: https://www.farmdash.one
          description: Production (public proof paths live at the site root)
      parameters:
        - $ref: '#/components/parameters/X-ClawHub-Skill'
      responses:
        '200':
          description: Proof key document
          x-farmdash-response-example:
            status: 200
            description: Proof key document
            body: null
            note: Documents status semantics without inventing a response payload.
      x-farmdash-request-example:
        method: GET
        url: https://www.farmdash.one/api/.well-known/farmdash-receipt-key.json
        description: Concrete illustrative request; authentication, payment, and signature headers are omitted unless separately documented.
  /v1/agent/futures/reconcile-order:
    parameters:
      - $ref: '#/components/parameters/X-FarmDash-Installation-ID'
      - $ref: '#/components/parameters/X-FarmDash-Client'
      - $ref: '#/components/parameters/X-FarmDash-Client-Version'
      - $ref: '#/components/parameters/X-FarmDash-Skill-Version'
    post:
      operationId: reconcilePerpOrder
      summary: Reconcile one Hyperliquid order from authoritative venue evidence
      description: |
        Read-only and zero-custody: signs nothing, submits nothing, and never retries
        an order. Durable order/fill evidence uses the existing idempotent accounting
        path; balances are not execution evidence. agentAddress is the venue API-wallet
        signer, not the session agent. accountAddress identifies its delegated owner.
        Known bounded reservations are discovered by account, network, market and OID.
        Optional controlActionId selects one exact durable action for cancellation or
        unknown-submission recovery. Selection is not proof of OID linkage; unproven
        submissions remain unknown and liability stays held. For a batch cancellation,
        reconcile every signed target OID. A bounded reservation result is policy
        bookkeeping, not proof of a fill, final cancellation or recognized revenue.
      security:
        - bearerAuth: []
        - {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReconcileOrderRequest'
            examples:
              default:
                summary: reconcilePerpOrder request
                description: Illustrative schema-conformant request; replace identifiers, wallets, amounts, signatures, and timestamps with fresh values.
                value:
                  agentAddress: '0x1111111111111111111111111111111111111111'
                  coin: ETH
                  orderId: 1
      responses:
        '200':
          description: Authoritative venue evidence recorded durably; bounded context is present only when matching reservations exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileOrderResponse'
              examples:
                success:
                  summary: reconcilePerpOrder HTTP 200
                  description: Illustrative successful response generated from the published schema.
                  value:
                    ok: true
                    reconciliation:
                      accountOwner: '0x1111111111111111111111111111111111111111'
                      signerAddress: '0x1111111111111111111111111111111111111111'
                      perpDex: hyperliquid
                      coin: ETH
                      orderId: 1
                      intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      clientOrderId: example_001
                      side: buy
                      orderSize: 1
                      orderPrice: 1
                      venueStatus: hyperliquid
                      venueReportedFilledSize: 1
                      reconciliationState: submitted
                      filledSize: 1
                      filledNotional: 1
                      avgFillPrice: 1
                      venueFee: 1
                      venueFeeToken: hyperliquid
                      fillCount: 1
                      terminal: true
                      reason: Illustrative FarmDash API example.
                      fills:
                        - fillId: 1
                          fillHash: '0x1111111111111111111111111111111111111111'
                          side: buy
                          size: 1
                          price: 1
                          notional: 1
                          fee: 1
                          feeToken: USDC
                          sizeRaw: '1'
                          priceRaw: '1'
                          feeRaw: '1'
                          builderFeeRaw: '1'
                          filledAt: 1
                      state: submitted
                      evidence:
                        accountOwner: '0x1111111111111111111111111111111111111111'
                        signerAddress: '0x1111111111111111111111111111111111111111'
                        perpDex: hyperliquid
                        coin: ETH
                        orderId: 1
                        intentHash: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                        clientOrderId: example_001
                        side: buy
                        orderSize: 1
                        orderPrice: 1
                        venueStatus: hyperliquid
                        venueReportedFilledSize: 1
                        reconciliationState: submitted
                        filledSize: 1
                        filledNotional: 1
                        avgFillPrice: 1
                        venueFee: 1
                        venueFeeToken: hyperliquid
                        fillCount: 1
                        terminal: true
                        reason: Illustrative FarmDash API example.
                        fills:
                          - fillId: 1
                            fillHash: '0x1111111111111111111111111111111111111111'
                            side: buy
                            size: 1
                            price: 1
                            notional: 1
                            fee: 1
                            feeToken: USDC
                            sizeRaw: '1'
                            priceRaw: '1'
                            feeRaw: '1'
                            builderFeeRaw: '1'
                            filledAt: 1
                    builderFees:
                      state: exact
                      builderFeeTotal: '1'
                      fillCountWithBuilderFee: 1
                      feeToken: USDC
                      venueTotal: hyperliquid
                      nonBuilderVenueFee: hyperliquid
                      recipient: '0x1111111111111111111111111111111111111111'
                      signedTenthsBps: example
                      reason: Illustrative FarmDash API example.
                      fills:
                        - fillId: 1
                          fillHash: '0x1111111111111111111111111111111111111111'
                          observedBuilderFee: '1'
                          expectedBuilderFee: '1'
                          builderFeeToken: USDC
                          nonBuilderVenueFee: hyperliquid
                          state: exact
                          reason: Illustrative FarmDash API example.
                    durableEvidence:
                      recorded: true
                      note: Illustrative FarmDash API example.
                    evidenceSources:
                      orderStatus: hyperliquid_order_status
                      fills: hyperliquid_user_fills
                      methodology: direct_venue_evidence_only
                      balanceDeltasUsed: false
                    timestamp: 1
        '400':
          description: Invalid input or signer/account authority relationship
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileOrderError'
              examples:
                error:
                  summary: reconcilePerpOrder HTTP 400
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error: invalid_request
                    code: invalid_request
                    retryable: false
        '402':
          description: Commercial API capacity payment required; payment is not execution authority
          headers:
            PAYMENT-REQUIRED:
              description: Base64-encoded x402 v2 PaymentRequired. Illustrative only; parse the live header.
              schema:
                type: string
              example: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfV0sInBheW1lbnRSZXF1aXJlbWVudHMiOnsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfSwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly93d3cuZmFybWRhc2gub25lL2FwaS92MS9hZ2VudC9wcm90b2NvbHMiLCJkZXNjcmlwdGlvbiI6IklsbHVzdHJhdGl2ZSBGYXJtRGFzaCBBUEkgYWNjZXNzIn0sImZhcm1kYXNoIjp7ImV4YW1wbGVfb25seSI6dHJ1ZSwiZ3JhbnRzX3RyYW5zYWN0aW9uX2F1dGhvcml0eSI6ZmFsc2V9fQ==
            X-Payment-Required:
              description: Compatibility signal for x402.
              schema:
                type: string
                enum:
                  - 'true'
              example: 'true'
            X-Payment-Amount:
              description: Illustrative Base USDC base units; live 402 is authoritative.
              schema:
                type: string
              example: '10000'
            X-Payment-Chain-Id:
              description: Illustrative payment chain.
              schema:
                type: string
              example: '8453'
            X-Payment-Address:
              description: Illustrative destination; verify live 402.
              schema:
                type: string
              example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
            X-Payment-Token:
              description: Illustrative Base USDC address; verify live 402.
              schema:
                type: string
              example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentRequiredError'
              examples:
                x402_payment_required:
                  summary: Illustrative x402 payment challenge
                  description: Live 402 and PAYMENT-REQUIRED are authoritative. Payment grants API capacity only, never execution authority.
                  value:
                    ok: false
                    error: payment_required
                    code: free_quota_exhausted
                    message: Illustrative x402 challenge; live 402 is authoritative for route-specific price and policy.
                    instruction: STOP_RETRYING
                    retry_same_request: false
                    next_action: Wait for quota reset, upgrade, or attach valid x402 payment evidence and retry once.
                    quota:
                      tier: scout
                      remaining: 0
                      reset_at: '2026-10-30T12:00:00Z'
                    retryable: false
                    payment_required:
                      amount: 0.01 USDC
                      chain: Base
                      destination: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
                      token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                      chainId: '8453'
        '409':
          description: controlActionId does not identify one unique durable action for this account, network and market; no liability released
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileOrderError'
              examples:
                error:
                  summary: reconcilePerpOrder HTTP 409
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error: conflict
                    code: conflict
                    retryable: false
        '413':
          description: Request body exceeds 1 MB
          x-farmdash-response-example:
            status: 413
            description: Request body exceeds 1 MB
            body: null
            note: Documents status semantics without inventing a response payload.
        '429':
          description: API rate limit exceeded
          x-farmdash-response-example:
            status: 429
            description: API rate limit exceeded
            body: null
            note: Documents status semantics without inventing a response payload.
        '502':
          description: Reconciliation unavailable; no execution or liability release inferred
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileOrderError'
              examples:
                error:
                  summary: reconcilePerpOrder HTTP 502
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error: upstream_unavailable
                    code: upstream_unavailable
                    retryable: true
        '503':
          description: Venue evidence or durable reconciliation unavailable; inspect durableEvidence before claiming persistence, and never resubmit automatically
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconcileOrderError'
              examples:
                error:
                  summary: reconcilePerpOrder HTTP 503
                  description: Illustrative structured error; live code/retryability/request ID are authoritative.
                  value:
                    ok: false
                    error: upstream_unavailable
                    code: upstream_unavailable
                    retryable: true
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Pioneer or Syndicate API key
  parameters:
    X-FarmDash-Installation-ID:
      name: X-FarmDash-Installation-ID
      in: header
      required: false
      description: Optional analytics-only locally generated UUIDv4 installation hint. Stored only as a domain-separated salted hash. Not authentication, principal proof, quota, payment, wallet ownership, delegation or transaction authority. Omission changes no functionality.
      schema:
        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}$
    X-FarmDash-Client:
      name: X-FarmDash-Client
      in: header
      required: false
      description: Optional untrusted analytics client hint; never security evidence.
      schema:
        type: string
        enum:
          - mcp
          - ts_agent_kit
          - python_agent_kit
          - public_client
          - webapp
    X-FarmDash-Client-Version:
      name: X-FarmDash-Client-Version
      in: header
      required: false
      description: Optional analytics client version; never security evidence.
      schema:
        type: string
        maxLength: 64
        pattern: ^[A-Za-z0-9._+-]{1,64}$
    X-FarmDash-Skill-Version:
      name: X-FarmDash-Skill-Version
      in: header
      required: false
      description: Optional event-touch analytics skill version, alongside X-ClawHub-Skill; never security evidence.
      schema:
        type: string
        maxLength: 64
        pattern: ^[A-Za-z0-9._+-]{1,64}$
    FromChainId:
      name: fromChainId
      in: query
      required: true
      schema:
        type: integer
        enum:
          - 1
          - 10
          - 137
          - 8453
          - 42161
          - 59144
      description: 'Source chain: 1=Ethereum, 10=Optimism, 137=Polygon, 8453=Base, 42161=Arbitrum, 59144=Linea'
    ToChainId:
      name: toChainId
      in: query
      required: true
      schema:
        type: integer
        enum:
          - 1
          - 10
          - 137
          - 8453
          - 42161
          - 59144
      description: Destination chain ID
    FromToken:
      name: fromToken
      in: query
      required: true
      schema:
        type: string
        pattern: ^0x[a-fA-F0-9]{40}$
      description: Source token contract address
    ToToken:
      name: toToken
      in: query
      required: true
      schema:
        type: string
        pattern: ^0x[a-fA-F0-9]{40}$
      description: Destination token contract address
    FromAmount:
      name: fromAmount
      in: query
      required: true
      schema:
        type: string
        pattern: ^\d+$
      description: Amount in wei (no leading zeros)
    X-ClawHub-Skill:
      name: X-ClawHub-Skill
      in: header
      required: false
      schema:
        type: string
        pattern: ^[a-zA-Z0-9-]{1,128}$
        example: farmdash-signal-architect
      description: 'ClawHub skill attribution. An installed FarmDash skill sends its canonical skill slug (e.g. farmdash-signal-architect) on every FarmDash API request so anonymous Scout usage can be attributed to the skill that drove it. Optional and analytics-only: absence never blocks a request, and malformed values are ignored. This is a skill identity, never a wallet address, API key, or user ID.'
  headers:
    X-RateLimit-Limit:
      description: Maximum requests allowed in the current window
      schema:
        type: string
    X-RateLimit-Remaining:
      description: Remaining requests in the current window
      schema:
        type: string
    X-RateLimit-Reset:
      description: UTC epoch seconds when the rate limit window resets
      schema:
        type: string
    X-Request-ID:
      description: Unique request trace ID for debugging and support
      schema:
        type: string
        format: uuid
    X-Scout-Bonus-Remaining:
      description: Remaining overflow-only free reads for public reputation/leaderboard after the shared Scout budget is spent. Present only on bonus-served 200s from those two endpoints.
      schema:
        type: string
  responses:
    BadRequest:
      description: Invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: getAgentStatus HTTP 405
              description: Illustrative structured error; live code/retryability/request ID are authoritative.
              value:
                error: request_failed
                ok: false
                code: request_failed
                message: Invalid parameters
                retryable: false
                request_id: 11111111-1111-4111-8111-111111111111
                details:
                  ok: false
                  error: request_failed
    PaymentRequired:
      description: Free-tier limit exceeded — x402 payment required
      headers:
        X-Payment-Required:
          schema:
            type: string
          description: Compatibility signal for x402.
          example: 'true'
        X-Payment-Address:
          schema:
            type: string
          description: Treasury wallet (USDC on Base)
          example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
        X-Payment-Token:
          schema:
            type: string
          description: USDC contract on Base
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
        X-Payment-Amount:
          schema:
            type: string
          description: Amount in token decimals (10000 = 0.01 USDC)
          example: '10000'
        X-Payment-Chain-Id:
          schema:
            type: string
          description: 8453 (Base)
          example: '8453'
        PAYMENT-REQUIRED:
          description: Base64-encoded x402 v2 PaymentRequired. Illustrative only; parse the live header.
          schema:
            type: string
          example: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6W3sic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfV0sInBheW1lbnRSZXF1aXJlbWVudHMiOnsic2NoZW1lIjoiZXhhY3QiLCJuZXR3b3JrIjoiZWlwMTU1Ojg0NTMiLCJhbW91bnQiOiIxMDAwMCIsImFzc2V0IjoiMHg4MzM1ODlmQ0Q2ZURiNkUwOGY0YzdDMzJENGY3MWI1NGJkQTAyOTEzIiwicGF5VG8iOiIweGIwRWQwZDdiY2EyNEJCYUQ2MzVCOTc3QzJlZmJFMDY3NDJlMzMzNzciLCJtYXhUaW1lb3V0U2Vjb25kcyI6MzAwfSwicmVzb3VyY2UiOnsidXJsIjoiaHR0cHM6Ly93d3cuZmFybWRhc2gub25lL2FwaS92MS9hZ2VudC9wcm90b2NvbHMiLCJkZXNjcmlwdGlvbiI6IklsbHVzdHJhdGl2ZSBGYXJtRGFzaCBBUEkgYWNjZXNzIn0sImZhcm1kYXNoIjp7ImV4YW1wbGVfb25seSI6dHJ1ZSwiZ3JhbnRzX3RyYW5zYWN0aW9uX2F1dGhvcml0eSI6ZmFsc2V9fQ==
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PaymentRequiredError'
          examples:
            x402_payment_required:
              summary: Illustrative x402 payment challenge
              description: Live 402 and PAYMENT-REQUIRED are authoritative. Payment grants API capacity only, never execution authority.
              value:
                ok: false
                error: payment_required
                code: free_quota_exhausted
                message: Illustrative x402 challenge; live 402 is authoritative for route-specific price and policy.
                instruction: STOP_RETRYING
                retry_same_request: false
                next_action: Wait for quota reset, upgrade, or attach valid x402 payment evidence and retry once.
                quota:
                  tier: scout
                  remaining: 0
                  reset_at: '2026-10-30T12:00:00Z'
                retryable: false
                payment_required:
                  amount: 0.01 USDC
                  chain: Base
                  destination: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
                  token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                  chainId: '8453'
    RateLimitExceeded:
      description: Rate limit exceeded
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until rate limit resets
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: getSwapQuote HTTP 429
              description: Illustrative structured error; live code/retryability/request ID are authoritative.
              value:
                error: rate_limited
                ok: false
                code: rate_limited
                message: Rate limit exceeded
                retryable: true
                request_id: 11111111-1111-4111-8111-111111111111
                details:
                  ok: false
                  error: request_failed
    NoRoute:
      description: Syntactically valid request but no executable route (no liquidity, unsupported pair, allowance/balance preconditions). Code quote_no_route, retryable false — retrying identical params will not help.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ProviderTimeout:
      description: Live quote provider timed out (bounded 15s upstream call). Code quote_provider_timeout, retryable true — back off and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: getSwapQuote HTTP 504
              description: Illustrative structured error; live code/retryability/request ID are authoritative.
              value:
                error: upstream_unavailable
                ok: false
                code: upstream_unavailable
                message: Live quote provider timed out (bounded 15s upstream call). Code quote_provider_timeout, retryable true — back off and retry.
                retryable: true
                request_id: 11111111-1111-4111-8111-111111111111
                details:
                  ok: false
                  error: request_failed
  schemas:
    SolanaSwapPrepareRequest:
      type: object
      additionalProperties: false
      required:
        - wallet
        - inputMint
        - outputMint
        - amount
      properties:
        wallet:
          type: string
          pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
        inputMint:
          type: string
          pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
        outputMint:
          type: string
          pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
        amount:
          type: string
          pattern: ^[1-9][0-9]*$
        continuationId:
          type: string
          format: uuid
          description: Optional context correlation only; does not create or change wallet authority.
        slippageBps:
          type: integer
          minimum: 1
          maximum: 500
        minAmountOut:
          type: string
          pattern: ^[1-9][0-9]*$
        idempotencyKey:
          type: string
          minLength: 1
          maxLength: 128
        executionTrialProof:
          $ref: '#/components/schemas/ExecutionTrialProof'
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
        sessionId:
          type: string
        grantId:
          type: string
        sessionToken:
          type: string
        signerPubkey:
          type: string
          pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$
    SolanaSwapPrepareResponse:
      type: object
      properties:
        continuation:
          $ref: '#/components/schemas/ExecutionContinuation'
        next_operation:
          $ref: '#/components/schemas/ExecutionContinuationNextOperation'
        ok:
          type: boolean
        status:
          type: string
          enum:
            - READY_FOR_USER_SIGNATURE
        preparationId:
          type: string
        transactionDigest:
          type: string
        wallet:
          type: string
        inputMint:
          type: string
        outputMint:
          type: string
        inAmount:
          type: string
        outAmount:
          type: string
        serializedTransactionBase64:
          type: string
        unsigned:
          type: boolean
          enum:
            - true
        serverSigned:
          type: boolean
          enum:
            - false
        requiresUserSignature:
          type: boolean
          enum:
            - true
        broadcastByFarmdash:
          type: boolean
          enum:
            - false
    ExecutionContinuationSelectionRequest:
      type: object
      additionalProperties: false
      required:
        - continuationId
      properties:
        continuationId:
          type: string
          format: uuid
    ExecutionContinuationSelection:
      type: object
      additionalProperties: false
      required:
        - ok
        - continuation
        - next_operation
        - correlation
      properties:
        ok:
          type: boolean
          enum:
            - true
        continuation:
          $ref: '#/components/schemas/ExecutionContinuation'
        next_operation:
          $ref: '#/components/schemas/ExecutionContinuationNextOperation'
        correlation:
          $ref: '#/components/schemas/ExecutionContinuationCorrelation'
    ExecutionContinuation:
      type: object
      additionalProperties: false
      required:
        - schema
        - continuation_id
        - source
        - execution_domain
        - network
        - protocol_id
        - assets
        - action_kind
        - lifecycle_id
        - trail_id
        - next_operation
        - available_execution_modes
        - authority
        - prerequisites
        - scout_trial
        - expires_at
      properties:
        schema:
          type: string
          const: farmdash.execution-continuation.v1
        continuation_id:
          type: string
          format: uuid
        source:
          type: object
          additionalProperties: false
          required:
            - type
            - ref
          properties:
            type:
              type: string
              enum:
                - market_estimate
                - solana_preview
                - futures_analysis
            ref:
              type: string
              maxLength: 128
        execution_domain:
          type: string
          enum:
            - spot
            - solana
            - futures
        network:
          type: string
        protocol_id:
          type:
            - string
            - 'null'
        assets:
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - namespace
              - network
              - identifier
              - kind
            properties:
              namespace:
                type: string
                enum:
                  - eip155
                  - solana
                  - hyperliquid
              network:
                type: string
              identifier:
                type: string
              symbol:
                type: string
              kind:
                type: string
                enum:
                  - native
                  - wrapped_native
                  - token
                  - market
              decimals:
                type: integer
                minimum: 0
                maximum: 36
        action_kind:
          type: string
          enum:
            - swap
            - prepare_order
        lifecycle_id:
          type: string
          format: uuid
        trail_id:
          type:
            - string
            - 'null'
        next_operation:
          $ref: '#/components/schemas/ExecutionContinuationNextOperation'
        available_execution_modes:
          type: array
          items:
            type: string
            enum:
              - USER_SIGNED
              - BOUNDED_AUTONOMOUS
        authority:
          type: string
          const: NOT_GRANTED
        prerequisites:
          type: array
          items:
            type: string
        scout_trial:
          type: object
          additionalProperties: false
          required:
            - exists
            - domain
            - daily_limit
            - remaining
            - status
            - after_exhaustion
          properties:
            exists:
              type: boolean
              const: true
            domain:
              type: string
              enum:
                - spot
                - futures
            daily_limit:
              type: integer
              minimum: 0
              maximum: 1000000
            remaining:
              type: 'null'
            status:
              type: string
              enum:
                - unknown
                - evaluation_required
            after_exhaustion:
              type: string
              const: authoritative_admission
        expires_at:
          type: string
          format: date-time
    ExecutionContinuationNextOperation:
      type: object
      additionalProperties: false
      required:
        - method
        - endpoint
        - parameters
        - required_fields
      properties:
        method:
          type: string
          const: POST
        endpoint:
          type: string
          enum:
            - /api/v1/agent/quote-intent
            - /api/agents/solana-swap
            - /api/agents/futures/prepare-order
            - /api/v1/agent/futures/prepare-order
        parameters:
          type: object
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
        required_fields:
          type: array
          items:
            type: string
    ExecutionContinuationCorrelation:
      type: object
      additionalProperties: false
      required:
        - continuation_id
        - source_type
        - source_ref
        - lifecycle_id
        - trail_id
        - execution_domain
      properties:
        continuation_id:
          type: string
          format: uuid
        source_type:
          type: string
          enum:
            - market_estimate
            - solana_preview
            - futures_analysis
        source_ref:
          type: string
        lifecycle_id:
          type: string
          format: uuid
        trail_id:
          type:
            - string
            - 'null'
        execution_domain:
          type: string
          enum:
            - spot
            - solana
            - futures
    VirtualsAcpSessionId:
      type: string
      minLength: 1
      maxLength: 200
    VirtualsAcpAddress:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
    VirtualsAcpSessionToken:
      type: string
      minLength: 32
      maxLength: 256
      description: Valid session capability; alternatively use X-FarmDash-Session-Token header. Required for tenant authentication, not wallet authority.
    VirtualsAcpTenderId:
      type: string
      pattern: ^fdat_[A-Za-z0-9_-]{8,59}$
    VirtualsAcpNonce:
      type: string
      pattern: ^\d{10,20}$
      description: Fresh millisecond timestamp; approval verification also enforces freshness, expiry and atomic nonce consumption
    VirtualsAcpApprovalSignature:
      type: string
      maxLength: 16386
      pattern: ^0x[0-9a-fA-F]+$
      description: Locally signed exact customer-wallet EIP-712 approval returned by draft preparation
    VirtualsAcpUint256:
      type: string
      pattern: ^\d{1,78}$
      x-maximum-decimal: '115792089237316195423570985008687907853269984665640564039457584007913129639935'
      description: Nonnegative decimal integer string; runtime additionally rejects values above uint256 maximum (2^256 - 1). The x-maximum-decimal extension records that application-level bound, not a JSON Schema numeric maximum on a string.
    VirtualsAcpPositiveUint256:
      type: string
      pattern: ^\d{1,78}$
      x-exclusive-minimum-decimal: '0'
      x-maximum-decimal: '115792089237316195423570985008687907853269984665640564039457584007913129639935'
      description: Positive decimal integer string; runtime additionally enforces 0 < value <= 2^256 - 1. Extensions record application-level numeric bounds on strings. Funding amounts are raw Base USDC units (6 decimals).
    VirtualsAcpPostgresBigint:
      type: string
      pattern: ^\d{1,78}$
      x-maximum-decimal: '9223372036854775807'
      description: Nonnegative decimal integer string; runtime additionally rejects values above PostgreSQL bigint maximum 9223372036854775807. Extension records the application-level bound.
    VirtualsAcpProviderSet:
      type: object
      additionalProperties: false
      required:
        - solidity_auditor
        - defi_economist
        - sentiment_analyst
      description: Three EVM specialist addresses; runtime requires distinct addresses after lowercase normalization
      properties:
        solidity_auditor:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        defi_economist:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sentiment_analyst:
          $ref: '#/components/schemas/VirtualsAcpAddress'
    VirtualsAcpDisclosureManifest:
      type: object
      additionalProperties: false
      required:
        - schemaVersion
        - categories
        - secretScan
      description: When secretScan is overridden, overrideReasonHash is required; when passed, overrideReasonHash must be absent. Categories are deduplicated/sorted and recipients are server-derived from the selected providers, never caller-controlled.
      properties:
        schemaVersion:
          type: string
          const: farmdash-acp-disclosure/v1
        categories:
          type: array
          minItems: 1
          maxItems: 16
          items:
            type: string
            enum:
              - transaction_intent
              - token_addresses
              - wallet_address
              - amounts
              - calldata
              - strategy_context
              - proprietary_context
              - personal_data
              - credentials_override
        secretScan:
          type: string
          enum:
            - passed
            - overridden
        overrideReasonHash:
          type: string
          pattern: ^[a-f0-9]{64}$
      allOf:
        - if:
            properties:
              secretScan:
                const: overridden
          then:
            required:
              - overrideReasonHash
          else:
            not:
              required:
                - overrideReasonHash
    VirtualsAcpCreateTenderParams:
      type: object
      additionalProperties: false
      required:
        - idempotencyKey
        - task
        - simulationId
        - expectedOutputAmount
        - expectedGasUsdCents
        - expectedYieldUsdCents
        - maxPaymentUnits
        - providers
        - approvalNonce
        - approvalExpiresAt
      properties:
        idempotencyKey:
          type: string
          minLength: 16
          maxLength: 200
        task:
          description: JSON-serializable value whose JSON encoding length is greater than 1 and at most 16,384 characters; omitted task is rejected by canSerializeTask. FarmDash retains only its commitment hash; plaintext stays with the connector.
        simulationId:
          type: string
          minLength: 1
          maxLength: 200
        expectedOutputAmount:
          type: string
          pattern: ^\d+(?:\.\d+)?$
          description: Positive decimal string; runtime additionally requires numeric value greater than zero
          x-exclusive-minimum-decimal: '0'
        expectedGasUsdCents:
          $ref: '#/components/schemas/VirtualsAcpPostgresBigint'
        expectedYieldUsdCents:
          $ref: '#/components/schemas/VirtualsAcpPostgresBigint'
        maxPaymentUnits:
          $ref: '#/components/schemas/VirtualsAcpUint256'
        providers:
          $ref: '#/components/schemas/VirtualsAcpProviderSet'
        approvalNonce:
          $ref: '#/components/schemas/VirtualsAcpNonce'
        approvalExpiresAt:
          type: string
          format: date-time
          description: UTC datetime ending in Z; offsets are rejected by the runtime validator
    VirtualsAcpSelectProviderPlanV2Params:
      type: object
      additionalProperties: false
      properties:
        idempotencyKey:
          type: string
          minLength: 16
          maxLength: 200
          description: Accepted optional input; selection handler does not consume it
    VirtualsAcpPrepareTenderV2Params:
      type: object
      additionalProperties: false
      required:
        - idempotencyKey
        - selectionId
        - taskCommitmentHash
        - simulationId
        - maxPaymentUnits
        - disclosureManifest
        - approvalNonce
        - approvalExpiresAt
      properties:
        idempotencyKey:
          type: string
          minLength: 16
          maxLength: 200
        selectionId:
          type: string
          format: uuid
        taskCommitmentHash:
          type: string
          pattern: ^[a-f0-9]{64}$
        simulationId:
          type: string
          minLength: 1
          maxLength: 200
        maxPaymentUnits:
          $ref: '#/components/schemas/VirtualsAcpPositiveUint256'
        providers:
          $ref: '#/components/schemas/VirtualsAcpProviderSet'
          description: Optional compatibility assertion; must exactly match the server selection, not override it
        disclosureManifest:
          $ref: '#/components/schemas/VirtualsAcpDisclosureManifest'
        approvalNonce:
          $ref: '#/components/schemas/VirtualsAcpNonce'
        approvalExpiresAt:
          type: string
          format: date-time
          description: UTC datetime ending in Z; offsets are rejected by the runtime validator
    VirtualsAcpAuthorizeTenderParams:
      type: object
      additionalProperties: false
      required:
        - tenderId
        - nonce
        - expiresAt
        - signature
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
        nonce:
          $ref: '#/components/schemas/VirtualsAcpNonce'
        expiresAt:
          type: string
          format: date-time
          description: UTC datetime ending in Z; offsets are rejected by the runtime validator
        signature:
          $ref: '#/components/schemas/VirtualsAcpApprovalSignature'
    VirtualsAcpAuthorizeTenderV2Params:
      type: object
      additionalProperties: false
      required:
        - tenderId
        - providerSelectionId
        - nonce
        - expiresAt
        - signature
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
        providerSelectionId:
          type: string
          format: uuid
        nonce:
          $ref: '#/components/schemas/VirtualsAcpNonce'
        expiresAt:
          type: string
          format: date-time
          description: UTC datetime ending in Z; offsets are rejected by the runtime validator
        signature:
          $ref: '#/components/schemas/VirtualsAcpApprovalSignature'
    VirtualsAcpTenderSelector:
      type: object
      additionalProperties: false
      required:
        - tenderId
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
    VirtualsAcpBindJobParams:
      type: object
      additionalProperties: false
      required:
        - tenderId
        - role
        - onchainJobId
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
        role:
          type: string
          enum:
            - solidity_auditor
            - defi_economist
            - sentiment_analyst
        onchainJobId:
          $ref: '#/components/schemas/VirtualsAcpPositiveUint256'
    VirtualsAcpReserveFundingV2Params:
      type: object
      additionalProperties: false
      required:
        - tenderId
        - role
        - onchainJobId
        - amountUnits
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
        role:
          type: string
          enum:
            - solidity_auditor
            - defi_economist
            - sentiment_analyst
        onchainJobId:
          $ref: '#/components/schemas/VirtualsAcpPositiveUint256'
        amountUnits:
          $ref: '#/components/schemas/VirtualsAcpPositiveUint256'
    VirtualsAcpRecordFundingSubmissionV2Params:
      type: object
      additionalProperties: false
      required:
        - tenderId
        - reservationId
        - transactionHashes
      properties:
        tenderId:
          $ref: '#/components/schemas/VirtualsAcpTenderId'
        reservationId:
          type: string
          format: uuid
        transactionHashes:
          type: array
          minItems: 1
          maxItems: 4
          items:
            type: string
            pattern: ^0x[a-fA-F0-9]{64}$
    VirtualsAcpCreateTenderRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: create_tender
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpCreateTenderParams'
    VirtualsAcpSelectProviderPlanV2Request:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: select_provider_plan_v2
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpSelectProviderPlanV2Params'
    VirtualsAcpPrepareTenderV2Request:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: prepare_tender_v2
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpPrepareTenderV2Params'
    VirtualsAcpAuthorizeTenderRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: authorize_tender
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpAuthorizeTenderParams'
    VirtualsAcpAuthorizeTenderV2Request:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: authorize_tender_v2
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpAuthorizeTenderV2Params'
    VirtualsAcpCancelTenderRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: cancel_tender
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpTenderSelector'
    VirtualsAcpBindJobRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: bind_job
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpBindJobParams'
    VirtualsAcpReserveFundingV2Request:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: reserve_funding_v2
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpReserveFundingV2Params'
    VirtualsAcpRecordFundingSubmissionV2Request:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: record_funding_submission_v2
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpRecordFundingSubmissionV2Params'
    VirtualsAcpEvaluateTenderRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: evaluate_tender
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpTenderSelector'
    VirtualsAcpGetTenderRequest:
      type: object
      additionalProperties: false
      required:
        - action
        - sessionId
        - agentAddress
        - params
      properties:
        action:
          type: string
          const: get_tender
        sessionId:
          $ref: '#/components/schemas/VirtualsAcpSessionId'
        agentAddress:
          $ref: '#/components/schemas/VirtualsAcpAddress'
        sessionToken:
          $ref: '#/components/schemas/VirtualsAcpSessionToken'
        params:
          $ref: '#/components/schemas/VirtualsAcpTenderSelector'
    VirtualsAcpRequest:
      discriminator:
        propertyName: action
        mapping:
          create_tender: '#/components/schemas/VirtualsAcpCreateTenderRequest'
          select_provider_plan_v2: '#/components/schemas/VirtualsAcpSelectProviderPlanV2Request'
          prepare_tender_v2: '#/components/schemas/VirtualsAcpPrepareTenderV2Request'
          authorize_tender: '#/components/schemas/VirtualsAcpAuthorizeTenderRequest'
          authorize_tender_v2: '#/components/schemas/VirtualsAcpAuthorizeTenderV2Request'
          cancel_tender: '#/components/schemas/VirtualsAcpCancelTenderRequest'
          bind_job: '#/components/schemas/VirtualsAcpBindJobRequest'
          reserve_funding_v2: '#/components/schemas/VirtualsAcpReserveFundingV2Request'
          record_funding_submission_v2: '#/components/schemas/VirtualsAcpRecordFundingSubmissionV2Request'
          evaluate_tender: '#/components/schemas/VirtualsAcpEvaluateTenderRequest'
          get_tender: '#/components/schemas/VirtualsAcpGetTenderRequest'
      oneOf:
        - $ref: '#/components/schemas/VirtualsAcpCreateTenderRequest'
        - $ref: '#/components/schemas/VirtualsAcpSelectProviderPlanV2Request'
        - $ref: '#/components/schemas/VirtualsAcpPrepareTenderV2Request'
        - $ref: '#/components/schemas/VirtualsAcpAuthorizeTenderRequest'
        - $ref: '#/components/schemas/VirtualsAcpAuthorizeTenderV2Request'
        - $ref: '#/components/schemas/VirtualsAcpCancelTenderRequest'
        - $ref: '#/components/schemas/VirtualsAcpBindJobRequest'
        - $ref: '#/components/schemas/VirtualsAcpReserveFundingV2Request'
        - $ref: '#/components/schemas/VirtualsAcpRecordFundingSubmissionV2Request'
        - $ref: '#/components/schemas/VirtualsAcpEvaluateTenderRequest'
        - $ref: '#/components/schemas/VirtualsAcpGetTenderRequest'
    VirtualsAcpResult:
      type: object
      required:
        - ok
      additionalProperties: true
      description: Open action-dependent success envelope, not a request schema. Fields vary by action; an ok response is not customer-wallet spend authority, execution proof or final settlement proof.
      properties:
        ok:
          type: boolean
          const: true
        tender:
          type: object
          additionalProperties: true
          description: Owned public tender commitment/state when returned
        spend_authority:
          type: string
          enum:
            - none_selection_only
            - none_draft_only
            - customer_wallet_only
        funding_confirmed:
          type: boolean
          const: false
          description: record_funding_submission_v2 only; submission does not confirm funding
        evaluation_available:
          type: boolean
          const: false
          description: record_funding_submission_v2 only; await authoritative confirmation
    VirtualsAcpError:
      type: object
      required:
        - ok
        - error
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            status:
              type: integer
            retryable:
              type: boolean
            request_id:
              type: string
            details:
              description: Optional validation or runtime prerequisite details
        code:
          type: string
        message:
          type: string
        retryable:
          type: boolean
        request_id:
          type: string
    ReconcileOrderRequest:
      type: object
      additionalProperties: false
      required:
        - agentAddress
        - coin
        - orderId
      properties:
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Venue API-wallet signer; never replaced by the session agent
        accountAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Delegated equity owner; defaults to agentAddress
        coin:
          type: string
          pattern: ^[a-zA-Z0-9]{1,16}$
          description: Default Hyperliquid perp market symbol, normalized uppercase
        orderId:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        intentHash:
          type: string
          nullable: true
          pattern: ^[a-f0-9]{64}$
          description: Optional submission provenance selector; caller hash alone is not evidence
        controlActionId:
          type: string
          format: uuid
          pattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
          description: Optional exact durable bounded control action selector, not authority or proof of OID linkage
    FuturesReconciliationState:
      type: string
      enum:
        - submitted
        - resting
        - partially_filled
        - fully_filled
        - canceled
        - venue_canceled
        - rejected
        - unknown
        - ambiguous
    FuturesReconciledFill:
      type: object
      required:
        - fillId
        - fillHash
        - side
        - size
        - price
        - notional
        - fee
        - feeToken
        - sizeRaw
        - priceRaw
        - feeRaw
        - builderFeeRaw
        - filledAt
      properties:
        fillId:
          type: integer
        fillHash:
          type: string
        side:
          type: string
          enum:
            - buy
            - sell
        size:
          type: number
        price:
          type: number
        notional:
          type: number
        fee:
          type: number
        feeToken:
          type: string
        sizeRaw:
          type: string
          nullable: true
        priceRaw:
          type: string
          nullable: true
        feeRaw:
          type: string
          nullable: true
        builderFeeRaw:
          type: string
          nullable: true
        filledAt:
          type: integer
          description: Unix milliseconds
    FuturesOrderReconciliationEvidence:
      type: object
      required:
        - accountOwner
        - signerAddress
        - perpDex
        - coin
        - orderId
        - intentHash
        - clientOrderId
        - side
        - orderSize
        - orderPrice
        - venueStatus
        - venueReportedFilledSize
        - reconciliationState
        - filledSize
        - filledNotional
        - avgFillPrice
        - venueFee
        - venueFeeToken
        - fillCount
        - terminal
        - reason
        - fills
      properties:
        accountOwner:
          type: string
        signerAddress:
          type: string
        perpDex:
          type: string
        coin:
          type: string
        orderId:
          type: integer
        intentHash:
          type: string
          nullable: true
        clientOrderId:
          type: string
          nullable: true
        side:
          type: string
          nullable: true
          enum:
            - buy
            - sell
            - null
        orderSize:
          type: number
          nullable: true
        orderPrice:
          type: number
          nullable: true
        venueStatus:
          type: string
          nullable: true
        venueReportedFilledSize:
          type: number
          nullable: true
        reconciliationState:
          $ref: '#/components/schemas/FuturesReconciliationState'
        filledSize:
          type: number
        filledNotional:
          type: number
        avgFillPrice:
          type: number
          nullable: true
        venueFee:
          type: number
        venueFeeToken:
          type: string
          nullable: true
        fillCount:
          type: integer
        terminal:
          type: boolean
        reason:
          type: string
          nullable: true
        fills:
          type: array
          items:
            $ref: '#/components/schemas/FuturesReconciledFill'
    FuturesOrderReconciliation:
      allOf:
        - $ref: '#/components/schemas/FuturesOrderReconciliationEvidence'
        - type: object
          required:
            - state
            - evidence
          properties:
            state:
              $ref: '#/components/schemas/FuturesReconciliationState'
            evidence:
              $ref: '#/components/schemas/FuturesOrderReconciliationEvidence'
    FuturesBuilderFeeFill:
      type: object
      required:
        - fillId
        - fillHash
        - observedBuilderFee
        - expectedBuilderFee
        - builderFeeToken
        - nonBuilderVenueFee
        - state
        - reason
      properties:
        fillId:
          type: integer
        fillHash:
          type: string
        observedBuilderFee:
          type: string
          nullable: true
        expectedBuilderFee:
          type: string
          nullable: true
        builderFeeToken:
          type: string
          nullable: true
        nonBuilderVenueFee:
          type: string
          nullable: true
        state:
          type: string
          enum:
            - exact
            - absent
            - ambiguous
            - unavailable
        reason:
          type: string
          nullable: true
    FuturesBuilderFeeReconciliation:
      type: object
      required:
        - state
        - builderFeeTotal
        - fillCountWithBuilderFee
        - feeToken
        - venueTotal
        - nonBuilderVenueFee
        - recipient
        - signedTenthsBps
        - reason
        - fills
      properties:
        state:
          type: string
          enum:
            - exact
            - absent
            - ambiguous
            - unavailable
        builderFeeTotal:
          type: string
          nullable: true
        fillCountWithBuilderFee:
          type: integer
        feeToken:
          type: string
          nullable: true
        venueTotal:
          type: string
          nullable: true
        nonBuilderVenueFee:
          type: string
          nullable: true
        recipient:
          type: string
          nullable: true
        signedTenthsBps:
          type: string
          nullable: true
        reason:
          type: string
          nullable: true
        fills:
          type: array
          items:
            $ref: '#/components/schemas/FuturesBuilderFeeFill'
    BoundedFuturesReservation:
      type: object
      description: Durable reservation row returned by FuturesPolicyService; not proof of execution, final cancellation or revenue
      required:
        - id
        - grant_id
        - action_id
        - network
        - account_address
        - coin
        - intent_hash
        - signed_action_hash
        - venue_order_id
        - status
        - dispatched_at
      properties:
        id:
          type: string
          format: uuid
        grant_id:
          type: string
          format: uuid
        action_id:
          type: string
          format: uuid
        network:
          type: string
          enum:
            - mainnet
            - testnet
        account_address:
          type: string
        coin:
          type: string
        intent_hash:
          type: string
        signed_action_hash:
          type: string
        venue_order_id:
          type: integer
          nullable: true
        status:
          type: string
          enum:
            - submitted
            - accepted
            - held_ambiguous
            - reconciled
            - released
        dispatched_at:
          type: string
          format: date-time
        scope:
          type: string
          enum:
            - futures.open
            - futures.reduce
            - futures.close
            - futures.cancel
            - futures.protective_order
        venue_nonce:
          type: integer
        requested_notional_usd:
          oneOf:
            - type: number
            - type: string
        new_risk_usd:
          oneOf:
            - type: number
            - type: string
        risk_reducing:
          type: boolean
        expires_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        evidence:
          type: object
          nullable: true
          additionalProperties: true
        cancel_target_evidence:
          type: object
          additionalProperties: true
    BoundedFuturesReconciliation:
      type: object
      required:
        - actionId
        - result
      properties:
        actionId:
          type: string
          format: uuid
        result:
          oneOf:
            - $ref: '#/components/schemas/BoundedFuturesReservation'
            - type: object
              additionalProperties: false
              required:
                - bounded
              properties:
                bounded:
                  type: boolean
                  enum:
                    - false
    ReconcileOrderDurableEvidence:
      type: object
      required:
        - recorded
        - note
      properties:
        recorded:
          type: boolean
          enum:
            - true
        record:
          type: object
          nullable: true
          additionalProperties: true
        note:
          type: string
    ReconcileOrderResponse:
      type: object
      required:
        - ok
        - reconciliation
        - builderFees
        - durableEvidence
        - evidenceSources
        - timestamp
      properties:
        ok:
          type: boolean
          enum:
            - true
        reconciliation:
          $ref: '#/components/schemas/FuturesOrderReconciliation'
        boundedReconciliation:
          type: array
          description: Optional; omitted when no durable bounded actions match. An accepted reservation is not final venue cancellation.
          items:
            $ref: '#/components/schemas/BoundedFuturesReconciliation'
        builderFees:
          $ref: '#/components/schemas/FuturesBuilderFeeReconciliation'
        durableEvidence:
          $ref: '#/components/schemas/ReconcileOrderDurableEvidence'
        evidenceSources:
          type: object
          required:
            - orderStatus
            - fills
            - methodology
            - balanceDeltasUsed
          properties:
            orderStatus:
              type: string
              enum:
                - hyperliquid_order_status
            fills:
              type: string
              enum:
                - hyperliquid_user_fills
            methodology:
              type: string
              enum:
                - direct_venue_evidence_only
            balanceDeltasUsed:
              type: boolean
              enum:
                - false
        timestamp:
          type: integer
          description: Unix milliseconds
    ReconcileOrderError:
      type: object
      description: Validation, conflict or degraded error. Established venue truth may accompany a persistence/core failure; missing durableEvidence never proves persistence. No automatic action resubmission.
      properties:
        ok:
          type: boolean
          enum:
            - false
        code:
          type: string
        error:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        reason:
          type: string
        retryable:
          type: boolean
        degraded:
          type: object
          additionalProperties: true
        warnings:
          type: array
          items:
            type: object
            additionalProperties: true
        reconciliation:
          $ref: '#/components/schemas/FuturesOrderReconciliation'
        builderFees:
          $ref: '#/components/schemas/FuturesBuilderFeeReconciliation'
        durableEvidence:
          type: object
          required:
            - recorded
          properties:
            recorded:
              type: boolean
            record:
              type: object
              nullable: true
              additionalProperties: true
    FuturesPolicy:
      type: object
      additionalProperties: false
      description: 'Owner-signed FarmDash policy, separate from Hyperliquid delegation. USD limits are exact positive decimal strings. maxRiskPerTrade is conservative full-notional admission USD, not a realized loss guarantee. Unix-second validity. Policy order types map actual route semantics: IOC/market_ioc -> market, Gtc/Alo -> limit.'
      required:
        - ownerAddress
        - agentAddress
        - apiWalletAddress
        - accountAddress
        - vaultAddress
        - network
        - sessionId
        - allowedMarkets
        - allowedActions
        - allowedOrderTypes
        - allowedDirections
        - maxOrderNotionalUsd
        - maxAggregateExposureUsd
        - maxSessionNewRiskNotionalUsd
        - maxLeverage
        - maxRiskPerTrade
        - maxSessionLossUsd
        - maxDailyLossUsd
        - validAfter
        - validUntil
        - nonce
        - policyVersion
      properties:
        ownerAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        apiWalletAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        accountAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        vaultAddress:
          type: string
          nullable: true
          pattern: ^0x[a-fA-F0-9]{40}$
        network:
          type: string
          enum:
            - mainnet
            - testnet
        sessionId:
          type: string
          minLength: 1
          maxLength: 128
        allowedMarkets:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            pattern: ^[A-Z0-9]{1,16}$
        allowedActions:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
              - futures.open
              - futures.reduce
              - futures.close
              - futures.cancel
              - futures.protective_order
        allowedOrderTypes:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
              - market
              - limit
              - stop_loss
              - take_profit
              - cancel
        allowedDirections:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            type: string
            enum:
              - long
              - short
        maxOrderNotionalUsd:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxAggregateExposureUsd:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxSessionNewRiskNotionalUsd:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxRiskPerTrade:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxSessionLossUsd:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxDailyLossUsd:
          type: string
          pattern: ^(0|[1-9]\d{0,17})(\.\d{1,8})?$
          description: Strictly positive USD limit; zero is invalid
        maxLeverage:
          type: integer
          minimum: 1
          maximum: 100
        validAfter:
          type: integer
          minimum: 0
          description: Unix seconds
        validUntil:
          type: integer
          minimum: 1
          description: Unix seconds, greater than validAfter
        nonce:
          type: string
          pattern: ^[1-9]\d{0,77}$
          description: Single-use owner uint256 decimal nonce
        policyVersion:
          type: integer
          enum:
            - 1
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        ok:
          type: boolean
          example: false
        error:
          type: string
        code:
          type: string
        message:
          type: string
        retryable:
          type: boolean
        request_id:
          type: string
        details:
          type: object
          additionalProperties: true
    PaymentRequiredError:
      type: object
      properties:
        ok:
          type: boolean
          example: false
        error:
          type: string
          example: payment_required
        code:
          type: string
          description: '`free_quota_exhausted` when the shared Scout allowance is spent; otherwise `payment_required`.'
          example: free_quota_exhausted
        message:
          type: string
        instruction:
          type: string
          enum:
            - STOP_RETRYING
          description: Present when an exhausted free caller must not repeat the same unpaid request.
        retry_same_request:
          type: boolean
          example: false
        next_action:
          type: string
          example: Wait for your quota reset, upgrade your plan, or use x402 paid access.
        quota:
          type: object
          properties:
            tier:
              type: string
              example: scout
            remaining:
              type: integer
              example: 0
            reset_at:
              type: string
              format: date-time
        abuse_notice:
          type: string
          example: Repeated automated requests while quota is exhausted may result in temporary or permanent API blocking.
        retryable:
          type: boolean
        upgrade_url:
          type: string
          format: uri
        direct_upgrade_url:
          type: string
          format: uri
        rate_limit:
          type: object
          additionalProperties: true
        developer_sandbox:
          type: object
          additionalProperties: true
        payment_required:
          type: object
          properties:
            amount:
              type: string
              example: 0.01 USDC
            chain:
              type: string
              example: Base
            destination:
              type: string
              example: '0xb0Ed0d7bca24BBaD635B977C2efbE06742e33377'
            token:
              type: string
            chainId:
              type: string
              pattern: ^[0-9]+$
              description: Numeric string from X402PaymentPolicy; transaction chain IDs retain their own integer contracts.
              example: '8453'
    DustStormWarning:
      type: object
      required:
        - kind
        - message
      properties:
        kind:
          type: string
          const: dust_storm
        message:
          type: string
    SupportedProtocol:
      type: string
      enum:
        - lifi
        - relay
      description: Swap quote provider. Automatic routing compares all healthy compatible providers (LI.FI, Relay; 0x paused until reinstated); force one with ?protocol= (deterministic, never silent fallback).
    SwapSafetyMode:
      type: string
      enum:
        - strict
        - balanced
    RiskSeverity:
      type: string
      enum:
        - low
        - medium
        - high
        - critical
    QuoteDecaySeverity:
      type: string
      enum:
        - none
        - low
        - medium
        - high
    Tier:
      type: string
      enum:
        - scout
        - pioneer
        - syndicate
    SwapTxData:
      type: object
      required:
        - to
        - data
        - value
        - chainId
      properties:
        to:
          type: string
          description: Protocol contract address (NOT FarmDash)
        data:
          type: string
          description: Encoded calldata
        value:
          type: string
          description: Native token value in wei
        chainId:
          type: integer
    SwapSimulationRequest:
      type: object
      required:
        - intent_id
        - wallet_address
      properties:
        intent_id:
          type: string
          description: Wallet-bound quote intent returned by /agents/quote
          example: fd_intent_7f3a
        wallet_address:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Signing wallet for the simulated execution
    SwapSimulationResponse:
      type: object
      required:
        - ok
        - simulation_id
        - intent_id
        - success
        - gas_used
        - gas_cost_usd
        - output_amount
        - mev_risk
        - valid_until
        - wallet_address
        - selected_protocol
        - required_for_execution
      properties:
        ok:
          type: boolean
          example: true
        simulation_id:
          type: string
          example: sim_9b2e
        intent_id:
          type: string
        success:
          type: boolean
        gas_used:
          type: number
        gas_cost_usd:
          type: number
        output_amount:
          type: string
        price_impact_pct:
          type: number
          nullable: true
        mev_risk:
          type: string
          enum:
            - low
            - medium
            - high
        revert_reason:
          type: string
          nullable: true
        valid_until:
          type: string
          format: date-time
        wallet_address:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        selected_protocol:
          $ref: '#/components/schemas/SupportedProtocol'
        tx_fingerprint:
          type: string
        request_fingerprint:
          type: string
        provider:
          type: string
        cached:
          type: boolean
        required_for_execution:
          type: boolean
          const: true
    SwapRequest:
      type: object
      required:
        - fromChainId
        - toChainId
        - fromToken
        - toToken
        - fromAmount
        - agentAddress
        - toAddress
        - simulationId
        - nonce
        - signature
      properties:
        fromChainId:
          type: integer
          enum:
            - 1
            - 10
            - 137
            - 8453
            - 42161
            - 59144
        toChainId:
          type: integer
          enum:
            - 1
            - 10
            - 137
            - 8453
            - 42161
            - 59144
        fromToken:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        toToken:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        fromAmount:
          type: string
          pattern: ^\d+$
          description: Amount in wei
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Agent wallet address (signer)
        toAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Destination wallet for swapped tokens
        slippage:
          type: number
          minimum: 0.01
          maximum: 5
          default: 0.5
          description: Slippage tolerance in percent (capped at 5%)
        protocol:
          type: string
          enum:
            - lifi
            - relay
        volumeHintUSD:
          type: number
          description: Advisory telemetry only — never determines the fee tier. Fee BPS uses server-oracle-derived input volume exclusively (50 bps under $10k, 45 bps at $10k+, 40 bps at $100k+, 30 bps at $1M+ combined routing target); unknown volume pays the default tier.
        expectedUpsideUsd:
          type: number
          description: Optional upside estimate in USD for positive-net-edge checks
        riskBufferUsd:
          type: number
          description: Optional extra execution-risk buffer in USD
        healthFactor:
          type: number
          description: Optional lending health factor supplied by the caller
        liquidationBufferPct:
          type: number
          description: Optional liquidation-buffer percentage supplied by the caller
        walletAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Optional wallet address used for on-chain approval checks
        safetyMode:
          $ref: '#/components/schemas/SwapSafetyMode'
          description: '`strict` halts on severe quote decay, `balanced` downgrades that condition to a warning'
        simulationId:
          type: string
          description: Fresh successful simulation_id from POST /v1/simulate
        intentId:
          type: string
          description: Optional qi_* quote-cache/idempotency identity; must match the simulation when supplied. Do not pass this value to /v1/simulate.
        nonce:
          type: string
          description: Current timestamp in milliseconds (60s window)
        signature:
          type: string
          pattern: ^0x[a-fA-F0-9]{130}$
          description: EIP-191 personal_sign of the v1 versioned payload
    AllowanceStatus:
      type: object
      properties:
        spender:
          type: string
          nullable: true
        allowance:
          type: string
          nullable: true
        requiredAmount:
          type: string
        approvalNeeded:
          type: boolean
        overApproved:
          type: boolean
        source:
          type: string
          enum:
            - onchain
            - quote_fallback
            - unavailable
    RiskFlag:
      type: object
      required:
        - code
        - category
        - severity
        - title
        - message
      properties:
        code:
          type: string
        category:
          type: string
          enum:
            - approval
            - bridge
            - contract
            - token
            - health
            - execution
        severity:
          $ref: '#/components/schemas/RiskSeverity'
        title:
          type: string
        message:
          type: string
        metadata:
          type: object
          additionalProperties: true
    PegCheck:
      type: object
      properties:
        tokenAddress:
          type: string
        symbol:
          type: string
        reference:
          type: string
          enum:
            - USD
            - ETH
        priceUsd:
          type: number
          nullable: true
        referencePriceUsd:
          type: number
          nullable: true
        deviationPct:
          type: number
          nullable: true
        alert:
          type: boolean
    HealthCheck:
      type: object
      properties:
        healthFactor:
          type: number
          nullable: true
        liquidationBufferPct:
          type: number
          nullable: true
        alertLevel:
          type: string
          enum:
            - none
            - warning
            - critical
        shouldHalt:
          type: boolean
    NetEdgeAnalysis:
      type: object
      properties:
        expectedUpsideUsd:
          type: number
          nullable: true
        protocolFeeUsd:
          type: number
        gasUsd:
          type: number
        bridgeFeeUsd:
          type: number
        riskBufferUsd:
          type: number
        totalCostUsd:
          type: number
        netEdgeUsd:
          type: number
          nullable: true
        positive:
          type: boolean
          nullable: true
        enforced:
          type: boolean
    QuoteDecayMetrics:
      type: object
      properties:
        previousObservedAt:
          type: integer
          nullable: true
        quoteAgeMs:
          type: integer
          nullable: true
        outputDecayBps:
          type: number
        gasIncreaseBps:
          type: number
        severity:
          $ref: '#/components/schemas/QuoteDecaySeverity'
    RouteCandidate:
      type: object
      properties:
        protocol:
          $ref: '#/components/schemas/SupportedProtocol'
        estimatedOutput:
          type: string
        feeAmountUsd:
          type: number
        gasEstimateUsd:
          type: number
          nullable: true
        bridgeFeeUsd:
          type: number
          nullable: true
        routeRiskScore:
          type: number
        selected:
          type: boolean
    ExecutionAlphaReport:
      type: object
      properties:
        selectedProtocol:
          $ref: '#/components/schemas/SupportedProtocol'
        routeReason:
          type: string
        mevProtection:
          type: object
          properties:
            safetyMode:
              $ref: '#/components/schemas/SwapSafetyMode'
            actualSlippageBps:
              type: integer
            maxRecommendedSlippageBps:
              type: integer
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/RouteCandidate'
        quoteDecay:
          $ref: '#/components/schemas/QuoteDecayMetrics'
        netEdge:
          $ref: '#/components/schemas/NetEdgeAnalysis'
    SwapRiskReport:
      type: object
      properties:
        flags:
          type: array
          items:
            $ref: '#/components/schemas/RiskFlag'
        approval:
          allOf:
            - $ref: '#/components/schemas/AllowanceStatus'
          nullable: true
        pegChecks:
          type: array
          items:
            $ref: '#/components/schemas/PegCheck'
        health:
          allOf:
            - $ref: '#/components/schemas/HealthCheck'
          nullable: true
        shouldHalt:
          type: boolean
        haltReasons:
          type: array
          items:
            type: string
    QuoteResponse:
      type: object
      required:
        - protocol
        - estimatedOutput
        - feeBps
        - feeAmountUSD
        - gasEstimate
        - txData
        - expiresAt
      properties:
        protocol:
          $ref: '#/components/schemas/SupportedProtocol'
        estimatedOutput:
          type: string
          description: Expected output in wei
        feeBps:
          type: integer
          description: Fee in basis points (45 = 0.45% default; configured volume discounts may apply)
        mode:
          type: string
          const: live
        unsigned:
          type: boolean
          const: true
        broadcast_by_farmdash:
          type: boolean
          const: false
        feeAmountUSD:
          type: string
        gasEstimate:
          type: string
        txData:
          $ref: '#/components/schemas/SwapTxData'
        expiresAt:
          type: integer
          description: Unix timestamp — quotes valid 30s
        simulation_required:
          type: boolean
          description: True when execute_swap requires a simulation for this route
        simulation_available:
          type: boolean
          description: True when the quote was wallet-bound and returned an intent_id
        intent_id:
          type: string
          nullable: true
          description: Pass this to POST /v1/simulate before execution
        intent_expires_at:
          type: string
          nullable: true
          format: date-time
        simulate_url:
          type: string
          example: /api/v1/simulate
        allowanceTarget:
          type: string
          nullable: true
        gasEstimateUsd:
          type: number
          nullable: true
        bridgeFeeUsd:
          type: number
          nullable: true
        executionAlpha:
          $ref: '#/components/schemas/ExecutionAlphaReport'
        riskReport:
          $ref: '#/components/schemas/SwapRiskReport'
        note:
          type: string
    MarketEstimateResponse:
      type: object
      required:
        - quoteKind
        - executionReady
        - liquidityConfirmed
        - priceUnknown
        - feeTierBps
        - volumeUnknown
        - compatibleProviders
        - routeSupported
        - sources
        - confidence
        - observedAt
        - cached
        - stale
        - unsigned
        - broadcast_by_farmdash
        - execution_boundary
        - note
      properties:
        quoteKind:
          type: string
          enum:
            - market_estimate
        continuation:
          $ref: '#/components/schemas/ExecutionContinuation'
        next_operation:
          $ref: '#/components/schemas/ExecutionContinuationNextOperation'
        executionReady:
          type: boolean
          enum:
            - false
        liquidityConfirmed:
          type: boolean
          enum:
            - false
        providerAttribution:
          type: string
          nullable: true
        referencePriceUsd:
          type: number
          nullable: true
        estimatedInputUsd:
          type: number
          nullable: true
        estimatedOutputUsd:
          type: number
          nullable: true
        priceUnknown:
          type: boolean
        feeTierBps:
          type: integer
        volumeUnknown:
          type: boolean
        compatibleProviders:
          type: array
          items:
            type: string
        routeSupported:
          type: boolean
        liquidityUsd:
          type: number
          nullable: true
        volume24hUsd:
          type: number
          nullable: true
        sources:
          type: array
          items:
            type: string
        confidence:
          type: string
          enum:
            - high
            - medium
            - low
        observedAt:
          type: string
        cached:
          type: boolean
        stale:
          type: boolean
        attempts:
          type: array
          items:
            type: object
        warnings:
          type: array
          items:
            type: string
        unsigned:
          type: boolean
          enum:
            - true
        broadcast_by_farmdash:
          type: boolean
          enum:
            - false
        simulation_required:
          type: boolean
        simulate_url:
          type: string
        execution_boundary:
          type: object
          properties:
            state:
              type: string
            simulation_required:
              type: boolean
            local_signature_required:
              type: boolean
            farmdash_broadcasts_transaction:
              type: boolean
        note:
          type: string
    FirmQuoteResponse:
      type: object
      required:
        - intentId
        - quoteKind
        - reused
        - selectedProvider
        - firmQuote
        - expiresAt
        - executionReady
        - simulationRequirements
        - attempts
        - alternateUsed
        - unsigned
        - broadcast_by_farmdash
        - executionAlpha
        - riskReport
        - execution_boundary
        - note
      properties:
        intentId:
          type: string
        quoteKind:
          type: string
          enum:
            - firm_quote
        reused:
          type: boolean
        marketBenchmark:
          type: object
          nullable: true
        selectedProvider:
          $ref: '#/components/schemas/SupportedProtocol'
        firmQuote:
          type: object
        expiresAt:
          type: string
        executionReady:
          type: boolean
        approval:
          type: object
          nullable: true
        simulationRequirements:
          type: object
          properties:
            required:
              type: boolean
            simulate_url:
              type: string
            intent_id:
              type: string
              description: fd_intent_* execution-simulation identity. Pass this value to /v1/simulate.
            valid_for_execution:
              type: boolean
            plan:
              type: object
              nullable: true
            signatures:
              type: array
              nullable: true
        attempts:
          type: array
          items:
            type: object
        alternateUsed:
          type: boolean
        unsigned:
          type: boolean
          enum:
            - true
        broadcast_by_farmdash:
          type: boolean
          enum:
            - false
        executionAlpha:
          $ref: '#/components/schemas/ExecutionAlphaReport'
        riskReport:
          $ref: '#/components/schemas/SwapRiskReport'
        execution_boundary:
          type: object
          properties:
            state:
              type: string
            simulation_required:
              type: boolean
            local_signature_required:
              type: boolean
            farmdash_broadcasts_transaction:
              type: boolean
        note:
          type: string
    SwapResult:
      type: object
      required:
        - protocol
        - estimatedOutput
        - feeBps
        - feeAmountUSD
        - gasEstimate
        - txData
        - expiresAt
      properties:
        protocol:
          $ref: '#/components/schemas/SupportedProtocol'
        estimatedOutput:
          type: string
        feeBps:
          type: integer
        feeAmountUSD:
          type: string
        feeEventId:
          type: string
          format: uuid
          description: Use with /agents/confirm to confirm settlement
        gasEstimate:
          type: string
        txData:
          $ref: '#/components/schemas/SwapTxData'
        expiresAt:
          type: integer
        allowanceTarget:
          type: string
          nullable: true
        gasEstimateUsd:
          type: number
          nullable: true
        bridgeFeeUsd:
          type: number
          nullable: true
        simulation:
          type: object
          additionalProperties: true
        executionAlpha:
          $ref: '#/components/schemas/ExecutionAlphaReport'
        riskReport:
          $ref: '#/components/schemas/SwapRiskReport'
        confirmUrl:
          type: string
          example: /api/agents/confirm
    SwapHaltResponse:
      type: object
      properties:
        error:
          type: string
          example: swap_halted
        code:
          type: string
          example: swap_halted
        selectedProtocol:
          $ref: '#/components/schemas/SupportedProtocol'
        executionAlpha:
          $ref: '#/components/schemas/ExecutionAlphaReport'
        riskReport:
          $ref: '#/components/schemas/SwapRiskReport'
    RiskSentinelRequest:
      type: object
      description: Provide either manual health/net-edge inputs or a full swap-shaped request for route-aware analysis.
      properties:
        fromChainId:
          type: integer
          enum:
            - 1
            - 10
            - 137
            - 8453
            - 42161
            - 59144
        toChainId:
          type: integer
          enum:
            - 1
            - 10
            - 137
            - 8453
            - 42161
            - 59144
        fromToken:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        toToken:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        fromAmount:
          type: string
          pattern: ^\d+$
        walletAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        toAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        protocol:
          type: string
          enum:
            - lifi
            - relay
        slippage:
          type: number
        expectedUpsideUsd:
          type: number
        riskBufferUsd:
          type: number
        healthFactor:
          type: number
        liquidationBufferPct:
          type: number
        protocolFeeUsd:
          type: number
        gasUsd:
          type: number
        bridgeFeeUsd:
          type: number
        enforcePositive:
          type: boolean
        safetyMode:
          $ref: '#/components/schemas/SwapSafetyMode'
    RiskSentinelResponse:
      type: object
      properties:
        ok:
          type: boolean
        mode:
          type: string
          enum:
            - manual
            - quoted
        selectedProtocol:
          allOf:
            - $ref: '#/components/schemas/SupportedProtocol'
          nullable: true
        executionAlpha:
          allOf:
            - $ref: '#/components/schemas/ExecutionAlphaReport'
          nullable: true
        riskReport:
          allOf:
            - $ref: '#/components/schemas/SwapRiskReport'
          nullable: true
        quotePreview:
          allOf:
            - $ref: '#/components/schemas/SwapResult'
          nullable: true
        health:
          allOf:
            - $ref: '#/components/schemas/HealthCheck'
          nullable: true
        netEdge:
          allOf:
            - $ref: '#/components/schemas/NetEdgeAnalysis'
          nullable: true
        flags:
          type: array
          items:
            $ref: '#/components/schemas/RiskFlag'
        shouldHalt:
          type: boolean
    ConfirmRequest:
      type: object
      required:
        - sessionId
        - agentAddress
        - feeEventId
        - txHash
      properties:
        sessionId:
          type: string
          description: Owning FarmDash session id (the session that owns the fee event).
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Session owner / customer wallet address.
        sessionToken:
          type: string
          description: 'Optional in this raw-HTTP schema: the session credential may be sent in the request body or via the X-FarmDash-Session-Token header. It authenticates the FarmDash session only; it is not wallet signing or transaction authority, and FarmDash never broadcasts the swap on the caller''s behalf.'
        feeEventId:
          type: string
          format: uuid
          description: FarmDash fee-event id associated with the prepared swap.
        txHash:
          type: string
          pattern: ^0x[a-fA-F0-9]{64}$
          description: 'On-chain transaction hash, which exists only after the customer-controlled wallet broadcast. A transaction hash alone is not confirmation: FarmDash verifies the canonical receipt/finality and the expected fee transfer before durable settlement is recorded.'
    ConfirmResponse:
      type: object
      properties:
        ok:
          type: boolean
        feeEventId:
          type: string
          format: uuid
        settlementStatus:
          type: string
          enum:
            - confirmed
            - pending
            - expired
        idempotent:
          type: boolean
          description: True if this was a duplicate confirmation (safe to retry)
    FeeEvent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        protocol:
          $ref: '#/components/schemas/SupportedProtocol'
        from_token:
          type: string
        to_token:
          type: string
        volume_usd:
          type: number
        fee_bps:
          type: integer
        fee_usd:
          type: number
        agent_address:
          type: string
        tx_hash:
          type: string
          nullable: true
        settlement_status:
          type: string
          enum:
            - pending
            - confirmed
            - expired
            - legacy
        chain_id:
          type: integer
    HistoryResponse:
      type: object
      required:
        - events
        - total
        - limit
        - offset
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/FeeEvent'
        total:
          type: integer
        limit:
          type: integer
        offset:
          type: integer
    RevenueMetrics:
      type: object
      required:
        - totalFeeUSD
        - totalVolumeUSD
        - totalSwaps
        - activeAgents
      properties:
        totalFeeUSD:
          type: number
        totalVolumeUSD:
          type: number
        totalSwaps:
          type: integer
        activeAgents:
          type: integer
    LeaderboardResponse:
      type: object
      required:
        - ok
        - source
        - entries
      properties:
        ok:
          type: boolean
        source:
          type: string
          description: Always 'fee_events_aggregated' — aggregates only, never raw events
        windowDays:
          type: integer
          nullable: true
        entries:
          type: array
          maxItems: 50
          items:
            type: object
            required:
              - address
              - totalVolumeUSD
              - totalFeeUSD
              - swapCount
            properties:
              address:
                type: string
              totalVolumeUSD:
                type: number
              totalFeeUSD:
                type: number
              swapCount:
                type: integer
    ReputationResponse:
      type: object
      required:
        - ok
        - reputation
      properties:
        ok:
          type: boolean
        reputation:
          type: object
          required:
            - address
            - trailCred
            - badge
          properties:
            address:
              type: string
            trailCred:
              type: number
            badge:
              type: string
            onchainScore:
              type: number
            vouchScore:
              type: number
            vouchCount:
              type: integer
            vouchers:
              type: array
              maxItems: 50
              items:
                type: object
            activity:
              type: object
            onchainData:
              nullable: true
            computedAt:
              type: string
              nullable: true
        scout_bonus:
          type: object
          description: Present only on overflow-bonus 200s after the shared Scout budget is spent
          properties:
            used:
              type: integer
            limit:
              type: integer
            remaining:
              type: integer
    ProtocolItem:
      type: object
      properties:
        protocol_name:
          type: string
        discovery_heuristic_score:
          oneOf:
            - type: number
            - type: string
              description: Encrypted for scout tier
          description: Catalog editorial heuristic (methodology catalog-editorial-v1). NOT live Trail Heat — canonical quantitative scores live at /v1/trail-heat.
        discovery_methodology:
          type: string
        sybil_risk:
          type: string
        tvl:
          type: string
        category:
          type: string
          enum:
            - Perps
            - Lending
            - Dex
            - L2
            - Bridge
            - Restaking
            - HyperEVM
            - Infra
            - Wallet
            - Testnet
        status:
          type: string
          enum:
            - Confirmed Airdrop
            - Points Program
            - Speculative
            - Completed
            - Unknown
        chains:
          type: array
          items:
            type: string
        recommended_agent_deploy_link:
          type: string
          format: uri
    ProtocolsResponse:
      type: object
      required:
        - tier
        - count
        - data
      properties:
        tier:
          $ref: '#/components/schemas/Tier'
        count:
          type: integer
        data:
          type: array
          items:
            $ref: '#/components/schemas/ProtocolItem'
        status:
          type: string
        message:
          type: string
        direct_upgrade_url:
          type: string
          format: uri
        total_protocols_available:
          type: integer
    ChainBreakdownItem:
      type: object
      properties:
        chain:
          type: string
        protocol_count:
          oneOf:
            - type: integer
            - type: string
        pct_of_total:
          oneOf:
            - type: number
            - type: string
        confirmed_airdrops:
          oneOf:
            - type: integer
            - type: string
        points_programs:
          oneOf:
            - type: integer
            - type: string
        categories:
          type: array
          items:
            type: string
    ChainBreakdownSummary:
      type: object
      properties:
        total_chains:
          type: integer
        total_protocols:
          oneOf:
            - type: integer
            - type: string
        dominant_chain:
          type: string
          nullable: true
        dominant_chain_pct:
          oneOf:
            - type: number
            - type: string
    ChainBreakdownResponse:
      type: object
      required:
        - tier
        - data
      properties:
        tier:
          $ref: '#/components/schemas/Tier'
        status:
          type: string
        message:
          type: string
        direct_upgrade_url:
          type: string
          format: uri
        data:
          type: object
          properties:
            chains:
              type: array
              items:
                $ref: '#/components/schemas/ChainBreakdownItem'
            summary:
              $ref: '#/components/schemas/ChainBreakdownSummary'
    FundingAnalysis:
      type: object
      properties:
        coin:
          type: string
        fundingRate:
          type: number
        annualizedRate:
          type: number
        predictedRate:
          type: number
        crossVenueDelta:
          type: number
        premium:
          type: number
        openInterest:
          type: number
        isArbOpportunity:
          type: boolean
        arbDirection:
          type: string
          nullable: true
          enum:
            - long_spot_short_perp
            - short_spot_long_perp
            - null
    TechnicalIndicators:
      type: object
      properties:
        ema8:
          type: number
        ema34:
          type: number
        emaCross:
          type: string
          enum:
            - bullish
            - bearish
            - neutral
        rsi:
          type: number
        macd:
          type: number
        macdSignal:
          type: number
        macdHistogram:
          type: number
        macdCross:
          type: string
          enum:
            - bullish_cross
            - bearish_cross
            - neutral
        adx:
          type: number
        atr:
          type: number
        bbUpper:
          type: number
        bbMiddle:
          type: number
        bbLower:
          type: number
        bbWidth:
          type: number
        volumeRatio:
          type: number
        zScore:
          type: number
    ScanFundingResponse:
      type: object
      properties:
        ok:
          type: boolean
        tier:
          $ref: '#/components/schemas/Tier'
        arbOpportunities:
          type: array
          items:
            $ref: '#/components/schemas/FundingAnalysis'
        highFunding:
          type: array
          items:
            $ref: '#/components/schemas/FundingAnalysis'
        totalScanned:
          type: integer
        upgradeMessage:
          type: string
        timestamp:
          type: integer
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    MarketConditionsResponse:
      type: object
      properties:
        ok:
          type: boolean
        coin:
          type: string
        indicators:
          $ref: '#/components/schemas/TechnicalIndicators'
        strategyHint:
          type: string
          enum:
            - momentum_long
            - momentum_short
            - mean_reversion
            - no_trade
        timestamp:
          type: integer
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    FuturesPosition:
      type: object
      properties:
        coin:
          type: string
        size:
          type: number
        side:
          type: string
          enum:
            - long
            - short
        entryPrice:
          type: number
        markPrice:
          type: number
        unrealizedPnl:
          type: number
        returnOnEquity:
          type: number
        leverage:
          type: number
        leverageType:
          type: string
        liquidationPrice:
          type: number
          nullable: true
        marginUsed:
          type: number
    AccountSummary:
      type: object
      properties:
        equity:
          type: string
        totalNotionalPosition:
          type: string
        marginUsed:
          type: string
        availableMargin:
          type: string
        aggregateLeverage:
          type: string
    RiskState:
      type: object
      properties:
        dailyPnl:
          type: string
        dailyPnlPct:
          type: string
        weeklyPnl:
          type: string
        realizedDailyPnl:
          type: string
        realizedWeeklyPnl:
          type: string
        unrealizedPnl:
          type: string
        pnlSource:
          type: string
          enum:
            - hyperliquid_venue_loss_pressure
        pnlAsOf:
          type: integer
          format: int64
        pnlMethodology:
          type: string
        drawdown:
          type: string
        peakEquity:
          type: string
        isTradingHalted:
          type: boolean
        haltReason:
          type: string
          nullable: true
        isReducedSize:
          type: boolean
        openPositionCount:
          type: integer
    Guardrails:
      type: object
      properties:
        maxLeverage:
          type: integer
          example: 5
        maxRiskPerTrade:
          type: string
          example: 2%
        maxPositions:
          type: integer
        dailyLossLimit:
          type: string
          example: '-3%'
        weeklyLossLimit:
          type: string
          example: '-7%'
        maxDrawdown:
          type: string
          example: '-15%'
    AccountStateResponse:
      type: object
      properties:
        ok:
          type: boolean
        account:
          $ref: '#/components/schemas/AccountSummary'
        positions:
          type: array
          items:
            $ref: '#/components/schemas/FuturesPosition'
        risk:
          $ref: '#/components/schemas/RiskState'
        guardrails:
          $ref: '#/components/schemas/Guardrails'
        timestamp:
          type: integer
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    FuturesMarketRegime:
      type: string
      enum:
        - trending
        - ranging
        - high_volatility
        - low_liquidity
    FuturesTradeDirection:
      type: string
      enum:
        - long
        - short
        - neutral
    FuturesStrategyObject:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - futures
        market:
          type: string
        direction:
          $ref: '#/components/schemas/FuturesTradeDirection'
        regime:
          $ref: '#/components/schemas/FuturesMarketRegime'
        triggerConditions:
          type: array
          items:
            type: string
        entryLogic:
          type: string
        exitLogic:
          type: string
        riskModel:
          type: object
          properties:
            baseRiskPercent:
              type: number
            appliedRiskPercent:
              type: number
            riskMultiplier:
              type: number
            leverageCap:
              type: number
            stopModel:
              type: string
        leverageModel:
          type: object
          properties:
            mode:
              type: string
              enum:
                - adaptive
            suggested:
              type: number
            cap:
              type: number
            drivers:
              type: array
              items:
                type: string
        fallbackLogic:
          type: array
          items:
            type: string
        telemetryTracking:
          type: array
          items:
            type: string
    FuturesAdaptiveRisk:
      type: object
      properties:
        baseRiskPercent:
          type: number
        appliedRiskPercent:
          type: number
        confidenceMultiplier:
          type: number
        volatilityMultiplier:
          type: number
        drawdownMultiplier:
          type: number
        portfolioMultiplier:
          type: number
        finalRiskMultiplier:
          type: number
    FuturesTradeSimulation:
      type: object
      properties:
        methodology:
          type: string
          enum:
            - heuristic_preflight
        holdingWindowHours:
          type: number
        entryValueUsd:
          type: number
        marginRequiredUsd:
          type: number
        marginImpactPct:
          type: number
        liquidationPriceEstimate:
          type: number
          nullable: true
        stopScenarioPnlUsd:
          type: number
        targetScenarioPnlUsd:
          type: number
        oneAtrMovePnlUsd:
          type: number
        estimatedFundingPnl24hUsd:
          type: number
        estimatedFundingPnl72hUsd:
          type: number
    FuturesPortfolioContext:
      type: object
      properties:
        openPositionCount:
          type: integer
        sameAssetExposureUsd:
          type: number
        sameAssetExposurePct:
          type: number
        directionalExposurePct:
          type: number
        netDirectionalBias:
          type: string
          enum:
            - net_long
            - net_short
            - balanced
        concentrationWarning:
          type: string
          nullable: true
    StrategyRecommendation:
      type: object
      properties:
        recommendedStrategy:
          type: string
          enum:
            - funding_arb
            - momentum_long
            - momentum_short
            - trend_pullback_long
            - trend_pullback_short
            - mean_reversion
            - no_trade
        confidence:
          type: number
        asset:
          type: string
        marketRegime:
          $ref: '#/components/schemas/FuturesMarketRegime'
        entry:
          type: number
        stopLoss:
          type: number
        takeProfit:
          type: number
        positionSize:
          type: number
        leverage:
          type: number
          maximum: 5
        riskPercent:
          type: number
          maximum: 0.02
        reasoning:
          type: array
          items:
            type: string
        noTradeReason:
          type: string
          nullable: true
        strategyObject:
          $ref: '#/components/schemas/FuturesStrategyObject'
        adaptiveRisk:
          $ref: '#/components/schemas/FuturesAdaptiveRisk'
        simulation:
          $ref: '#/components/schemas/FuturesTradeSimulation'
        portfolioContext:
          $ref: '#/components/schemas/FuturesPortfolioContext'
        trailHeatCrossRef:
          type: object
          properties:
            protocolId:
              type: string
            score:
              type: number
            farmingOpportunity:
              type: boolean
            referralLink:
              type: string
              format: uri
        fundingAnalysis:
          $ref: '#/components/schemas/FundingAnalysis'
        indicators:
          $ref: '#/components/schemas/TechnicalIndicators'
    AnalyzeStrategyResponse:
      type: object
      properties:
        continuation:
          $ref: '#/components/schemas/ExecutionContinuation'
        next_operation:
          $ref: '#/components/schemas/ExecutionContinuationNextOperation'
        ok:
          type: boolean
        recommendation:
          $ref: '#/components/schemas/StrategyRecommendation'
        account:
          type: object
          properties:
            equity:
              type: string
            availableMargin:
              type: string
            openPositions:
              type: integer
        guardrails:
          $ref: '#/components/schemas/Guardrails'
        timestamp:
          type: integer
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    PositionSizingRequest:
      type: object
      required:
        - equity
        - entryPrice
        - stopPrice
      properties:
        equity:
          type: number
          description: Account equity in USD
        entryPrice:
          type: number
        stopPrice:
          type: number
        riskPercent:
          type: number
          maximum: 0.02
          description: Capped at 2%
        targetPrice:
          type: number
          description: For R:R calculation
        riskMultiplier:
          type: number
          minimum: 0.1
          maximum: 1
          description: Optional flexibility modifier for risk tolerance. 1.0 keeps the full risk budget; lower values are more conservative.
    PositionSizing:
      type: object
      properties:
        positionSize:
          type: number
        positionValueUsd:
          type: number
        leverage:
          type: number
        marginRequired:
          type: number
        riskAmount:
          type: number
        riskPercent:
          type: number
        stopDistance:
          type: number
        rewardRiskRatio:
          type: number
    PositionSizingResponse:
      type: object
      properties:
        ok:
          type: boolean
        sizing:
          $ref: '#/components/schemas/PositionSizing'
        guardrails:
          type: object
          properties:
            maxLeverage:
              type: integer
            maxRiskPerTrade:
              type: string
            maxPositionValue:
              type: string
            note:
              type: string
        timestamp:
          type: integer
    EIP712Signature:
      type: object
      required:
        - r
        - s
        - v
      properties:
        r:
          type: string
        s:
          type: string
        v:
          type: integer
    ExecutionTrialProof:
      type: object
      required:
        - issuedAt
        - signature
      description: Locally signed server-issued commercial identity challenge. Creates no transaction authority or delegation. Valid for five minutes. Never send private keys.
      properties:
        issuedAt:
          type: integer
          minimum: 1
        signature:
          type: string
    PrepareOrderRequest:
      type: object
      additionalProperties: false
      required:
        - agentAddress
        - coin
        - isBuy
        - size
        - price
        - orderType
      properties:
        executionTrialId:
          type: string
          description: Inherited durable analysis lifecycle identity; commercial permission only.
        continuationId:
          type: string
          format: uuid
          description: Optional server-issued context correlation; grants no execution authority.
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        accountAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        coin:
          type: string
          pattern: ^[a-zA-Z0-9]{1,16}$
        isBuy:
          type: boolean
        size:
          type: string
          pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
        price:
          type: string
          pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
        orderType:
          type: string
          enum:
            - limit_gtc
            - limit_ioc
            - limit_alo
            - market_ioc
            - stop_loss
            - take_profit
        reduceOnly:
          type: boolean
          default: false
        leverage:
          oneOf:
            - type: number
              exclusiveMinimum: 0
              maximum: 5
            - type: string
        nonce:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        expiresAt:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
          default: USER_SIGNED
          description: Preparation is not execution authority. Bounded submission additionally requires an owner grant and authenticated session and remains subject to the canonical rollout gate.
    PrepareOrderExecuteRequest:
      type: object
      additionalProperties: false
      required:
        - agentAddress
        - coin
        - isBuy
        - size
        - price
        - orderType
        - accountAddress
        - reduceOnly
        - leverage
        - nonce
        - expiresAt
        - intentHash
        - signedAction
        - executionMode
      properties:
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        accountAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        coin:
          type: string
          pattern: ^[a-zA-Z0-9]{1,16}$
        isBuy:
          type: boolean
        size:
          type: string
          pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
        price:
          type: string
          pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
        orderType:
          type: string
          enum:
            - limit_gtc
            - limit_ioc
            - limit_alo
            - market_ioc
            - stop_loss
            - take_profit
        reduceOnly:
          type: boolean
          default: false
        leverage:
          oneOf:
            - type: number
              exclusiveMinimum: 0
              maximum: 5
            - type: string
        nonce:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        expiresAt:
          type: integer
          minimum: 1
          maximum: 9007199254740991
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
          default: USER_SIGNED
          description: Preparation is not execution authority. Bounded submission additionally requires an owner grant and authenticated session and remains subject to the canonical rollout gate.
        intentHash:
          type: string
          pattern: ^[a-f0-9]{64}$
        signedAction:
          type: object
          description: Exact Hyperliquid action including FarmDash builder terms; sign this action without modification.
    PrepareOrderResponse:
      type: object
      required:
        - ok
        - state
        - executionMode
        - preparation
        - typedData
        - executeRequest
        - next_action
        - zeroCustody
        - privateKeyRequiredByFarmDash
        - timestamp
      properties:
        ok:
          type: boolean
          enum:
            - true
        state:
          type: string
          enum:
            - READY_FOR_LOCAL_SIGNATURE
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
          default: USER_SIGNED
          description: Preparation is not execution authority. Bounded submission additionally requires an owner grant and authenticated session and remains subject to the canonical rollout gate.
        preparation:
          type: object
          required:
            - agentAddress
            - coin
            - isBuy
            - size
            - price
            - orderType
            - accountAddress
            - reduceOnly
            - leverage
            - assetIndex
            - signedAction
            - nonce
            - expiresAt
            - intentHash
            - vaultAddress
            - builder
          properties:
            agentAddress:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
            accountAddress:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
            coin:
              type: string
              pattern: ^[a-zA-Z0-9]{1,16}$
            isBuy:
              type: boolean
            size:
              type: string
              pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
            price:
              type: string
              pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
            orderType:
              type: string
              enum:
                - limit_gtc
                - limit_ioc
                - limit_alo
                - market_ioc
                - stop_loss
                - take_profit
            reduceOnly:
              type: boolean
              default: false
            leverage:
              oneOf:
                - type: number
                  exclusiveMinimum: 0
                  maximum: 5
                - type: string
            nonce:
              type: integer
              minimum: 1
              maximum: 9007199254740991
            expiresAt:
              type: integer
              minimum: 1
              maximum: 9007199254740991
            intentHash:
              type: string
              pattern: ^[a-f0-9]{64}$
            signedAction:
              type: object
              description: Exact Hyperliquid action including FarmDash builder terms; sign this action without modification.
            assetIndex:
              type: integer
              minimum: 0
            vaultAddress:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
              nullable: true
            builder:
              type: object
              required:
                - b
                - f
                - basisPoints
                - approvedMaximumVenueUnitsTenthsBps
              properties:
                b:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                f:
                  type: integer
                  enum:
                    - 1
                basisPoints:
                  type: number
                  enum:
                    - 0.1
                approvedMaximumVenueUnitsTenthsBps:
                  type: integer
                  minimum: 1
        typedData:
          type: object
          required:
            - domain
            - types
            - primaryType
            - message
          properties:
            domain:
              type: object
              required:
                - name
                - version
                - chainId
                - verifyingContract
              properties:
                name:
                  type: string
                  enum:
                    - Exchange
                version:
                  type: string
                  enum:
                    - '1'
                chainId:
                  type: integer
                  enum:
                    - 1337
                verifyingContract:
                  type: string
                  enum:
                    - '0x0000000000000000000000000000000000000000'
            types:
              type: object
              additionalProperties:
                type: array
                items:
                  type: object
                  required:
                    - name
                    - type
                  properties:
                    name:
                      type: string
                    type:
                      type: string
            primaryType:
              type: string
              enum:
                - Agent
            message:
              type: object
              required:
                - source
                - connectionId
              properties:
                source:
                  type: string
                  enum:
                    - a
                    - b
                connectionId:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{64}$
        executeRequest:
          $ref: '#/components/schemas/PrepareOrderExecuteRequest'
        next_action:
          type: object
          required:
            - local
            - then
          properties:
            local:
              type: string
            then:
              type: string
        zeroCustody:
          type: boolean
          enum:
            - true
        privateKeyRequiredByFarmDash:
          type: boolean
          enum:
            - false
        timestamp:
          type: integer
          minimum: 1
          maximum: 9007199254740991
    ExecuteOrderRequest:
      type: object
      required:
        - agentAddress
        - coin
        - isBuy
        - size
        - price
        - orderType
        - nonce
        - expiresAt
        - intentHash
        - signature
      properties:
        executionTrialId:
          type: string
          description: Inherited durable futures lifecycle. Accepted orders commit; ambiguous submission stays held pending direct venue reconciliation.
        accountAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
          default: USER_SIGNED
          description: USER_SIGNED is preserved for unenrolled signers. Owner registration permanently enrolls the API wallet on its network across accounts, including after expiry/revocation; stripping mode/session fields cannot bypass bounded policy. Bounded dispatch returns nonretryable bounded_futures_preparation_only while rollout is not operational.
        grantId:
          type: string
          description: Required for BOUNDED_AUTONOMOUS
        sessionId:
          type: string
          description: Required for BOUNDED_AUTONOMOUS; binds session agent separately from API wallet
        sessionToken:
          type: string
          description: Session capability; alternatively X-FarmDash-Session-Token header
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        coin:
          type: string
        isBuy:
          type: boolean
        size:
          type: string
        price:
          type: string
        orderType:
          type: string
          enum:
            - limit_gtc
            - limit_ioc
            - limit_alo
            - market_ioc
            - stop_loss
            - take_profit
          description: '`market_ioc` is a signed, price-protected IOC limit order with a live 100 bps adverse-price cap, never an unbounded market order.'
        reduceOnly:
          type: boolean
          default: false
        leverage:
          oneOf:
            - type: number
            - type: string
        signedAction:
          type: object
          description: 'If supplied, must contain the signed FarmDash builder term `{ b: treasury, f: 1 }`; f is tenths of a basis point.'
        nonce:
          type: integer
        expiresAt:
          type: integer
        intentHash:
          type: string
        signature:
          $ref: '#/components/schemas/EIP712Signature'
    ExecuteOrderResponse:
      type: object
      properties:
        ok:
          type: boolean
        state:
          type: string
          enum:
            - fully_filled
            - partially_filled
            - zero_fill
            - resting_unfilled
            - rejected
            - unknown
        result:
          type: object
          properties:
            status:
              type: string
            response:
              type: object
        order:
          type: object
          properties:
            coin:
              type: string
            side:
              type: string
              enum:
                - buy
                - sell
            size:
              type: string
            price:
              type: string
            type:
              type: string
            reduceOnly:
              type: boolean
            leverage:
              type: number
            leverageStatus:
              type: string
              enum:
                - risk_check_metadata_only
            builderFee:
              type: object
              properties:
                recipient:
                  type: string
                venueUnitsTenthsBps:
                  type: number
                  example: 1
                basisPoints:
                  type: number
                  example: 0.1
                percent:
                  type: number
                  example: 0.001
                appliesTo:
                  type: string
                  enum:
                    - filled_notional_only
                signedInsideOrderAction:
                  type: boolean
        intentHash:
          type: string
        expiresAt:
          type: integer
        timestamp:
          type: integer
        error:
          type: string
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    CancelOrderRequest:
      type: object
      required:
        - agentAddress
        - coin
        - orderIds
        - nonce
        - expiresAt
        - intentHash
        - signature
      properties:
        executionMode:
          type: string
          enum:
            - USER_SIGNED
            - BOUNDED_AUTONOMOUS
          default: USER_SIGNED
          description: USER_SIGNED is preserved for unenrolled signers. Owner registration permanently enrolls the API wallet on its network across accounts, including after expiry/revocation; stripping mode/session fields cannot bypass bounded policy. Bounded dispatch returns nonretryable bounded_futures_preparation_only while rollout is not operational.
        grantId:
          type: string
          description: Required for BOUNDED_AUTONOMOUS
        sessionId:
          type: string
          description: Required for BOUNDED_AUTONOMOUS; binds session agent separately from API wallet
        sessionToken:
          type: string
          description: Session capability; alternatively X-FarmDash-Session-Token header
        agentAddress:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        coin:
          type: string
        orderIds:
          type: array
          minItems: 1
          maxItems: 50
          items:
            type: integer
        signedAction:
          type: object
        nonce:
          type: integer
        expiresAt:
          type: integer
        intentHash:
          type: string
        signature:
          $ref: '#/components/schemas/EIP712Signature'
    CancelOrderResponse:
      type: object
      properties:
        ok:
          type: boolean
        state:
          type: string
          enum:
            - accepted
            - rejected
            - partially_rejected
            - unknown
          description: '`accepted` is application acknowledgement, not final venue cancellation.'
        result:
          type: object
          properties:
            status:
              type: string
            response:
              type: object
        cancellation:
          type: object
          properties:
            accountAddress:
              type: string
            coin:
              type: string
            orderIds:
              type: array
              items:
                type: integer
            count:
              type: integer
            perOrder:
              type: array
              items:
                type: object
                properties:
                  orderId:
                    type: integer
                  status: {}
        reconciliation:
          type: object
          description: Required handoff for final venue cancellation evidence.
          properties:
            required:
              type: boolean
              enum:
                - true
            endpoint:
              type: string
              enum:
                - /api/v1/agent/futures/reconcile-order
            orderIds:
              type: array
              items:
                type: integer
        intentHash:
          type: string
        expiresAt:
          type: integer
        timestamp:
          type: integer
        error:
          type: string
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/DustStormWarning'
    AgentMeta:
      type: object
      properties:
        name:
          type: string
        version:
          type: string
        framework:
          type: string
        capabilities:
          type: array
          items:
            type: string
    AutopilotConfig:
      type: object
      properties:
        strategies:
          type: array
          items:
            type: string
            enum:
              - funding_arb
              - momentum
              - mean_reversion
              - portfolio_rebalance
              - full_auto
        assets:
          type: array
          items:
            type: string
        maxEquityPct:
          type: number
        rebalanceIntervalMin:
          type: integer
        autoCompound:
          type: boolean
        riskPreference:
          type: string
          enum:
            - conservative
            - balanced
            - aggressive
        riskSentinel:
          $ref: '#/components/schemas/RiskSentinelConfig'
        executionAlpha:
          $ref: '#/components/schemas/ExecutionAlphaConfig'
    RiskSentinelConfig:
      type: object
      properties:
        minHealthFactor:
          type: number
        minLiquidationBufferPct:
          type: number
        maxStablecoinDepegPct:
          type: number
    ExecutionAlphaConfig:
      type: object
      properties:
        mevSafetyMode:
          $ref: '#/components/schemas/SwapSafetyMode'
        maxQuoteDecayBps:
          type: number
        maxGasUsdPerAction:
          type: number
        requirePositiveNetEdge:
          type: boolean
        minNetEdgeUsd:
          type: number
    RebalanceContext:
      type: object
      properties:
        expectedUpsideUsd:
          type: number
          nullable: true
        bridgeFeeUsd:
          type: number
          nullable: true
        gasUsd:
          type: number
          nullable: true
        riskBufferUsd:
          type: number
          nullable: true
        currentChain:
          type: string
          nullable: true
        targetChain:
          type: string
          nullable: true
    AutopilotRiskStatus:
      type: object
      properties:
        dailyPnlPct:
          type: number
        weeklyPnlPct:
          type: number
        drawdownPct:
          type: number
        openPositions:
          type: integer
        aggregateLeverage:
          type: number
        healthFactor:
          type: number
          nullable: true
        liquidationBufferPct:
          type: number
          nullable: true
        stablecoinDepegPct:
          type: number
          nullable: true
        quoteDecayBps:
          type: number
          nullable: true
        gasPerActionUsd:
          type: number
          nullable: true
        alerts:
          type: array
          items:
            type: string
        isTradingAllowed:
          type: boolean
        haltReason:
          type: string
          nullable: true
    TrackedPosition:
      type: object
      properties:
        coin:
          type: string
        side:
          type: string
          enum:
            - long
            - short
        entryPrice:
          type: number
        size:
          type: number
        leverage:
          type: number
        stopLoss:
          type: number
          nullable: true
        takeProfit:
          type: number
          nullable: true
        openedAt:
          type: string
          format: date-time
        strategy:
          type: string
        unrealizedPnl:
          type: number
    DelegationRecord:
      type: object
      properties:
        ownerAddress:
          type: string
        apiWalletAddress:
          type: string
        verified:
          type: boolean
        verifiedAt:
          type: string
          format: date-time
          nullable: true
    AgentSession:
      type: object
      properties:
        id:
          type: string
        agentAddress:
          type: string
        status:
          type: string
          enum:
            - active
            - paused
            - halted
            - expired
        delegation:
          $ref: '#/components/schemas/DelegationRecord'
        autopilot:
          $ref: '#/components/schemas/AutopilotConfig'
        activePositions:
          type: array
          items:
            $ref: '#/components/schemas/TrackedPosition'
        sessionPnl:
          type: number
        peakEquity:
          type: number
        tradeCount:
          type: integer
        lastHeartbeat:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
        agentMeta:
          $ref: '#/components/schemas/AgentMeta'
    DelegationResponse:
      type: object
      properties:
        ok:
          type: boolean
        delegation:
          $ref: '#/components/schemas/DelegationRecord'
        message:
          type: string
        warning:
          type: string
    AutopilotAction:
      type: object
      properties:
        type:
          type: string
          enum:
            - analyze
            - execute
            - adjust_stop
            - close_position
            - rebalance
            - skip
            - halt
        asset:
          type: string
        reason:
          type: string
        details:
          type: object
        priority:
          type: string
          enum:
            - high
            - medium
            - low
    OnboardResponse:
      type: object
      properties:
        ok:
          type: boolean
        welcome:
          type: string
        version:
          type: string
        quickStart:
          type: object
          properties:
            summary:
              type: string
            steps:
              type: array
              items:
                type: object
                properties:
                  step:
                    type: integer
                  name:
                    type: string
                  description:
                    type: string
                  action:
                    type: string
                  endpoint:
                    type: string
                    nullable: true
                  required:
                    type: boolean
        capabilities:
          type: object
        security:
          type: object
        autonomousWorkflow:
          type: object
        discovery:
          type: object
        pricing:
          type: object
x-farmdash-capability-truth: {"spot.USER_SIGNED":{"status":"operational","prerequisite":"Healthy execution governor, quote provider, RPC and durable receipt store; customer signs and submits."},"spot.BOUNDED_AUTONOMOUS":{"status":"operational","prerequisite":"Owner-signed EVM grant, exact simulation/calldata binding, durable budget and customer-local signer authority."},"futures.USER_SIGNED":{"status":"operational","prerequisite":"Venue account ownership, local action signature, builder approval, risk/research gates and durable order control."},"futures.BOUNDED_AUTONOMOUS":{"status":"operational","prerequisite":"Authenticated owner-bound futures policy, authorized local API-wallet signature, durable nonce/budget/order controls."},"solana.USER_SIGNED":{"status":"operational","prerequisite":"Native Jupiter/RPC route, durable preparation and finality store; customer signs and broadcasts."},"solana.BOUNDED_AUTONOMOUS":{"status":"operational","prerequisite":"Native owner-signed Solana policy; local key must be an actual required transaction signer. Policy creates no on-chain authority."},"ERC4337_SERVER_SUBMISSION":{"status":"preparation_only","prerequisite":"Qualified tenant/account authorization and session-key policy enforcement on public forwarding, configured bundler, durable claims and verified receipt integration."},"GENERIC_SERVER_INTENT_EXECUTION":{"status":"preparation_only","prerequisite":"Trusted executable adapter, exact signed-transaction binding and canonical receipt verifier."},"MEE":{"status":"preparation_only","prerequisite":"Production coordinator and authoritative source/destination receipt verifier."},"ACP":{"status":"deployment_prerequisite","prerequisite":"AcpReadinessService paidWorkflowReady, evaluator/client identities, migrations, funding/finality workers and Base RPC."}}
x-farmdash-example-contract:
  version: 1
  examples_are_illustrative: true
  live_response_is_authoritative: true
  security_note: Never copy example signatures, nonces, hashes, payment destinations, or timestamps into a real transaction.
  x402_note: Live HTTP 402 and PAYMENT-REQUIRED are authoritative. Payment grants eligible API capacity only; never wallet signing or execution authority.
x-farmdash-simulation-contract:
  invariant: simulation != execution; simulation never grants wallet authority, broadcasts a transaction, or proves settlement
  execution_preflight:
    endpoint: /v1/simulate
    operationId: simulateSwapExecution
    side_effects: none
    grants_execution_authority: false
    broadcasts_transaction: false
    proves_settlement: false
    binding: wallet + fd_intent_* quote intent + transaction fingerprint + freshness window
  research_projection:
    operationId: simulatePoints
    side_effects: none
    grants_execution_authority: false
    authoritative_for_execution: false
  futures_research:
    operationId: analyzeStrategy
    simulation_methodology: heuristic_preflight
    grants_execution_authority: false
    authoritative_for_execution: false
  solana_preparation:
    operationId: prepareSolanaSwap
    simulation: authoritative RPC preflight is embedded before prepared transaction return
    grants_execution_authority: false
    broadcasts_transaction: false
    proves_settlement: false
