{
 "openapi": "3.1.0",
 "info": {
  "title": "Pocketly offers",
  "version": "1.0.0",
  "description": "UK current-account switching offers from each bank’s own terms, and the quick check as a call. No personal data is stored.",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://www.pocketly.co.uk/api/v1"
  }
 ],
 "paths": {
  "/offers.json": {
   "get": {
    "operationId": "list_offers",
    "summary": "Every live offer, with its conditions and their clauses",
    "responses": {
     "200": {
      "description": "The offers",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "offers": {
           "type": "array",
           "items": {
            "type": "object",
            "description": "One live offer, as Pocketly holds it from the bank’s own terms."
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/offers/{id}.json": {
   "get": {
    "operationId": "get_offer",
    "summary": "One offer",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The offer",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "description": "One live offer, as Pocketly holds it from the bank’s own terms."
        }
       }
      }
     },
     "404": {
      "description": "No such offer"
     }
    }
   }
  },
  "/changes.json": {
   "get": {
    "operationId": "list_changes",
    "summary": "Every edition published, newest first",
    "responses": {
     "200": {
      "description": "The change log"
     }
    }
   }
  },
  "/check": {
   "post": {
    "operationId": "check_offers",
    "summary": "Which offers fit a situation, and the best order (the public quick check)",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "bank",
         "directDebits",
         "cash",
         "householdBills",
         "cardSpending",
         "salary"
        ],
        "properties": {
         "bank": {
          "type": "string",
          "enum": [
           "barclays",
           "bank-of-scotland",
           "co-op",
           "first-direct",
           "halifax",
           "hsbc",
           "lloyds",
           "metro",
           "monzo",
           "nationwide",
           "natwest",
           "rbs",
           "santander",
           "starling",
           "tsb",
           "ulster-bank",
           "virgin-money",
           "other"
          ],
          "description": "Who your current account is with (\"other\" for any other bank)"
         },
         "directDebits": {
          "type": "integer",
          "minimum": 0,
          "maximum": 30
         },
         "householdBills": {
          "type": "boolean",
          "description": "At least 2 of the Direct Debits are household bills"
         },
         "cash": {
          "type": "number",
          "minimum": 0,
          "description": "Spare cash you could move for a few days, in pounds"
         },
         "buffer": {
          "type": "number",
          "minimum": 0,
          "description": "Money to keep untouched, in pounds (default 0)"
         },
         "cardSpending": {
          "type": "boolean",
          "description": "Could use a new card for everyday spending for a couple of months"
         },
         "salary": {
          "type": "boolean",
          "description": "A salary of £2,000 or more is paid in each month"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result, as on the page"
     },
     "400": {
      "description": "An answer is missing or out of range"
     },
     "429": {
      "description": "Too many checks"
     }
    }
   }
  }
 }
}