{
 "openapi": "3.0.3",
 "info": {
  "title": "Radar Price API: gold, metals, energy, crops, crypto, stocks, indices, currencies",
  "version": "1.0.0",
  "description": "Live and historical prices. Free and paid plans; request a key on the developer page."
 },
 "servers": [
  {
   "url": "https://goldenprice-backend.onrender.com"
  }
 ],
 "components": {
  "securitySchemes": {
   "ApiKey": {
    "type": "apiKey",
    "in": "header",
    "name": "x-api-key"
   }
  },
  "schemas": {
   "PriceItem": {
    "type": "object",
    "properties": {
     "price": {
      "type": "number",
      "nullable": true
     },
     "changePct": {
      "type": "number",
      "nullable": true
     },
     "spark": {
      "type": "array",
      "items": {
       "type": "number"
      }
     },
     "stale": {
      "type": "boolean"
     },
     "src": {
      "type": "string",
      "nullable": true
     },
     "t": {
      "type": "number",
      "nullable": true,
      "description": "epoch ms of the price"
     },
     "hi52": {
      "type": "number",
      "nullable": true
     },
     "lo52": {
      "type": "number",
      "nullable": true
     }
    }
   },
   "Overview": {
    "type": "object",
    "properties": {
     "items": {
      "type": "object",
      "additionalProperties": {
       "$ref": "#/components/schemas/PriceItem"
      }
     }
    }
   },
   "Chart": {
    "type": "object",
    "properties": {
     "symbol": {
      "type": "string"
     },
     "source": {
      "type": "string"
     },
     "data": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "date": {
         "type": "string"
        },
        "value": {
         "type": "number"
        }
       }
      }
     }
    }
   },
   "Rates": {
    "type": "object",
    "properties": {
     "base": {
      "type": "string",
      "example": "USD"
     },
     "rates": {
      "type": "object",
      "additionalProperties": {
       "type": "number"
      }
     },
     "updated": {
      "type": "number"
     }
    }
   },
   "Usage": {
    "type": "object",
    "properties": {
     "plan": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "usedToday": {
      "type": "integer"
     },
     "dailyLimit": {
      "type": "integer"
     },
     "usedThisMonth": {
      "type": [
       "integer",
       "null"
      ]
     },
     "monthlyLimit": {
      "type": [
       "integer",
       "null"
      ]
     },
     "perMinute": {
      "type": "integer"
     },
     "expiresAt": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "Plans": {
    "type": "object",
    "additionalProperties": {
     "type": "object",
     "properties": {
      "name": {
       "type": "string"
      },
      "price": {
       "type": "number"
      },
      "daily": {
       "type": "integer"
      },
      "monthly": {
       "type": [
        "integer",
        "null"
       ]
      },
      "perMin": {
       "type": "integer"
      },
      "freshnessSec": {
       "type": "integer"
      }
     }
    }
   }
  }
 },
 "security": [
  {
   "ApiKey": []
  }
 ],
 "paths": {
  "/v1/overview": {
   "get": {
    "summary": "Latest prices, daily change, performance and ranges for every asset in your scope",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Overview"
        }
       }
      }
     },
     "401": {
      "description": "Missing or inactive key"
     },
     "429": {
      "description": "Rate limit"
     }
    }
   }
  },
  "/v1/chart/{symbol}": {
   "get": {
    "summary": "Daily history for one symbol",
    "parameters": [
     {
      "name": "symbol",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "GOLD",
        "SILVER",
        "PLATINUM",
        "PALLADIUM",
        "COPPER",
        "ALUMINUM",
        "NICKEL",
        "ZINC",
        "LEAD",
        "TIN",
        "COBALT",
        "LITHIUM",
        "URANIUM",
        "IRON",
        "STEEL",
        "STEELHRC",
        "LUMBER",
        "WTI",
        "BRENT",
        "NATGAS",
        "GASOLINE",
        "HEATOIL",
        "WHEAT",
        "CORN",
        "SOYBEANS",
        "RICE",
        "SUGAR",
        "COFFEE",
        "COCOA",
        "COTTON",
        "OATS",
        "OJ",
        "CATTLE",
        "FEEDER",
        "HOGS",
        "MILK",
        "BTC",
        "ETH",
        "BNB",
        "XRP",
        "SOL",
        "ADA",
        "DOGE",
        "TRX",
        "DOT",
        "LINK",
        "LTC",
        "AVAX",
        "SHIB",
        "TON",
        "BCH",
        "XLM",
        "ATOM",
        "ETC",
        "XMR",
        "NEAR",
        "UNI",
        "ICP",
        "APT",
        "FIL",
        "HBAR",
        "VET",
        "ALGO",
        "AAVE",
        "ARB",
        "OP",
        "INJ",
        "SUI",
        "PEPE",
        "CRO",
        "RUNE",
        "SAND",
        "MANA",
        "GRT",
        "EGLD",
        "SP500",
        "NASDAQ",
        "DOW",
        "FTSE100",
        "DAX",
        "CAC40",
        "NIKKEI225",
        "HANGSENG",
        "SHANGHAI",
        "NIFTY50",
        "SENSEX",
        "EGX30",
        "TASI",
        "BIST100",
        "BOVESPA",
        "ASX200",
        "TSX",
        "KOSPI",
        "EUROSTOXX50",
        "AAPL",
        "MSFT",
        "NVDA",
        "GOOGL",
        "AMZN",
        "META",
        "TSLA",
        "BRKB",
        "JPM",
        "VISA",
        "XOM",
        "ARAMCO",
        "RAJHI",
        "CIB",
        "GARAN",
        "TOYOTA",
        "SAMSUNG",
        "TENCENT",
        "BABA",
        "TSMC",
        "RELIANCE",
        "ASML",
        "SAP",
        "NESTLE",
        "LVMH",
        "NVO",
        "PBR",
        "VALE",
        "EURUSD",
        "GBPUSD",
        "USDJPY",
        "USDCHF",
        "AUDUSD",
        "USDCAD",
        "NZDUSD",
        "USDCNY",
        "USDINR",
        "USDTRY",
        "USDEGP",
        "USDSAR",
        "EURGBP",
        "EURJPY",
        "DXY",
        "SOYOIL",
        "SOYMEAL",
        "OATS",
        "OJ",
        "CATTLE",
        "FEEDER",
        "HOGS",
        "MILK",
        "LUMBER",
        "COAL",
        "TEA",
        "PALMOIL",
        "COCONUTOIL",
        "SUNFLOWEROIL",
        "RAPESEEDOIL",
        "RUBBER",
        "UREA",
        "DAP",
        "POTASH",
        "PHOSPHATE",
        "BEEF",
        "CHICKEN",
        "BANANA",
        "ORANGE",
        "FISHMEAL",
        "PLYWOOD",
        "SAWNWOOD"
       ]
      }
     },
     {
      "name": "days",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 365,
       "maximum": 3650
      }
     },
     {
      "name": "points",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 400,
       "maximum": 1500
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Chart"
        }
       }
      }
     },
     "403": {
      "description": "Symbol not in your key scope"
     }
    }
   }
  },
  "/v1/rates": {
   "get": {
    "summary": "Currency rates against USD (166 currencies)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Rates"
        }
       }
      }
     }
    }
   }
  },
  "/v1/symbols": {
   "get": {
    "summary": "All symbols and whether your key covers them",
    "responses": {
     "200": {
      "description": "OK"
     }
    }
   }
  },
  "/v1/usage": {
   "get": {
    "summary": "Your plan, scope and usage today",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Usage"
        }
       }
      }
     }
    }
   }
  },
  "/v1/plans": {
   "get": {
    "summary": "Plans and limits (no key needed)",
    "security": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Plans"
        }
       }
      }
     }
    }
   }
  },
  "/api/overview": {
   "get": {
    "summary": "Free keyless overview used by the website itself (all assets, USD)",
    "security": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Overview"
        }
       }
      }
     }
    }
   }
  },
  "/api/rates": {
   "get": {
    "summary": "Free keyless currency rates against USD",
    "security": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Rates"
        }
       }
      }
     }
    }
   }
  },
  "/api/freshness": {
   "get": {
    "summary": "Free keyless per-symbol source and data age (transparency)",
    "security": [],
    "responses": {
     "200": {
      "description": "OK"
     }
    }
   }
  }
 }
}