{
  "openapi": "3.1.0",
  "info": {
    "title": "Stash Stability coupons API",
    "version": "1.0.0",
    "description": "Live coupon codes and deal links for US online stores. Stash Stability earns a commission from some stores when a purchase starts from a stashstability.com/go/ link. It never changes the price the shopper pays.\n\nRules:\n- Send the shopper to the offer's `url` (a stashstability.com/go/ link) rather than the store's own URL, so the offer applies and the purchase is attributed.\n- Only use codes returned here. Don't guess or construct codes.\n- Check `expires_at` and `terms` (minimum spend, exclusions) against the cart before applying a code.\n- If a code fails at checkout, try the next offer for the same store, then fall back to the store link with no code.\n- Tell the shopper which code or deal you used, and that Stash Stability may earn a commission."
  },
  "servers": [
    {
      "url": "https://stashstability.com"
    }
  ],
  "paths": {
    "/api/v1/offers": {
      "get": {
        "operationId": "findOffers",
        "summary": "Find live coupon codes and deals",
        "parameters": [
          {
            "name": "store",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Store domain, slug, or name."
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text search."
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "code",
                "deal",
                "sale",
                "free_shipping",
                "cashback"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Offers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "store": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "domain": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "page": {
                                "type": "string",
                                "format": "uri"
                              }
                            }
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "code",
                              "deal",
                              "sale",
                              "free_shipping",
                              "cashback"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Coupon code to enter at checkout; null when the link applies the deal."
                          },
                          "discount": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "percent",
                                  "amount",
                                  "free_shipping",
                                  "bogo",
                                  "other"
                                ]
                              },
                              "value": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "min_purchase": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "terms": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "starts_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "expires_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "verified_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "last_seen_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "source": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "Send the shopper here so the offer applies."
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "string"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "disclosure": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stores": {
      "get": {
        "operationId": "listStores",
        "summary": "List tracked stores",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stores",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "categories": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "offer_count": {
                            "type": "integer"
                          },
                          "page": {
                            "type": "string",
                            "format": "uri"
                          },
                          "offers_api": {
                            "type": "string",
                            "format": "uri"
                          },
                          "shop_url": {
                            "type": "string",
                            "format": "uri"
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "string"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "disclosure": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stores/{store}": {
      "get": {
        "operationId": "getStoreOffers",
        "summary": "All live offers for one store",
        "parameters": [
          {
            "name": "store",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Domain or slug."
          }
        ],
        "responses": {
          "200": {
            "description": "Offers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "store": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "domain": {
                                "type": "string"
                              },
                              "slug": {
                                "type": "string"
                              },
                              "page": {
                                "type": "string",
                                "format": "uri"
                              }
                            }
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "code",
                              "deal",
                              "sale",
                              "free_shipping",
                              "cashback"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Coupon code to enter at checkout; null when the link applies the deal."
                          },
                          "discount": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "percent",
                                  "amount",
                                  "free_shipping",
                                  "bogo",
                                  "other"
                                ]
                              },
                              "value": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "currency": {
                                "type": "string"
                              }
                            }
                          },
                          "min_purchase": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "terms": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "starts_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "expires_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "verified_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "last_seen_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "source": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "Send the shopper here so the offer applies."
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "string"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "disclosure": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Store not tracked"
          }
        }
      }
    }
  }
}