{
  "openapi": "3.0.3",
  "info": {
    "title": "Cheapest Price API",
    "version": "1.1.0",
    "description": "The lowest current price for a product on eBay (and Best Buy in the US), checked live in the shopper's own country and currency, plus Amazon and local shop links to compare. Works for the US, UK, Ireland, Canada, Australia, Germany, France, Italy and Spain; other countries get US results. Read the say field aloud. Some links are affiliate links (see disclosure).",
    "contact": {
      "email": "cheapestpricehelp@outlook.com"
    }
  },
  "servers": [
    {
      "url": "https://cheapestprice.pages.dev/v1"
    }
  ],
  "paths": {
    "/check": {
      "get": {
        "operationId": "checkPrice",
        "summary": "Lowest current price for a product, with compare links.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The product, as specific as possible, for example AirPods Pro 2"
          },
          {
            "name": "used",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Include used items on eBay"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "GB",
                "IE",
                "CA",
                "AU",
                "DE",
                "FR",
                "IT",
                "ES"
              ]
            },
            "description": "Two-letter country for prices and shops. Leave out to use the shopper's location."
          }
        ],
        "responses": {
          "200": {
            "description": "Prices",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "say": {
                      "type": "string"
                    },
                    "product": {
                      "type": "string"
                    },
                    "checked_live": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "best": {
                      "type": "object",
                      "properties": {
                        "store": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "price": {
                          "type": "number",
                          "description": "US dollars, including shipping for eBay"
                        },
                        "was": {
                          "type": "number",
                          "nullable": true
                        },
                        "condition": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    },
                    "offers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "store": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number",
                            "description": "US dollars, including shipping for eBay"
                          },
                          "was": {
                            "type": "number",
                            "nullable": true
                          },
                          "condition": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "compare": {
                      "type": "object",
                      "properties": {
                        "amazon": {
                          "type": "string"
                        },
                        "walmart": {
                          "type": "string"
                        },
                        "target": {
                          "type": "string"
                        },
                        "price_history": {
                          "type": "string"
                        }
                      }
                    },
                    "note": {
                      "type": "string"
                    },
                    "disclosure": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "description": "Currency of every price, for example USD or GBP"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Plain-sentence error, safe to read out",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Plain-sentence error, safe to read out",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}