openapi: 3.2.0 info: title: Marketstack API v2 Commodities API version: 2.0.0 description: 'The official Marketstack API documentation will help you learn how to query the Marketstack JSON API for real-time, intraday, and historical stock market data, along with more advanced EDGAR data endpoints. Also, define multiple stock symbols, retrieve extensive data about 2700+ Stock Exchanges Info, 30000+ Stock tickers from more than 50 countries, as well as 750 + Stock Market indexes, information about timezones, currencies, and more. Our API is built upon a RESTful and easy-to-understand request and response structure. API requests are always sent using a simple API request URL with a series of required and optional HTTPS GET parameters, and API responses are provided in lightweight JSON format. ' servers: - url: https://api.marketstack.com/v2 security: - ApiKeyQuery: [] tags: - name: Commodities paths: /commodities: get: tags: - Commodities summary: Commodity Prices description: 'Get commodity prices of 70+ world-known commodities of energy, metals, industrial, agricultural, and livestock areas. **Note:** * Rate limit for 1 API call per minute is enforced on this endpoint. See the full list of available commodities in the file presented here:[**Download**](https://marketstack.com/download/marketstack-commodities.xlsx) * Historical end-of-day data (`eod`) is available for up to 15 years back, while intraday data (`intraday`) always only offers the last 10,000 entries for each of the intervals available. **Example:** For a 1-minute interval, historical intraday data is available for up to 10,000 minutes back.' parameters: - $ref: '#/components/parameters/AccessKey' - $ref: '#/components/parameters/CommodityName' responses: '200': description: Real-time commodity prices retrieved. content: application/json: schema: $ref: '#/components/schemas/CommodityResponse' /commoditieshistory: get: tags: - Commodities summary: Commodities Historical Prices description: 'If you are looking for past commodity prices, you can use the Historical Commodity Prices endpoint, where you can choose specific dates and search by individual commodities. Additionally, the API offers options for daily data from the previous five years or monthly intervals using the `frequency` parameter. **Note:** * A rate limit of 1 API call per minute is enforced on this endpoint. * The recommended historical date range for a single API call is 1 year when requesting daily data. While larger ranges (up to 1.5 years) may work, retrieving data one year at a time ensures consistency. * Historical data for Commodities is available for up to 15 years in the past, though coverage varies by commodity type like **Metals:** Typically over 13 years of historical data, with some having as few as 2 years. **Energy:** Generally 15 years of coverage, though a few have up to 10 years. **Industrial:** Usually 15 years, with some limited to 10 years. **Livestock and Agricultural:** Coverage ranges from 9 to 15 years.' parameters: - $ref: '#/components/parameters/AccessKey' - $ref: '#/components/parameters/CommodityName' - $ref: '#/components/parameters/DateFrom' - $ref: '#/components/parameters/DateTo' - $ref: '#/components/parameters/Frequency' responses: '200': description: Historical commodity prices retrieved. content: application/json: schema: $ref: '#/components/schemas/CommodityHistoricalResponse' components: parameters: Frequency: name: frequency in: query description: Specify the frequency of the commodity prices. Available options are `daily`, `weekly`, `monthly`, `quarterly`, and `yearly`. Default is `daily`. required: false schema: type: string enum: - daily - weekly - monthly - quarterly - yearly AccessKey: name: access_key in: query description: Your Marketstack API access key. required: true schema: type: string CommodityName: name: commodity_name in: query description: Specify the commodity_name for which you like to receive the Price, aluminum for example. required: true schema: type: string DateFrom: name: date_from in: query description: Filter results from this date (inclusive). Format `YYYY-MM-DD`. required: false schema: type: string format: date DateTo: name: date_to in: query description: Filter results up to this date (inclusive). Format `YYYY-MM-DD`. required: false schema: type: string format: date schemas: CommodityResponse: type: object properties: data: type: array items: type: object properties: commodity_name: type: string description: Name of the commodity. commodity_unit: type: string description: Unit of the commodity. commodity_price: type: string description: Current price of the commodity. price_change_day: type: string description: Absolute day change. percentage_day: type: string description: Day change in percent. percentage_week: type: string description: Week change in percent. percentage_month: type: string description: Month change in percent. percentage_year: type: string description: Year change in percent. quarter1_25: type: string description: Value for the first quarter of 2025. quarter2_25: type: string description: Value for the second quarter of 2025. quarter3_25: type: string description: Value for the third quarter of 2025. quarter4_25: type: string description: Value for the fourth quarter of 2025. datetime: type: string format: date-time description: Timestamp of the commodity price in ISO8601 format. CommodityHistoricalResponse: type: object properties: result: type: object properties: basics: type: object properties: frequency: type: string description: Frequency of the historical data (e.g., 1day, 1month) data: type: array items: type: object properties: commodity_name: type: string description: Name of the commodity. commodity_unit: type: string description: Unit of the commodity. commodity_prices: type: array items: type: object properties: commodity_price: type: string description: Price of the commodity for the date. date: type: string description: Date for the price (YYYY-MM-DD or YYYY-MM for monthly). securitySchemes: ApiKeyQuery: type: apiKey in: query name: access_key description: Your Marketstack API access key.