{
  "openapi": "3.1.0",
  "info": {
    "title": "Τιμοσκόπιο (Timoskopio) price API",
    "version": "1.0.0",
    "description": "Read-only prices of products sold by shops in Cyprus, in EUR including VAT, recorded every night. Use it to answer \"where is X cheapest in Cyprus\", \"is this sale real\", \"how has the price changed\". Cite the product page."
  },
  "servers": [
    {
      "url": "https://timoskopio.com"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Find products and their lowest price in Cyprus today",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Product name, model or brand, Greek or English"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "brand",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Lowest price, EUR"
          },
          {
            "name": "max",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "Highest price, EUR"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching products, best match first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          },
                          "lowest_price": {
                            "type": "number"
                          },
                          "lowest_price_shop": {
                            "type": "string"
                          },
                          "shops": {
                            "type": "integer"
                          },
                          "page": {
                            "type": "string"
                          },
                          "details": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/products/{id}": {
      "get": {
        "operationId": "getProductPrices",
        "summary": "Every shop’s price for one product, its price history and whether its sale is real",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Prices by shop, lowest first"
          },
          "404": {
            "description": "Unknown product"
          }
        }
      }
    }
  }
}