Metals-API Analytics API

Time series, fluctuation, and OHLC analytics.

OpenAPI Specification

metals-api-analytics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Metals Analytics API
  description: Metals-API provides a free, simple, and lightweight JSON API for current and historical precious metals rates and currency conversion. It supports real-time and historical data for gold, silver, platinum, palladium, and other metals in 170 world currencies.
  version: '1.0'
  contact:
    name: Metals-API
    url: https://metals-api.com/
  license:
    name: Proprietary
    url: https://metals-api.com/terms
servers:
- url: https://metals-api.com/api
  description: Production
security:
- accessKey: []
tags:
- name: Analytics
  description: Time series, fluctuation, and OHLC analytics.
paths:
  /timeseries:
    get:
      summary: Get rates over a time series
      description: Returns daily rates between two dates.
      operationId: getTimeseries
      tags:
      - Analytics
      parameters:
      - name: start_date
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: end_date
        in: query
        required: true
        schema:
          type: string
          format: date
      - $ref: '#/components/parameters/Base'
      - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: Time series rates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeseriesResponse'
  /fluctuation:
    get:
      summary: Get rate fluctuation
      description: Returns rate fluctuations between a start and end date.
      operationId: getFluctuation
      tags:
      - Analytics
      parameters:
      - name: start_date
        in: query
        required: true
        schema:
          type: string
          format: date
      - name: end_date
        in: query
        required: true
        schema:
          type: string
          format: date
      - $ref: '#/components/parameters/Base'
      - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: Fluctuation data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FluctuationResponse'
  /lowest-highest/{date}:
    get:
      summary: Get daily lowest and highest prices
      description: Returns daily lowest and highest prices for the requested date.
      operationId: getLowestHighest
      tags:
      - Analytics
      parameters:
      - name: date
        in: path
        required: true
        schema:
          type: string
          format: date
      - $ref: '#/components/parameters/Base'
      - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: Daily lowest and highest prices.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RatesResponse'
  /open-high-low-close/{date}:
    get:
      summary: Get OHLC data
      description: Returns open, high, low, and close prices for the requested date.
      operationId: getOhlc
      tags:
      - Analytics
      parameters:
      - name: date
        in: path
        required: true
        schema:
          type: string
          format: date
      - $ref: '#/components/parameters/Base'
      - $ref: '#/components/parameters/Symbols'
      responses:
        '200':
          description: OHLC data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OhlcResponse'
components:
  parameters:
    Base:
      name: base
      in: query
      description: Three-letter currency or metal code that serves as the base.
      schema:
        type: string
    Symbols:
      name: symbols
      in: query
      description: Comma-separated list of currency or metal codes to limit the response.
      schema:
        type: string
  schemas:
    FluctuationResponse:
      type: object
      properties:
        success:
          type: boolean
        fluctuation:
          type: boolean
        start_date:
          type: string
          format: date
        end_date:
          type: string
          format: date
        base:
          type: string
        rates:
          type: object
          additionalProperties:
            type: object
            properties:
              start_rate:
                type: number
              end_rate:
                type: number
              change:
                type: number
              change_pct:
                type: number
    OhlcResponse:
      type: object
      properties:
        success:
          type: boolean
        timestamp:
          type: integer
        base:
          type: string
        rates:
          type: object
          additionalProperties:
            type: object
            properties:
              open:
                type: number
              high:
                type: number
              low:
                type: number
              close:
                type: number
    RatesResponse:
      type: object
      properties:
        success:
          type: boolean
        timestamp:
          type: integer
        base:
          type: string
        date:
          type: string
          format: date
        rates:
          type: object
          additionalProperties:
            type: number
        unit:
          type: string
    TimeseriesResponse:
      type: object
      properties:
        success:
          type: boolean
        timeseries:
          type: boolean
        start_date:
          type: string
          format: date
        end_date:
          type: string
          format: date
        base:
          type: string
        rates:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              type: number
  securitySchemes:
    accessKey:
      type: apiKey
      in: query
      name: access_key