
openapi: 3.0.0
info:
  title: MinerYield API
  description: >-
    API for MinerYield application. Estimates only; not investment, financial, or tax advice. Results vary with network difficulty, coin price, power cost, and hardware performance. Do your own research.
  version: 1.0.0
servers:
  - url: /api/v1
paths:
  /miners:
    get:
      summary: Get all miners
      description: >-
        Rank catalog ASICs with the same solar/battery/grid leftover-watt model as the site calculator.
        Query overrides (solarW, batteryCapacity, zipCode, elecCost, solar, battery, grid) replace the
        API-key owner profile when present. Passing solarW without solar=false turns solar on; passing
        batteryCapacity without battery=false turns battery on. Sort PROFIT/DAY to answer "which miner
        makes the most" for a home or small-business array.
      security:
        - bearerAuth: []
      parameters:
        - name: solarW
          in: query
          required: false
          schema:
            type: number
          description: Solar array capacity in Watts (10000 = 10 kW).
        - name: batteryCapacity
          in: query
          required: false
          schema:
            type: number
          description: Battery storage in kWh (20 = 20 kWh).
        - name: zipCode
          in: query
          required: false
          schema:
            type: string
          description: 5-digit US ZIP for Peak Sun Hours.
        - name: elecCost
          in: query
          required: false
          schema:
            type: number
          description: Grid leftover price in USD/kWh (0.15 = 15 cents). Solar and battery kWh are free.
        - name: solar
          in: query
          required: false
          schema:
            type: boolean
          description: Use solarW during Peak Sun Hours. Defaults true when solarW is sent.
        - name: battery
          in: query
          required: false
          schema:
            type: boolean
          description: Use leftover solar stored in batteryCapacity at night. Defaults true when batteryCapacity is sent.
        - name: grid
          in: query
          required: false
          schema:
            type: boolean
          description: Draw leftover kWh from the grid at elecCost so the miner can run 24 hours.
      responses:
        '200':
          description: A JSON array of miner objects
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    MODEL:
                      type: string
                    COIN:
                      type: string
                      description: Coin used for the profitability model. Multi-coin algorithms default to the most profitable supported coin from live market data.
                    ALGO:
                      type: string
                    HASHRATE:
                      type: number
                    POWER:
                      type: number
                    ELEC_COST:
                      type: number
                    REVENUE/DAY:
                      type: number
                      description: Individual unit revenue
                    COST/DAY:
                      type: number
                      description: Individual unit cost
                    PROFIT/DAY:
                      type: number
                      description: Individual unit pool-mining profit
                    REVENUE/DAY_NICEHASH:
                      type: number
                      nullable: true
                      description: Estimated daily revenue from selling the ASIC's hashrate on NiceHash (USD/day). Uses the public NiceHash paying rate (sat per H/s per day) times hashrate times BTC/USD. Null when no usable NiceHash market rate exists for the algorithm.
                    PROFIT/DAY_MRR:
                      type: number
                      nullable: true
                      description: Estimated daily profit from listing the ASIC on Mining Rig Rentals (rental revenue minus the same power cost). Null when no usable MRR market rate exists for the algorithm.
                    RUNTIME_HOURS:
                      type: number
                      description: Individual unit runtime hours
                    SOLO_PROBABILITY:
                      type: number
                    MEAN_TIME_TO_BLOCK:
                      type: number
  /rigs:
    get:
      summary: Get user rigs
      description: Returns the user's saved "My Rigs" data, including the list of favorited miner IDs and their corresponding quantities.
      security:
        - bearerAuth: []
      responses:
        '200':
          description: A detailed array containing profitability metrics for each saved rig configuration.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    QTY:
                      type: integer
                    MODEL:
                      type: string
                    COIN:
                      type: string
                      description: Coin used for this saved rig. A stored preferredCoins override is used when present; otherwise the most profitable supported coin from live market data.
                    ALGO:
                      type: string
                      description: Active algorithm. For Goldshell HS-Lite, a stored preferredAlgos override selects Blake2B-SHA3 (HNS) or Blake2B (SC/BTCB2) and changes HASHRATE/POWER.
                    HASHRATE:
                      type: number
                    POWER:
                      type: number
                    ELEC_COST:
                      type: number
                    REVENUE/DAY:
                      type: number
                      description: Individual unit revenue
                    COST/DAY:
                      type: number
                      description: Individual unit cost
                    PROFIT/DAY:
                      type: number
                      description: Individual unit pool-mining profit
                    REVENUE/DAY_NICEHASH:
                      type: number
                      nullable: true
                      description: Estimated daily revenue from selling the rig's hashrate on NiceHash (USD/day). Null when no usable NiceHash market rate exists for the algorithm.
                    PROFIT/DAY_MRR:
                      type: number
                      nullable: true
                      description: Estimated daily profit from listing the ASIC on Mining Rig Rentals (rental revenue minus the same power cost). Null when no usable MRR market rate exists for the algorithm.
                    RUNTIME_HOURS:
                      type: number
                      description: Individual unit runtime hours
                    SOLO_PROBABILITY:
                      type: number
                    MEAN_TIME_TO_BLOCK:
                      type: number
        '401':
          description: Unauthorized
  /calculator:
    post:
      summary: Calculate profitability
      description: Provides access to the profitability calculator.
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                hashrate:
                  type: number
                  description: Hashing power in catalog units (TH/s for SHA-256 and Kadena, GH/s for NexaPow and XPHash, MH/s for Scrypt, KH/s for RandomX).
                power:
                  type: number
                  description: Total power consumption in Watts (W).
                algorithm:
                  type: string
                  description: Catalog algorithm name (SHA-256, Scrypt, KHeavyHash, Eaglesong, SHA512256d, Blake2B, Blake2B-Sia, Blake2B-SHA3, Blake256R14, X11, Cuckatoo31, Cuckatoo32, Equihash, RandomX, SHA3X, Ethash4G, Blake3, zkSNARK, Kadena, NexaPow, XPHash).
                elecCost:
                  type: number
                  description: The cost of electricity in $/kWh (e.g., 0.15).
                solarW:
                  type: number
                  description: Home/small-business solar array capacity in Watts (10000 = 10 kW). Generation is free during Peak Sun Hours from zipCode; leftover watts can charge the battery.
                zipCode:
                  type: string
                  description: 5-digit US ZIP used to look up local Peak Sun Hours (PSH) for the solar-by-day window.
                hardwareCost:
                  type: number
                  description: Upfront cost of the mining hardware in USD to calculate ROI Days.
                batteryCapacity:
                  type: number
                  description: Battery storage in kWh (20 = 20 kWh). Used when powerSources.battery is true. Excess daytime solar charges it; it covers night hours before grid.
                powerSources:
                  type: object
                  properties:
                    solar:
                      type: boolean
                      description: Use solarW during Peak Sun Hours.
                    battery:
                      type: boolean
                      description: Use leftover daytime solar stored in batteryCapacity at night.
                    grid:
                      type: boolean
                      description: Draw leftover kWh from the grid at elecCost (solar by day, grid at night when battery is off). If false, the miner only runs while solar or battery energy lasts.
                  description: Same solar/battery/grid mix as the site calculator. {solar:true, battery:false, grid:true} is solar by day and grid at night.
                preferredCoin:
                  type: string
                  description: Target coin when an algorithm supports more than one (BTC/BCH/QUAI, SC/BTCB2, BTCB2/SC, ZEC/ARRR, ETC/OCTA/ETHW/QKC, DCR/SCP). Blake2B-SHA3 is HNS only; Cuckatoo31 is MWC only; Cuckatoo32 is GRIN only. Scrypt reports LTC/DOGE (merged). When omitted, defaults to the most profitable supported coin from live market data except Ethash4G, which defaults to ETC. Invalid preferredCoin values for the algorithm return HTTP 400.
      responses:
        '200':
          description: A JSON object with the calculation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CalculationResult'
        '400':
          description: Bad Request (missing required fields, or preferredCoin is not valid for the algorithm)
        '401':
          description: Unauthorized
  /market:
    get:
      summary: Get live market spot prices
      description: Returns the real-time spot prices for supported cryptocurrencies, including BTC, BCH, LTC, DOGE, ZEC, KAS, CKB, RXD, SC, DCR, DASH, GRIN, ALPH, XTM, ETC, XMR, ALEO, HNS, BTCB2, KDA, NEXA, XP, QUAI, ARRR, OCTA, ETHW, QKC, MWC, and SCP.
      security:
        - bearerAuth: []
      responses:
        '200':
          description: A JSON object containing the live cryptocurrency spot prices.
          content:
            application/json:
              schema:
                type: object
                properties:
                  btcPrice:
                    type: number
                    description: Current spot price of Bitcoin (BTC) in USD.
                  bchPrice:
                    type: number
                    description: Current spot price of Bitcoin Cash (BCH) in USD.
                  ltcPrice:
                    type: number
                    description: Current spot price of Litecoin (LTC) in USD.
                  dogePrice:
                    type: number
                    description: Current spot price of Dogecoin (DOGE) in USD.
                  zecPrice:
                    type: number
                    description: Current spot price of Zcash (ZEC) in USD.
                  kasPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Kaspa (KAS) in USD. Null/omitted when DataHub has no live quote.
                  ckbPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Nervos (CKB) in USD. Null/omitted when DataHub has no live quote.
                  rxdPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Radiant (RXD) in USD. Null/omitted when DataHub has no live quote.
                  scPrice:
                    type: number
                    description: Current spot price of Siacoin (SC) in USD.
                  dcrPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Decred (DCR) in USD. Null/omitted when DataHub has no live quote.
                  dashPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Dash (DASH) in USD. Null/omitted when DataHub has no live quote.
                  grinPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Grin (GRIN) in USD. Null/omitted when DataHub has no live quote.
                  alphPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Alephium (ALPH) in USD. Null/omitted when DataHub has no live quote.
                  xtmPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Tari (XTM) in USD. Null/omitted when DataHub has no live quote.
                  etcPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Ethereum Classic (ETC) in USD. Null/omitted when DataHub has no live quote.
                  xmrPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Monero (XMR) in USD. Null/omitted when DataHub has no live quote.
                  aleoPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Aleo (ALEO) in USD. Null/omitted when DataHub has no live quote.
                  hnsPrice:
                    type: number
                    description: Current spot price of Handshake (HNS) in USD.
                  btcb2Price:
                    type: number
                    nullable: true
                    description: Current spot price of BTCB2 in USD. Null/omitted when DataHub has no live quote.
                  kdaPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Kadena (KDA) in USD. Null/omitted when DataHub has no live quote.
                  nexaPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Nexa (NEXA) in USD. Null/omitted when DataHub has no live quote.
                  xpPrice:
                    type: number
                    nullable: true
                    description: Current spot price of XPHERE (XP) in USD. Null/omitted when DataHub has no live quote.
                  quaiPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Quai (QUAI) in USD. Null/omitted when DataHub has no live quote.
                  arrrPrice:
                    type: number
                    nullable: true
                    description: Current spot price of Pirate Chain (ARRR) in USD. Null/omitted when DataHub has no live quote.
                  octaPrice:
                    type: number
                    nullable: true
                    description: Current spot price of OctaSpace (OCTA) in USD. Null/omitted when DataHub has no live quote.
                  ethwPrice:
                    type: number
                    nullable: true
                    description: Current spot price of EthereumPoW (ETHW) in USD. Null/omitted when DataHub has no live quote.
                  qkcPrice:
                    type: number
                    nullable: true
                    description: Current spot price of QuarkChain (QKC) in USD. Null/omitted when DataHub has no live quote.
                  mwcPrice:
                    type: number
                    nullable: true
                    description: Current spot price of MimbleWimble Coin (MWC) in USD. Null/omitted when DataHub has no live quote.
                  scpPrice:
                    type: number
                    nullable: true
                    description: Current spot price of ScPrime (SCP) in USD. Null/omitted when DataHub has no live quote.
        '401':
          description: Unauthorized
        '429':
          description: Quota Exceeded
  /solar-forecast:
    get:
      summary: Get 7-day solar forecast
      description: Returns a 7-day solar production forecast based on zip code and system capacity.
      security:
        - bearerAuth: []
      parameters:
        - name: zipCode
          in: query
          description: 5-digit US Zip Code.
          required: false
          schema:
            type: string
        - name: capacityW
          in: query
          description: Solar array capacity in Watts.
          required: false
          schema:
            type: number
      responses:
        '200':
          description: A JSON object containing the 7-day forecast.
          content:
            application/json:
              schema:
                type: object
                properties:
                  zipCode:
                    type: string
                  capacityW:
                    type: number
                  latitude:
                    type: number
                  longitude:
                    type: number
                  forecast:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        radiation:
                          type: number
                          description: Shortwave radiation sum in MJ/m².
                        estimatedKwh:
                          type: number
                          description: Estimated daily kWh production.
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '429':
          description: Quota Exceeded
  /difficulty-prediction:
    get:
      summary: Get 7-day difficulty prediction
      description: Returns a 7-day difficulty trend prediction for a specific coin.
      security:
        - bearerAuth: []
      parameters:
        - name: coin
          in: query
          description: The cryptocurrency ticker. Must be a DATAHUB_MARKET_SYMBOLS value. Defaults to BTC. Unknown coins return HTTP 400.
          required: false
          schema:
            type: string
            enum: [BTC, BCH, LTC, DOGE, ZEC, KAS, CKB, RXD, SC, DCR, DASH, GRIN, ALPH, XTM, ETC, XMR, ALEO, HNS, BTCB2, KDA, NEXA, XP, QUAI, ARRR, OCTA, ETHW, QKC, MWC, SCP]
      responses:
        '200':
          description: A JSON object containing current difficulty and 7-day predictions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  coin:
                    type: string
                  currentDifficulty:
                    type: number
                  lastAdjustmentHeight:
                    type: integer
                  nextAdjustmentHeight:
                    type: integer
                  predictions:
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                        predictedDifficulty:
                          type: number
                        changePercent:
                          type: number
        '400':
          description: Coin is not in DATAHUB_MARKET_SYMBOLS
        '401':
          description: Unauthorized
        '429':
          description: Quota Exceeded
  /catalog/miners:
    get:
      summary: List catalog miners (public)
      description: Returns the public ASIC catalog (specs only, no user profitability). Includes Kadena/KDA, NexaPow/NEXA, XPHash/XP, zkSNARK/ALEO, Blake3/ALPH, and SHA-256 QUAI-capable SKUs under 5000 W. Goldshell HS-Lite is one catalog id with dual modes (Blake2B-SHA3/HNS and Blake2B SC/BTCB2). No API key required.
      responses:
        '200':
          description: A JSON array of ASIC catalog objects
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    name:
                      type: string
                    hashrate:
                      type: number
                      description: Catalog hashrate in algorithm units (TH/s for SHA-256 and Kadena, GH/s for NexaPow and XPHash).
                    power:
                      type: number
                      description: Watts. Home catalog is capped at 5000 W.
                    algorithm:
                      type: string
                      description: Catalog algorithm name (SHA-256, Kadena, NexaPow, XPHash, …). Goldshell HS-Lite defaults to Blake2B-SHA3 (HNS).
                    coin:
                      type: string
                      description: Default coin ticker (BTC, KDA, NEXA, XP, QUAI, ALEO, …).
                    modes:
                      type: array
                      description: Dual-algo firmware profiles when one catalog id can switch algorithms (Goldshell HS-Lite). Each mode has its own algorithm, hashrate, power, and defaultCoin. Blake2B-SHA3 is HNS only; Blake2B is SC/BTCB2.
                      items:
                        type: object
                        properties:
                          algorithm:
                            type: string
                          hashrate:
                            type: number
                          power:
                            type: number
                          defaultCoin:
                            type: string
  /market-data:
    get:
      summary: Get full market data (public)
      description: Returns the full market payload used by the web app (spot prices plus network hashrate/difficulty). Includes KDA, NEXA, XP, QUAI, ARRR, OCTA, ETHW, QKC, MWC, and SCP. New-coin and XP hashRate/blockReward may be null from DataHub and are omitted rather than invented. No API key required. Broader than GET /market.
      responses:
        '200':
          description: MarketData object consumed by the MinerYield UI
          content:
            application/json:
              schema:
                type: object
                properties:
                  kdaPrice:
                    type: number
                    nullable: true
                  nexaPrice:
                    type: number
                    nullable: true
                  xpPrice:
                    type: number
                    nullable: true
                  quaiPrice:
                    type: number
                    nullable: true
                  kdaNetworkHashrate:
                    type: number
                    nullable: true
                    description: Kadena network hashrate in H/s.
                  nexaNetworkHashrate:
                    type: number
                    nullable: true
                    description: NexaPow network hashrate in H/s.
                  xpNetworkHashrate:
                    type: number
                    nullable: true
                    description: XPHash network hashrate in H/s. Omitted when DataHub hashRate is null.
                  quaiNetworkHashrate:
                    type: number
                    nullable: true
                    description: QUAI SHA-256 network hashrate in H/s.
                  arrrNetworkHashrate:
                    type: number
                    nullable: true
                    description: Pirate Chain Equihash network hashrate in Sol/s. Omitted when DataHub hashRate is null.
                  octaNetworkHashrate:
                    type: number
                    nullable: true
                    description: OctaSpace Ethash network hashrate in H/s.
                  ethwNetworkHashrate:
                    type: number
                    nullable: true
                    description: EthereumPoW Ethash network hashrate in H/s.
                  qkcNetworkHashrate:
                    type: number
                    nullable: true
                    description: QuarkChain Ethash network hashrate in H/s.
                  mwcNetworkHashrate:
                    type: number
                    nullable: true
                    description: MimbleWimble Coin Cuckatoo31 network hashrate in GPS (DataHub hashRate is H/s; GPS is 1:1).
                  scpNetworkHashrate:
                    type: number
                    nullable: true
                    description: ScPrime Blake256r14 network hashrate in H/s.
                  kdaNetworkDifficulty:
                    type: number
                    nullable: true
                  nexaNetworkDifficulty:
                    type: number
                    nullable: true
                  xpNetworkDifficulty:
                    type: number
                    nullable: true
                  quaiNetworkDifficulty:
                    type: number
                    nullable: true
  /mrr-rates:
    get:
      summary: List Mining Rig Rentals rates (public)
      description: Cached Mining Rig Rentals algorithm rates. NexaPow maps to the MRR nexapow book. SHA3X, zkSNARK, Blake256R14, Kadena, and XPHash have no primary MRR book (null). No API key required.
      responses:
        '200':
          description: Cached MRR snapshot
          content:
            application/json:
              schema:
                type: object
                properties:
                  rates:
                    type: object
                  fetchedAt:
                    type: number
                    description: Unix epoch milliseconds
  /nicehash-rates:
    get:
      summary: List NiceHash paying rates (public)
      description: Cached NiceHash public simplemultialgo paying rates (sat per H/s or Sol/s per day). Used for My Rigs NiceHash revenue ($/day). SHA3X, zkSNARK, Blake256R14, Kadena, and XPHash have no NiceHash paying book (null) and are omitted. No API key required. Market snapshot, not a rental booking.
      responses:
        '200':
          description: Cached NiceHash snapshot
          content:
            application/json:
              schema:
                type: object
                properties:
                  rates:
                    type: object
                    additionalProperties:
                      type: object
                      properties:
                        nhName:
                          type: string
                        satsPerHsPerDay:
                          type: number
                          description: NiceHash paying field — satoshis per H/s (or Sol/s) per day.
                  fetchedAt:
                    type: number
                    description: Unix epoch milliseconds
components:
  schemas:
    CalculationResult:
      type: object
      properties:
        dailyRev:
          type: number
        dailyCost:
          type: number
        dailyProfit:
          type: number
        dailyRevenueNicehash:
          type: number
          nullable: true
          description: Estimated NiceHash marketplace daily revenue in USD. Null when no usable NiceHash paying rate exists.
        dailyProfitMrr:
          type: number
          nullable: true
          description: Estimated MRR rent-out daily profit in USD. Null when no usable MRR market rate exists.
        solarSavings:
          type: number
        effectiveElecCost:
          type: number
        roiDays:
          type: number
        runtimeHours:
          type: number
        soloProbability:
          type: number
        meanTimeToBlock:
          type: number
        monthlyRev:
          type: number
        monthlyProfit:
          type: number
        ltcDaily:
          type: number
        dogeDaily:
          type: number
        coinDaily:
          type: number
        coinSymbol:
          type: string
        revenueUnavailable:
          type: boolean
          description: True when live price or network hashrate is missing (notably BTCB2 or XP).
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
