{
  "openapi": "3.1.0",
  "info": {
    "title": "Pro Yield API",
    "version": "0.1.0",
    "summary": "Non-custodial stablecoin yield infrastructure on HyperEVM (chain id 999).",
    "description": "Read + build endpoints for integrating Pro Yield's non-custodial USDC vault (blue-chip lending venues; 10% performance fee only on profits; withdraw anytime).\n\n- GET /api/yield/strategies — vault identity, live on-chain caps (TVL cap, per-user cap, paused state), deployed strategy split, curated venue rates with safety tiers. Every figure sourced and dated.\n- GET /api/yield/positions — live position reads for any wallet (vault shares, share value via the vault's own offset share math, wallet USDC).\n- GET /api/yield/series — the vault's daily share-price series from the signed attestation feed (one point per day + daily growth in basis points; no interpolation). The free read of the same data as GET /api/agents/series.\n- POST /api/yield/build-tx — returns UNSIGNED transaction calldata (approve/deposit/withdraw) for the caller's own wallet to simulate, sign and broadcast. Pro Yield never signs, never custodies, never holds keys. Byte-parity with the Pro Yield app's own flows; full chain-state validation (caps, pause, balances, minimums).\n\nNo API key required today. Open CORS. Per-IP rate limits apply (429 with Retry-After). All responses JSON; errors fail closed with a stable machine-readable `error` code plus a human `message`.\n\nA browser widget (deposit/withdraw card) is available: https://pyd.fi/widget.js with a demo at https://pyd.fi/widget-demo.",
    "x-guidance": "Pro Yield publishes two surfaces. (1) FREE human/partner reads under /api/yield/*: GET /api/yield/strategies for the vault catalog and curated venue rates, GET /api/yield/positions?address=0x… for a wallet position, GET /api/yield/series for the daily share-price series, POST /api/yield/build-tx for UNSIGNED deposit/withdraw calldata the caller signs itself. No key, rate-limited, open CORS. (2) A PAID machine surface under /api/agents/* at $0.010 per call in USDC via x402 v2 (EIP-3009, no signup): GET /api/agents is a free index, then /api/agents/yields, /vault, /all (both in one call) and /series. Start by calling the free index; a paid request with no PAYMENT-SIGNATURE header returns HTTP 402 with the terms in the PAYMENT-REQUIRED header (base64 JSON, one `accepts[]` entry per accepted network). Sign exactly one entry, resend with PAYMENT-SIGNATURE, and read the settlement from PAYMENT-RESPONSE. Echo the chosen `accepts[]` entry verbatim (EIP-3009 `signature` at the payload level, not nested inside the authorization) — a payload that does not echo a served field is answered with a 402 challenge that names it, never an opaque gateway error. Every number is a sourced, dated read — never simulated, and never a promise of future returns. Aggregate machine-payment tally (no payer data) at GET /api/x402/stats.",
    "contact": {
      "name": "Pro Yield",
      "url": "https://proyield.fi",
      "email": "team@proyield.fi"
    },
    "license": {
      "name": "Proprietary",
      "identifier": "LicenseRef-ProYield-PartnerTerms"
    }
  },
  "servers": [
    {
      "url": "https://pyd.fi",
      "description": "Production — free human/partner API under /api/yield/*, x402 machine surface under /api/agents/*"
    }
  ],
  "tags": [
    {
      "name": "yield",
      "description": "Pro Yield vault reads and transaction builders"
    },
    {
      "name": "agents",
      "description": "x402 pay-per-call surface for AI agents and machines (USDC, EIP-3009, no signup). Base is the primary network; additional chains are enabled server-side and listed in the free index."
    }
  ],
  "paths": {
    "/api/yield/strategies": {
      "get": {
        "operationId": "getStrategies",
        "tags": [
          "yield"
        ],
        "summary": "Vault catalog: caps, strategies, venue rates",
        "description": "Upstream failures degrade rather than 5xx: the affected field comes back `null` and an entry is appended to `errors[]` on a 200 — never a substituted number, and this path declares no 5xx response. Live vault data for integration UIs and agents: on-chain caps read at request time (tvlCap, perUserCap, depositsPaused), the deployed strategy split, and the curated lending venue rates with safety tiers. Figures are sourced and dated; `blend.target_pct` is a policy anchor from measured history, NOT a guaranteed rate (`guarantee: false`).",
        "responses": {
          "200": {
            "description": "Strategy catalog + live caps",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyCatalog"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": []
      }
    },
    "/api/yield/positions": {
      "get": {
        "operationId": "getPositions",
        "tags": [
          "yield"
        ],
        "summary": "Live wallet position (shares, value, wallet USDC)",
        "description": "Pure chain reads: vault shares for the address, the assets those shares redeem for (the vault's offset share math, floor-rounded like the contract), the live share price, and the wallet's HyperEVM USDC balance. Nothing stored. A wallet-balance read failure degrades to `null` plus an `errors[]` entry — never a substituted number.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "description": "0x-prefixed 20-byte EVM address to read.",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            },
            "example": "0x8954a73Bb36D17e4B212137Eb7B2328A1A14D1C1"
          }
        ],
        "responses": {
          "200": {
            "description": "Live position",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Position"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidAddress"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          }
        },
        "security": []
      }
    },
    "/api/yield/series": {
      "get": {
        "operationId": "getSharePriceSeries",
        "tags": [
          "yield"
        ],
        "summary": "Daily share-price series + daily bps growth (free)",
        "description": "The vault's own signed daily attestation series — the same data the paid GET /api/agents/series serves: one point per day (`points[]`) plus consecutive-day growth in basis points (`daily_growth_bps[]`). Both surfaces derive from ONE shared implementation, so the numbers cannot drift. No interpolation and no simulated days — a day with no on-chain read reports `share_price_usdc: null` (an honest empty state, never 0) and the bps entry that depends on it is null too. A failed feed read degrades to an honest empty series plus an `errors[]` entry on a 200 — never a substituted number, and this path declares no 5xx. History is a record of the past, not a forecast or a promised rate.",
        "responses": {
          "200": {
            "description": "Share-price series (+ `errors[]` when the feed read degraded)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeriesFeed"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": []
      }
    },
    "/api/yield/build-tx": {
      "post": {
        "operationId": "buildTx",
        "tags": [
          "yield"
        ],
        "summary": "Unsigned deposit/withdraw calldata",
        "description": "Builds UNSIGNED transactions for the caller's own wallet on HyperEVM (chain id 999).\n\nDeposit: [optional one-time MAX USDC approve] + deposit(amount). Minimum $1; full chain-state validation (deposits paused, vault TVL cap, per-user cap on position value + amount, wallet balance).\n\nWithdraw: withdrawUpTo(amount) — the resilient partial redemption: pays what idle + recalls can settle now; shares burn only for what is paid. Minimum $0.50; an amount above the position clamps to the position; `all: true` settles the full position (dust exit). Send either `amount_usdc` OR `all` — not both.\n\nResponses carry a `quote` (share price, estimates, expected paid) and `warnings[]` (e.g. partial-settlement previews). Pro Yield never signs or broadcasts; numbers are live reads at build time — sign promptly.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BuildTxRequest"
              },
              "examples": {
                "deposit": {
                  "summary": "Deposit $5 USDC",
                  "value": {
                    "action": "deposit",
                    "address": "0x8954a73Bb36D17e4B212137Eb7B2328A1A14D1C1",
                    "amount_usdc": "5"
                  }
                },
                "withdrawAll": {
                  "summary": "Withdraw the full position",
                  "value": {
                    "action": "withdraw",
                    "address": "0x8954a73Bb36D17e4B212137Eb7B2328A1A14D1C1",
                    "all": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Unsigned transactions + quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuildTxResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "404": {
            "description": "Endpoint disabled via kill-switch (`error: not_enabled`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Vault state blocks the action (`deposits_paused`, `tvl_cap_reached`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (`below_minimum`, `per_user_cap_exceeded`, `insufficient_balance`, `nothing_to_withdraw`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/UpstreamUnavailable"
          }
        },
        "security": []
      }
    },
    "/api/agents": {
      "get": {
        "operationId": "getAgentIndex",
        "tags": [
          "agents"
        ],
        "summary": "Free index: paid endpoints, prices, accepted payment networks",
        "description": "No payment required. Lists every paid endpoint with its price, and the payment networks currently accepted (Base primary; the live list is authoritative — it is not a promise that every chain in the code's registry is switched on).",
        "responses": {
          "200": {
            "description": "Index",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentIndex"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": []
      }
    },
    "/api/agents/yields": {
      "get": {
        "operationId": "getAgentYields",
        "tags": [
          "agents"
        ],
        "summary": "Curated venue rates + blend target + provenance ($0.010)",
        "description": "x402 v2 pay-per-call, $0.010 in USDC (EIP-3009). A request with no payment header returns 402 with a PAYMENT-REQUIRED header (base64 JSON) whose `accepts[]` lists one payment requirement per accepted network. Sign one of them, resend with PAYMENT-SIGNATURE, and the response carries a PAYMENT-RESPONSE header with the settlement result. Echo the chosen `accepts[]` entry verbatim (`maxTimeoutSeconds` and `extra` included) with the EIP-3009 `signature` at the payload level — a shape-variant payload gets a precise 402 challenge naming the missing field, never an opaque gateway error. The payment is gasless for the payer. x402 v1 buyer tooling may send the v1 `X-PAYMENT` header instead of `PAYMENT-SIGNATURE` (accepted as an alias; a v1-shaped echo with `maxAmountRequired` and no `extra` is tolerated), and a settled response also carries the v1 `X-PAYMENT-RESPONSE` receipt header alongside `PAYMENT-RESPONSE`. Rates are sourced and dated; the blend target is a policy anchor, not a promised rate.",
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/api/agents/vault": {
      "get": {
        "operationId": "getAgentVault",
        "tags": [
          "agents"
        ],
        "summary": "Vault state + live caps (+ position with ?address=) ($0.010)",
        "description": "Same payment contract as /agents/yields. Live eth_calls at request time: share price, total assets, TVL cap, per-user cap, deposits-paused. Supply ?address= to also get that wallet's share balance, position value and wallet USDC.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": false,
            "description": "Optional 0x-prefixed 20-byte EVM address. A malformed value is reported in `errors[]` and the position is omitted — never substituted.",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/api/agents/all": {
      "get": {
        "operationId": "getAgentAll",
        "tags": [
          "agents"
        ],
        "summary": "Yields + vault (+ position) in ONE $0.010 call",
        "description": "Bundle of /agents/yields and /agents/vault for the same single $0.010 charge: `yields` and `vault` sub-objects, identical to the individual endpoints. Supply ?address= to include the wallet position. Nothing extra is invented — this is the cheaper-feeling way to get the whole picture.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": false,
            "description": "Optional 0x-prefixed 20-byte EVM address for the position block.",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/api/agents/series": {
      "get": {
        "operationId": "getAgentSeries",
        "tags": [
          "agents"
        ],
        "summary": "Daily share price + daily bps growth from the attestation feed ($0.010)",
        "description": "The vault's own signed daily attestation series: one point per day (`points[]`) plus consecutive-day growth in basis points (`daily_growth_bps[]`). No interpolation and no simulated days — a day with no on-chain read reports `share_price_usdc: null`, and the bps entry that depends on it is null too. History is a record of the past, not a forecast or a promised rate.",
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/api/agents/brief": {
      "get": {
        "operationId": "getAgentBrief",
        "tags": [
          "agents"
        ],
        "summary": "Allocator brief: rates + vault + attestation in one call ($0.100)",
        "description": "One call that joins four Pro Yield feeds: the blend target and sleeve allocation with ranked venue rates and their dispersion (`rates`), live vault state including cap headroom and utilisation (`vault`), the signed attestation status with measured share-price growth over 7 and 30 days (`attestation`), and the flags those numbers set (`watch[]`). Growth is measured between attested points only — no interpolation, no simulated days — and `basis` states the span actually measured when the feed is shorter than the window. Every block carries its source and timestamp; a failed feed appears in `errors[]` with its block null rather than a substitute number. Use instead of four separate $0.010 calls.",
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        },
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.100000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        }
      }
    },
    "/api/x402/stats": {
      "get": {
        "operationId": "getX402Stats",
        "tags": [
          "agents"
        ],
        "summary": "Aggregate machine-payment tally (public, no payment)",
        "description": "Aggregate only, by construction: settled call count, total USDC received, first/last settlement timestamps. Never payer addresses, resources, transaction hashes or per-call rows. A failed ledger read reports `null` — never a false zero.",
        "responses": {
          "200": {
            "description": "Aggregate tally",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/X402Stats"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "security": []
      }
    },
    "/api/agents/risk": {
      "get": {
        "operationId": "getAgentRisk",
        "tags": [
          "agents"
        ],
        "summary": "Per-venue due-diligence register joined to live rates ($0.030)",
        "description": "Returns Pro Yield's per-venue due-diligence register: the verdicts we reached on the venues examined for our sleeves, each quoted verbatim from its DD document (`verdict_headline`) with the document path (`doc`), review date (`reviewed`), evidence grade, mandate-check results and conditions. Entries are joined to the live rates feed where a venue appears in it (`live`); a venue that is not in the feed has `live: null` and is never estimated or carried forward. `verdict_basis` states which part of the DD document the quote came from, and `conditions[]` carries the flip/integration blockers, which are a separate question from whether the venue passed DD. `excluded[]` names the two context documents that carry no per-venue verdict. This is our procurement analysis, not a rating-agency opinion and not investment advice: Pro Yield does not audit venues, and no entry is a recommendation to buy. Degrades like every other kind - a failed feed appears in `errors[]` with its block null.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.030000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "responses": {
          "200": {
            "description": "Paid response (PAYMENT-RESPONSE header carries the settlement)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaidResponse"
                }
              }
            }
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "409": {
            "$ref": "#/components/responses/PaymentReplay"
          },
          "404": {
            "$ref": "#/components/responses/AgentDisabled"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/SettleUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "RateLimited": {
        "description": "Per-IP rate limit hit. Retry after the `Retry-After` seconds.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "rate_limited",
              "message": "Too many requests — try again shortly."
            }
          }
        }
      },
      "InvalidAddress": {
        "description": "Missing or malformed address.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid_address",
              "message": "Provide ?address= as a 0x-prefixed 20-byte hex address."
            }
          }
        }
      },
      "InvalidRequest": {
        "description": "Malformed body / field combination.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid_body",
              "message": "Provide either \"amount_usdc\" or \"all\": true — not both."
            }
          }
        }
      },
      "UpstreamUnavailable": {
        "description": "Transient chain-read failure — retry. Served as **503 Service Unavailable** (not 502): Cloudflare's edge replaces an origin-returned 502/504 with its own error page on a custom domain, which would hide this JSON body (the `message` / `detail`) from a caller on https://pyd.fi; 503 passes through untouched. `error` is `upstream_unavailable`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "upstream_unavailable",
              "message": "Chain reads failed — retry."
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "No (or unmatched) payment attached. The terms travel in the `PAYMENT-REQUIRED` header as base64-encoded JSON (x402 v2): `accepts[]` holds one requirement per accepted network (scheme `exact`, CAIP-2 `network`, `amount` in atomic USDC, `asset`, `payTo`, `maxTimeoutSeconds`, EIP-712 `extra`). Sign ONE of them (EIP-3009 transferWithAuthorization) and resend with `PAYMENT-SIGNATURE` — or, for x402 v1 buyer tooling, with the v1 `X-PAYMENT` header (accepted as an alias; the v1-shaped body entry is tolerated as-is).",
        "headers": {
          "PAYMENT-REQUIRED": {
            "description": "base64 JSON payment terms.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PaymentChallenge"
            }
          }
        }
      },
      "PaymentReplay": {
        "description": "This authorization was already settled. Sign a new one — replay protection is per authorization nonce.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "payment_replay",
              "message": "This payment authorization was already settled. Sign a new authorization."
            }
          }
        }
      },
      "SettleUnavailable": {
        "description": "Payment could not be settled (facilitator unreachable or settle failed). NOTHING was settled — retry with the same authorization. Served as **503 Service Unavailable** (not 502): Cloudflare's edge replaces an origin-returned 502/504 with its own error page on a custom domain, which would hide this JSON body; 503 passes through. `error` is `upstream_unavailable` or `settle_failed`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "upstream_unavailable",
              "message": "Payment processing failed — nothing was settled. Retry."
            }
          }
        }
      },
      "AgentDisabled": {
        "description": "The paid surface is switched off (kill-switch) — the whole /api/agents/* tree 404s.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "not_found"
            }
          }
        }
      }
    },
    "schemas": {
      "AgentIndex": {
        "type": "object",
        "description": "Free index of the paid machine surface.",
        "required": [
          "api",
          "version",
          "kind",
          "price_usd",
          "networks",
          "endpoints"
        ],
        "properties": {
          "api": {
            "type": "string",
            "const": "proyield-x402"
          },
          "version": {
            "type": "integer",
            "const": 2
          },
          "kind": {
            "type": "string",
            "const": "index"
          },
          "note": {
            "type": "string",
            "description": "Human note naming the accepted payment networks."
          },
          "why_pay": {
            "type": "string",
            "description": "Why the paid tier exists: the free /api/yield/* tier serves the same data, so this tier's differentiator is no signup, no account, no API key — pay per call with a gasless authorization instead of registering. (F-21)"
          },
          "price_usd": {
            "type": "object",
            "description": "Price per endpoint, in USD, as published at read time.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "networks": {
            "type": "array",
            "description": "Payment networks currently accepted. The first entry is primary. Authoritative — do not assume chains that are not listed.",
            "items": {
              "type": "object",
              "required": [
                "network",
                "label",
                "asset",
                "decimals",
                "primary"
              ],
              "properties": {
                "network": {
                  "type": "string",
                  "description": "CAIP-2 id, e.g. eip155:8453."
                },
                "label": {
                  "type": "string"
                },
                "asset": {
                  "type": "string",
                  "description": "USDC contract on that network."
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Decimals of that network's USDC asset (6 today; read from the payment registry, not assumed)."
                },
                "primary": {
                  "type": "boolean"
                }
              }
            }
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "resource",
                "price_usd",
                "amount",
                "asset",
                "decimals",
                "network",
                "description"
              ],
              "properties": {
                "resource": {
                  "type": "string",
                  "format": "uri"
                },
                "price_usd": {
                  "type": "string",
                  "description": "Price in USD, as published at read time."
                },
                "amount": {
                  "type": "string",
                  "description": "The same price in atomic USDC units — the value the 402 carries as `amount` (v2) / `maxAmountRequired` (v1-shaped body)."
                },
                "asset": {
                  "type": "string",
                  "description": "USDC contract for `network`."
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Decimals of the USDC asset for `network`, so `amount` and `price_usd` can be reconciled without out-of-band knowledge."
                },
                "network": {
                  "type": "string",
                  "description": "CAIP-2 id of the network this price entry quotes (the primary accepted network)."
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            }
          },
          "free_equivalents": {
            "type": "string"
          }
        }
      },
      "PaymentChallenge": {
        "type": "object",
        "description": "Body of a 402. The machine-readable terms are in the PAYMENT-REQUIRED header; this body repeats the resource metadata.",
        "required": [
          "x402Version",
          "resource",
          "accepts"
        ],
        "properties": {
          "x402Version": {
            "type": "integer",
            "const": 2
          },
          "error": {
            "type": "string"
          },
          "resource": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "description": {
                "type": "string",
                "maxLength": 500
              },
              "mimeType": {
                "type": "string"
              },
              "serviceName": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "iconUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "accepts": {
            "type": "array",
            "description": "One payment requirement per accepted network; sign exactly one.",
            "items": {
              "type": "object",
              "required": [
                "scheme",
                "network",
                "amount",
                "asset",
                "payTo",
                "maxTimeoutSeconds"
              ],
              "properties": {
                "scheme": {
                  "type": "string",
                  "const": "exact"
                },
                "network": {
                  "type": "string",
                  "description": "CAIP-2 id."
                },
                "amount": {
                  "type": "string",
                  "description": "Atomic USDC (6 decimals). 10000 = $0.010."
                },
                "asset": {
                  "type": "string",
                  "description": "USDC contract address on this network."
                },
                "payTo": {
                  "type": "string",
                  "description": "Recipient address (protocol treasury Safe)."
                },
                "maxTimeoutSeconds": {
                  "type": "integer"
                },
                "extra": {
                  "type": "object",
                  "description": "EIP-712 domain for the transferWithAuthorization signature.",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "extensions": {
            "type": "object"
          }
        }
      },
      "AgentPaidResponse": {
        "type": "object",
        "description": "Endpoint-specific paid payload. Every response carries `api`, `version`, `kind`, a `network` provenance block, `notes[]` and `errors[]`; figures are sourced and dated, and a failed sub-read is reported in `errors[]` rather than replaced with a number.",
        "required": [
          "api",
          "version",
          "kind",
          "network"
        ],
        "properties": {
          "api": {
            "type": "string",
            "const": "proyield-x402"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "yields",
              "vault",
              "all",
              "series",
              "brief",
              "risk"
            ]
          },
          "as_of": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "network": {
            "type": "object",
            "required": [
              "name",
              "chain_id",
              "payments"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "Chain the DATA comes from."
              },
              "chain_id": {
                "type": "integer"
              },
              "payments": {
                "type": "string",
                "description": "Networks the payment could be settled on, with their CAIP-2 ids."
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "X402Stats": {
        "type": "object",
        "description": "Aggregate machine-payment tally. Nulls mean the read failed — never a substituted zero.",
        "required": [
          "api",
          "kind",
          "calls_settled",
          "total_received_usdc"
        ],
        "properties": {
          "api": {
            "type": "string",
            "const": "proyield-x402"
          },
          "version": {
            "type": "integer"
          },
          "kind": {
            "type": "string",
            "const": "x402_stats"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "calls_settled": {
            "type": [
              "integer",
              "null"
            ]
          },
          "total_received_atomic": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_received_usdc": {
            "type": [
              "number",
              "null"
            ]
          },
          "first_settled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_settled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "note": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Stable machine-readable code."
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation."
          },
          "remaining_usdc": {
            "type": "number"
          },
          "cap_usdc": {
            "type": "number"
          },
          "balance_usdc": {
            "type": "number"
          },
          "detail": {
            "type": "string"
          }
        }
      },
      "Network": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "HyperEVM Mainnet"
          },
          "chain_id": {
            "type": "integer",
            "example": 999
          }
        }
      },
      "Caps": {
        "type": "object",
        "description": "Live on-chain launch caps.",
        "properties": {
          "tvl_usdc": {
            "type": [
              "number",
              "null"
            ],
            "description": "Vault TVL cap in USDC."
          },
          "per_user_usdc": {
            "type": [
              "number",
              "null"
            ],
            "description": "Per-wallet position cap in USDC."
          },
          "deposits_paused": {
            "type": "boolean"
          }
        }
      },
      "Strategy": {
        "type": "object",
        "properties": {
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "assets_usdc": {
            "type": [
              "number",
              "null"
            ]
          },
          "apy_pct": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "StrategyCatalog": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "strategy_catalog"
          },
          "as_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "Feed timestamp the strategy split is dated to."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "network": {
            "$ref": "#/components/schemas/Network"
          },
          "vault": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "address": {
                "type": "string"
              },
              "share_price_usdc": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "total_assets_usdc": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "total_shares": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "idle_usdc": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "caps": {
                "$ref": "#/components/schemas/Caps"
              },
              "flags": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": true
              }
            }
          },
          "strategies": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Strategy"
            }
          },
          "blend": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "target_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "guarantee": {
                "type": "boolean"
              },
              "note": {
                "type": "string"
              }
            }
          },
          "venue_rates": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Position": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "position"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "network": {
            "$ref": "#/components/schemas/Network"
          },
          "address": {
            "type": "string"
          },
          "vault": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string"
              },
              "shares": {
                "type": "number"
              },
              "value_usdc": {
                "type": "number"
              },
              "share_price_usdc": {
                "type": "number"
              },
              "percent_of_vault": {
                "type": "number"
              },
              "total_assets_usdc": {
                "type": "number"
              },
              "total_shares": {
                "type": "number"
              }
            }
          },
          "wallet": {
            "type": "object",
            "properties": {
              "usdc_hyperevm": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "null when the wallet read failed — see errors[]."
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SeriesPoint": {
        "type": "object",
        "description": "One daily attestation point. `share_price_usdc` is null on a day with no on-chain read — never 0.",
        "properties": {
          "date": {
            "type": [
              "string",
              "null"
            ],
            "description": "Attestation date (YYYY-MM-DD).",
            "example": "2026-09-26"
          },
          "chain_id": {
            "type": [
              "integer",
              "null"
            ],
            "example": 999
          },
          "share_price_usdc": {
            "type": [
              "number",
              "null"
            ]
          },
          "total_assets_usdc": {
            "type": [
              "number",
              "null"
            ]
          },
          "insurance_usdc": {
            "type": [
              "number",
              "null"
            ]
          },
          "coverage_ratio": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "SeriesGrowth": {
        "type": "object",
        "description": "Growth from the previous consecutive day, in basis points. null when either day has no share price — no fill-forward.",
        "properties": {
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "from_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "share_price_usdc": {
            "type": [
              "number",
              "null"
            ],
            "description": "The day's own share price (null when there was no on-chain read)."
          },
          "bps": {
            "type": [
              "number",
              "null"
            ],
            "description": "(share_price[day] / share_price[previous day] - 1) * 10_000, rounded to 4dp."
          }
        }
      },
      "SeriesFeed": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "share_price_series"
          },
          "as_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "Date of the last attestation point."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "network": {
            "$ref": "#/components/schemas/Network"
          },
          "source": {
            "type": "string",
            "description": "Where the series comes from (the signed attestation feed)."
          },
          "points_count": {
            "type": "integer"
          },
          "first_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeriesPoint"
            }
          },
          "daily_growth_bps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeriesGrowth"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Failed sub-reads, listed honestly. A non-empty array means a field above is null/empty — nothing is substituted."
          }
        }
      },
      "BuildTxRequest": {
        "type": "object",
        "required": [
          "action",
          "address"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "deposit",
              "withdraw"
            ]
          },
          "address": {
            "type": "string",
            "pattern": "^0x[a-fA-F0-9]{40}$"
          },
          "amount_usdc": {
            "type": [
              "string",
              "number"
            ],
            "description": "Positive decimal with ≤6 decimal places. Required for deposit; for withdraw send alongside action:\"withdraw\" unless using `all`."
          },
          "all": {
            "type": "boolean",
            "description": "Withdraw the full position (dust exit). Withdraw only; mutually exclusive with amount_usdc."
          }
        }
      },
      "Tx": {
        "type": "object",
        "properties": {
          "step": {
            "type": "string",
            "enum": [
              "approve",
              "deposit",
              "withdraw"
            ]
          },
          "to": {
            "type": "string",
            "description": "Contract to call."
          },
          "data": {
            "type": "string",
            "description": "0x-prefixed calldata."
          },
          "value": {
            "type": "string",
            "description": "Native value — always 0x0 (USDC flows only)."
          },
          "chain_id": {
            "type": "integer",
            "const": 999
          },
          "description": {
            "type": "string"
          }
        }
      },
      "BuildTxResponse": {
        "type": "object",
        "properties": {
          "api": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "const": "build_tx"
          },
          "action": {
            "type": "string",
            "enum": [
              "deposit",
              "withdraw"
            ]
          },
          "network": {
            "$ref": "#/components/schemas/Network"
          },
          "address": {
            "type": "string"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          },
          "amount_usdc": {
            "type": "number"
          },
          "amount_raw": {
            "type": "string",
            "description": "6-decimal atomic units."
          },
          "txs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tx"
            }
          },
          "quote": {
            "type": "object",
            "additionalProperties": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
