openapi: 3.0.3
info:
  title: ThunderCheck Public API (by ThunderLaunch)
  version: "1.0"
  description: |
    Token-safety reports and risk scores for any Solana mint, powered by the
    same production security engine behind [ThunderCheck](https://thunderlaunch.fun/thundercheck).

    - **Formerly "RugCheck" (renamed 2026-11-06).** The v1 contract is unchanged:
      the legacy paths `/api/v1/rugcheck/{mint}`, `/api/v1/rugcheck/batch` and
      `/api/v1/rugcheck/{mint}/history` remain served permanently as aliases of
      the `/api/v1/thundercheck/...` paths below, with identical responses, rate
      limits and quotas. Existing API keys and the `rugcheck:read` scope value
      keep working — no client changes are required.

    - **Anonymous access works** (per-IP rate limits). An API key (create one at
      [/profile/api-keys](https://thunderlaunch.fun/profile/api-keys) with the
      `rugcheck:read` permission) unlocks your key's own rate limit and monthly
      fresh-scan quota.
    - **Stability**: v1 response shapes only change additively — clients must
      ignore unknown fields. Breaking changes would ship as `/api/v2`.
    - Cached reads are free and unlimited on every tier; only fresh scans
      (uncached mints) count against monthly quotas.

    Human-readable docs: https://thunderlaunch.fun/developers
  termsOfService: https://thunderlaunch.fun/developers#terms
  contact:
    email: support@thunderlaunch.fun
servers:
  - url: https://thunderlaunch.fun
security:
  - {}
  - ApiKeyHeader: []
  - BearerAuth: []
tags:
  - name: ThunderCheck
    description: Token safety reports and risk scores

paths:
  /api/v1/thundercheck/{mint}:
    get:
      tags: [ThunderCheck]
      operationId: getThundercheckReport
      summary: Full safety report for a Solana mint
      description: >
        Complete report: scores, verdict, hard-cap flags, market and holder
        context, creator reputation, and the evidence-backed findings list.
        A stored report is served as current for up to 1 minute on tokens
        under 24 hours old and 10 minutes on older tokens (see ageSeconds /
        maxAgeSeconds); past that it is rebuilt fresh (can take several seconds).
      parameters:
        - $ref: "#/components/parameters/Mint"
        - name: forceRefresh
          in: query
          required: false
          description: >
            Bypass the report cache and build fresh. Requires an API key on the
            Pro or Scale tier (`paid_tier_required` otherwise); the forced
            build counts against the monthly fresh-scan quota.
          schema:
            type: boolean
      responses:
        "200":
          description: Safety report
          content:
            application/json:
              schema:
                type: object
                required: [success, data]
                properties:
                  success:
                    type: boolean
                    enum: [true]
                  data:
                    $ref: "#/components/schemas/RugReport"
        "400": { $ref: "#/components/responses/InvalidMint" }
        "401": { $ref: "#/components/responses/InvalidKey" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "422": { $ref: "#/components/responses/NotAMint" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "500": { $ref: "#/components/responses/ScanFailed" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/thundercheck/{mint}/summary:
    get:
      tags: [ThunderCheck]
      operationId: getThundercheckSummary
      summary: Short form of a safety report, for small displays
      description: >
        The short form of a report for clients that show a result in a small
        space (a bot reply, a browser-extension badge): score, verdictLabel,
        the top risks by name, what could not be checked, links back to the
        site, and ready-made text. Auth, quotas and daily capacity are those of
        the full report: the API key is optional, a stored report within its
        freshness limit is always served and never metered, and a fresh scan
        counts against the caller's quota and capacity exactly like
        GET /api/v1/thundercheck/{mint}. Without a key the per-IP limit is 60
        requests per minute, separate from the full report's. forceRefresh is
        not supported here (ignored). Display verdictLabel, never verdict: a
        clean result reads "No major flags found". Successful answers to
        calls without a key carry
        `Cache-Control: public, s-maxage=<up to 60, never past the report's
        freshness limit>, stale-while-revalidate=30`, so scannedAt (not
        ageSeconds) is the time to trust; `404 not_cached` carries
        `public, s-maxage=10`; other errors, and every answer to a call
        with a key, are not cacheable.
      parameters:
        - $ref: "#/components/parameters/Mint"
        - name: client
          in: query
          required: false
          description: >
            The surface showing the result. Tags reportUrl and launchUrl with
            utm_source=<client>&utm_medium=scan&utm_campaign=verify_before_you_ape&utm_content=<mint>.
            Omit for untagged links; any other value returns 400 `invalid_client`.
          schema:
            type: string
            enum: [tg_bot, x_bot, extension, web_share]
        - name: cachedOnly
          in: query
          required: false
          description: >
            true = never start a scan: answer from the stored report if one is
            within its freshness limit, otherwise 404 `not_cached`. Costs no
            quota and no capacity.
          schema:
            type: boolean
        - name: X-Client
          in: header
          required: false
          description: >
            Your app's name and version (e.g. my-extension/1.2.0), logged for
            usage statistics. Letters, digits, `. _ / -` and spaces, up to 64
            characters.
          schema:
            type: string
            maxLength: 64
            example: my-extension/1.2.0
      responses:
        "200":
          description: Report summary
          content:
            application/json:
              schema:
                type: object
                required: [success, data]
                properties:
                  success:
                    type: boolean
                    enum: [true]
                  data:
                    $ref: "#/components/schemas/Summary"
        "400":
          description: Not a valid base58 Solana address (`invalid_mint`) or an unknown `client` value (`invalid_client`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "401": { $ref: "#/components/responses/InvalidKey" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "404":
          description: >
            cachedOnly=true and no report within its freshness limit is stored
            for this mint (`not_cached`). No scan was started; call again
            without cachedOnly to scan it.
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "422": { $ref: "#/components/responses/NotAMint" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "500": { $ref: "#/components/responses/ScanFailed" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/thundercheck/batch:
    post:
      tags: [ThunderCheck]
      operationId: batchThundercheck
      summary: Resolve many mints in one call (API key required)
      description: >
        Keyed-only. Per-tier batch caps: Free 10 / Pro 50 / Scale 100 mints per
        call. Each mint resolves independently (cached-first; fresh builds count
        against the monthly quota) — the batch responds 200 with per-item
        ok/error entries, and one batch call counts as ONE request against the
        key's rate limit. Default items carry the lightweight risk shape;
        `full: true` returns complete reports.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [mints]
              properties:
                mints:
                  type: array
                  minItems: 1
                  items: { type: string }
                  description: Base58 mint addresses (deduped server-side)
                full:
                  type: boolean
                  default: false
                  description: Return complete RugReports instead of risk shapes
      responses:
        "200":
          description: Per-item results (batch itself succeeds even when items fail)
          content:
            application/json:
              schema:
                type: object
                required: [success, data]
                properties:
                  success:
                    type: boolean
                    enum: [true]
                  data:
                    type: object
                    required: [total, ok, failed, results]
                    properties:
                      total: { type: integer }
                      ok: { type: integer }
                      failed: { type: integer }
                      results:
                        type: array
                        items: { $ref: "#/components/schemas/BatchItem" }
        "400":
          description: Invalid body or batch over the tier cap (`invalid_request`, `batch_too_large`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "401":
          description: Missing (`key_required`) or invalid (`invalid_key`) API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/thundercheck/pair/{address}:
    get:
      tags: [ThunderCheck]
      operationId: getTokenForPair
      summary: The token a trading-pair address belongs to
      description: >
        Trading sites put the pair (pool) address in their page addresses at
        least as often as the token's; reports are keyed by the token. Answers
        a pair with its token (`kind: pair`), a token mint with itself
        (`kind: token`), anything else with 404 `not_found`. DexScreener
        lower-cases addresses in its page addresses: pass them as they appear
        (the pair lookup is case-insensitive). No API key; 60 requests per
        minute per IP. A 200 is cacheable for a day
        (`Cache-Control: public, s-maxage=86400`), a 404 for a minute.
      security: []
      parameters:
        - name: address
          in: path
          required: true
          description: A Solana trading-pair or token address (32-44 letters and digits)
          schema: { type: string, pattern: "^[1-9A-Za-z]{32,44}$" }
      responses:
        "200":
          description: The token
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  data:
                    type: object
                    required: [address, mint, kind]
                    properties:
                      address: { type: string, description: The address as given }
                      mint: { type: string, description: The token's mint address }
                      kind: { type: string, enum: [pair, token] }
        "400":
          description: Not address-shaped (`invalid_address`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "404":
          description: Not a known trading pair or a token (`not_found`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/thundercheck/{mint}/history:
    get:
      tags: [ThunderCheck]
      operationId: getMintHistory
      summary: Scan history + monitor time series for a mint (API key required)
      description: >
        Durable summary (first scan, scan count, terminal rug state,
        peak-liquidity drawdown) plus the security monitor's time series
        (holder count, liquidity, price, net flow — 10-minute cadence, 30-day
        retention, oldest-first, max 500 points). Keyed-only, any tier; pure
        DB reads — never consumes fresh-scan quota. 404 `not_found` when the
        mint has never been scanned.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      parameters:
        - $ref: "#/components/parameters/Mint"
      responses:
        "200":
          description: History
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  data: { $ref: "#/components/schemas/MintHistory" }
        "400": { $ref: "#/components/responses/InvalidMint" }
        "401":
          description: Missing (`key_required`) or invalid (`invalid_key`) API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "404":
          description: Mint never scanned (`not_found`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/deployer/{wallet}:
    get:
      tags: [ThunderCheck]
      operationId: getDeployerReputation
      summary: Deployer/creator reputation for a wallet (API key required)
      description: >
        Launch count, rug outcomes, serial-rugger flag, funding-source class
        (when known from scans), and the wallet's most recent rugged tokens.
        Keyed-only, any tier; pure DB reads — never consumes fresh-scan quota.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      parameters:
        - name: wallet
          in: path
          required: true
          description: Base58 Solana wallet address
          schema: { type: string }
      responses:
        "200":
          description: Reputation
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  data: { $ref: "#/components/schemas/WalletReputation" }
        "400":
          description: Not a valid base58 wallet (`invalid_wallet`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "401":
          description: Missing (`key_required`) or invalid (`invalid_key`) API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/webhooks:
    post:
      tags: [ThunderCheck]
      operationId: createWebhook
      summary: Subscribe a URL to token alerts (Scale tier)
      description: >
        Requires an API key on the SCALE tier (`scale_tier_required` otherwise;
        max 5 active subscriptions per key — `too_many_webhooks`). Omit `mints`
        to alert on EVERY token, or list specific mints. Two events: `rugged`
        (liquidity collapsed and the creator cashed out; terminal;
        ThunderLaunch-launched tokens only) and `liquidity_collapsed`
        (liquidity fell 90%+ to near zero, no blame assigned; any token;
        opt-in via `events`). Deliveries are POSTed by a worker (~5 min
        cadence) with headers `X-Thunder-Event: <event>` and
        `X-Thunder-Signature: t=<unix_seconds>,v1=<hex>` where
        v1 = HMAC_SHA256(secret, "{t}.{rawBody}") — verify v1 and reject stale
        t. Payload: { event, mint, token:{name,symbol}, riskScore, verdict,
        ruggedAt | collapsedAt, reason, deliveryId, attempt }. Retries:
        5m/30m/2h/6h, then failed; subscriptions auto-disable after 25
        consecutive failures.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url]
              properties:
                url:
                  type: string
                  description: Absolute http(s) URL to POST alerts to
                mints:
                  type: array
                  items: { type: string }
                  description: Optional mint filter (omit = all tokens)
                events:
                  type: array
                  items:
                    type: string
                    enum: [rugged, liquidity_collapsed]
                  description: Which alerts to receive (omit = rugged only)
      responses:
        "201":
          description: Subscription created (includes the signing secret)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  data: { $ref: "#/components/schemas/WebhookSubscription" }
        "400":
          description: Invalid body (`invalid_request`) or subscription cap reached (`too_many_webhooks`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "401":
          description: Missing (`key_required`) or invalid (`invalid_key`) API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "403":
          description: Missing scope (`missing_scope`) or non-Scale tier (`scale_tier_required`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }
    get:
      tags: [ThunderCheck]
      operationId: listWebhooks
      summary: List this key's webhook subscriptions (Scale tier)
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      responses:
        "200":
          description: Subscriptions (secrets included — retrievable model)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  data:
                    type: object
                    properties:
                      webhooks:
                        type: array
                        items: { $ref: "#/components/schemas/WebhookSubscription" }
        "401":
          description: Missing or invalid API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "403":
          description: Missing scope or non-Scale tier
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/webhooks/{id}:
    delete:
      tags: [ThunderCheck]
      operationId: deleteWebhook
      summary: Delete a webhook subscription
      description: Allowed even after the Scale tier lapses — cleanup is never gated.
      security:
        - ApiKeyHeader: []
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string, format: uuid }
      responses:
        "200":
          description: Deleted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean, enum: [true] }
                  message: { type: string }
        "401":
          description: Missing or invalid API key
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "404":
          description: Not found for this key (`not_found`)
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Error" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "503": { $ref: "#/components/responses/Unavailable" }

  /api/v1/risk/{mint}:
    get:
      tags: [ThunderCheck]
      operationId: getRiskScore
      summary: Lightweight risk score for a Solana mint
      description: >
        Same engine and cache as the full report, ~50x smaller response — for
        high-volume programmatic use (snipe filters, trading bots). Note this
        returns the RISK score (higher = riskier). Recommended fail-closed
        pattern: treat any non-2xx, `rugged: true`, or non-empty `flags` as
        "do not trade".
      parameters:
        - $ref: "#/components/parameters/Mint"
      responses:
        "200":
          description: Risk score
          content:
            application/json:
              schema:
                type: object
                required: [success, data]
                properties:
                  success:
                    type: boolean
                    enum: [true]
                  data:
                    $ref: "#/components/schemas/RiskScore"
        "400": { $ref: "#/components/responses/InvalidMint" }
        "401": { $ref: "#/components/responses/InvalidKey" }
        "403": { $ref: "#/components/responses/MissingScope" }
        "422": { $ref: "#/components/responses/NotAMint" }
        "429": { $ref: "#/components/responses/RateLimited" }
        "500": { $ref: "#/components/responses/ScanFailed" }
        "503": { $ref: "#/components/responses/Unavailable" }

components:
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key (sk_...) with the rugcheck:read scope
    BearerAuth:
      type: http
      scheme: bearer
      description: The same API key sent as a Bearer token

  parameters:
    Mint:
      name: mint
      in: path
      required: true
      description: Base58 Solana mint address
      schema:
        type: string
        example: DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263

  responses:
    InvalidMint:
      description: Not a valid base58 Solana address (`invalid_mint`)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    NotAMint:
      description: >
        The address is valid base58 but is not an SPL Token or Token-2022 mint
        (`not_a_mint`) — e.g. a wallet, pool or program address. Not counted
        against any quota.
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    InvalidKey:
      description: An API key was sent but is invalid or expired (`invalid_key`)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    MissingScope:
      description: The API key lacks the rugcheck:read scope (`missing_scope`)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    RateLimited:
      description: >
        Per-IP/per-key rate limit exceeded (`rate_limited`, includes
        retryAfterSeconds) or monthly fresh-scan quota reached
        (`quota_exceeded`, includes used/limit; cached reads still served)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    ScanFailed:
      description: The core engine failed for this mint — retry later (`scan_failed`)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
    Unavailable:
      description: >
        `disabled` (ThunderCheck switched off), `emergency` (platform under
        emergency maintenance), `quota_unavailable` (quota service
        unreachable — fresh scans paused, cached reads served), `capacity`
        (the daily fresh-scan capacity for your kind of caller is used up:
        Pro and Scale keys have their own daily budget; Free keys, anonymous
        callers and ThunderLaunch's own site and bots share the public budget,
        inside which anonymous callers share a smaller ceiling of their own.
        Cached reports are still served; resets at 00:00 UTC), or
        `scan_in_progress` (another request is already scanning this mint and did
        not finish within the wait window — retry after `retryAfterSeconds`)
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }

  schemas:
    Error:
      type: object
      required: [success, error, message]
      properties:
        success:
          type: boolean
          enum: [false]
        error:
          type: string
          description: Machine-readable code
          enum:
            - invalid_mint
            - not_a_mint
            - invalid_wallet
            - invalid_request
            - invalid_key
            - key_required
            - missing_scope
            - paid_tier_required
            - scale_tier_required
            - batch_too_large
            - too_many_webhooks
            - not_found
            - invalid_client
            - not_cached
            - internal_error
            - rate_limited
            - quota_exceeded
            - scan_failed
            - quota_unavailable
            - capacity
            - scan_in_progress
            - disabled
            - emergency
        message:
          type: string
        retryAfterSeconds:
          type: integer
          description: Present on rate_limited and scan_in_progress
        used:
          type: integer
          description: Present on quota_exceeded
        limit:
          type: integer
          description: Present on quota_exceeded

    WalletReputation:
      type: object
      properties:
        wallet: { type: string }
        priorLaunches: { type: integer }
        ruggedLaunches: { type: integer }
        rugRate:
          type: number
          description: ruggedLaunches / priorLaunches (0-1)
        isSerialRugger: { type: boolean }
        fundedBy:
          type: object
          nullable: true
          properties:
            funder: { type: string }
            sourceClass:
              type: string
              enum: [known_scammer, mixer, prior_rugger, fresh_cex, cex, established, unknown]
        profileUpdatedAt:
          type: string
          format: date-time
          nullable: true
        recentRuggedTokens:
          type: array
          items:
            type: object
            properties:
              mint: { type: string }
              name: { type: string, nullable: true }
              symbol: { type: string, nullable: true }
              ruggedAt: { type: string, format: date-time }

    MintHistory:
      type: object
      properties:
        mint: { type: string }
        token:
          type: object
          properties:
            name: { type: string, nullable: true }
            symbol: { type: string, nullable: true }
        summary:
          type: object
          properties:
            riskScore: { type: integer }
            verdict: { type: string }
            rugged: { type: boolean }
            ruggedAt: { type: string, format: date-time, nullable: true }
            ruggedReason: { type: string, nullable: true }
            firstScannedAt: { type: string, format: date-time }
            lastScannedAt: { type: string, format: date-time }
            scanCount: { type: integer }
            currentLiquidityUsd: { type: number, nullable: true }
            peakLiquidityUsd: { type: number, nullable: true }
            liquidityDrawdownPct:
              type: number
              nullable: true
              description: "% of peak liquidity that has left the pool (0 = at peak)"
        snapshots:
          type: array
          description: 10-min cadence, 30-day retention, oldest-first, max 500 points
          items:
            type: object
            properties:
              capturedAt: { type: string, format: date-time }
              holderCount: { type: integer, nullable: true }
              liquidityUsd: { type: number, nullable: true }
              priceUsd: { type: number, nullable: true }
              netFlowSol: { type: number, nullable: true }
              earlyBuyersHeldPct: { type: number, nullable: true }
              insiderClusterPct: { type: number, nullable: true }

    WebhookSubscription:
      type: object
      properties:
        id: { type: string, format: uuid }
        url: { type: string }
        secret:
          type: string
          description: whsec_... HMAC signing secret (verify X-Thunder-Signature with it)
        events:
          type: array
          items: { type: string }
        mints:
          type: array
          items: { type: string }
          nullable: true
          description: Null = alerts for every token
        is_active: { type: boolean }
        failure_count: { type: integer }
        last_delivery_at: { type: string, format: date-time, nullable: true }
        last_delivery_status: { type: string, nullable: true }
        created_at: { type: string, format: date-time }

    BatchItem:
      type: object
      required: [mint, ok]
      properties:
        mint: { type: string }
        ok: { type: boolean }
        data:
          description: Present when ok — RiskScore shape (default) or RugReport (full=true)
          oneOf:
            - $ref: "#/components/schemas/RiskScore"
            - $ref: "#/components/schemas/RugReport"
        error:
          type: string
          description: Present when not ok (invalid_mint, not_a_mint, quota_exceeded, capacity, scan_in_progress, scan_failed, ...)
        message: { type: string }

    RiskLevel:
      type: string
      enum: [low, medium, high, critical]

    Verdict:
      type: string
      enum: [Safe, Caution, High Risk, Danger]
      description: >
        Stable machine value. Do not display it: show verdictLabel.

    RiskScore:
      type: object
      required: [mint, riskScore, riskLevel, verdict, verdictLabel, flags, rugged, liquidityCollapsed, scannedAt, ageSeconds]
      properties:
        mint: { type: string }
        riskScore:
          type: integer
          minimum: 0
          maximum: 100
          description: Higher = riskier
        riskLevel: { $ref: "#/components/schemas/RiskLevel" }
        verdict: { $ref: "#/components/schemas/Verdict" }
        verdictLabel:
          type: string
          description: The wording to display for this result
        scannedAt:
          type: string
          format: date-time
        ageSeconds:
          type: integer
          description: Seconds between the scan and this response
        flags:
          type: array
          items: { type: string }
          description: Hard-cap conditions with deterministic proof (honeypot, unlocked_lp, ...)
        rugged:
          type: boolean
          description: >
            Terminal — liquidity collapsed and the creator cashed out; the token
            stays Danger forever
        liquidityCollapsed:
          type: boolean
          description: >
            Liquidity fell 90%+ from its peak to near zero. No claim about who
            caused it; cleared if liquidity recovers

    SummaryRisk:
      type: object
      required: [check, category, status, severity]
      properties:
        check: { type: string, description: "Short check name, e.g. Top-10 Concentration" }
        category: { type: string, description: "Report section, e.g. Authorities, Holders" }
        status:
          type: string
          enum: [warn, fail]
        severity:
          type: string
          enum: [info, low, medium, high, critical]

    Summary:
      type: object
      required:
        - apiVersion
        - mint
        - scannedAt
        - ageSeconds
        - maxAgeSeconds
        - token
        - safetyScore
        - riskScore
        - riskLevel
        - verdict
        - verdictLabel
        - rugged
        - liquidityCollapsed
        - flags
        - riskCount
        - topRisks
        - dataGaps
        - reportUrl
        - imageUrl
        - launchUrl
        - text
      properties:
        apiVersion:
          type: string
          enum: [v1]
        mint: { type: string }
        scannedAt:
          type: string
          format: date-time
          description: When the scan ran. The time to trust; compute the age from it
        ageSeconds:
          type: integer
          description: >
            The scan's age when this response was produced (a CDN may serve the
            response for up to a minute)
        maxAgeSeconds:
          type: integer
          description: >
            The oldest (seconds) a stored report of this token is served as
            current — 60 for tokens under 24 hours old, 600 otherwise
        token:
          type: object
          required: [name, symbol]
          properties:
            name: { type: string, nullable: true }
            symbol: { type: string, nullable: true }
        safetyScore:
          type: integer
          minimum: 0
          maximum: 100
          description: Higher = safer (100 - riskScore)
        riskScore:
          type: integer
          minimum: 0
          maximum: 100
        riskLevel: { $ref: "#/components/schemas/RiskLevel" }
        verdict: { $ref: "#/components/schemas/Verdict" }
        verdictLabel:
          type: string
          description: >
            The wording to display for this result ("No major flags found",
            "Caution", "High Risk", "Danger"). Show this, never verdict
        rugged: { type: boolean }
        liquidityCollapsed: { type: boolean }
        flags:
          type: array
          items: { type: string }
          description: Hard-cap conditions with deterministic proof (honeypot, unlocked_lp, ...)
        riskCount:
          type: integer
          description: How many warnings and failures the scan found in total
        topRisks:
          type: array
          maxItems: 3
          description: The most severe of them (up to 3), by name only; the evidence stays in the full report
          items: { $ref: "#/components/schemas/SummaryRisk" }
        dataGaps:
          type: array
          description: >
            Report sections that could not be completed. A gap means
            unverified, not passed
          items:
            type: string
            enum: [market, holders, launchIntegrity, creator, manipulation, sellSimulation]
        reportUrl:
          type: string
          description: The public report page (tagged when client is set)
        imageUrl:
          type: string
          description: This scan's share-card image (a new scan gets a new URL)
        launchUrl:
          type: string
          nullable: true
          description: >
            The launch page (tagged when client is set). Null when the launch
            call to action is switched off, or the result is Danger, rugged or
            liquidity-collapsed
        text:
          type: object
          required: [short, telegramHtml]
          properties:
            short:
              type: string
              maxLength: 240
              description: >
                One line of plain text without a link; includes the scan time
                and "Not financial advice · Not an endorsement"
            telegramHtml:
              type: string
              description: The result card as Telegram HTML (parse_mode "HTML"); buttons not included

    Finding:
      type: object
      required: [category, check, status, severity, evidence, explanation]
      properties:
        category: { type: string, description: "Report section, e.g. Authorities, Liquidity" }
        check: { type: string, description: "Short check name, e.g. LP Burned" }
        status:
          type: string
          enum: [pass, warn, fail, info]
        severity: { type: string }
        evidence: { type: string, description: Concrete on-chain evidence }
        explanation: { type: string, description: Plain-English meaning }

    RugReport:
      type: object
      required:
        - apiVersion
        - mint
        - scannedAt
        - ageSeconds
        - maxAgeSeconds
        - cached
        - token
        - safetyScore
        - riskScore
        - riskLevel
        - verdict
        - verdictLabel
        - summary
        - rugged
        - ruggedAt
        - liquidityCollapsed
        - flags
        - market
        - holders
        - creator
        - findings
        - dataAvailability
      properties:
        apiVersion:
          type: string
          enum: [v1]
        mint: { type: string }
        scannedAt:
          type: string
          format: date-time
        ageSeconds:
          type: integer
          description: Seconds between the scan and this response
        maxAgeSeconds:
          type: integer
          description: >
            The oldest (seconds) a stored report of this token is served as
            current — 60 for tokens under 24 hours old, 600 otherwise
        cached:
          type: boolean
          description: True when served from the stored report (within its freshness limit)
        token:
          type: object
          required: [name, symbol, imageUrl, isNative]
          properties:
            name: { type: string, nullable: true }
            symbol: { type: string, nullable: true }
            imageUrl: { type: string, nullable: true }
            isNative:
              type: boolean
              description: Launched on ThunderLaunch
        safetyScore:
          type: integer
          minimum: 0
          maximum: 100
          description: Higher = safer (100 - riskScore)
        riskScore:
          type: integer
          minimum: 0
          maximum: 100
        riskLevel: { $ref: "#/components/schemas/RiskLevel" }
        verdict: { $ref: "#/components/schemas/Verdict" }
        verdictLabel:
          type: string
          description: >
            The wording to display for this result ("No major flags found",
            "Caution", "High Risk", "Danger")
        summary: { type: string }
        rugged: { type: boolean }
        ruggedAt:
          type: string
          format: date-time
          nullable: true
        liquidityCollapsed:
          type: boolean
          description: >
            Liquidity fell 90%+ from its peak to near zero (also in flags as
            liquidity_collapsed). No claim about who caused it; cleared if
            liquidity recovers. Never true together with rugged
        flags:
          type: array
          items: { type: string }
        market:
          type: object
          nullable: true
          description: Null = unavailable (see dataAvailability), never "passed"
          properties:
            priceUsd: { type: number, nullable: true }
            marketCap: { type: number, nullable: true }
            liquidityUsd: { type: number, nullable: true }
            volume24h: { type: number, nullable: true }
            pairAgeDays: { type: number, nullable: true }
        holders:
          type: object
          nullable: true
          properties:
            totalHolders: { type: integer }
            effectiveHolders:
              type: integer
              nullable: true
              description: Corrected for dust/airdrop inflation
            topHolderPct:
              type: number
              nullable: true
              description: Largest single holder's supply %, leaving out burn addresses, DEX pools and bonding curves
            devHoldingsPct: { type: number, nullable: true }
            insiderClusterPct:
              type: number
              nullable: true
              description: Supply % held by deployer-connected clusters
        creator:
          type: object
          nullable: true
          properties:
            deployer: { type: string, nullable: true }
            priorLaunches: { type: integer, nullable: true }
            ruggedLaunches: { type: integer, nullable: true }
            isSerialRugger: { type: boolean }
        findings:
          type: array
          items: { $ref: "#/components/schemas/Finding" }
        dataAvailability:
          type: object
          description: False = "unverifiable", never "passed"
          required: [market, holders, launchIntegrity, creator, manipulation, sellSimulation]
          properties:
            market: { type: boolean }
            holders: { type: boolean }
            launchIntegrity: { type: boolean }
            creator: { type: boolean }
            manipulation: { type: boolean }
            sellSimulation: { type: boolean }
