{
 "openapi": "3.1.0",
 "info": {
  "title": "Keldrin API",
  "version": "0.7.3",
  "description": "Verified corporate-action records for Coinbase tokenized stocks (B20) on Base. Read-only, informational; not an oracle or investment advice. Only independently CONFIRMED records are served. WAD values are exact integer strings scaled by 1e18. Read-only. Rate limited per client; successful reads are cached up to 60 s at the CDN.",
  "x-guidance": "Free one-stock routes under /v1. One-call snapshot (/v1/snapshot) and report (/v1/report?token=) give 3 free complete answers per client per day, then 402 FREE_TRIES_USED with the paid links. Paid: GET /api/snapshot and /api/report (forward to Bankr x402 Cloud): x402 v2, scheme exact, network eip155:8453, USDC, amount 50000 ($0.05), payTo 0x8AEE621035D93Deb3C0C1177fac252dC2dd501a0. Sign once, never re-sign automatically; only a 2xx is charged. Agent guide: https://keldrin.vercel.app/skill.md"
 },
 "servers": [
  {
   "url": "https://usekeldrin.co",
   "description": "production"
  },
  {
   "url": "https://keldrin.vercel.app",
   "description": "same deployment, kept for existing integrations"
  }
 ],
 "paths": {
  "/health": {
   "get": {
    "operationId": "getHealth",
    "summary": "Coverage, last run and limitations",
    "responses": {
     "200": {
      "description": "Health",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "object"
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets": {
   "get": {
    "operationId": "listAssets",
    "summary": "Tracked tokens with identity state and current multiplier",
    "responses": {
     "200": {
      "description": "Assets",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Asset"
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     }
    },
    "description": "Each token carries coverage_level (full = verified identity + independently CONFIRMED Chainlink NAV feed (DEX price only where verified pools exist, see capabilities.dex_price); market = verified DEX pools without a verified NAV; identity = identity and corporate actions only; unverified = identity check not passed; unknown = coverage could not be read) and a capabilities object (identity, corporate_actions, nav_history, risk, market_context, dex_price). meta.coverage_levels counts tokens per level. Each token carries supply_state (issued: totalSupply > 0; registered_not_issued: listed by Coinbase, no tokens issued yet; unknown) and missing_explained (plain-English reasons for each false capability); meta.supply_states counts them."
   }
  },
  "/v1/assets/{contract}": {
   "get": {
    "operationId": "getAsset",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Asset with identity checks",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Asset"
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad address",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Unknown asset",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/actions": {
   "get": {
    "operationId": "listActions",
    "summary": "Confirmed corporate actions, newest first",
    "parameters": [
     {
      "name": "contract",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "symbol",
      "in": "query",
      "description": "Exact token symbol (e.g. GOOGLc). Prefer contract.",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 200,
       "default": 50
      }
     },
     {
      "name": "cursor",
      "in": "query",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Page of issuer_action records",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "https://keldrin.invalid/schemas/issuer-action-v0.2.schema.json"
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Unknown symbol",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "409": {
      "description": "Ambiguous symbol",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/actions/{record_id}": {
   "get": {
    "operationId": "getAction",
    "parameters": [
     {
      "name": "record_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Record, review, revisions and company context",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "object",
           "required": [
            "record",
            "review",
            "revisions",
            "company_context"
           ],
           "properties": {
            "record": {
             "$ref": "https://keldrin.invalid/schemas/issuer-action-v0.2.schema.json"
            },
            "review": {
             "type": "object"
            },
            "revisions": {
             "type": "array"
            },
            "company_context": {
             "type": [
              "object",
              "null"
             ],
             "description": "SEC reconciliation (record_type=reconciliation); null when none is confirmed for this revision."
            }
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad record id",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "No confirmed record",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/llms.txt": {
   "get": {
    "operationId": "getLlmsTxt",
    "responses": {
     "200": {
      "description": "Agent index",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  },
  "/openapi.json": {
   "get": {
    "operationId": "getOpenApi",
    "responses": {
     "200": {
      "description": "This document",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    }
   }
  },
  "/v1/calendar": {
   "get": {
    "operationId": "getCalendar",
    "summary": "Declared dividends and the date each token is expected to adjust (leading calendar)",
    "description": "Entries come from SEC filing text (quote, document URL and sha256) and are independently re-verified. expected_adjustment_date is the payable date: an observed issuer pattern whose measured rate is stated in each entry's basis, not a guarantee.",
    "parameters": [
     {
      "name": "contract",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "state",
      "in": "query",
      "schema": {
       "enum": [
        "upcoming",
        "applied",
        "not_observed"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Calendar entries",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "type": "object"
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/events": {
   "get": {
    "operationId": "listEvents",
    "summary": "Applied and upcoming corporate actions in one list",
    "parameters": [
     {
      "name": "contract",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "enum": [
        "predicted",
        "confirmed_onchain",
        "verified_matched",
        "late",
        "unknown"
       ]
      }
     },
     {
      "name": "within_days",
      "in": "query",
      "description": "Only events expected to apply in the next N days (0-365), plus overdue ones",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "maximum": 365
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Events",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Event"
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Rate limited (see retry-after)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "description": "Every event carries status_description, its status in plain English."
   }
  },
  "/v1/changes": {
   "get": {
    "operationId": "listChanges",
    "summary": "Events added or whose status changed since a timestamp (poll with meta.as_of)",
    "parameters": [
     {
      "name": "since",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "contract",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "enum": [
        "predicted",
        "confirmed_onchain",
        "verified_matched",
        "late",
        "unknown"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changed events",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Event"
           }
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "Rate limited (see retry-after)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets/{contract}/nav/history": {
   "get": {
    "summary": "Chainlink NAV history for one token (verified feeds only)",
    "description": "Verbatim Chainlink rounds with feed, phase, aggregator and round id per point, so each value can be re-read onchain with getRoundData. Total-return NAV: it already includes dividends and splits. Official rounds only by default: inside the window in which the proxy served that aggregator, from an aggregator whose decimals match the proxy. interval=daily returns the last official round inside each New York trading day's regular session; trading days without one are listed in meta.quality.missing_trading_days and never filled. Served only when the feed's latest independent review is CONFIRMED, and only rounds that review covered. Returns 503 NAV_NOT_ENABLED until enabled by the operator.",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "interval",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "daily",
        "round"
       ],
       "default": "daily"
      }
     },
     {
      "name": "from",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      },
      "description": "Default: 90 days before `to` (daily) or 2026-01-01 (round)"
     },
     {
      "name": "to",
      "in": "query",
      "schema": {
       "type": "string",
       "format": "date"
      },
      "description": "Default: today (UTC)"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 1000,
       "default": 500
      },
      "description": "round interval only"
     },
     {
      "name": "include",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "official",
        "all"
       ],
       "default": "official"
      },
      "description": "all (interval=round only) also returns non-official rounds with official/proxy_live/decimals_ok flags"
     },
     {
      "name": "cursor",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^\\d{1,12}-\\d{1,30}$"
      },
      "description": "round interval only; pass meta.next_cursor back unchanged (order: updated_at, then round_id)"
     }
    ],
    "responses": {
     "200": {
      "description": "NAV points",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "meta"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/NavPoint"
           }
          },
          "meta": {
           "type": "object",
           "properties": {
            "token": {
             "type": "string"
            },
            "symbol": {
             "type": "string"
            },
            "feed": {
             "type": "string"
            },
            "decimals": {
             "type": "integer"
            },
            "interval": {
             "type": "string"
            },
            "semantics": {
             "type": "string"
            },
            "next_cursor": {
             "type": [
              "string",
              "null"
             ]
            },
            "quality": {
             "type": "object",
             "properties": {
              "rounds_indexed": {
               "type": "integer"
              },
              "first_round_at": {
               "type": [
                "string",
                "null"
               ]
              },
              "last_round_at": {
               "type": [
                "string",
                "null"
               ]
              },
              "missing_trading_days": {
               "type": "array",
               "items": {
                "type": "string"
               }
              },
              "not_covered_days": {
               "type": "array",
               "items": {
                "type": "string"
               }
              },
              "verification": {
               "type": "object"
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Unknown token (UNKNOWN_ASSET) or no NAV feed (NO_NAV_FEED)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "Not enabled (NAV_NOT_ENABLED) or feed not independently verified (NAV_NOT_VERIFIED)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/market/session": {
   "get": {
    "summary": "US equity session right now (NYSE calendar 2026-2027)",
    "responses": {
     "200": {
      "description": "Session",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "type": "object",
           "properties": {
            "session": {
             "type": "string",
             "enum": [
              "open",
              "pre",
              "after",
              "closed",
              "weekend",
              "holiday",
              "calendar_not_covered"
             ]
            },
            "ny_date": {
             "type": "string"
            },
            "ny_time": {
             "type": "string"
            },
            "is_trading_day": {
             "type": [
              "boolean",
              "null"
             ]
            },
            "early_close": {
             "type": "boolean"
            },
            "next_open": {
             "type": [
              "string",
              "null"
             ]
            },
            "next_close": {
             "type": [
              "string",
              "null"
             ]
            },
            "last_close": {
             "type": [
              "string",
              "null"
             ]
            },
            "calendar_version": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets/{contract}/market-context": {
   "get": {
    "summary": "Session, latest Chainlink NAV (live, with round id and age) and staleness for one token",
    "description": "The latest round is read live from Base's public RPC (reused up to 30 s in the server; responses are not CDN-cached) and served only if its phase was covered by the latest CONFIRMED review with matching decimals. staleness (method v2): trading (regular-session) seconds since the round, across days, against threshold = max(2 × the feed's p99 in-session gap, 30 min): fresh | expected_closed | unexpectedly_stale | unknown | calendar_not_covered. Failures degrade to nav: null with nav_unavailable_reason (no_nav_feed, feed_not_verified, rpc_unavailable, rpc_result_invalid, phase_not_reviewed, aggregator_decimals_differ_from_proxy). dex: the main verified pool's price, venue, pool, block, 2% depth and nav_premium_pct (DEX vs last published NAV), with a note when the market is closed. Returns 503 NAV_NOT_ENABLED until enabled. When the DEX-vs-NAV gap is shown, dex.gap_reflects_market_closure is true outside the regular session (the NAV is held at its last value).",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Market context"
     },
     "400": {
      "description": "Bad address",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "UNKNOWN_ASSET",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "NAV_NOT_ENABLED",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets/{contract}/corporate-actions": {
   "get": {
    "summary": "One token's verified corporate actions with multiplier and uiMultiplier detail",
    "description": "Same events as /v1/events for the token, plus operator description, announced_at, effective block/time, ui_multiplier_before/after_wad and its effective time (when the UIMultiplierUpdated event exists), announcement transactions and evidence links (onchain tx, Coinbase issuer record, SEC filing, Keldrin record).",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Corporate actions"
     },
     "400": {
      "description": "Bad address",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "UNKNOWN_ASSET",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets/{contract}/dex": {
   "get": {
    "summary": "Live DEX price of a tokenized stock on Base (onchain, one pinned block)",
    "description": "Reads Keldrin's independently verified pools (Uniswap v3, Aerodrome v2, Aerodrome Slipstream and plain no-hook Uniswap v4 pools against USDC, WETH or ETH) at one block from Base's public RPC. Per pool: price per token in the quote and in USD (ETH priced from the Uniswap v3 WETH/USDC 0.05% pool), estimated 2% depth in USD, status (ok, too_thin, outlier, unsupported, unreadable). main = deepest pool with depth >= $100 and price within 0.25x-4x of the median; thin_market when depth < $1,000. Never CDN-cached.",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "DEX price (main may be null with unavailable_reason)"
     },
     "400": {
      "description": "Bad address",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "UNKNOWN_ASSET",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/mcp": {
   "post": {
    "summary": "Remote MCP server (Streamable HTTP, stateless JSON; no SSE)",
    "description": "One JSON-RPC 2.0 message per POST (max 64 KB): initialize, ping, tools/list, tools/call. Read-only tools: list_assets, get_corporate_actions, get_nav_history, get_market_context, get_dex_price, get_market_session. Tool results carry a plain lead sentence, the JSON, and structuredContent; API errors come back as isError with the same codes as the REST API. Add with: claude mcp add --transport http keldrin https://keldrin.vercel.app/mcp",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "JSON-RPC response"
     },
     "202": {
      "description": "Notification accepted"
     },
     "400": {
      "description": "Parse error / invalid request"
     },
     "413": {
      "description": "Body over 64 KB"
     }
    }
   }
  },
  "/v1/snapshot": {
   "get": {
    "operationId": "snapshotFreeTry",
    "summary": "All verified stocks in one answer (3 free per day)",
    "description": "Every Coinbase tokenized stock on Base with a verified Chainlink NAV feed, in one answer: latest NAV with round id and age, freshness, main DEX price with depth and gap vs NAV, next corporate action; plus the US session. 3 free complete answers per client per UTC day (shared with /v1/report), then 402 FREE_TRIES_USED with the paid x402 links. Incomplete answers are 503 and use no try.",
    "responses": {
     "200": {
      "description": "Complete snapshot; meta.free_tries_left_today"
     },
     "402": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "503": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/report": {
   "get": {
    "operationId": "reportFreeTry",
    "summary": "Everything on one stock (3 free per day)",
    "description": "Everything keldrin verifies about one token in one answer: corporate actions with evidence, market context (live NAV, freshness, DEX gap), 30 daily NAV closes with round ids, every verified DEX pool. Same 3 free tries as /v1/snapshot, then 402.",
    "parameters": [
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Exact symbol (e.g. NVDAc) or 0x contract address"
     }
    ],
    "responses": {
     "200": {
      "description": "Complete report"
     },
     "400": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "402": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "409": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "503": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/snapshot": {
   "get": {
    "operationId": "snapshotPaid",
    "summary": "All verified stocks in one answer ($0.05 USDC on Base, x402)",
    "description": "Every Coinbase tokenized stock on Base with a verified Chainlink NAV feed, in one answer: latest NAV with round id and age, freshness, main DEX price with depth and gap vs NAV, next corporate action; plus the US session. Forwards to https://x402.bankr.bot/0xb98f0de777eea8c481b64e33d3e0066cea38fa91/keldrin-snapshot (same terms). Only a 2xx is charged.",
    "x-payment-info": {
     "price": "0.05",
     "currency": "USDC",
     "network": "eip155:8453",
     "scheme": "exact",
     "x402Version": 2,
     "amount": "50000",
     "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
     "payTo": "0x8AEE621035D93Deb3C0C1177fac252dC2dd501a0",
     "facilitator": "Bankr x402 Cloud"
    },
    "responses": {
     "200": {
      "description": "Complete snapshot (charged)"
     },
     "402": {
      "description": "Payment required (x402 v2): terms in the payment-required header (base64 JSON). scheme exact, network eip155:8453, USDC, amount 50000 ($0.05), payTo 0x8AEE621035D93Deb3C0C1177fac252dC2dd501a0.",
      "headers": {
       "payment-required": {
        "schema": {
         "type": "string"
        },
        "description": "Base64 JSON with the x402 payment requirements"
       }
      }
     },
     "503": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/api/report": {
   "get": {
    "operationId": "reportPaid",
    "summary": "Everything on one stock ($0.05 USDC on Base, x402)",
    "description": "Everything keldrin verifies about one token in one answer: corporate actions with evidence, market context (live NAV, freshness, DEX gap), 30 daily NAV closes with round ids, every verified DEX pool. Forwards to https://x402.bankr.bot/0xb98f0de777eea8c481b64e33d3e0066cea38fa91/keldrin-report (same terms). Only a 2xx is charged.",
    "parameters": [
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Exact symbol (e.g. NVDAc) or 0x contract address"
     }
    ],
    "x-payment-info": {
     "price": "0.05",
     "currency": "USDC",
     "network": "eip155:8453",
     "scheme": "exact",
     "x402Version": 2,
     "amount": "50000",
     "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
     "payTo": "0x8AEE621035D93Deb3C0C1177fac252dC2dd501a0",
     "facilitator": "Bankr x402 Cloud"
    },
    "responses": {
     "200": {
      "description": "Complete report (charged)"
     },
     "400": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "402": {
      "description": "Payment required (x402 v2): terms in the payment-required header (base64 JSON). scheme exact, network eip155:8453, USDC, amount 50000 ($0.05), payTo 0x8AEE621035D93Deb3C0C1177fac252dC2dd501a0.",
      "headers": {
       "payment-required": {
        "schema": {
         "type": "string"
        },
        "description": "Base64 JSON with the x402 payment requirements"
       }
      }
     },
     "404": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "409": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "503": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/v1/feedback": {
   "post": {
    "operationId": "feedback",
    "summary": "Website feedback form",
    "description": "Email required; X handle and message optional. 5 per client per day.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "email"
        ],
        "properties": {
         "email": {
          "type": "string"
         },
         "x": {
          "type": "string"
         },
         "message": {
          "type": "string",
          "maxLength": 1000
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Received"
     },
     "400": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     },
     "503": {
      "description": "Error (never charged)",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "error": {
           "type": "object",
           "properties": {
            "code": {
             "type": "string"
            },
            "message": {
             "type": "string"
            },
            "hint": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/skill.md": {
   "get": {
    "operationId": "skill",
    "summary": "Agent guide (when to use keldrin, how to read answers, how to pay)",
    "responses": {
     "200": {
      "description": "Markdown"
     }
    }
   }
  },
  "/v1/assets/{contract}/risk": {
   "get": {
    "summary": "NAV-based risk for one token (verified feeds only)",
    "description": "Deterministic risk from official Chainlink total-return NAV daily closes (the same closes as /nav/history?interval=daily, provisional sessions excluded): 30- and 60-day annualized volatility (sample sd of daily log returns x sqrt(252)), max drawdown since the first official close in the window (at most 400 days; see history_window) and over the last 90 closes with peak and trough round ids, and 1/5/20-day and since-start returns. Includes stale (more than 2 completed trading days since the newest close used) and excluded_days_no_decimal_value. A metric without enough history is null with the reason. Facts from history, not a forecast or advice. Returns 503 NAV_NOT_ENABLED until enabled by the operator.",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Risk metrics",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad input",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "404": {
      "description": "Unknown token (UNKNOWN_ASSET) or no NAV feed (NO_NAV_FEED)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "503": {
      "description": "Not enabled (NAV_NOT_ENABLED) or feed not independently verified (NAV_NOT_VERIFIED)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/v1/assets/{contract}/earnings": {
   "get": {
    "summary": "The company's earnings releases (SEC 8-K item 2.02)",
    "description": "SEC Form 8-K (and 8-K/A) filings that list item 2.02 (Results of Operations and Financial Condition) since 2025-01-01, with SEC's acceptance time (UTC), filed date, accession and links to the filing and its index. Read from SEC's submissions index (including its older pages, so complete since 2025-01-01) and served only after a re-check against the filing's own headers on www.sec.gov: form, item, filed date, acceptance time and filer CIK (latest review CONFIRMED). is_amendment marks an 8-K/A. Facts only: no estimates, consensus or predicted dates. Foreign issuers filing 6-K are not covered (meta.unavailable_reason).",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Earnings releases",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad address"
     },
     "404": {
      "description": "Unknown asset"
     }
    }
   }
  },
  "/v1/assets/{contract}/adoption": {
   "get": {
    "summary": "Onchain adoption of the stock on launch platforms (Clanker v5, Bankr)",
    "description": "Tokens launched on a launch platform (Clanker v5, and Bankr launches on Doppler) with this stock as their pair (quote) token, and the trading in those pools: launches, pools traded, swaps and stock-side volume (net of the platform tax, the tax itself, and gross) for 24h, 7d and all time, with the last trade. Served only for pools whose independent review is CONFIRMED and blocks inside the contiguous run of CONFIRMED recount windows (meta.platforms[].verified_through_block). value_at_nav (NAV stocks only) is an estimate at the latest official NAV close. These pools price the community token in the stock: they are never a price for the stock (see /dex). For Bankr only gross stock volume is served (net and fee are null: the fee is not emitted as a stock amount).",
    "parameters": [
     {
      "name": "contract",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Adoption per platform",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad address"
     },
     "404": {
      "description": "Unknown asset"
     }
    }
   }
  },
  "/v1/pairs": {
   "get": {
    "summary": "Verified stock-paired launch pools",
    "description": "Pools launched on a platform with a tokenized stock as the pair: pool id, community token, stock, creator, launch block/tx/time, fee, tick spacing, hook, liquidity model, buy/sell tax, swaps, stock-side volume, last trade block. Only independently CONFIRMED pools. Facts about how the stock is used, not recommendations.",
    "parameters": [
     {
      "name": "platform",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "clanker",
        "bankr"
       ]
      }
     },
     {
      "name": "stock",
      "in": "query",
      "schema": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$"
      }
     },
     {
      "name": "sort",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "launch",
        "swaps"
       ],
       "default": "launch"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 200,
       "default": 50
      }
     },
     {
      "name": "offset",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 0,
       "default": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Pools",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Bad address"
     }
    }
   }
  },
  "/v1/pairs/overview": {
   "get": {
    "summary": "Totals per stock on launch platforms",
    "description": "Every stock with at least one verified launch: launches, pools traded, swaps (24h, 7d, all) and stock-side volume, sorted by swaps; totals in meta. A factual table, not a ranking. Each row also carries launches_7d.",
    "parameters": [
     {
      "name": "platform",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "clanker",
        "bankr"
       ]
      }
     },
     {
      "name": "sort",
      "in": "query",
      "description": "all (by swaps all time; default for overview) or 7d (by the last 7 days' swaps, then launches; default for leaderboard)",
      "schema": {
       "type": "string",
       "enum": [
        "all",
        "7d"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Per-stock totals",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Unknown platform or sort"
     }
    }
   }
  },
  "/v1/adoption/leaderboard": {
   "get": {
    "summary": "Stocks ranked by builder activity in the last 7 days",
    "description": "Same rows as /v1/pairs/overview, sorted by the last 7 days' swaps then launches (sort=all for all time). Verified pools only. A factual table, not a recommendation. Each row also carries launches_7d.",
    "parameters": [
     {
      "name": "platform",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "clanker",
        "bankr"
       ]
      }
     },
     {
      "name": "sort",
      "in": "query",
      "description": "all (by swaps all time; default for overview) or 7d (by the last 7 days' swaps, then launches; default for leaderboard)",
      "schema": {
       "type": "string",
       "enum": [
        "all",
        "7d"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Per-stock totals",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "Unknown platform or sort"
     }
    },
    "operationId": "adoptionLeaderboard"
   }
  }
 },
 "components": {
  "schemas": {
   "Error": {
    "type": "object",
    "required": [
     "error"
    ],
    "properties": {
     "error": {
      "type": "object",
      "required": [
       "code",
       "message"
      ],
      "properties": {
       "code": {
        "type": "string"
       },
       "message": {
        "type": "string"
       },
       "hint": {
        "type": "string"
       }
      }
     }
    }
   },
   "Meta": {
    "type": "object",
    "required": [
     "as_of",
     "schema_version",
     "served"
    ],
    "properties": {
     "as_of": {
      "type": "string",
      "format": "date-time"
     },
     "schema_version": {
      "type": "string"
     },
     "served": {
      "const": "independently_confirmed_records_only"
     },
     "count": {
      "type": "integer"
     },
     "next_cursor": {
      "type": [
       "string",
       "null"
      ],
      "description": "Opaque; pass back unchanged as `cursor`."
     }
    }
   },
   "Asset": {
    "type": "object",
    "required": [
     "chain_id",
     "contract_address",
     "symbol",
     "identity_state"
    ],
    "properties": {
     "chain_id": {
      "const": 8453
     },
     "contract_address": {
      "type": "string"
     },
     "symbol": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "isin": {
      "type": [
       "string",
       "null"
      ]
     },
     "identity_state": {
      "enum": [
       "verified",
       "mismatch",
       "incomplete"
      ]
     },
     "multiplier_wad": {
      "type": [
       "string",
       "null"
      ]
     },
     "observed_block": {
      "type": "string"
     }
    }
   },
   "Event": {
    "type": "object",
    "required": [
     "event_id",
     "chain_id",
     "ticker",
     "contract_address",
     "event_type",
     "status",
     "confidence",
     "expected_adjustment_date",
     "updated_at",
     "warnings"
    ],
    "properties": {
     "event_id": {
      "type": "string"
     },
     "chain_id": {
      "const": 8453
     },
     "ticker": {
      "type": "string",
      "description": "B20 token symbol, e.g. NVDAc. Store contract_address, not the ticker."
     },
     "contract_address": {
      "type": "string"
     },
     "event_type": {
      "enum": [
       "dividend",
       "split",
       "reverse_split",
       "other"
      ]
     },
     "status": {
      "enum": [
       "predicted",
       "confirmed_onchain",
       "verified_matched",
       "late",
       "unknown"
      ],
      "description": "predicted: declared/announced, not applied yet. confirmed_onchain: applied, no dated company declaration matched. verified_matched: applied and matches the declared payable date. late: applied (or expected) more than 1 day after the payable date."
     },
     "confidence": {
      "enum": [
       "high",
       "medium",
       "unknown"
      ],
      "description": "high: two independent sources agree (SEC declaration and onchain). medium: one source. Never guessed."
     },
     "expected_adjustment_date": {
      "type": [
       "string",
       "null"
      ],
      "description": "Payable date of the declaration (observed issuer pattern, not a guarantee). null when no dated declaration is evidenced."
     },
     "adjusted_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "multiplier_before_wad": {
      "type": [
       "string",
       "null"
      ]
     },
     "multiplier_after_wad": {
      "type": [
       "string",
       "null"
      ]
     },
     "multiplier_delta": {
      "type": [
       "string",
       "null"
      ],
      "description": "after/before as an exact decimal string"
     },
     "per_share": {
      "type": [
       "string",
       "null"
      ]
     },
     "record_date": {
      "type": [
       "string",
       "null"
      ]
     },
     "payable_date": {
      "type": [
       "string",
       "null"
      ]
     },
     "sec_filing_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "quoted_text": {
      "type": [
       "string",
       "null"
      ]
     },
     "onchain_tx": {
      "type": [
       "string",
       "null"
      ]
     },
     "issuer_corporate_action_uuid": {
      "type": [
       "string",
       "null"
      ]
     },
     "record_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "basis": {
      "type": "string"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "warnings": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Anything that does not add up beyond timing, e.g. multiplier_change_unusually_large_for_cash_dividend. Any warning lowers confidence."
     }
    }
   },
   "NavPoint": {
    "type": "object",
    "required": [
     "chain_id",
     "token",
     "feed",
     "round_id",
     "phase_id",
     "answer_raw",
     "decimals",
     "nav",
     "updated_at",
     "retrieved_at"
    ],
    "properties": {
     "session_day": {
      "type": "string",
      "format": "date",
      "description": "daily interval only"
     },
     "session_close": {
      "type": "string",
      "format": "date-time"
     },
     "chain_id": {
      "type": "integer"
     },
     "token": {
      "type": "string"
     },
     "feed": {
      "type": "string"
     },
     "round_id": {
      "type": "string",
      "description": "proxy round id (phaseId<<64 | aggregatorRoundId), decimal string"
     },
     "phase_id": {
      "type": "integer"
     },
     "aggregator_round_id": {
      "type": "string"
     },
     "aggregator": {
      "type": "string"
     },
     "answer_raw": {
      "type": "string"
     },
     "decimals": {
      "type": "integer"
     },
     "nav": {
      "type": "string",
      "description": "exact decimal"
     },
     "started_at": {
      "type": "string",
      "format": "date-time"
     },
     "updated_at": {
      "type": "string",
      "format": "date-time"
     },
     "answered_in_round": {
      "type": "string"
     },
     "retrieved_at": {
      "type": "string",
      "format": "date-time"
     },
     "retrieved_block": {
      "type": "string"
     },
     "provisional": {
      "type": "boolean",
      "description": "daily interval only: true while that session has not closed yet"
     },
     "official": {
      "type": "boolean",
      "description": "include=all only: inside its phase's live window and decimals match the proxy"
     },
     "proxy_live": {
      "type": "boolean",
      "description": "include=all only: the proxy served this round's aggregator when it was published"
     },
     "decimals_ok": {
      "type": "boolean",
      "description": "include=all only: the aggregator's decimals equal the proxy's"
     }
    }
   }
  }
 }
}