# =============================================================================
# Conyr API — OpenAPI 3.1 spec
#
# This spec covers the full live /v1 surface. Every implemented REST route is
# documented below with its access tier (see the x-tier extension on each
# operation, and the per-tier security model in the description). The only
# planned operations are intentionally absent so generated agent clients only
# contain callable production routes.
#
# Removed:
#   getWalletTaxonomy → use getWalletLabels
#   getWalletBundles  → use getTokenBundles + client-side filter
#   getWalletSecurity → use WS wallet:{addr}:security
# =============================================================================

openapi: 3.1.0
info:
  title: CONYR API
  version: 1.6.0
  description: |
    The Solana intelligence API built for autonomous agents. The live surface exposes
    42 /v1 operations for position-correct wallet skill, FIFO positions and realized PnL,
    public X/Telegram identity, what an address is (exchanges, services, bridges, protocols
    and the OFAC mark, with receipts), funding provenance, 30-dimensional behavioral
    similarity, bundle state, actor-level coordination, holder concentration, liquidity exit
    capacity, and organic OHLCV.

    This spec documents the full live /v1 surface. Each operation carries an `x-tier`
    extension declaring its minimum access tier (Free, Layer 1, Layer 2, or Layer 3);
    requesting an operation above your key's tier returns 403. Planned operations
    remain out of this contract so generated clients only expose callable routes.

    Each key has a per-minute limit (Free 10, Layer 1 100, Layer 2 300, Layer 3 600,
    Enterprise 3,000+). A Free account also gets 10,000 answered calls a month (UTC);
    from 2026-12-01 00:00 UTC, past that number every call gets a 429 with
    reason month_limit until the next 1st, and every Free answer carries the
    X-Conyr-Month-Limit, X-Conyr-Month-Used and X-Conyr-Month-Reset headers. Paid
    plans include 500,000 (Layer 1), 1,500,000 (Layer 2), 3,000,000 (Layer 3) or
    10,000,000 (Platform Feed) calls a month; that number is never a cutoff.

    Thirteen live WebSocket channel families are available at wss://api.conyr.ai/ws.
    They cover trade ticks, candles, wallet activity, security, coordination, raw BundleV2
    state, and compact dump alerts. REST-only analytical reads are identified separately.

    The /ws endpoint requires a Bearer key; the Free tier is rejected at upgrade (HTTP 403).
    Per-key concurrent connection caps apply (Free 0 / Layer 1 5 / Layer 2 20 / Layer 3 50 /
    Enterprise unlimited), with 50 subscriptions per connection on paid tiers; exceeding the
    connection cap closes the socket with WS close code 1008. WebSocket channels are themselves
    tier-gated — subscribing to a channel above your key's tier returns a non-fatal op:error
    while the connection and other channels in the batch stay live:
      Layer 1: token:{mint}:trades, token:{mint}:ticks, token:{mint}:ohlcv:{view}:{tf}
      Layer 2: wallet:{addr}:pnl, wallet:{addr}:positions, wallet:{addr}:labels
      Layer 3: token:{mint}:security, token:{mint}:campaign,
               token:{mint}:bundles, token:{mint}:dump_alert,
               wallet:{addr}:security, wallet:{addr}:follow, wallet:{addr}:entity
    See WsChannelFormat schema for details.
  contact:
    name: CONYR
    url: https://conyr.ai
servers:
  - url: https://api.conyr.ai
    description: Production
security:
  - BearerAuth: []

tags:
  - name: Operations
    description: System liveness and readiness; Prometheus metrics use a dedicated monitoring credential
  - name: Wallets
    description: Wallet performance, trades, positions, public identity, labels, quality, profile, similarity, provenance
  - name: Tokens
    description: Token info, OHLCV, trades, liquidity, holders, bundles, and security signals
  - name: Leaderboard
    description: Ranked wallet leaderboard
  - name: Coordination
    description: coordination-v2 follows, entities, campaigns, crowd state, and health
  - name: Intel
    description: Cross-cutting coordination intelligence composites

paths:
  /health:
    get:
      operationId: getHealth
      summary: Liveness check
      tags: [Operations]
      security: []
      responses:
        "200":
          description: Service is alive
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum: [ok]

  /ready:
    get:
      operationId: getReadiness
      summary: Readiness check
      tags: [Operations]
      security: []
      responses:
        "200":
          description: Service ready
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReadinessResponse"
        "503":
          description: Service not ready
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReadinessResponse"

  /metrics:
    get:
      operationId: getMetrics
      summary: Prometheus metrics
      tags: [Operations]
      description: Requires the dedicated bearer token configured through API_METRICS_BEARER_TOKEN.
      security:
        - MetricsBearerAuth: []
      responses:
        "200":
          description: Prometheus text format
          content:
            text/plain:
              schema:
                type: string
        "401":
          description: Missing or invalid monitoring token
        "404":
          description: Monitoring access is not configured

  /v1/wallet/{address}/performance:
    get:
      operationId: getWalletPerformance
      summary: Wallet trading performance summary
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
        - name: window
          in: query
          description: Time window for performance calculation
          schema:
            type: string
            enum: [1d, 7d, 30d]
            default: "7d"
      responses:
        "200":
          description: Performance summary
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WalletPerformance"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/trades:
    get:
      operationId: getWalletTrades
      summary: Wallet trade history (realized PnL with FIFO cost-basis)
      description: |
        Returns paginated realized-PnL history including FIFO cost-basis,
        entry/exit signatures and prices, hold time, position/exit type, and DEXes.
        The wallet:{address}:pnl stream carries a richer live event payload.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: token
          in: query
          description: Filter trades by token mint address
          schema:
            type: string
      responses:
        "200":
          description: Paginated trade list
          content:
            application/json:
              schema:
                type: object
                properties:
                  trades:
                    type: array
                    items:
                      $ref: "#/components/schemas/WalletTrade"
                  limit:
                    type: integer
                  offset:
                    type: integer
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/positions:
    get:
      operationId: getWalletPositions
      summary: Wallet token positions (lot-level FIFO)
      description: |
        Returns wallet positions tracked with lot-level FIFO accounting.
        Supports fragment tracking for partial fills and DCA entries.
        Live stream: wallet:{address}:positions fires on open/update/close.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
        - name: status
          in: query
          description: Filter by position status
          schema:
            type: string
            enum: [open, closed, all]
            default: all
      responses:
        "200":
          description: Position list
          content:
            application/json:
              schema:
                type: object
                properties:
                  positions:
                    type: array
                    items:
                      $ref: "#/components/schemas/WalletPosition"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/labels:
    get:
      operationId: getWalletLabels
      summary: Focused wallet classification, automation, tool use, and badges
      description: |
        Returns the focused classification contract: trader type, performance
        level, size class, exit style, automation and tool-use labels, fresh-funding
        flags, badges, description, and label hash. Use /quality for quantitative
        performance evidence such as Sharpe, profit factor, disposition, and ROI
        percentiles. Nullable `kol_username` and `kol_platform` values are compact
        preferred-identity projections through a 5–10 minute ClickHouse dictionary;
        the response is then cached for 60 seconds. Use /identity for current aliases.
        `address_label` is the registry's label of the wallet itself when it is a service
        or carries the OFAC mark, through the same kind of dictionary; read
        /v1/address/{address}/label for its receipts.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Wallet labels (null if not yet classified)
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/WalletLabel"
                  - type: "null"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"

  /v1/wallet/{address}/identity:
    get:
      operationId: getWalletIdentity
      summary: Resolve a wallet's public KOL identity and active aliases
      description: |
        Returns a wallet's public identity from Conyr's identity registry: the
        owner-proven links, the names listed for it, and the names a wallet
        declares for itself (pump.fun names, `.sol` domains, FOMO handles). The
        registry is read on every request.
        This lookup is independent of behavioral-label coverage, so it also
        works for a wallet that has no wallet-label snapshot.

        The path accepts a Solana wallet or an EVM address (`0x` and 40 hex
        digits, any case). An EVM address is looked up in lower case and echoed
        as sent in `wallet_address`.

        `aliases` holds every active association that names a person, X before
        Telegram, each list in the registry's precedence order. `primary` is the
        alias the registry chose for the wallet's label, verified before
        predicted. It is `null` when the label names no person, even
        when `tags` are present. Each alias carries its `tier`, `basis`,
        `reason` and `claim_id`; `source` stays per alias, so preserve it.

        Beside those fields the response returns the `person` the label names
        (current handles and former ones), the label's `tier`, `conflict`, the
        `tags` that name no one, one row per name, and the operator's `denials`.
        The top-level `reason` is always null and `receipts` is always empty;
        both stay for existing clients. A syntactically accepted wallet
        identifier with no registry identity returns HTTP 200 with `primary:
        null`, `aliases: []` and every added field empty or null.

        Use this route when an agent needs the complete, current identity record.
        For high-volume screening, use the compact nullable `kol_username`,
        `kol_platform` and `kol_tier` fields on wallet labels or leaderboard
        entries, then hydrate only shortlisted wallets here. A `predicted`
        association is a listing, not proof of account ownership.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - name: address
          in: path
          required: true
          description: >-
            A base58-form Solana wallet identifier (32-44 characters), or an
            EVM address: `0x` followed by 40 hex digits in any case, read in
            lower case.
          schema:
            type: string
            minLength: 32
            maxLength: 44
            pattern: "^([1-9A-HJ-NP-Za-km-z]{32,44}|0x[0-9A-Fa-f]{40})$"
            example: "CyaE1VxvBrahnPWkqm5VsdCvyS2QmNht2UFrKJHga54o"
      responses:
        "200":
          description: Wallet identity; primary and person are null when the wallet's label names no person
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WalletIdentityResponse"
              examples:
                knownWallet:
                  summary: Wallet whose label names a person
                  value:
                    wallet_address: CyaE1VxvBrahnPWkqm5VsdCvyS2QmNht2UFrKJHga54o
                    chain: solana
                    primary:
                      platform: x
                      username: Cented7
                      profile_url: https://x.com/Cented7
                      source: conyr
                      verification: source_asserted
                      created_at: "2026-09-29T00:00:00Z"
                      updated_at: "2026-09-29T00:00:00Z"
                      tier: verified
                      basis: app_binding
                      reason: ""
                      claim_id: 26
                    aliases:
                      - platform: x
                        username: Cented7
                        profile_url: https://x.com/Cented7
                        source: conyr
                        verification: source_asserted
                        created_at: "2026-09-29T00:00:00Z"
                        updated_at: "2026-09-29T00:00:00Z"
                        tier: verified
                        basis: app_binding
                        reason: ""
                        claim_id: 26
                      - platform: x
                        username: Cented7
                        profile_url: https://x.com/Cented7
                        source: conyr
                        verification: source_asserted
                        created_at: "2026-09-29T00:00:00Z"
                        updated_at: "2026-09-29T00:00:00Z"
                        tier: predicted
                        basis: tracker
                        reason: ""
                        claim_id: 39
                      - platform: x
                        username: Cented7
                        profile_url: https://x.com/Cented7
                        source: axiom
                        verification: source_asserted
                        created_at: "2026-09-29T00:00:00Z"
                        updated_at: "2026-09-29T00:00:00Z"
                        tier: predicted
                        basis: tracker
                        reason: x listed by Axiom
                        claim_id: 51
                      - platform: x
                        username: Cented7
                        profile_url: https://x.com/Cented7
                        source: conyr
                        verification: source_asserted
                        created_at: "2026-08-16T00:00:00Z"
                        updated_at: "2026-08-16T00:00:00Z"
                        tier: predicted
                        basis: kol_tracker
                        reason: ""
                        claim_id: 6
                    person:
                      id: person:x:cented7
                      name: Cented7
                      handles:
                        - platform: x
                          username: Cented7
                          profile_url: https://x.com/Cented7
                      formerly: []
                    tier: verified
                    reason: null
                    conflict: false
                    tags:
                      - platform: pumpfun
                        username: cented69420
                        source: axiom
                        basis: tracker
                        tier: predicted
                        reason: pump.fun name
                        flags: []
                        hidden: false
                        claim_id: 50
                      - platform: sns
                        username: popscandle.sol
                        source: conyr
                        basis: self_attested
                        tier: predicted
                        reason: ".sol name"
                        flags: []
                        hidden: false
                        claim_id: 32
                    receipts: {}
                    denials: []
                unknownWallet:
                  summary: Accepted wallet identifier with no registry identity
                  value:
                    wallet_address: "11111111111111111111111111111111"
                    chain: solana
                    primary: null
                    aliases: []
                    person: null
                    tier: null
                    reason: null
                    conflict: false
                    tags: []
                    receipts: {}
                    denials: []
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"

  /v1/kol-wallets/{username}:
    get:
      operationId: getKolWallets
      summary: Resolve a public username to active wallets
      description: |
        Exact reverse lookup from a case-insensitive public username to every
        distinct wallet whose current identity in Conyr's identity registry
        names a person by that handle. A single username may map to multiple
        wallets. A leading `@` is optional; this is not fuzzy or prefix search.
        A handle the operator denied on a wallet does not match that wallet.

        Omit `platform` to match both X and Telegram, or provide it when the same
        username may exist on both platforms. `chain` selects Solana wallets
        (the default), EVM wallets, or both. Unknown usernames return HTTP 200
        with an empty `wallets` array, `person: null` and `matches: []`.

        `person` is the entity that currently holds the handle's profile (X
        before Telegram when no platform is given). `matches` has one entry per
        wallet, in the same address order: the first association naming the
        handle on that wallet, with its `tier`, `basis`, `source` and `reason`,
        and the wallet's `conflict` flag. After resolving a handle, hydrate each
        shortlisted wallet through `/v1/wallet/{address}/identity`: the wallet's
        `primary` alias can differ from the alias used for this reverse lookup.
        A `predicted` match is a listing, not proof of account control.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - name: username
          in: path
          required: true
          description: >-
            X or Telegram username in the canonical client form: 1-32 ASCII
            letters, digits, or underscores with at most one leading @. The
            server also trims surrounding whitespace and repeated leading @
            characters before lowercasing and validating.
          schema:
            type: string
            minLength: 1
            maxLength: 33
            pattern: "^@?[A-Za-z0-9_]{1,32}$"
          example: "@FrankDeGods"
        - name: platform
          in: query
          required: false
          description: >-
            Optional case-insensitive platform filter. Clients should send the
            canonical lowercase form.
          schema:
            type: string
            pattern: "^([xX]|[tT][eE][lL][eE][gG][rR][aA][mM])$"
            example: x
        - name: chain
          in: query
          required: false
          description: >-
            Optional case-insensitive chain filter: `solana` (the default),
            `evm`, or `all`. Clients should send the canonical lowercase form.
          schema:
            type: string
            pattern: "^([sS][oO][lL][aA][nN][aA]|[eE][vV][mM]|[aA][lL][lL])$"
            example: all
      responses:
        "200":
          description: Every active wallet associated with the normalized username
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KolWalletsResponse"
              examples:
                match:
                  summary: Two EVM wallets for the normalized handle (chain=evm)
                  value:
                    username: orangie
                    wallets:
                      - "0x0fd94b02867a7311c87c5b995793e9a3dca5c565"
                      - "0xb3fd97526020fbf5560857b7dca5dd2f1652422f"
                    person:
                      id: person:x:orangie
                      name: orangie
                    matches:
                      - address: "0x0fd94b02867a7311c87c5b995793e9a3dca5c565"
                        chain: evm
                        tier: predicted
                        basis: tracker
                        source: axiom
                        reason: x listed by Axiom
                        conflict: false
                      - address: "0xb3fd97526020fbf5560857b7dca5dd2f1652422f"
                        chain: evm
                        tier: predicted
                        basis: tracker
                        source: axiom
                        reason: x listed by Axiom
                        conflict: false
                noMatch:
                  summary: Syntactically valid username with no association
                  value:
                    username: nobody_here
                    wallets: []
                    person: null
                    matches: []
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"

  /v1/leaderboard:
    get:
      operationId: getLeaderboard
      summary: Ranked wallet leaderboard
      description: >-
        Ranked performance rows with nullable compact KOL identity. Identity
        first passes through a 5–10 minute ClickHouse dictionary and the full
        response is cached for 60 seconds; use the direct wallet identity route
        for current aliases and provenance.
      tags: [Leaderboard]
      x-tier: Layer 2
      parameters:
        - name: window
          in: query
          description: Time window
          schema:
            type: string
            enum: [1d, 7d, 30d]
            default: "7d"
        - name: sort
          in: query
          description: Sort metric
          schema:
            type: string
            enum: [pnl_usd, roi, win_rate]
            default: pnl_usd
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: include_hft
          in: query
          description: >-
            Include HFT/MEV bots (wallets with a median hold time under 60s).
            Defaults to false — they are excluded so the board reflects real
            traders rather than tick-scalpers. Wallets Conyr tags as serial
            ruggers are always excluded.
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Leaderboard results
          content:
            application/json:
              schema:
                type: object
                properties:
                  leaderboard:
                    type: array
                    items:
                      $ref: "#/components/schemas/LeaderboardEntry"
                  window:
                    type: string
                  sort:
                    type: string
                  limit:
                    type: integer
                  offset:
                    type: integer
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"

  /v1/token/{mint}/info:
    get:
      operationId: getTokenInfo
      summary: Token validation status
      description: |
        Returns token validation state and any validation reason currently attached
        to the token.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Token validation status
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenInfo"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/ohlcv:
    get:
      operationId: getTokenOhlcv
      summary: OHLCV candlestick data (full + filtered views)
      description: |
        Returns OHLCV candles with buy/sell volume split, VWAP, trade count,
        and approximate unique buyer/seller counts. The "filtered" view removes
        bot and wash trades for organic price discovery.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: timeframe
          in: query
          description: Candle interval
          schema:
            type: string
            enum: [1s, 1m, 5m, 15m, 1h]
            default: "1m"
        - name: view
          in: query
          description: Full includes all trades; filtered removes bot/wash activity
          schema:
            type: string
            enum: [full, filtered]
            default: full
        - name: from
          in: query
          description: Start time (unix milliseconds)
          schema:
            type: integer
            format: int64
        - name: to
          in: query
          description: End time (unix milliseconds)
          schema:
            type: integer
            format: int64
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 2000
            default: 500
      responses:
        "200":
          description: OHLCV candles
          content:
            application/json:
              schema:
                type: object
                properties:
                  candles:
                    type: array
                    items:
                      $ref: "#/components/schemas/OhlcvCandle"
                  token_mint:
                    type: string
                  timeframe:
                    type: string
                  view:
                    type: string
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/trades:
    get:
      operationId: getTokenTrades
      summary: Recent trades for a token
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
      responses:
        "200":
          description: Trade list
          content:
            application/json:
              schema:
                type: object
                properties:
                  trades:
                    type: array
                    items:
                      $ref: "#/components/schemas/TokenTrade"
                  token_mint:
                    type: string
                  limit:
                    type: integer
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/liquidity:
    get:
      operationId: getTokenLiquidity
      summary: Current pool depth, LP state, dump impact, and exit capacity
      description: |
        Returns the latest supported reserve snapshot, LP burn/lock verdict,
        coordinated-dump impact, and the SOL sell capacity before 10%, 25%,
        and 50% price impact. Depth is null when it is missing, stale, or unusable;
        USD capacity is null because this route does not invent a SOL/USD quote.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Liquidity intelligence snapshot
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LiquidityResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/liquidity/events:
    get:
      operationId: getTokenLiquidityEvents
      summary: Latest LP add/remove events with bundle and flag attribution
      description: |
        Returns the newest 100 liquidity events for the token. Each event reports
        pool, DEX, wallet, side, vault deltas, share of pool moved when known,
        full-close status, bundle membership, and whether the wallet carries
        Conyr's serial rugger tag.
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Newest-first liquidity event tape
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LiquidityEventsResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/holders/summary:
    get:
      operationId: getTokenHoldersSummary
      summary: Holder distinct count, concentration, and hydration status
      description: |
        Distinct holder count, total non-zero balance, top-N concentration
        (top_10_pct / top_50_pct / top_100_pct), and hydration lifecycle status.
        The "Top 10 hold X%" flagship signal.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Holder summary
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HoldersSummary"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/holders/top:
    get:
      operationId: getTokenHoldersTop
      summary: Ordered top-N holders
      description: |
        Summary fields plus the ordered top-N holders with per-holder
        percentage of total balance.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: n
          in: query
          description: Number of holders to return (default 10, max 500)
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 10
      responses:
        "200":
          description: Top holders
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HoldersTop"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/holders:
    get:
      operationId: getTokenHolders
      summary: Paginated full holder list
      description: |
        Top fields plus pagination (limit, offset, next_offset) over the full
        holder list ordered by balance descending.
      tags: [Tokens]
      x-tier: Layer 1
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        "200":
          description: Holder list
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HoldersList"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/buyer-quality:
    get:
      operationId: getBuyerQuality
      summary: Aggregate buyer-quality signal for a token
      description: |
        Aggregate quality of the wallets currently buying a token over the
        given lookback window, derived from buyer skill labels and outcomes.
      tags: [Tokens]
      x-tier: Free
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: window_hours
          in: query
          description: Lookback window in hours
          schema:
            type: integer
            minimum: 1
            maximum: 24
            default: 1
      responses:
        "200":
          description: Buyer-quality summary
          headers:
            X-Conyr-Month-Limit:
              $ref: "#/components/headers/XConyrMonthLimit"
            X-Conyr-Month-Used:
              $ref: "#/components/headers/XConyrMonthUsed"
            X-Conyr-Month-Reset:
              $ref: "#/components/headers/XConyrMonthReset"
          content:
            application/json:
              schema:
                type: object
                description: Aggregate buyer-quality metrics for the token.
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/bundles/summary:
    get:
      operationId: getTokenBundleSummary
      summary: Bundle summary for a token
      description: |
        The coordinated bundles Conyr's detector tracks on a token now: how many,
        how many are still open, the share of supply they hold, its value and
        their realized PnL, without the per-bundle detail. Every number comes
        from the detector's one row for the coin, so they agree with each other.
        The detector's tracking starts again from zero when it restarts, and a
        coin nobody has traded since keeps its last numbers. The Layer 3 list
        (/v1/token/{mint}/bundles) holds the coin's bundle records instead,
        closed bundles and execution-only clusters included, so it is longer.
      tags: [Tokens]
      x-tier: Free
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Bundle summary
          headers:
            X-Conyr-Month-Limit:
              $ref: "#/components/headers/XConyrMonthLimit"
            X-Conyr-Month-Used:
              $ref: "#/components/headers/XConyrMonthUsed"
            X-Conyr-Month-Reset:
              $ref: "#/components/headers/XConyrMonthReset"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BundleSummary"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/bundles:
    get:
      operationId: getTokenBundles
      summary: Detected coordinated bundles for a token
      description: |
        Full list of coordinated bundles (BundleV2) detected on a token, with
        membership, status, supply held, and evidence.
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Bundle list
          content:
            application/json:
              schema:
                type: object
                properties:
                  bundles:
                    type: array
                    items:
                      $ref: "#/components/schemas/Bundle"
                  token_mint:
                    type: string
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/bundles/{bundle_id}:
    get:
      operationId: getBundleDetail
      summary: Detail for a single bundle
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: bundle_id
          in: path
          required: true
          description: Bundle identifier
          schema:
            type: string
      responses:
        "200":
          description: Bundle detail
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BundleFullResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/wash-trades:
    get:
      operationId: getWashTrades
      summary: Detected wash-trading activity for a token
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
      responses:
        "200":
          description: Wash-trade signals
          content:
            application/json:
              schema:
                type: object
                description: Detected wash-trading clusters and offending wallets.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/funding-abuse:
    get:
      operationId: getFundingAbuse
      summary: Funding-abuse detection for early buyers of a token
      description: |
        Early buyers funded from shared/farm sources within the early window,
        surfacing coordinated funding abuse around launch. Funding is judged as of
        each wallet's first buy of the coin and does not change afterwards. Each
        wallet row carries the registry's label of its funding root and of its
        direct funder (`root_address_label`, `direct_funder_address_label`) when
        they are services or carry the OFAC mark; the summary and its score do not
        read them.
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: early_window_minutes
          in: query
          description: Early-buy window in minutes
          schema:
            type: integer
            minimum: 10
            maximum: 240
            default: 60
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
      responses:
        "200":
          description: Funding-abuse signals
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FundingAbuseResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"

  /v1/token/{mint}/suspicious-activity:
    get:
      operationId: getSuspiciousActivity
      summary: Aggregate suspicious-activity signals for a token
      tags: [Tokens]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Suspicious-activity summary
          content:
            application/json:
              schema:
                type: object
                description: Composite suspicious-activity flags and evidence for the token.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/campaigns:
    get:
      operationId: getTokenCampaigns
      summary: Coordinated campaigns on a token
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Token campaigns
          content:
            application/json:
              schema:
                type: object
                description: Coordinated campaigns (coordination-v2) active on the token.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/token/{mint}/crowd:
    get:
      operationId: getTokenCrowd
      summary: Per-minute crowd state for a token
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
      responses:
        "200":
          description: Crowd state
          content:
            application/json:
              schema:
                type: object
                description: Coordination-v2 crowd-state snapshot for the token.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/quality:
    get:
      operationId: getWalletQuality
      summary: Wallet quality — position-correct skill signal
      description: |
        Composite skill score and the position-correct vs commodity win-rate
        delta. `rated` is true once the wallet has at least 10 closed positions.
        Returns the object below, or literal null when no snapshot row exists.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Wallet quality (null if no snapshot row)
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/WalletQuality"
                  - type: "null"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/profile:
    get:
      operationId: getWalletProfile
      summary: 30-dimensional behavioral profile for a wallet
      description: |
        Behavioral profile derived from the wallet's 30-dim embedding —
        hold timing, exit discipline, performance, velocity/sizing, and
        infrastructure/provenance axes.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Wallet behavioral profile
          content:
            application/json:
              schema:
                type: object
                description: 30-dim behavioral profile and derived axes for the wallet.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/similar:
    get:
      operationId: getWalletSimilar
      summary: Wallets behaviorally similar to a given wallet
      description: |
        k-nearest-neighbour lookup over the 30-dim behavioral vector space,
        optionally filtered by minimum trade count and performance level.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: min_trades
          in: query
          description: Only return wallets with at least this many trades
          schema:
            type: integer
        - name: performance_level
          in: query
          description: Filter similar wallets by performance level
          schema:
            type: string
            enum: [EARNER, BREAK_EVEN, UNPROFITABLE, UNRATED, DORMANT]
      responses:
        "200":
          description: Similar wallets
          content:
            application/json:
              schema:
                type: object
                description: Behaviorally similar wallets with cosine similarity scores.
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/provenance:
    get:
      operationId: getWalletProvenance
      summary: Funding provenance for a wallet
      description: |
        Where a wallet's SOL came from: the funding root found by tracing transfers
        back up to 20 hops (`root_source`) and its name (`root_entity`), the hop count,
        the direct funder and the last funding time. `root_address_label` and
        `direct_funder_address_label` are the registry's labels of the root and of the
        direct funder when they are services or carry the OFAC mark. A wallet with no
        traced provenance answers `root_entity: null`. Responses are cached for 5
        minutes.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Wallet provenance
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WalletProvenance"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/address/{address}/label:
    get:
      operationId: getAddressLabel
      summary: What an address is, with the receipts behind it
      description: |
        Returns what an address is from Conyr's label registry: an exchange (a hot
        wallet, a cold wallet or a deposit address), a custodian, an onramp, a bridge,
        a protocol, a tip account, a terminal, an infrastructure wallet, or the OFAC
        SDN mark. A money label names a service by its brand, as its sources do. A
        company is named (`type` `company`) only on Conyr's own review, with the
        company's evidence; a person never is. The mark's `sanction` names the party as
        OFAC writes it.

        `label.tier` is `verified` when the winning source names the address, the
        on-chain account check confirms what that source says (a plain wallet for an
        exchange wallet, a program for a program address, the expected token account
        for a derived account), and no other source on the address disagrees. It is
        `predicted` when the label rests on Conyr's observations or on a rule's
        inference (the deposit-sweep rule), when the check does not confirm it, or when
        sources disagree. `label.reason` is the one-line reason, led by the primary
        source in words. `label.source.url` is the first public document among the
        label's claims: an official list's or an official source's document, OFAC's
        list, or the publisher's file of a published tip list. Conyr's own lists and
        the deposit rule have no link.

        `receipts` holds the facts behind the label, field by field per source: each
        document with its fetch time and the saved copy's sha256, the account check
        made when the claim was first read, OKX's signed message and signatures, a
        derived account's program and seeds, a deposit address's sweeps and the
        verified wallets it paid. A receipt never holds a loader path, a database host,
        a curator's name or an internal note, never an SDN entry's aliases, documents,
        dates or contacts, and never the deposit rule's recipe (its thresholds or its
        exchange checks).
        `rests_on` lists, for a rule's label, the verified wallets it rests on with
        their own labels; `conflicts` the other live claims on the address; `history`
        the earlier money labels at the address, newest first; `method_card` the rule's
        measured recall and precision.

        People and social handles are not here: an address whose label names a person
        answers with `identity` set to its `/v1/wallet/{address}/identity` path, and
        `label` `null` unless the address is on the SDN list, when it is the mark. An address with no label answers 200 with `label: null` and empty lists.
        The route reads the registry's Postgres tables on every request and is not
        response-cached.
      tags: [Wallets]
      x-tier: Layer 2
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
          description: A Solana address (base58)
      responses:
        "200":
          description: "The address's money label with its receipts, or `label: null`"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddressLabelResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/entanglement:
    get:
      operationId: getWalletEntanglement
      summary: Coordination entanglement for a wallet
      description: |
        Wallets entangled with the given wallet through shared funding or
        shared execution, with the strength of each link.
      tags: [Wallets]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Wallet entanglement
          content:
            application/json:
              schema:
                type: object
                description: Entangled wallets and the basis (shared funder/execution) of each link.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/follows:
    get:
      operationId: getWalletFollows
      summary: Follow edges for a wallet
      description: |
        coordination-v2 follow edges where the wallet is a leader or follower,
        with TF-IDF support and confidence.
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
      responses:
        "200":
          description: Follow edges
          content:
            application/json:
              schema:
                type: object
                description: Follow edges involving the wallet, with confidence and support.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/wallet/{address}/entity:
    get:
      operationId: getWalletEntity
      summary: Entity membership for a wallet
      description: |
        The coordination-v2 entity (shared-funder / shared-execution cluster)
        the wallet belongs to, if any.
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/WalletAddress"
      responses:
        "200":
          description: Entity membership
          content:
            application/json:
              schema:
                type: object
                description: Entity the wallet belongs to (coordination-v2), or null.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/entity/{entity_id}:
    get:
      operationId: getEntityDetail
      summary: Detail for a coordination entity
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - name: entity_id
          in: path
          required: true
          description: Entity identifier
          schema:
            type: string
      responses:
        "200":
          description: Entity detail
          content:
            application/json:
              schema:
                type: object
                description: Coordination-v2 entity detail (kind, root wallet, member count, confidence).
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/entity/{entity_id}/members:
    get:
      operationId: getEntityMembers
      summary: Members of a coordination entity
      tags: [Coordination]
      x-tier: Layer 3
      parameters:
        - name: entity_id
          in: path
          required: true
          description: Entity identifier
          schema:
            type: string
        - name: page
          in: query
          description: Page number, starting at 0
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: page_size
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
      responses:
        "200":
          description: Entity members
          content:
            application/json:
              schema:
                type: object
                description: Paginated member wallets of the entity.
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/coordination/health:
    get:
      operationId: getCoordinationHealth
      summary: coordination-v2 engine health
      description: |
        Runtime health of the coordination-v2 engine (freshness, queue depth,
        and per-shard liveness).
      tags: [Coordination]
      x-tier: Layer 3
      responses:
        "200":
          description: Coordination health
          content:
            application/json:
              schema:
                type: object
                description: Coordination-v2 runtime health metrics.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/coordinated-pushes/forming:
    get:
      operationId: getFormingCoordinatedPushes
      summary: Coordinated token pushes currently forming
      description: |
        Cross-cutting coord_v2 composite — tokens with an active coordinated
        push (regime shift + campaign + participant entities).
      tags: [Intel]
      x-tier: Layer 3
      responses:
        "200":
          description: Forming coordinated pushes
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CoordinatedPushCandidate"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/wallet/{leader}/cascade:
    get:
      operationId: getFollowerCascade
      summary: Follower cascade behind a leader on a token
      description: |
        Followers that bought the given token shortly after the leader, with
        confidence and lag in seconds.
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - name: leader
          in: path
          required: true
          description: Leader wallet address (base58)
          schema:
            type: string
        - name: mint
          in: query
          required: true
          description: Token mint to scope the cascade to (required)
          schema:
            type: string
        - name: window_s
          in: query
          description: Lookback window in seconds
          schema:
            type: integer
            minimum: 1
            maximum: 3600
            default: 300
      responses:
        "200":
          description: Follower cascade
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CascadeFollower"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/entities/emerging:
    get:
      operationId: getEmergingEntities
      summary: Recently emerged wallet entities
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - name: hours
          in: query
          description: Lookback window in hours
          schema:
            type: integer
            minimum: 1
            maximum: 168
            default: 24
      responses:
        "200":
          description: Emerging entities
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/EmergingEntity"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/token/{mint}/early-buyers:
    get:
      operationId: getTokenEarlyBuyers
      summary: Coordinated entities present in the early-buy window
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: window_s
          in: query
          description: Early-buy window in seconds
          schema:
            type: integer
            minimum: 1
            maximum: 3600
            default: 300
      responses:
        "200":
          description: Early-buy clusters
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/EarlyBuyCluster"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/token/{mint}/copy-originator:
    get:
      operationId: getTokenCopyOriginator
      summary: Candidate copy-trade originators within a time window
      description: |
        Candidate leader wallets whose buys were copied by followers in the
        given window. The window is bounded to a maximum of 60 minutes.
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: start_ts_ms
          in: query
          required: true
          description: Window start (unix milliseconds, required)
          schema:
            type: integer
            format: int64
        - name: end_ts_ms
          in: query
          required: true
          description: Window end (unix milliseconds, required; must be > start_ts_ms, max 60 minutes wide)
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Originator candidates
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/OriginatorCandidate"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/token/{mint}/entity-concentration:
    get:
      operationId: getTokenEntityConcentration
      summary: Entity-level volume concentration for a token
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: hours
          in: query
          description: Lookback window in hours
          schema:
            type: integer
            minimum: 1
            maximum: 168
            default: 24
      responses:
        "200":
          description: Entity concentration
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EntityConcentration"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

  /v1/intel/token/{mint}/late-retail:
    get:
      operationId: getTokenLateRetail
      summary: Late-retail entry behind elite exits
      description: |
        Buys made within 10 minutes after a sell by an EARNER wallet: how many
        (lateBuyers counts buys) and by how many wallets (lateBuyerWallets),
        with volume, average lag, and the share not by an earner.
      tags: [Intel]
      x-tier: Layer 3
      parameters:
        - $ref: "#/components/parameters/TokenMint"
        - name: hours
          in: query
          description: Lookback window in hours
          schema:
            type: integer
            minimum: 1
            maximum: 72
            default: 24
      responses:
        "200":
          description: Late-retail summary
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LateRetail"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key passed as Bearer token in Authorization header
    MetricsBearerAuth:
      type: http
      scheme: bearer
      description: Dedicated Prometheus scrape token; not a customer API key

  parameters:
    WalletAddress:
      name: address
      in: path
      required: true
      description: Base58-form Solana wallet identifier accepted by the API
      schema:
        type: string
        minLength: 32
        maxLength: 44
        pattern: "^[1-9A-HJ-NP-Za-km-z]+$"
        example: "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"

    TokenMint:
      name: mint
      in: path
      required: true
      description: Solana token mint address (base58)
      schema:
        type: string
        example: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

  headers:
    XConyrMonthLimit:
      description: The Free plan's answered calls a month (sent on Free keys only)
      schema:
        type: integer
        example: 10000
    XConyrMonthUsed:
      description: The account's answered calls on Free keys this month, as of the last count (about every 30 s)
      schema:
        type: integer
        example: 3214
    XConyrMonthReset:
      description: When the count starts again, the next 1st at 00:00 UTC (RFC 3339)
      schema:
        type: string
        format: date-time
        example: "2026-12-01T00:00:00Z"

  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

    Forbidden:
      description: |
        The key's plan does not include this endpoint (reason plan_required).
        upgrade_url opens checkout for the plan it needs (a Free key), or the
        app's API tab (a key already on a paid plan).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PlanRefusal"
          examples:
            freeKeyOnLayer2:
              summary: A Free key on a Layer 2 route
              value:
                code: 403
                error: "Endpoint requires Layer 2 tier (resolved: Free)"
                reason: plan_required
                required_tier: Layer 2
                resolved_tier: Free
                upgrade_url: "https://conyr.ai/app/profile?tab=api&plan=L2&utm_source=api&utm_medium=refusal&utm_content=plan-l2"
            layer2KeyOnLayer3:
              summary: A Layer 2 key on a Layer 3 route
              value:
                code: 403
                error: "Endpoint requires Layer 3 tier (resolved: Layer 2)"
                reason: plan_required
                required_tier: Layer 3
                resolved_tier: Layer 2
                upgrade_url: "https://conyr.ai/app/profile?tab=api&utm_source=api&utm_medium=refusal&utm_content=plan-l3"

    TooManyRequests:
      description: |
        Over the key's per-minute limit (reason minute_limit), or a Free account
        past its 10,000 answered calls this month (reason month_limit, from
        2026-12-01 00:00 UTC; it answers again from resets_at). Retry-After
        carries the seconds to wait. A month_limit answer also carries the three
        X-Conyr-Month-* headers.
      headers:
        Retry-After:
          description: Seconds until a call can be answered again
          schema:
            type: integer
        X-Conyr-Month-Limit:
          $ref: "#/components/headers/XConyrMonthLimit"
        X-Conyr-Month-Used:
          $ref: "#/components/headers/XConyrMonthUsed"
        X-Conyr-Month-Reset:
          $ref: "#/components/headers/XConyrMonthReset"
      content:
        application/json:
          schema:
            oneOf:
              - $ref: "#/components/schemas/MinuteLimitRefusal"
              - $ref: "#/components/schemas/MonthLimitRefusal"
            discriminator:
              propertyName: reason
              mapping:
                minute_limit: "#/components/schemas/MinuteLimitRefusal"
                month_limit: "#/components/schemas/MonthLimitRefusal"
          examples:
            minuteLimit:
              summary: Over the per-minute limit (Retry-After 6)
              value:
                code: 429
                error: rate limit exceeded
                reason: minute_limit
                limit_per_minute: 10
                retry_after_seconds: 6
                upgrade_url: "https://conyr.ai/app/profile?tab=api&plan=L1&utm_source=api&utm_medium=refusal&utm_content=minute-limit"
            monthLimit:
              summary: A Free account past 10,000 calls this month
              value:
                code: 429
                error: Monthly free limit reached
                reason: month_limit
                limit: 10000
                used: 10004
                resets_at: "2026-12-01T00:00:00Z"
                retry_after_seconds: 1131712
                upgrade_url: "https://conyr.ai/app/profile?tab=api&plan=L1&utm_source=api&utm_medium=refusal&utm_content=month-limit"

    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

    ServiceUnavailable:
      description: Authentication or another required backend is temporarily unavailable
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

  schemas:
    Error:
      type: object
      required: [error, code]
      properties:
        error:
          type: string
        code:
          type: integer

    PlanRefusal:
      allOf:
        - $ref: "#/components/schemas/Error"
        - type: object
          required: [required_tier, resolved_tier, reason]
          properties:
            required_tier:
              type: string
              enum: [Free, Layer 1, Layer 2, Layer 3, Enterprise]
            resolved_tier:
              type: string
              enum: [Free, Layer 1, Layer 2, Layer 3, Enterprise]
            reason:
              type: string
              enum: [plan_required]
            upgrade_url:
              type: string
              format: uri
              description: Checkout for the plan the route needs (Free key), or the app's API tab (paid key)

    MinuteLimitRefusal:
      allOf:
        - $ref: "#/components/schemas/Error"
        - type: object
          required: [reason, limit_per_minute, retry_after_seconds]
          properties:
            reason:
              type: string
              enum: [minute_limit]
            limit_per_minute:
              type: integer
            retry_after_seconds:
              type: integer
            upgrade_url:
              type: string
              format: uri
              description: Present when a higher plan can be bought from the app (not on Layer 3 or Enterprise)

    MonthLimitRefusal:
      allOf:
        - $ref: "#/components/schemas/Error"
        - type: object
          required: [reason, limit, used, resets_at, retry_after_seconds]
          properties:
            reason:
              type: string
              enum: [month_limit]
            limit:
              type: integer
              example: 10000
            used:
              type: integer
            resets_at:
              type: string
              format: date-time
              description: The next 1st at 00:00 UTC, RFC 3339 in UTC (Z), whole seconds, e.g. 2026-12-01T00:00:00Z
            retry_after_seconds:
              type: integer
            upgrade_url:
              type: string
              format: uri

    ReadinessResponse:
      type: object
      properties:
        status:
          type: string
          enum: [ready, not ready]

    WalletPerformance:
      type: object
      properties:
        wallet_address:
          type: string
        total_trades:
          type: integer
          format: uint64
        wins:
          type: integer
          format: uint64
        losses:
          type: integer
          format: uint64
        win_rate:
          type: number
          format: double
          description: Value between 0.0 and 1.0
        total_pnl_usd:
          type: number
          format: double
        total_volume_usd:
          type: number
          format: double
        total_fees_usd:
          type: number
          format: double
        avg_hold_time_seconds:
          type: number
          format: double
        cash_pnl_usd:
          type: number
          format: double
          description: Net cash flow (SOL in/out) in USD terms
        sharpe_ratio:
          type: number
          format: double
          description: Present but currently always 0.0 on this endpoint; use /quality for the populated metric.
        profit_factor:
          type: number
          format: double
          description: Present but currently always 0.0 on this endpoint; use /quality for the populated metric.
        disposition_index:
          type: number
          format: double
          description: Present but currently always 0.0 on this endpoint; use /quality for the populated metric.

    WalletTrade:
      type: object
      properties:
        wallet_address:
          type: string
        token_mint:
          type: string
        entry_signature:
          type: string
        exit_signature:
          type: string
        entry_timestamp:
          type: string
          description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-15 11:38:23.488
        exit_timestamp:
          type: string
          description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-15 11:38:23.488
        hold_time_seconds:
          type: integer
        entry_price_usd:
          type: number
          format: double
          description: What the whole entry position cost in US dollars, not a price per token
        exit_price_usd:
          type: number
          format: double
          description: The US dollars this exit received
        realized_pnl_usd:
          type: number
          format: double
        realized_pnl_sol:
          type: number
          format: double
        percentage_gain:
          type: number
          format: double
        position_type:
          type: string
        exit_type:
          type: string
        exit_dex:
          type: string
        entry_dex:
          type: string
        basis:
          type: string
          enum: [own, received_transfer]
          description: own when this wallet bought the tokens it sold; received_transfer when another wallet bought them and moved them here

    WalletPosition:
      type: object
      properties:
        wallet_address:
          type: string
        token_mint:
          type: string
        entry_signature:
          type: string
        entry_timestamp:
          type: integer
          format: int64
          description: Unix time in milliseconds, e.g. 1793205455129 (an integer, unlike the trades' text times)
        entry_price_usd:
          type: number
          format: double
          description: What the lot cost in US dollars
        original_amount:
          type: number
          format: double
          description: Tokens in the token's smallest unit
        remaining_amount:
          type: number
          format: double
          description: Tokens in the token's smallest unit
        price_per_token:
          type: number
          format: double
          description: US dollars per smallest unit at entry (entry_price_usd / original_amount)
        status:
          type: string
          enum: [OPEN, PARTIAL, CLOSED]
        exit_count:
          type: integer
        entry_dex:
          type: string

    WalletLabel:
      type: object
      required:
        - wallet
        - kol_username
        - kol_platform
        - kol_tier
        - address_label
        - trader_type
        - performance_level
        - size_class
        - exit_style
        - automation_label
        - primary_terminal
        - primary_tool
        - primary_tool_pct
        - is_fresh_6h
        - is_fresh_24h
        - funded_by_farm
        - labels
        - trade_badges
        - identity_badges
        - special_labels
        - description
        - label_hash
      properties:
        wallet:
          type: string
        kol_username:
          type: [string, "null"]
          description: >-
            The registry's name for the wallet when its label names a person (an
            owner-proven link or a listing; see `kol_tier` and
            `/v1/wallet/{address}/identity`), without the leading @.
        kol_platform:
          type: [string, "null"]
          enum: [x, telegram, null]
          description: Platform required to construct the correct public profile URL.
        kol_tier:
          type: [string, "null"]
          enum: [verified, predicted, null]
          description: >-
            The tier of the registry's label behind `kol_username`: `verified`
            when it is owner-proven and no other source on the wallet disagrees,
            else `predicted` (a tracker, a roster or a single source lists it).
            Null when the label names no person.
        address_label:
          description: >-
            The registry's label of the wallet itself when it is a service or carries
            the OFAC mark; null otherwise. Its receipts are on
            `/v1/address/{address}/label`.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"
        trader_type:
          type: string
          enum: [SCALPER, DAY_TRADER, SWING_TRADER, POSITION_TRADER, MALICIOUS]
        performance_level:
          type: string
          enum: [BANNED, UNRATED, DORMANT, EARNER, UNPROFITABLE, BREAK_EVEN]
        size_class:
          type: string
          enum: [SHRIMP, FISH, SHARK, WHALE]
        exit_style:
          type: string
          enum: [FULL_EXITER, DCA_OUT, PARTIAL_TAKER, MIXED]
        automation_label:
          type: string
          description: "BOT:HFT, BOT:FLASH, BOT:ARB, BOT:WASH, BOT:MULTI, MIXED, ORGANIC, UNKNOWN"
        primary_terminal:
          type: string
          description: Primary trading tool (photon, bullx, axiom, etc.)
        primary_tool:
          type: string
        primary_tool_pct:
          type: number
          format: double
        is_fresh_6h:
          type: integer
        is_fresh_24h:
          type: integer
        funded_by_farm:
          type: integer
          description: "1 if funded by a known farm wallet, 0 otherwise"
        labels:
          type: array
          items:
            type: string
        trade_badges:
          type: array
          items:
            type: string
          description: "RUNNER_KEEPER, CONFIDENCE_SIZER, STOP_LOSS_USER, CONSISTENT_WINNER, BAG_HOLDER, LOSS_CUTTER, LOTTO_PLAYER, DIAMOND_HANDS, PAPER_HANDS, ELITE_TRADER, VETERAN_WINNER"
        identity_badges:
          type: array
          items:
            type: string
          description: "Kept for older clients and always empty; read `labels`."
        special_labels:
          type: array
          items:
            type: string
        description:
          type: [string, "null"]
        label_hash:
          type: [string, "null"]

    KolIdentity:
      type: object
      required:
        - platform
        - username
        - profile_url
        - source
        - verification
        - created_at
        - updated_at
      properties:
        platform:
          type: string
          enum: [x, telegram]
        username:
          type: string
          minLength: 1
          maxLength: 32
          pattern: "^[A-Za-z0-9_]+$"
          description: Public handle without the leading @.
        profile_url:
          type: string
          format: uri
          description: Platform-correct X or Telegram profile URL.
        source:
          type: string
          description: >-
            `axiom` or `fomo` when that terminal lists the name, otherwise
            `conyr`.
          example: axiom
        verification:
          type: string
          enum: [source_asserted]
          deprecated: true
          description: Always `source_asserted`; kept for existing clients. Read `tier` and `basis`.
        created_at:
          type: string
          format: date-time
          description: >-
            For a row of the original KOL registry, the row's own creation time;
            for every other association, the start of the registry run that
            first wrote it. RFC 3339 in UTC (Z), fractional seconds only when not zero (3, 6 or 9 digits), e.g. 2026-10-10T20:55:25.598085Z.
        updated_at:
          type: string
          format: date-time
          description: >-
            For a row of the original KOL registry, the row's own update time;
            for every other association, the start of the registry run that
            first wrote it. RFC 3339 in UTC (Z), fractional seconds only when not zero (3, 6 or 9 digits), e.g. 2026-10-10T20:55:25.598085Z.
        tier:
          type: string
          enum: [verified, predicted]
          description: >-
            `verified` when the association is owner-proven (the holder's own
            link, an on-chain proof, or an operator assertion backed by owner
            evidence); `predicted` when it is listed, not proven.
        basis:
          type: string
          description: >-
            What the association rests on: `chain_proof` (the SNS registry),
            `app_binding` (a link the holder made in an app), `operator`,
            `tracker`, `kol_app`, `kol_tracker`.
          example: app_binding
        reason:
          type: string
          description: The terminal in words; empty when no terminal lists the name.
          example: x listed by Axiom
        claim_id:
          type: integer
          format: int64
          description: The registry claim behind the association.

    WalletIdentityResponse:
      type: object
      required: [wallet_address, primary, aliases]
      properties:
        wallet_address:
          type: string
          description: Wallet identifier requested by the caller, echoed unchanged.
        chain:
          type: string
          enum: [solana, evm]
          description: The chain of the wallet's registry label, else of the input.
        primary:
          description: >-
            The alias the registry chose for the wallet's label (one of `aliases`,
            not an additional association); null when the label names no person.
          oneOf:
            - $ref: "#/components/schemas/KolIdentity"
            - type: "null"
        aliases:
          type: array
          description: >-
            Every active association that names a person, X before Telegram,
            each list in the registry's precedence order. Each alias is one
            source's association, so the same handle can appear once per source;
            for display, dedupe by `platform` and `username`.
          items:
            $ref: "#/components/schemas/KolIdentity"
        person:
          description: The person the wallet's label names; null when it names no person.
          oneOf:
            - $ref: "#/components/schemas/IdentityPerson"
            - type: "null"
        tier:
          type: [string, "null"]
          enum: [verified, predicted, null]
          description: The label's tier when it names a person; else null.
        reason:
          type: [string, "null"]
          description: Always null; kept for existing clients.
        conflict:
          type: boolean
          description: >-
            True when the wallet's live associations name more than one entity;
            the label is then `predicted`.
        tags:
          type: array
          description: >-
            Active associations that name no one (pump.fun names, `.sol`
            domains, SNS records, FOMO handles, listed handles), one row per
            name, in platform order. A tag is never a person's name.
          items:
            $ref: "#/components/schemas/IdentityTag"
        receipts:
          type: object
          maxProperties: 0
          description: Always empty; kept for existing clients.
        denials:
          type: array
          description: The associations on this wallet the operator denied, with the operator's note.
          items:
            $ref: "#/components/schemas/IdentityDenial"

    KolWalletsResponse:
      type: object
      required: [username, wallets]
      properties:
        username:
          type: string
          minLength: 1
          maxLength: 32
          pattern: "^[a-z0-9_]+$"
          description: Lowercase normalized username without the leading @.
        wallets:
          type: array
          description: Distinct active wallet associations in ascending address order.
          items:
            type: string
        person:
          description: >-
            The entity that currently holds the handle's profile (X before
            Telegram when no platform is given); null when no one does.
          oneOf:
            - type: object
              required: [id, name]
              properties:
                id:
                  type: string
                  example: person:x:orangie
                name:
                  type: string
            - type: "null"
        matches:
          type: array
          description: One entry per wallet, in the order of `wallets`.
          items:
            $ref: "#/components/schemas/KolWalletMatch"

    IdentityPerson:
      type: object
      required: [id, name, handles, formerly]
      properties:
        id:
          type: string
          example: person:x:cented7
        name:
          type: string
        handles:
          type: array
          description: The person's current X and Telegram profiles, X first.
          items:
            $ref: "#/components/schemas/IdentityHandle"
        formerly:
          type: array
          description: X and Telegram handles the person no longer holds, newest first.
          items:
            $ref: "#/components/schemas/IdentityFormerHandle"

    IdentityHandle:
      type: object
      required: [platform, username, profile_url]
      properties:
        platform:
          type: string
          enum: [x, telegram]
        username:
          type: string
          description: Handle without the leading @.
        profile_url:
          type: string
          format: uri

    IdentityFormerHandle:
      type: object
      required: [platform, username, until]
      properties:
        platform:
          type: string
          enum: [x, telegram]
        username:
          type: string
        until:
          type: string
          format: date-time
          description: When the registry closed the person's profile for this handle; RFC 3339 in UTC (Z), fractional seconds only when not zero (3, 6 or 9 digits), e.g. 2026-11-02T02:35:35.245117Z.

    IdentityTag:
      type: object
      required: [platform, username, source, basis, tier, reason, flags, hidden, claim_id]
      properties:
        platform:
          type: string
          enum: [x, telegram, pumpfun, fomo, sns, discord, github, backpack]
        username:
          type: string
        source:
          type: string
          description: "`axiom` or `fomo` when that terminal lists the name, otherwise `conyr`."
        basis:
          type: string
          description: "What the tag rests on, e.g. `self_attested` (the wallet declares it), `tracker`, `app_binding`."
        tier:
          type: string
          enum: [verified, predicted]
        reason:
          type: string
          example: pump.fun name
        flags:
          type: array
          items:
            type: string
        hidden:
          type: boolean
          description: >-
            True for a default name (`default_name`, `auto_created` or `low15`
            among `flags`); hide it unless the user asks for it.
        claim_id:
          type: integer
          format: int64
          description: The registry claim behind the tag.
        via:
          type: object
          description: >-
            Present on a FOMO handle that Axiom listed: the FOMO claim that gave
            the handle, and the name Axiom listed it under.
          required: [claim_id, listed_as]
          properties:
            claim_id:
              type: integer
              format: int64
            listed_as:
              type: string

    IdentityDenial:
      type: object
      required: [claim_id, platform, username, source, basis, operator_line, note]
      properties:
        claim_id:
          type: integer
          format: int64
        platform:
          type: string
        username:
          type: string
        source:
          type: string
        basis:
          type: string
        operator_line:
          type: [string, "null"]
          description: The id of the operator line that denied the association.
        note:
          type: [string, "null"]
          description: The operator's note.

    KolWalletMatch:
      type: object
      required: [address, chain, tier, basis, source, reason, conflict]
      properties:
        address:
          type: string
        chain:
          type: string
          enum: [solana, evm]
        tier:
          type: string
          enum: [verified, predicted]
        basis:
          type: string
        source:
          type: string
        reason:
          type: string
          example: x listed by Axiom
        conflict:
          type: boolean
          description: The wallet's `conflict` flag.

    AddressLabel:
      type: object
      description: >-
        The short label: the registry's money label of an address, when it is a
        service (an exchange or one of its deposit addresses, a custodian, an onramp,
        a bridge, a protocol, a tip account, a terminal, an infrastructure wallet) or
        carries the OFAC SDN mark. A company is named only on Conyr's own review. Its
        receipts are on `/v1/address/{address}/label`.
        Read through a ClickHouse dictionary that follows a registry load within 5–10
        minutes, then each route's own cache.
      required: [name, type, role, tier, reason]
      properties:
        name:
          type: [string, "null"]
          description: The service's name as its sources give it; null for the OFAC mark.
        type:
          type: [string, "null"]
          enum: [exchange, custodian, onramp, protocol, bridge, mev, terminal, infrastructure, company, null]
          description: The kind of service; null for the OFAC mark.
        role:
          type: string
          description: >-
            What the address is to the service, such as "Hot Wallet", "Deposit",
            "Escrow (USDC)" or "Tip Account"; "Sanctioned (OFAC SDN)" for the mark.
        tier:
          type: string
          enum: [verified, predicted]
          description: See `getAddressLabel` for what each tier means.
        reason:
          type: string
          description: The one-line reason, led by the primary source in words.
      example:
        name: Binance
        type: exchange
        role: Hot Wallet
        tier: verified
        reason: "verified: Conyr's curated list, plain wallet at slot 460080146; Conyr's roots list and Binance proof of reserves agree"

    AddressLabelResponse:
      type: object
      required: [address, chain, label, receipts, rests_on, conflicts, method_card, history, identity]
      properties:
        address:
          type: string
          description: The address as sent.
        chain:
          type: string
          enum: [solana]
        label:
          description: >-
            The current money label, or the OFAC mark when a person or a handle wins an
            address on the list; `null` for a person, a handle only, or no label.
          oneOf:
            - $ref: "#/components/schemas/MoneyLabel"
            - type: "null"
        receipts:
          type: object
          description: >-
            One receipt per money claim on the label and per claim in `rests_on`, keyed
            by claim id as a string. Empty when `label` is null.
          additionalProperties:
            $ref: "#/components/schemas/LabelReceipt"
        rests_on:
          type: array
          description: >-
            For a rule's label (a deposit address), the claims the winning claim rests on,
            in their stored order, each with its address and that address's current label.
            Empty otherwise: an address on an exchange's own list rests on that list.
          items:
            $ref: "#/components/schemas/LabelRestsOn"
        conflicts:
          type: array
          description: The other live claims on the address when sources disagree, in their stored order.
          items:
            $ref: "#/components/schemas/LabelConflict"
        method_card:
          description: The rule's method card when a rule's claim won the label; else null.
          oneOf:
            - $ref: "#/components/schemas/MethodCard"
            - type: "null"
        history:
          type: array
          description: The address's earlier money labels, newest first.
          items:
            $ref: "#/components/schemas/LabelPeriod"
        identity:
          type: [string, "null"]
          description: >-
            The `/v1/wallet/{address}/identity` path when the address's label has an
            identity view (a person or a handle); else null.

    MoneyLabel:
      type: object
      required: [entity, role, tier, reason, conflict, source, sanction, confidence, since]
      properties:
        entity:
          description: The organisation the label names; null for the OFAC mark (alone, or when a person or a handle wins).
          oneOf:
            - $ref: "#/components/schemas/LabelEntity"
            - type: "null"
        role:
          type: string
        tier:
          type: string
          enum: [verified, predicted]
        reason:
          type: string
          description: The one-line reason, led by the primary source in words.
        conflict:
          type: boolean
          description: True when sources on the address disagree; such a label is predicted.
        source:
          $ref: "#/components/schemas/LabelSource"
        sanction:
          description: The OFAC SDN entry on the address; null when there is none.
          oneOf:
            - $ref: "#/components/schemas/Sanction"
            - type: "null"
        confidence:
          type: [string, "null"]
          description: >-
            A rule's label only: its method card's lower bound on precision, rounded
            down and capped at 1, such as "1.000". Null otherwise.
        since:
          type: string
          format: date-time
          description: >-
            When the address took this name, role and tier: the start of the unbroken
            run of label periods with them. A rewording does not reset it.
            RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-10-01T00:03:07.653572Z.

    LabelEntity:
      type: object
      required: [id, name, type]
      properties:
        id:
          type: string
          example: org:binance
        name:
          type: string
          example: Binance
        type:
          type: string
          enum: [exchange, custodian, onramp, protocol, bridge, mev, terminal, infrastructure, company]

    LabelSource:
      type: object
      required: [code, url]
      properties:
        code:
          type: string
          description: >-
            The winning claim's source and, after a colon, its kind, such as
            `wallet_entity_labels:cex_hot_wallet`, `exchange_official:okx_por`,
            `deposit_sweeps:deposit_sweep_rule`, `official_sources:ofac_sdn` or
            `provenance_roots`.
        url:
          type: [string, "null"]
          format: uri
          description: >-
            The first public document among the winning claim and then the live claims
            that name the label's service (https only); null when none has one.

    Sanction:
      type: object
      required: [list, entry, name, type, programs, list_date]
      properties:
        list:
          type: string
          enum: [OFAC SDN]
        entry:
          type: integer
          description: The SDN list's entry number.
        name:
          type: [string, "null"]
          description: The party's name as OFAC writes it (its primary name; never an alias).
        type:
          type: [string, "null"]
          enum: [individual, entity, null]
          description: OFAC's type for the entry.
        programs:
          type: array
          items:
            type: string
        list_date:
          type: string
          format: date
          description: The publication date of the list read, YYYY-MM-DD, e.g. 2026-10-15.

    LabelReceipt:
      type: object
      description: >-
        The facts behind one claim, built field by field from the stored receipt.
        Every receipt has `source`, `claim_id`, `run`, `first_check` and `list`; the
        other fields depend on the source, as each field says. A receipt never holds a
        loader path, a database host, a curator's name, an internal note, an SDN
        entry's aliases, documents, dates or contacts, or the deposit rule's recipe.
      required: [source, claim_id, run, first_check, list]
      properties:
        source:
          type: string
          enum: [code_constants, wallet_entity_labels, provenance_roots, exchange_official, deposit_sweeps, official_sources, operator]
        claim_id:
          type: integer
          format: int64
        run:
          type: object
          description: The registry run that first wrote the claim.
          properties:
            id:
              type: integer
              format: int64
            started_at:
              type: string
              format: date-time
              description: RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-10-01T00:03:07.653572Z
        first_check:
          type: object
          description: The account check made when the claim was first read.
          properties:
            state:
              type: [string, "null"]
              description: plain_wallet, token_account, program, program_owned, stake_account, mint, no_account, …
            slot:
              type: [integer, "null"]
              format: int64
            checked_at:
              type: [string, "null"]
              format: date-time
              description: RFC 3339 in UTC (Z), whole seconds, e.g. 2026-10-01T00:03:07Z
        list:
          type: string
          description: >-
            The claim's source in words, such as "Conyr's curated list", "OKX proof of
            reserves", "the deposit-sweep rule", "Hyperlane account from its published
            seeds" or "the OFAC SDN list".
        release:
          type: [string, "null"]
          description: "exchange_official: OKX's release id; null for the other lists."
        document:
          type: object
          description: "exchange_official: the list's document."
          properties:
            url:
              type: string
            fetched_at:
              type: string
              format: date-time
              description: RFC 3339 in UTC (Z), whole seconds, e.g. 2026-10-15T22:26:52Z
            copy_sha256:
              type: string
              description: The saved copy's sha256; the copy stays with Conyr.
        role_words:
          type: [string, "null"]
          description: "exchange_official, official_sources: the role words on the address's line in the source."
        okx:
          type: object
          description: "exchange_official, OKX: the signed message, the address's signatures over it with their file lines, and whether a signature verified."
          properties:
            message:
              type: string
            signatures:
              type: array
              items:
                type: object
                properties:
                  signature:
                    type: string
                  line:
                    type: integer
            signature_verified:
              type: boolean
        custodian:
          type: string
          description: "exchange_official, Binance: the custodian named on the address's line."
        exchange:
          type: string
          description: "deposit_sweeps: the exchange."
        sweeps:
          type: object
          description: "deposit_sweeps: the sweeps seen: USD, rows, signatures, assets, first and last time, sample signatures."
          properties:
            usd:
              type: string
            rows:
              type: integer
            signatures:
              type: integer
            assets:
              type: array
              items:
                type: string
            first_at:
              type: string
              description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-09-30 00:02:48.215
            last_at:
              type: string
              description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-10-17 06:22:59.890
            samples:
              type: array
              items:
                type: string
        paid:
          type: array
          description: "deposit_sweeps: the verified wallets the address paid, with the USD to each."
          items:
            type: object
            properties:
              address:
                type: string
              usd:
                type: string
        window:
          type: object
          description: "deposit_sweeps: the observation window."
          properties:
            from:
              type: string
              description: UTC, as YYYY-MM-DD HH:MM:SS (a space, whole seconds, no zone; not RFC 3339), e.g. 2026-09-30 00:00:00
            to:
              type: string
              description: UTC, as YYYY-MM-DD HH:MM:SS (a space, whole seconds, no zone; not RFC 3339), e.g. 2026-10-17 07:00:00
        snapshot:
          type: string
          description: "deposit_sweeps: the sweep snapshot's id, which starts with its date."
        method_card:
          type: integer
          description: "deposit_sweeps: the method card's id."
        documents:
          type: array
          description: >-
            official_sources: each document read, with the line or field read (`at`).
            A `rpc:` url names an on-chain read, not a public document.
          items:
            type: object
            properties:
              url:
                type: string
              fetched_at:
                type: string
                format: date-time
                description: RFC 3339 in UTC (Z), whole seconds, e.g. 2026-10-18T04:46:51Z
              copy_sha256:
                type: string
              at:
                type: string
        derivation:
          type: object
          description: >-
            official_sources, a derived account: `{kind: pda, program, seeds, bump}` or
            `{kind: ata, owner, mint, token_program}`, so anyone can derive the address
            again.
        config:
          type: object
          description: "official_sources, an on-chain config read: the account, the field and the slot read."
          properties:
            account:
              type: string
            field:
              type: string
            slot:
              type: integer
        ofac:
          type: object
          description: "official_sources, OFAC: the entry, its name and type as OFAC writes them, its programs, the publication and the list date."
          properties:
            entry:
              type: integer
            name:
              type: string
            type:
              type: string
            programs:
              type: array
              items:
                type: string
            publication:
              type: integer
            list_date:
              type: string
              format: date
              description: YYYY-MM-DD, e.g. 2026-10-15
        evidence:
          type: object
          description: "operator: the evidence for Conyr's own review."
          properties:
            kind:
              type: string
            url:
              type: [string, "null"]
            copy_sha256:
              type: [string, "null"]
            captured_at:
              type: [string, "null"]
              description: As stored with the evidence, either a date (YYYY-MM-DD, e.g. 2026-11-02) or RFC 3339 in UTC, whole seconds (e.g. 2026-11-02T01:17:46Z)
        added:
          type: string
          description: "wallet_entity_labels: when the row was added to Conyr's curated list; RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-07-21T21:15:35.097953Z."
        changed:
          type: string
          description: "wallet_entity_labels: when the row last changed; RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-11-02T02:35:35.245117Z."
        row_sha256:
          type: string
          description: "wallet_entity_labels: the row's sha256."
        root_label:
          type: string
          description: "provenance_roots: the label Conyr's roots list gives."
        section:
          type: string
          description: "code_constants, the published tip list: the section (the provider)."
        publisher_url:
          type: string
          description: "code_constants, the published tip list: the publisher's file."
        publisher_sha256:
          type: string
          description: "code_constants, the published tip list: the publisher file's sha256."
        observed:
          type: string
          description: "code_constants, an observed list: \"seen in transactions Conyr parsed\"."

    LabelRestsOn:
      type: object
      required: [address, entity, role, tier, reason, claim_id]
      properties:
        address:
          type: string
        entity:
          oneOf:
            - $ref: "#/components/schemas/LabelEntity"
            - type: "null"
        role:
          type: [string, "null"]
        tier:
          type: string
          enum: [verified, predicted]
        reason:
          type: string
        claim_id:
          type: integer
          format: int64
          description: The parent claim; its receipt is in `receipts`.

    LabelConflict:
      type: object
      required: [claim_id, source, entity, role]
      properties:
        claim_id:
          type: integer
          format: int64
          description: The conflicting claim; its receipt is in `receipts`.
        source:
          type: string
          description: The claim's source in words.
        entity:
          oneOf:
            - $ref: "#/components/schemas/LabelEntity"
            - type: "null"
        role:
          type: [string, "null"]

    MethodCard:
      type: object
      description: >-
        A rule's method card: what the deposit-sweep rule was scored on, its recall,
        and its precision as a lower bound. How the precision is computed, and any
        count or threshold the rule uses, are never shown.
      required: [rule, card_id, scored_on, window, measured_on, recall, precision, confidence, confidence_is]
      properties:
        rule:
          type: string
          enum: [deposit sweeps]
        card_id:
          type: integer
          format: int64
        scored_on:
          type: string
          example: OKX's signed lists of its own deposit addresses
        window:
          type: object
          properties:
            from:
              type: string
              format: date-time
              description: RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-09-30T00:00:00.000000Z
            to:
              type: string
              format: date-time
              description: RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-10-17T07:00:00.000000Z
        measured_on:
          type: [string, "null"]
          format: date
          description: YYYY-MM-DD, e.g. 2026-10-17
        recall:
          type: object
          properties:
            found:
              type: integer
            total:
              type: integer
            share:
              type: string
              description: found / total as a percent, rounded down to one decimal, such as "99.4%".
        precision:
          type: string
          description: The lower bound in words; "above 99.9%" at or above 0.999, else "at least <p>%".
        confidence:
          type: [string, "null"]
          description: The label's confidence.
        confidence_is:
          type: string
          description: What the confidence is, in words.

    LabelPeriod:
      type: object
      required: [valid_from, valid_to, entity, role, tier, reason, reworded]
      properties:
        valid_from:
          type: string
          format: date-time
          description: RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-10-01T00:03:07.653572Z
        valid_to:
          type: string
          format: date-time
          description: RFC 3339 in UTC (Z) with six fractional digits, e.g. 2026-10-23T20:36:20.752745Z
        entity:
          oneOf:
            - $ref: "#/components/schemas/LabelEntity"
            - type: "null"
        role:
          type: [string, "null"]
        tier:
          type: string
          enum: [verified, predicted]
        reason:
          type: string
          description: The reason as Conyr stated it then.
        reworded:
          type: boolean
          description: >-
            True when the next newer period (or the current label) has the same
            service, role and tier: the row differs only in wording or account state.

    WalletProvenance:
      type: object
      required: [wallet, root_entity, hops, root_address_label, direct_funder_address_label]
      properties:
        wallet:
          type: string
        root_entity:
          type: [string, "null"]
          description: The funding root's name; null when no provenance is traced.
        root_source:
          type: string
          description: The funding root's address (present when a root is traced).
        hops:
          type: [integer, "null"]
          description: Transfers between the root and the wallet; null when no provenance is traced.
        direct_funder:
          type: string
          description: The wallet that funded this one directly (present when a root is traced).
        last_funded_ts:
          type: string
          description: The last funding time, UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-15 11:32:21.514 (present when a root is traced; empty when unknown).
        funding_path:
          type: "null"
          description: Present, as null, only when no provenance is traced.
        root_address_label:
          description: The registry's label of the funding root when it is a service or carries the OFAC mark.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"
        direct_funder_address_label:
          description: The registry's label of the direct funder when it is a service or carries the OFAC mark.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"

    FundingAbuseResponse:
      type: object
      required: [token_mint, summary, wallets]
      properties:
        token_mint:
          type: string
        summary:
          $ref: "#/components/schemas/FundingAbuseSummary"
        wallets:
          type: array
          description: The flagged early buyers; empty when the drilldown is unavailable.
          items:
            $ref: "#/components/schemas/FundingAbuseWallet"

    FundingAbuseSummary:
      type: object
      properties:
        token_mint:
          type: string
        token_first_buy_ts:
          type: string
          description: The coin's first recorded buy, UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-23 18:35:28.592; empty when the coin launched before Conyr began recording
        early_window_minutes:
          type: integer
        early_buyer_count:
          type: integer
        seeded_wallet_count:
          type: integer
        seeded_wallet_pct:
          type: number
        funded_by_farm_count:
          type: integer
        funded_by_farm_pct:
          type: number
        cex_root_count:
          type: integer
          description: Seeded wallets whose funding root is an exchange or onramp wallet on Conyr's service list (an exact address match).
        distinct_cex_root_count:
          type: integer
          description: How many distinct such roots the seeded wallets span.
        cex_root_pct:
          type: number
        avg_seed_fund_to_buy_seconds:
          type: number
        median_seed_fund_to_buy_seconds:
          type: number
        top_seeded_terminal:
          type: string
        top_seeded_terminal_wallets:
          type: integer
        top_seeded_terminal_share:
          type: number
        suspicious:
          type: boolean
        score:
          type: number
        reasons:
          type: array
          items:
            type: string

    FundingAbuseWallet:
      type: object
      properties:
        wallet_address:
          type: string
        first_buy_ts:
          type: string
          description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-23 18:35:49.033
        first_buy_slot:
          type: integer
        first_buy_usd:
          type: number
        first_buy_dex:
          type: string
        last_fresh_fund_ts:
          type: string
          description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-23 18:24:30.661; empty when no fresh funding was seen
        fresh_fund_to_buy_seconds:
          type: integer
        funded_by_farm:
          type: integer
        root_label:
          type: string
        root_source:
          type: string
        direct_funder:
          type: string
        is_root_cex:
          type: integer
          description: 1 when the funding root (root_source) is an exchange's hot or cold wallet or an onramp on Conyr's service list (an exact address match), else 0.
        primary_terminal:
          type: string
        automation_label:
          type: string
        is_seeded_wallet:
          type: integer
        root_address_label:
          description: The registry's label of the funding root when it is a service or carries the OFAC mark.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"
        direct_funder_address_label:
          description: The registry's label of the direct funder when it is a service or carries the OFAC mark.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"

    BundleSummary:
      type: object
      properties:
        token_mint:
          type: string
        bundle_count:
          type: integer
          description: Bundles the detector tracks on the coin now, of the types that count toward its supply share; 0 when it tracks none
        open_bundle_count:
          type: integer
          description: Those of them still open (active, dormant, dumping or derisked)
        bundled_supply_pct:
          type: number
          format: double
          description: Percent of total token supply held by those tracked bundles, from 0 to 100 (18.5 means 18.5%; 0.04 means 0.04%, not 4%).
        bundled_value_usd:
          type: number
          format: double
        bundled_realized_pnl_usd:
          type: number
          format: double
        dominant_bundle_type:
          type: [string, "null"]
          description: Type of the tracked bundle holding the most tokens; null when no tracked bundle holds any

    Bundle:
      type: object
      properties:
        bundle_id:
          type: string
        token_mint:
          type: string
        bundle_type:
          type: string
          description: JitoMev, SameSlotBuyCohort, SameSlotSellCohort, LaunchSlotBurst, MultiSlotBuyCohort, MultiSell, SybilPoisoning, Synthetic, CexCoordinated or SyntheticSwarm (the type list also holds JitoSequential, Sleeper and Unattributed, which no bundle carries today)
        status:
          type: string
          enum: [active, dormant, dumping, derisked, exited, rugged, merged]
        leader_wallet:
          type: string
        member_count_total:
          type: integer
        member_count_active:
          type: integer
        chain_balance_ui:
          type: number
          format: double
          description: Current token balance held by all bundle members
        total_usd_invested:
          type: number
          format: double
        total_usd_returned:
          type: number
          format: double
        total_tokens_bought_ui:
          type: number
          format: double
        total_tokens_sold_ui:
          type: number
          format: double
        realized_pnl_usd:
          type: number
          format: double
        risk_score:
          type: number
          format: double
          description: 0 to 100; higher means stronger evidence
        evidence:
          type: array
          items:
            type: string
          description: Evidence codes, each DOMAIN:CODE (EXEC, PROV, COORD or BEHAV), for example PROV:SYBIL_POISONING
        sold_pct:
          type: number
          format: double
          description: 0 to 1, as sold_pct_basis says. chain_balance (most bundles), the share of the tokens the bundle bought that its wallets no longer hold on chain; swaps (execution-only clusters), the share sold by swaps, or 0 when the cluster is not tied to a tracked bundle.
        sold_pct_basis:
          type: string
          enum: [chain_balance, swaps]
          description: Which sold_pct the row carries
        created_at:
          type: string
          description: UTC, as Postgres prints a timestamptz, YYYY-MM-DD HH:MM:SS.ffffff+00 (a space, up to six fractional digits, none when zero, then +00; not RFC 3339), e.g. 2026-11-23 16:31:15.760402+00
        linked_entity:
          $ref: "#/components/schemas/BundleLinkedEntity"

    BundleLinkedEntity:
      type: object
      properties:
        entityId:
          type: string
        entityKind:
          type: string
        memberCount:
          type: integer
        bundleMemberShare:
          type: number
          format: double
          description: Fraction of bundle members sharing this entity.

    BundleMember:
      type: object
      properties:
        wallet_address:
          type: string
        bundle_id:
          type: string
        is_leader:
          type: boolean
        is_active:
          type: boolean
        chain_balance_ui:
          type: number
          format: double
        realized_pnl_usd:
          type: number
          format: double
        avg_entry_price_usd:
          type: number
          format: double

    BundleFullResponse:
      type: object
      properties:
        bundle:
          $ref: "#/components/schemas/Bundle"
        members:
          type: array
          items:
            $ref: "#/components/schemas/BundleMember"

    LeaderboardEntry:
      type: object
      required:
        - rank
        - wallet_address
        - kol_username
        - kol_platform
        - kol_tier
        - total_trades
        - wins
        - losses
        - win_rate
        - total_pnl_usd
        - total_volume_usd
        - roi
        - cash_pnl_usd
      properties:
        rank:
          type: integer
          format: uint64
          description: The row's place on the board; wallets tied on the sort follow by total_pnl_usd, largest first, then by address
        wallet_address:
          type: string
        kol_username:
          type: [string, "null"]
          description: >-
            The registry's name for the wallet when its label names a person (an
            owner-proven link or a listing; see `kol_tier` and
            `/v1/wallet/{address}/identity`), without the leading @.
        kol_platform:
          type: [string, "null"]
          enum: [x, telegram, null]
          description: Platform for the public handle.
        kol_tier:
          type: [string, "null"]
          enum: [verified, predicted, null]
          description: >-
            The tier of the registry's label behind `kol_username`: `verified`
            when it is owner-proven and no other source on the wallet disagrees,
            else `predicted` (a tracker, a roster or a single source lists it).
            Null when the label names no person.
        total_trades:
          type: integer
          format: uint64
        wins:
          type: integer
          format: uint64
        losses:
          type: integer
          format: uint64
        win_rate:
          type: number
          format: double
        total_pnl_usd:
          type: number
          format: double
        total_volume_usd:
          type: number
          format: double
        roi:
          type: number
          format: double
          description: Return on investment as percentage
        cash_pnl_usd:
          type: number
          format: double

    TokenInfo:
      type: object
      properties:
        token_mint:
          type: string
        is_validated:
          type: boolean
        is_suspicious:
          type: boolean
        is_high_risk:
          type: boolean
        validation_reason:
          type: string
          nullable: true

    OhlcvCandle:
      type: object
      properties:
        bucket:
          type: string
          description: Candle start, UTC, as Postgres prints a timestamptz, YYYY-MM-DD HH:MM:SS+00 (a space, whole seconds, then +00; not RFC 3339), e.g. 2026-11-23 16:44:00+00
        open:
          type: number
          format: double
        high:
          type: number
          format: double
        low:
          type: number
          format: double
        close:
          type: number
          format: double
        volume_token:
          type: number
          format: double
        volume_usd:
          type: number
          format: double
        num_trades:
          type: integer
          format: int64
        buy_volume:
          type: number
          format: double
        sell_volume:
          type: number
          format: double
        vwap:
          type: number
          format: double
          nullable: true
          description: Volume-weighted average price

    TokenTrade:
      type: object
      properties:
        signature:
          type: string
        slot:
          type: integer
          format: uint64
        timestamp:
          type: string
          description: UTC, as YYYY-MM-DD HH:MM:SS.mmm (a space, milliseconds, no zone; not RFC 3339), e.g. 2026-11-23 18:38:51.376
        wallet_address:
          type: string
        token_amount:
          type: number
          format: double
          description: Tokens in the token's smallest unit
        direction:
          type: string
          enum: [buy, sell]
        dex_name:
          type: string
        base_amount:
          type: number
          format: double
          description: The other side of the swap in the smallest unit of base_mint (lamports in a SOL pool, millionths of a USDC in a USDC pool)
        base_price_usd:
          type: number
          format: double
          description: The swap's value in US dollars, not a price per token
        total_fees_usd:
          type: number
          format: double
        base_mint:
          type: string
          description: The trade's quote mint, the unit base_amount is counted in
        base_decimals:
          type: [integer, "null"]
          description: base_mint's decimals (9 for SOL; 6 for USDC, USDT, PYUSD, USDS, USD1, USDG and CASH; 8 for DAI); null for another quote token

    LiquidityResponse:
      type: object
      required: [token_mint, depth, lock, dump_impact_pct, exit_capacity]
      properties:
        token_mint:
          type: string
        depth:
          oneOf:
            - $ref: "#/components/schemas/LiquidityDepth"
            - type: "null"
          description: Null when no current supported reserve snapshot is available.
        lock:
          oneOf:
            - $ref: "#/components/schemas/LiquidityLock"
            - type: "null"
          description: Null until LP lock/burn state has been measured.
        dump_impact_pct:
          type: [number, "null"]
          format: double
          description: Fractional price impact if every coordinated wallet sold.
        exit_capacity:
          oneOf:
            - $ref: "#/components/schemas/ExitCapacity"
            - type: "null"
          description: Null when depth is unknown or the venue curve is unsupported.

    LiquidityDepth:
      type: object
      required: [venue, token_reserve_ui, quote_reserve_sol, liquidity_usd, reserve_slot, updated_at_ms]
      properties:
        venue:
          type: string
          enum: [curve_virtual, amm_actual]
        token_reserve_ui:
          type: number
          format: double
        quote_reserve_sol:
          type: number
          format: double
        liquidity_usd:
          type: [number, "null"]
          format: double
          description: Null in the current implementation; convert with the agent's own SOL/USD source.
        reserve_slot:
          type: integer
          format: int64
        updated_at_ms:
          type: [integer, "null"]
          format: int64
          description: Unix time in milliseconds, e.g. 1795459144506; null when never stamped

    LiquidityLock:
      type: object
      required: [status, burn_pct, lock_pct, verified_at]
      properties:
        status:
          type: string
          enum: [burned, locked, unlocked, unknown]
        burn_pct:
          type: [number, "null"]
          format: double
        lock_pct:
          type: [number, "null"]
          format: double
        verified_at:
          type: [string, "null"]
          description: UTC, as Postgres prints a timestamptz, YYYY-MM-DD HH:MM:SS.ffffff+00 (up to six fractional digits, none when zero; not RFC 3339), e.g. 2026-11-09 21:30:41.542896+00; null when not known

    ExitCapacity:
      type: object
      required: [usd_at_10, usd_at_25, usd_at_50, sol_at_10, sol_at_25, sol_at_50]
      properties:
        usd_at_10:
          type: [number, "null"]
          format: double
        usd_at_25:
          type: [number, "null"]
          format: double
        usd_at_50:
          type: [number, "null"]
          format: double
        sol_at_10:
          type: number
          format: double
        sol_at_25:
          type: number
          format: double
        sol_at_50:
          type: number
          format: double

    LiquidityEventsResponse:
      type: object
      required: [token_mint, events]
      properties:
        token_mint:
          type: string
        events:
          type: array
          items:
            $ref: "#/components/schemas/LiquidityEvent"

    LiquidityEvent:
      type: object
      required: [signature, ts_ms, slot, pool, dex, wallet, side, token_ui, quote_ui, pct_of_pool, is_full_close, is_bundle_member, is_flagged]
      properties:
        signature:
          type: string
        ts_ms:
          type: integer
          format: int64
          description: Unix time in milliseconds, e.g. 1795459154491
        slot:
          type: integer
          format: int64
        pool:
          type: string
        dex:
          type: string
        wallet:
          type: string
        side:
          type: string
          enum: [add, remove]
        token_ui:
          type: number
          format: double
          description: Zero means vault deltas could not be resolved, not that no tokens moved.
        quote_ui:
          type: number
          format: double
        pct_of_pool:
          type: [number, "null"]
          format: double
          description: Fraction of the quote vault moved.
        is_full_close:
          type: boolean
        is_bundle_member:
          type: boolean
        is_flagged:
          type: boolean
          description: True when the wallet carries Conyr's serial rugger tag.

    HoldersSummary:
      type: object
      properties:
        mint:
          type: string
        distinctCount:
          type: integer
          format: uint64
        totalBalanceRaw:
          type: string
          description: Sum of all non-zero holder balances, raw token units (string for u64 precision)
        supplyRaw:
          type: string
          description: On-chain mint supply, raw units. Omitted when unknown.
        top10Pct:
          type: number
          format: double
          description: Percentage of total balance held by the top 10 wallets. Omitted when fewer than 10 holders.
        top50Pct:
          type: number
          format: double
        top100Pct:
          type: number
          format: double
        hydrationStatus:
          type: string
          description: "born_forward | hydrating | hydrated | partial_forward"
        hydratedAtSlot:
          type: integer
          format: uint64
        lastUpdatedSlot:
          type: integer
          format: uint64
        lastUpdatedTsMs:
          type: integer
          format: int64
          description: Unix time in milliseconds, e.g. 1795457090850
        asOfTsMs:
          type: integer
          format: int64
          description: When the server answered, Unix time in milliseconds, e.g. 1795459147222

    HolderEntry:
      type: object
      properties:
        rank:
          type: integer
          format: uint32
        wallet:
          type: string
        balanceRaw:
          type: string
          description: Holder balance, raw token units (string for u64 precision)
        pctOfTotal:
          type: number
          format: double
          description: Percentage of total balance. Omitted when total is zero.
        firstSeenSlot:
          type: integer
          format: uint64
        addressLabel:
          description: >-
            The registry's label of the holder when it is a service (an exchange, a
            custodian, a protocol vault, …) or carries the OFAC mark; null otherwise.
          oneOf:
            - $ref: "#/components/schemas/AddressLabel"
            - type: "null"

    HoldersTop:
      type: object
      properties:
        mint:
          type: string
        distinctCount:
          type: integer
          format: uint64
        totalBalanceRaw:
          type: string
        hydrationStatus:
          type: string
        holders:
          type: array
          items:
            $ref: "#/components/schemas/HolderEntry"
        asOfTsMs:
          type: integer
          format: int64
          description: When the server answered, Unix time in milliseconds, e.g. 1795459147475

    HoldersList:
      type: object
      properties:
        mint:
          type: string
        distinctCount:
          type: integer
          format: uint64
        totalBalanceRaw:
          type: string
        hydrationStatus:
          type: string
        holders:
          type: array
          items:
            $ref: "#/components/schemas/HolderEntry"
        limit:
          type: integer
          format: uint32
        offset:
          type: integer
          format: uint32
        nextOffset:
          type: integer
          format: uint32
          nullable: true
          description: Offset of the next page, or null when no more pages
        asOfTsMs:
          type: integer
          format: int64
          description: When the server answered, Unix time in milliseconds, e.g. 1795459147681

    WalletQuality:
      type: object
      properties:
        wallet:
          type: string
        rated:
          type: boolean
          description: True when closed_positions >= 10
        skill_score:
          type: number
          format: double
          description: Composite skill score in [0, 100]
        performance_level:
          type: string
        trader_type:
          type: string
        exit_style:
          type: string
        size_class:
          type: string
        closed_positions:
          type: integer
          format: uint64
        position_win_rate_pct:
          type: number
          format: double
          description: Position-correct win rate — the differentiated metric
        raw_exit_win_rate_pct:
          type: number
          format: double
          description: Commodity per-exit win rate, for contrast
        win_rate_inflation_pts:
          type: number
          format: double
          description: How much the commodity number overstates skill (raw - position), in pts
        disposition_index:
          type: number
          format: double
          nullable: true
        conviction_sizing:
          type: number
          format: double
          nullable: true
        profit_factor:
          type: number
          format: double
        sharpe_ratio:
          type: number
          format: double
          nullable: true
        runner_score:
          type: number
          format: double
        avg_loss_roi_pct:
          type: number
          format: double
        loss_consistency_stddev:
          type: number
          format: double
        roi_p10_pct:
          type: number
          format: float
          nullable: true
          description: Null when closed_positions is 0
        roi_p50_pct:
          type: number
          format: float
          nullable: true
          description: Null when closed_positions is 0
        roi_p90_pct:
          type: number
          format: float
          nullable: true
          description: Null when closed_positions is 0
        big_wins:
          type: integer
          format: uint64
        big_losses:
          type: integer
          format: uint64
        realized_pnl_usd:
          type: number
          format: double
        trade_badges:
          type: array
          items:
            type: string

    CoordinatedPushCandidate:
      type: object
      properties:
        tokenMint:
          type: string
        latestRegime:
          type: string
        priorRegime:
          type: string
        campaignId:
          type: string
        campaignStatus:
          type: string
        participantWallets:
          type: integer
          format: uint32
        participantEntities:
          type: integer
          format: uint32
        confidence:
          type: number
          format: double
        tokenAgeMinutes:
          type: integer
          format: uint32

    CascadeFollower:
      type: object
      properties:
        follower:
          type: string
        confidence:
          type: number
          format: double
        lagSeconds:
          type: integer
          format: int32

    EmergingEntity:
      type: object
      properties:
        entityId:
          type: string
        entityKind:
          type: string
        rootWallet:
          type: string
        memberCount:
          type: integer
          format: uint32
        confidence:
          type: number
          format: double
        firstSeenTsMs:
          type: integer
          format: uint64
          description: Unix time in milliseconds, e.g. 1795459157825
        lastSeenTsMs:
          type: integer
          format: uint64
          description: Unix time in milliseconds, e.g. 1795459157825

    EarlyBuyCluster:
      type: object
      properties:
        entityId:
          type: string
        entityKind:
          type: string
        rootWallet:
          type: string
        confidence:
          type: number
          format: double
        membersInEarlyBuy:
          type: integer
          format: uint32
        memberWallets:
          type: array
          items:
            type: string

    OriginatorCandidate:
      type: object
      properties:
        candidateLeader:
          type: string
        followerBuysInCluster:
          type: integer
          format: uint32
        meanConfidence:
          type: number
          format: double

    EntityConcentration:
      type: object
      properties:
        totalWallets:
          type: integer
          format: uint64
        distinctActors:
          type: integer
          format: uint64
        totalVolumeUsd:
          type: number
          format: double
        entityVolumeUsd:
          type: number
          format: double
        entityVolumeShare:
          type: number
          format: double
        topActors:
          type: array
          items:
            type: string

    LateRetail:
      type: object
      properties:
        eliteSells:
          type: integer
          format: uint64
        lateBuyers:
          type: integer
          format: uint64
          description: Buys (not wallets) made within 10 minutes after an earner's sell
        lateBuyerWallets:
          type: integer
          format: uint64
          description: Distinct wallets that made those late buys, earners included (the same buys lateBuyers counts)
        lateBuyerVolumeUsd:
          type: number
          format: double
        avgLagSeconds:
          type: number
          format: double
          description: Average seconds from the nearest earner sell before each late buy
        shareUnprofitable:
          type: number
          format: double

    # WebSocket schemas (not REST, documented for completeness)
    WsClientMessage:
      discriminator:
        propertyName: op
      oneOf:
        - type: object
          properties:
            op:
              type: string
              const: subscribe
            channels:
              type: array
              items:
                type: string
          required: [op, channels]
        - type: object
          properties:
            op:
              type: string
              const: unsubscribe
            channels:
              type: array
              items:
                type: string
          required: [op, channels]
        - type: object
          properties:
            op:
              type: string
              const: ping
          required: [op]

    WsServerMessage:
      oneOf:
        - type: object
          description: Data event
          properties:
            channel:
              type: string
            data:
              type: object
          required: [channel, data]
        - type: object
          description: Control message
          properties:
            op:
              type: string
              enum: [subscribed, unsubscribed, pong, error]
            channels:
              type: array
              items:
                type: string
            message:
              type: string

    WsChannelFormat:
      type: string
      description: |
        Channel naming convention. Market data:
        - token:<mint>:trades — live trade tape
        - token:<mint>:ticks — chart tick events
        - token:<mint>:ohlcv:<view>:<tf> — OHLCV updates (view: full|filtered, tf: 1s|1m|5m|15m|1h)

        Wallet activity:
        - wallet:<address>:pnl — realized PnL events (sub-second)
        - wallet:<address>:positions — position updates
        - wallet:<address>:labels — activity-driven label and badge updates, not canonical identity-registry changes; empty KOL strings clear cached identity

        Security:
        - token:<mint>:security — token security events (bundle, wash trade, rug, coordination alert)
        - token:<mint>:bundles — raw BundleV2 token updates
        - token:<mint>:dump_alert — compact qualifying coordinated-dump alerts
        - wallet:<address>:security — wallet-scoped security events

        Coordination v2:
        - wallet:<address>:follow — follow-edge activations
        - wallet:<address>:entity — entity-membership changes
        - token:<mint>:campaign — coordinated campaign activations

      examples:
        - "token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:trades"
        - "token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:ohlcv:full:1m"
        - "wallet:7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU:pnl"
        - "wallet:7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU:follow"
