{
  "openapi": "3.1.0",
  "info": {
    "title": "TensorCash core-node API",
    "version": "1.0.0",
    "description": "Small REST surface exposed by the TensorCash core-node alongside the JSON-RPC server. Used by the miner-api to query model metadata and node metrics. The full chain surface is the JSON-RPC at /docs/rpc/."
  },
  "paths": {
    "/": {
      "get": {
        "summary": "Root",
        "description": "Root endpoint - provides API information.",
        "operationId": "root__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Health Check",
        "description": "Health check endpoint - no auth required.",
        "operationId": "health_check_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/models": {
      "get": {
        "summary": "Get Models List",
        "description": "Get list of models with rate limiting.",
        "operationId": "get_models_list_api_v1_models_get",
        "parameters": [
          {
            "name": "extended",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Extended"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/HTTPAuthorizationCredentials"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Credentials"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ModelInfo"
                  },
                  "title": "Response Get Models List Api V1 Models Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/blockchaininfo": {
      "get": {
        "summary": "Get Blockchain Info",
        "description": "Pass-through to the node's `getblockchaininfo` RPC.\n\nUsed by the verification orchestrator to compute distance-to-verdict for\nPendingVerification model records and trigger anticipatory smell-stat\npre-bake before a model flips to Registered.",
        "operationId": "get_blockchain_info_api_v1_blockchaininfo_get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/HTTPAuthorizationCredentials"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Credentials"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/models/{model_hash}": {
      "get": {
        "summary": "Get Model Info",
        "description": "Get model information with input validation.",
        "operationId": "get_model_info_api_v1_models__model_hash__get",
        "parameters": [
          {
            "name": "model_hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Model Hash"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/HTTPAuthorizationCredentials"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Credentials"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/miner/metrics": {
      "get": {
        "summary": "Get Miner Metrics",
        "description": "Get mining throughput metrics from the miner proxy.\nReturns token throughput (tokens/sec), completion rate, and totals.",
        "operationId": "get_miner_metrics_api_v1_miner_metrics_get",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/HTTPAuthorizationCredentials"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Credentials"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPAuthorizationCredentials": {
        "properties": {
          "scheme": {
            "type": "string",
            "title": "Scheme"
          },
          "credentials": {
            "type": "string",
            "title": "Credentials"
          }
        },
        "type": "object",
        "required": [
          "scheme",
          "credentials"
        ],
        "title": "HTTPAuthorizationCredentials",
        "description": "The HTTP authorization credentials in the result of using `HTTPBearer` or\n`HTTPDigest` in a dependency.\n\nThe HTTP authorization header value is split by the first space.\n\nThe first part is the `scheme`, the second part is the `credentials`.\n\nFor example, in an HTTP Bearer token scheme, the client will send a header\nlike:\n\n```\nAuthorization: Bearer deadbeef12346\n```\n\nIn this case:\n\n* `scheme` will have the value `\"Bearer\"`\n* `credentials` will have the value `\"deadbeef12346\"`"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ModelInfo": {
        "properties": {
          "model_hash": {
            "type": "string",
            "title": "Model Hash"
          },
          "model_name": {
            "type": "string",
            "title": "Model Name"
          },
          "model_commit": {
            "type": "string",
            "title": "Model Commit"
          },
          "difficulty": {
            "type": "integer",
            "title": "Difficulty"
          },
          "status": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "cid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cid"
          },
          "extra": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Extra"
          },
          "txid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Txid"
          },
          "block_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Block Hash"
          },
          "block_height": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Block Height"
          },
          "deposit_txid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deposit Txid"
          },
          "deposit_vout": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deposit Vout"
          },
          "deposit_amount": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deposit Amount"
          },
          "owner_key_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Key Hash"
          },
          "deposit_block_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deposit Block Hash"
          },
          "deposit_block_height": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deposit Block Height"
          },
          "commit_txid": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commit Txid"
          },
          "commit_block_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commit Block Hash"
          },
          "commit_block_height": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commit Block Height"
          },
          "verification_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verification Code"
          },
          "verification_details": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verification Details"
          }
        },
        "type": "object",
        "required": [
          "model_hash",
          "model_name",
          "model_commit",
          "difficulty"
        ],
        "title": "ModelInfo"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}
