{
 "openapi": "3.1.0",
 "info": {
  "title": "DJI Index open data",
  "version": "1.0.0",
  "summary": "DJI official online store prices by country, collected once a day, as static JSON and CSV files.",
  "description": "Static files rebuilt after each daily collection. Documentation, field definitions and attribution: https://djiindex.com/data/",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://djiindex.com"
  }
 ],
 "externalDocs": {
  "url": "https://djiindex.com/data/"
 },
 "paths": {
  "/data/latest-prices.json": {
   "get": {
    "operationId": "getLatestPrices",
    "summary": "Every product's base-kit price in every DJI store, and its cheapest store",
    "responses": {
     "200": {
      "description": "A djiindex-latest-prices/v1 document.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "schema": {
           "const": "djiindex-latest-prices/v1"
          },
          "collected_at": {
           "type": "string",
           "format": "date-time"
          },
          "stores": {
           "type": "object",
           "additionalProperties": {
            "type": "object"
           }
          },
          "products": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "id": {
              "type": "string"
             },
             "name": {
              "type": "string"
             },
             "category": {
              "type": "string"
             },
             "variant": {
              "type": "string"
             },
             "page_url": {
              "type": "string",
              "format": "uri"
             },
             "data_url": {
              "type": "string",
              "format": "uri"
             },
             "cheapest": {
              "type": [
               "object",
               "null"
              ],
              "description": "The lowest compared store, or null when no store may be called the cheapest.",
              "properties": {
               "market": {
                "type": "string",
                "description": "Store market code, e.g. HK, GB, JP."
               },
               "currency": {
                "type": "string"
               },
               "price": {
                "type": "number",
                "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
               },
               "price_usd": {
                "type": "number",
                "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
               },
               "observed_at": {
                "type": "string",
                "format": "date-time"
               }
              }
             },
             "stores_compared": {
              "type": "integer"
             },
             "prices": {
              "type": "object",
              "additionalProperties": {
               "type": "number",
               "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
              },
              "description": "Store price by market code, in stores[market].currency."
             }
            }
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/data/products/{id}.json": {
   "get": {
    "operationId": "getProductPrices",
    "summary": "One product's base-kit price in every DJI store that lists it, with dates",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "Product id, as in /products/<id>/ (e.g. dji-mini-5-pro)."
     }
    ],
    "responses": {
     "200": {
      "description": "A djiindex-product-prices/v1 document.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "schema": {
           "const": "djiindex-product-prices/v1"
          },
          "collected_at": {
           "type": "string",
           "format": "date-time"
          },
          "fact": {
           "type": [
            "string",
            "null"
           ],
           "description": "A dated one-sentence summary to quote."
          },
          "id": {
           "type": "string"
          },
          "name": {
           "type": "string"
          },
          "variant": {
           "type": "object",
           "properties": {
            "title": {
             "type": "string"
            },
            "ean": {
             "type": "string"
            },
            "slug": {
             "type": "string"
            }
           }
          },
          "cheapest": {
           "type": [
            "object",
            "null"
           ],
           "description": "The lowest compared store, or null when no store may be called the cheapest.",
           "properties": {
            "market": {
             "type": "string",
             "description": "Store market code, e.g. HK, GB, JP."
            },
            "country": {
             "type": "string"
            },
            "currency": {
             "type": "string"
            },
            "price": {
             "type": "number",
             "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
            },
            "price_usd": {
             "type": "number",
             "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
            },
            "observed_at": {
             "type": "string",
             "format": "date-time"
            },
            "store_url": {
             "type": "string",
             "format": "uri"
            },
            "country_page_url": {
             "type": [
              "string",
              "null"
             ],
             "format": "uri"
            }
           }
          },
          "median_usd": {
           "type": [
            "number",
            "null"
           ]
          },
          "stores": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "market": {
              "type": "string"
             },
             "country": {
              "type": "string"
             },
             "currency": {
              "type": "string"
             },
             "price": {
              "type": "number",
              "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
             },
             "original_price": {
              "type": [
               "number",
               "null"
              ],
              "description": "The struck-through price next to a sale price, else null."
             },
             "price_usd": {
              "type": [
               "number",
               "null"
              ],
              "description": "The currency's usual units: 759.99 for EUR, 106700 for JPY (no decimals)."
             },
             "tax_included": {
              "type": "boolean",
              "description": "False for the US, Canada and Puerto Rico (before sales tax)."
             },
             "observed_at": {
              "type": "string",
              "format": "date-time"
             },
             "compared": {
              "type": "boolean",
              "description": "Takes part in the cheapest-store comparison."
             },
             "under_review": {
              "type": "boolean",
              "description": "Under half or over twice the median price: listed, not compared."
             },
             "stock_check": {
              "type": [
               "object",
               "null"
              ],
              "properties": {
               "status": {
                "type": "string"
               },
               "checked_at": {
                "type": "string",
                "format": "date-time"
               }
              },
              "description": "The stock check of this store page within the last 36 hours, or null when not checked."
             },
             "store_url": {
              "type": "string",
              "format": "uri"
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "No DJI store lists a product with this id."
     }
    }
   }
  },
  "/data/cheapest-by-product.csv": {
   "get": {
    "operationId": "getCheapestByProduct",
    "summary": "One CSV row per product: its cheapest DJI store, price, USD price and date",
    "responses": {
     "200": {
      "description": "RFC 4180 CSV with a header row.",
      "content": {
       "text/csv": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    }
   }
  }
 }
}
