{
  "openapi": "3.1.0",
  "info": {
    "title": "NodeFlare Data API",
    "version": "1.0.0",
    "summary": "Balances, portfolios, token approvals, transaction simulation and token risk signals across the EVM chains NodeFlare serves.",
    "description": "Every endpoint is a POST with a JSON body and works on 17 EVM chains.\n\n**With an API key** (every plan, including the free one) a call runs the full version and is charged to the plan's monthly compute units; the cost is stated per endpoint. Send the key as `Authorization: Bearer nf_live_...` or as `x-api-key: nf_live_...`. The Data API does not read a key from the URL path. A key that is restricted to certain chains or methods cannot be used here; restrictions by origin or IP address still apply.\n\n**Without a key** the endpoints return a lighter result, free of charge and rate-limited per IP address; what is left out is stated per endpoint.\n\nErrors are JSON objects with an `error` code and a `message`. Documentation: https://nodeflare.app/docs/data",
    "termsOfService": "https://nodeflare.app/terms"
  },
  "externalDocs": {
    "description": "Data API documentation",
    "url": "https://nodeflare.app/docs/data"
  },
  "servers": [
    {
      "url": "https://rpc.nodeflare.app"
    }
  ],
  "tags": [
    {
      "name": "Data API"
    }
  ],
  "paths": {
    "/data/balances": {
      "post": {
        "operationId": "getBalances",
        "summary": "Native and ERC-20 balances of one address across chains",
        "description": "Returns the native balance and the balance of each listed ERC-20 per chain, with USD price and value where a market price is known.\n\nWith an API key: 15 compute units per call, and `discover: true` is available. Compute units are only charged when the call returns 200.\n\nWithout a key the call is free and rate-limited per IP address; `discover: true` then returns 402.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BalancesRequest"
              },
              "example": {
                "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
                "chains": [
                  "eth",
                  "base"
                ],
                "tokens": {
                  "base": [
                    "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalancesResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `invalid_address` or `unknown_chain`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "`discover: true` was sent without an API key. This needs an API key. `error` is `payment_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/portfolio": {
      "post": {
        "operationId": "getPortfolio",
        "summary": "USD-valued portfolio of one address across chains",
        "description": "Same request and per-chain data as `/data/balances`, plus the USD value of native coins, a USD value per chain and a `totalUsd`. Chains are sorted by value.\n\nWith an API key: 20 compute units per call, and `discover: true` is available. Compute units are only charged when the call returns 200.\n\nWithout a key the call is free and rate-limited per IP address; `discover: true` then returns 402.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BalancesRequest"
              },
              "example": {
                "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `invalid_address` or `unknown_chain`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "`discover: true` was sent without an API key. This needs an API key. `error` is `payment_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/allowances": {
      "post": {
        "operationId": "getAllowances",
        "summary": "Active ERC-20 approvals an address has granted",
        "description": "Scans Approval logs and returns, per chain, each token and spender whose current allowance is above zero, with an `unlimited` flag. Each chain states how much history was read: `fullHistory`, or `scannedFromBlock` for a scan of recent blocks.\n\nRequires an API key: 75 compute units for each chain scanned. Without `chains` every chain is scanned and charged. Compute units are only charged when the call returns 200.\n\nWithout a key the endpoint returns 402.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AllowancesRequest"
              },
              "example": {
                "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
                "chains": [
                  "eth",
                  "base"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllowancesResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `invalid_address` or `unknown_chain`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "No API key was sent. This needs an API key. `error` is `payment_required`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/wallet-report": {
      "post": {
        "operationId": "getWalletReport",
        "summary": "Portfolio, largest holdings and approvals of one address in one call",
        "description": "Combines the portfolio (native and listed ERC-20 balances with USD values), a summary, the ten largest holdings and the active ERC-20 approvals per chain. It does not run token discovery.\n\nWith an API key: 90 compute units per call, including the approvals. Compute units are only charged when the call returns 200.\n\nWithout a key the call is free and rate-limited per IP address; the approvals and the approval counts are then left out.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WalletReportRequest"
              },
              "example": {
                "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
                "chains": [
                  "eth",
                  "base"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `invalid_address` or `unknown_chain`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/simulate": {
      "post": {
        "operationId": "simulateTransaction",
        "summary": "Check a transaction on one chain before sending it",
        "description": "Runs the call against the chain and reports whether it reverts (with the reason), the return data and a gas estimate.\n\nWith an API key: 90 compute units per call, and the result adds `assetChanges`, the net native and ERC-20 movements, on chains whose nodes support call tracing. Compute units are only charged when the call returns 200.\n\nWithout a key the call is free and rate-limited per IP address; `assetChanges` is then left out.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulateRequest"
              },
              "example": {
                "chain": "base",
                "from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
                "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                "data": "0x313ce567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SimulateResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `unknown_chain` or `invalid_address`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/token-safety": {
      "post": {
        "operationId": "checkTokenSafety",
        "summary": "Risk signals for an ERC-20 token on one chain",
        "description": "Reads the token's metadata, contract code, ownership and proxy status and folds them into a rule-based `score` (0 to 100, higher means riskier) with a list of `signals`. The score is a set of indicators, not proof that a token is safe.\n\nWith an API key: 90 compute units per call, and the check adds holder concentration, a simulated transfer from the largest holder and the token's age in blocks. Compute units are only charged when the call returns 200.\n\nWithout a key the call is free and rate-limited per IP address; those deep checks are then left out.",
        "tags": [
          "Data API"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenSafetyRequest"
              },
              "example": {
                "chain": "base",
                "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result. A chain that could not be read carries an `error` string in its own entry; the call itself still returns 200.",
            "headers": {
              "X-Cache": {
                "description": "Whether the result came from the short-lived result cache.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HIT",
                    "MISS"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenSafetyResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request body was refused. `error` is `invalid_json` or `unknown_chain` or `invalid_address`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is not valid. `error` is `invalid_api_key`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key has an origin or IP restriction that this request does not meet, or it is restricted to chains or methods; such a key cannot be used on the Data API. Not charged. `error` is `key_restricted`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 256 KB. `error` is `payload_too_large`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded, or the monthly compute-unit quota of the plan is used up. `error` is `rate_limit_exceeded` or `monthly_limit_reached`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "NodeFlare API key: `Authorization: Bearer nf_live_...` (`nf_live_` followed by 64 hex characters)."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "NodeFlare API key in the `x-api-key` header."
      }
    },
    "schemas": {
      "Chain": {
        "type": "string",
        "enum": [
          "eth",
          "base",
          "bnb",
          "arb",
          "op",
          "hl",
          "avax",
          "unichain",
          "sonic",
          "polygon",
          "zircuit",
          "robinhood",
          "xlayer",
          "soneium",
          "bob",
          "ink",
          "mode"
        ],
        "description": "Chain identifier, the same one used in RPC endpoint URLs. `eth` = Ethereum (1), `base` = Base (8453), `bnb` = BNB Chain (56), `arb` = Arbitrum One (42161), `op` = Optimism (10), `hl` = HyperEVM (999), `avax` = Avalanche (43114), `unichain` = Unichain (130), `sonic` = Sonic (146), `polygon` = Polygon (137), `zircuit` = Zircuit (48900), `robinhood` = Robinhood Chain (4663), `xlayer` = XLayer (196), `soneium` = Soneium (1868), `bob` = BOB (60808), `ink` = Ink (57073), `mode` = Mode (34443). Requests also accept some chain names (for example `ethereum`, `arbitrum`, `optimism`, `avalanche`) and the numeric chain ID; responses always use the identifiers listed here."
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error code."
          },
          "message": {
            "type": "string",
            "description": "Explanation in plain language."
          }
        }
      },
      "NativeBalance": {
        "type": "object",
        "required": [
          "currency",
          "balance",
          "wei"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "Symbol of the native coin, for example `ETH`."
          },
          "balance": {
            "type": "string",
            "description": "Balance in whole coins, as a decimal string."
          },
          "wei": {
            "type": "string",
            "description": "Exact balance in wei, as a decimal string."
          },
          "usdPrice": {
            "type": "number",
            "description": "USD price. Only set by `/data/portfolio` and `/data/wallet-report`, where a price is known."
          },
          "usdValue": {
            "type": "number",
            "description": "USD value. Only set by `/data/portfolio` and `/data/wallet-report`, where a price is known."
          }
        }
      },
      "TokenBalance": {
        "type": "object",
        "required": [
          "token",
          "symbol",
          "decimals",
          "balance",
          "raw"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "ERC-20 contract address."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Token symbol; null when it could not be read."
          },
          "decimals": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Token decimals; null when they could not be read."
          },
          "balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human-readable balance; null when `decimals` could not be read. The value is never scaled with a guessed number of decimals."
          },
          "raw": {
            "type": "string",
            "description": "Exact balance in the token's smallest unit, as a decimal string."
          },
          "usdPrice": {
            "type": "number",
            "description": "USD price, where a market price is known."
          },
          "usdValue": {
            "type": "number",
            "description": "USD value of the balance, where it could be priced."
          },
          "spam": {
            "type": "boolean",
            "description": "Discovery only: the symbol looks like a spam token."
          }
        }
      },
      "ChainBalances": {
        "type": "object",
        "required": [
          "chain",
          "chainId",
          "native",
          "tokens"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "chainId": {
            "type": "integer",
            "description": "EVM chain ID."
          },
          "native": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NativeBalance"
              },
              {
                "type": "null"
              }
            ],
            "description": "Native-coin balance; null when it could not be read."
          },
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TokenBalance"
            }
          },
          "error": {
            "type": "string",
            "description": "Present when this chain could not be read (for example `timeout` or `upstream unavailable`)."
          },
          "discoveryError": {
            "type": "string",
            "description": "Discovery only: the log scan on this chain failed."
          },
          "discoveryNote": {
            "type": "string",
            "description": "Discovery only: how far back the log scan on this chain reached."
          },
          "usdValue": {
            "type": "number",
            "description": "USD value of this chain, rounded to cents. Only set by `/data/portfolio`."
          }
        }
      },
      "BalancesRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The 0x address to look up."
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Chain"
            },
            "description": "Chains to include. Defaults to every supported chain. Entries that are not recognised are skipped; if none is recognised the call returns 400 `unknown_chain`."
          },
          "tokens": {
            "type": "object",
            "description": "ERC-20 contract addresses to read, per chain. At most 50 per chain are read; entries that are not a 0x address are skipped.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              }
            },
            "example": {
              "base": [
                "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
              ]
            }
          },
          "discover": {
            "type": "boolean",
            "default": false,
            "description": "Find every ERC-20 the address holds from its incoming Transfer logs. Needs an API key (any plan); without one the call returns 402."
          },
          "fromBlock": {
            "type": "string",
            "description": "Start block of the discovery scan, as a hex block number or `earliest` (the default). Where a node limits the range of one log query, the default scan covers recent blocks only and says so in a note on that chain."
          },
          "minUsd": {
            "type": "number",
            "minimum": 0,
            "default": 0.01,
            "description": "Discovery only: drop priced tokens worth less than this many USD."
          },
          "includeSpam": {
            "type": "boolean",
            "default": false,
            "description": "Discovery only: keep unpriced tokens whose symbol looks like spam."
          },
          "includeDust": {
            "type": "boolean",
            "default": false,
            "description": "Discovery only: keep balances below 1e-9 of a token."
          }
        }
      },
      "BalancesResponse": {
        "type": "object",
        "required": [
          "address",
          "discover",
          "chains"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "discover": {
            "type": "boolean",
            "description": "Whether token discovery ran."
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChainBalances"
            }
          }
        }
      },
      "PortfolioResponse": {
        "type": "object",
        "required": [
          "address",
          "discover",
          "totalUsd",
          "chains"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "discover": {
            "type": "boolean",
            "description": "Whether token discovery ran."
          },
          "totalUsd": {
            "type": "number",
            "description": "Sum of every priced native and token balance, rounded to cents."
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChainBalances"
            },
            "description": "Sorted by `usdValue`, highest first."
          }
        }
      },
      "AllowancesRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The 0x address that granted the approvals."
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Chain"
            },
            "description": "Chains to scan. Defaults to every supported chain. A keyed call costs 75 compute units for each chain scanned, so name the chains you need."
          },
          "fromBlock": {
            "type": "string",
            "description": "Start block of the Approval-log scan, as a hex block number or `earliest` (the default). Where a node limits the range of one log query, the default scan covers recent blocks only and says so in a note on that chain."
          }
        }
      },
      "Approval": {
        "type": "object",
        "required": [
          "token",
          "symbol",
          "decimals",
          "spender",
          "allowance",
          "allowanceRaw",
          "unlimited"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "ERC-20 contract address."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          },
          "decimals": {
            "type": [
              "integer",
              "null"
            ]
          },
          "spender": {
            "type": "string",
            "description": "Address that may move the token."
          },
          "allowance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human-readable approved amount; null when `decimals` could not be read."
          },
          "allowanceRaw": {
            "type": "string",
            "description": "Exact approved amount in the token's smallest unit, as a decimal string."
          },
          "unlimited": {
            "type": "boolean",
            "description": "True when the approved amount is 2^255 or more."
          },
          "usdPrice": {
            "type": "number",
            "description": "USD price of the token, where known."
          }
        }
      },
      "ChainApprovals": {
        "type": "object",
        "required": [
          "chain",
          "chainId",
          "approvals"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "chainId": {
            "type": "integer",
            "description": "EVM chain ID."
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Approval"
            },
            "description": "Approvals whose current allowance is above zero."
          },
          "error": {
            "type": "string",
            "description": "Present when the scan of this chain did not complete."
          },
          "note": {
            "type": "string",
            "description": "How far back the scan reached and whether parts of it failed. An empty `approvals` list with a note is not proof that no older approvals exist."
          },
          "scannedFromBlock": {
            "type": "integer",
            "minimum": 0,
            "description": "First block of the Approval history that was read; the scan runs from this block to the latest. Absent when the scan failed or the start is not known (a block tag as `fromBlock`). Approvals granted before this block are not in `approvals`."
          },
          "fullHistory": {
            "type": "boolean",
            "description": "True only when the whole chain was read from its first block and every pair found is listed. False when the scan covers recent blocks or a `fromBlock` range, when that could not be confirmed, or when more than 200 token and spender pairs were found (the 200 most recently approved are then listed, and the note says so). Absent when the scan failed."
          }
        }
      },
      "AllowancesResponse": {
        "type": "object",
        "required": [
          "address",
          "chains"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChainApprovals"
            }
          }
        }
      },
      "WalletReportRequest": {
        "type": "object",
        "required": [
          "address"
        ],
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The 0x address to report on."
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Chain"
            },
            "description": "Chains to include. Defaults to every supported chain. Entries that are not recognised are skipped; if none is recognised the call returns 400 `unknown_chain`."
          },
          "tokens": {
            "type": "object",
            "description": "ERC-20 contract addresses to read, per chain. At most 50 per chain are read; entries that are not a 0x address are skipped.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              }
            },
            "example": {
              "base": [
                "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
              ]
            }
          }
        }
      },
      "WalletReportChain": {
        "type": "object",
        "required": [
          "chain",
          "chainId",
          "native",
          "tokens"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "chainId": {
            "type": "integer",
            "description": "EVM chain ID."
          },
          "native": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NativeBalance"
              },
              {
                "type": "null"
              }
            ]
          },
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TokenBalance"
            }
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Approval"
            },
            "description": "Active ERC-20 approvals. Only with an API key."
          },
          "error": {
            "type": "string",
            "description": "Present when this chain could not be read (for example `timeout` or `upstream unavailable`)."
          },
          "note": {
            "type": "string",
            "description": "How far back the approval scan reached. Only with an API key."
          },
          "approvalScan": {
            "type": "object",
            "required": [
              "fullHistory"
            ],
            "description": "How much Approval history the scan behind `approvals` read. Only with an API key, and absent when that scan failed.",
            "properties": {
              "fullHistory": {
                "type": "boolean",
                "description": "True only when the whole chain was read from its first block."
              },
              "scannedFromBlock": {
                "type": "integer",
                "minimum": 0,
                "description": "First block of the Approval history that was read."
              }
            }
          }
        }
      },
      "WalletReportResponse": {
        "type": "object",
        "required": [
          "address",
          "totalUsd",
          "summary",
          "topHoldings",
          "chains"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "totalUsd": {
            "type": "number",
            "description": "Sum of every priced native and token balance, rounded to cents."
          },
          "summary": {
            "type": "object",
            "required": [
              "chainsWithBalance",
              "tokenCount"
            ],
            "properties": {
              "chainsWithBalance": {
                "type": "integer",
                "description": "Chains with a priced balance above zero."
              },
              "tokenCount": {
                "type": "integer"
              },
              "approvalCount": {
                "type": "integer",
                "description": "Only with an API key."
              },
              "unlimitedApprovalCount": {
                "type": "integer",
                "description": "Only with an API key."
              }
            }
          },
          "topHoldings": {
            "type": "array",
            "description": "Up to ten largest priced positions across all chains.",
            "items": {
              "type": "object",
              "required": [
                "chain",
                "symbol",
                "token",
                "usdValue"
              ],
              "properties": {
                "chain": {
                  "$ref": "#/components/schemas/Chain"
                },
                "symbol": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "token": {
                  "type": "string",
                  "description": "ERC-20 contract address, or `native` for the native coin."
                },
                "usdValue": {
                  "type": "number"
                }
              }
            }
          },
          "chains": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WalletReportChain"
            }
          },
          "note": {
            "type": "string",
            "description": "Present on a keyless call, which leaves the approvals out."
          }
        }
      },
      "SimulateRequest": {
        "type": "object",
        "required": [
          "chain",
          "to"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "to": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The 0x address the transaction is sent to."
          },
          "data": {
            "type": "string",
            "pattern": "^0x",
            "default": "0x",
            "description": "Calldata as 0x-prefixed hex."
          },
          "from": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The 0x sender address. Asset changes are computed for this address; without it, for `to`."
          },
          "value": {
            "type": "string",
            "pattern": "^0x",
            "default": "0x0",
            "description": "Native value in wei, as 0x-prefixed hex."
          },
          "block": {
            "type": "string",
            "default": "latest",
            "description": "Block tag or hex block number to simulate against."
          }
        }
      },
      "AssetChange": {
        "type": "object",
        "required": [
          "token",
          "symbol",
          "decimals",
          "direction",
          "amount",
          "raw"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "ERC-20 contract address, or `native` for the native coin."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          },
          "decimals": {
            "type": [
              "integer",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "in",
              "out"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human-readable net amount; null when `decimals` is unknown."
          },
          "raw": {
            "type": "string",
            "description": "Exact net amount in the smallest unit, as a decimal string."
          }
        }
      },
      "SimulateResponse": {
        "type": "object",
        "required": [
          "chain",
          "chainId",
          "reverts"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "chainId": {
            "type": "integer",
            "description": "EVM chain ID."
          },
          "reverts": {
            "type": "boolean",
            "description": "Whether the call reverts."
          },
          "revertReason": {
            "type": "string",
            "description": "Decoded revert reason, or the node's error message."
          },
          "revertSelector": {
            "type": "string",
            "description": "Selector of a custom error that could not be decoded further."
          },
          "returnData": {
            "type": "string",
            "description": "Return data of the call as hex, when it does not revert."
          },
          "gasEstimate": {
            "type": "object",
            "description": "Gas estimate, when the node returned one.",
            "required": [
              "decimal",
              "hex"
            ],
            "properties": {
              "decimal": {
                "type": "string"
              },
              "hex": {
                "type": "string"
              }
            }
          },
          "assetChanges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetChange"
            },
            "description": "Net native and ERC-20 movements for the sender. Only with an API key, and only on chains whose nodes support call tracing."
          },
          "note": {
            "type": "string",
            "description": "Says why `assetChanges` is absent."
          },
          "error": {
            "type": "string",
            "description": "Present when the chain could not be read (`timeout` or `upstream unavailable`)."
          }
        }
      },
      "TokenSafetyRequest": {
        "type": "object",
        "required": [
          "chain",
          "token"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "token": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "The ERC-20 contract address to check."
          }
        }
      },
      "TokenSafetyResponse": {
        "type": "object",
        "description": "On a timeout or an unreachable chain only `chain`, `chainId`, `token` and `error` are present.",
        "required": [
          "chain",
          "chainId",
          "token"
        ],
        "properties": {
          "chain": {
            "$ref": "#/components/schemas/Chain"
          },
          "chainId": {
            "type": "integer",
            "description": "EVM chain ID."
          },
          "token": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          },
          "decimals": {
            "type": [
              "integer",
              "null"
            ]
          },
          "totalSupply": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total supply in the token's smallest unit, as a decimal string."
          },
          "isContract": {
            "type": "boolean",
            "description": "Whether the address has contract code."
          },
          "ownershipRenounced": {
            "type": "boolean",
            "description": "True when `owner()` or `getOwner()` returns the zero address."
          },
          "owner": {
            "type": "string",
            "description": "Owner address, when there is one that is not the zero address."
          },
          "isProxy": {
            "type": "boolean",
            "description": "True when the EIP-1967 implementation slot is set (upgradeable proxy)."
          },
          "implementation": {
            "type": "string",
            "description": "Implementation address of the proxy."
          },
          "verified": {
            "type": "boolean",
            "description": "True for a short list of established tokens, for which ownership and holder concentration do not raise the score."
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Risk signals found, in plain language."
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Rule-based risk score. Higher means riskier."
          },
          "note": {
            "type": "string",
            "description": "Present on a keyless call, which leaves the deep checks out."
          },
          "holdersSampled": {
            "type": "integer",
            "description": "Only with an API key: holders with a balance that were ranked."
          },
          "concentrationBasis": {
            "type": "string",
            "description": "Only with an API key: whether the holder figures come from full history or from a recent sample (then they are a lower bound)."
          },
          "topHolderPct": {
            "type": "number",
            "description": "Only with an API key: share of supply held by the largest holder found, in percent."
          },
          "top10Pct": {
            "type": "number",
            "description": "Only with an API key: share of supply held by the ten largest holders found, in percent."
          },
          "holderScanNote": {
            "type": "string",
            "description": "Only with an API key: how far back the holder scan reached."
          },
          "holderScanError": {
            "type": "string",
            "description": "Only with an API key: the holder scan failed."
          },
          "earliestTransferBlock": {
            "type": "integer",
            "description": "Only with an API key: earliest block with a transfer that the scan saw."
          },
          "ageBlocks": {
            "type": "integer",
            "description": "Only with an API key: blocks between that transfer and the latest block."
          },
          "transfersBlocked": {
            "type": "boolean",
            "description": "Only with an API key: a simulated transfer from the largest holder reverted or returned false. An indicator, not proof."
          },
          "transferSimBasis": {
            "type": "string",
            "description": "Only with an API key: how the transfer simulation was done."
          },
          "transferSimNote": {
            "type": "string",
            "description": "Only with an API key: why the transfer simulation gave no result."
          },
          "error": {
            "type": "string",
            "description": "Present when the chain could not be read (`timeout` or `upstream unavailable`)."
          }
        }
      }
    }
  }
}