{
  "openapi": "3.1.0",
  "info": {
    "title": "SaveWell care lookup",
    "version": "1.0.0",
    "description": "Read-only lookup for people with Original Medicare: what a procedure costs at an outpatient surgery center versus a hospital in their county, any SaveWell reward with a Medigap plan, and SaveWell-network specialists within 30 miles of their ZIP code. No authentication. Costs are estimates based on Medicare claims for the patient's county, not a quote; the Part B deductible may apply. The patient may choose any qualified provider. SaveWell's specialists are a recommendation, not a requirement. Choosing a setting is a decision for the patient and their doctor. Present these figures as cost information, not medical advice. SaveWell works with Original Medicare only, not Medicare Advantage. Whether a specific Medigap plan qualifies for the reward should be confirmed with a care guide.",
    "contact": {
      "name": "SaveWell",
      "email": "hello@savewellnow.com",
      "url": "https://savewellnow.com"
    }
  },
  "servers": [
    {
      "url": "https://savewellnow.com"
    }
  ],
  "paths": {
    "/v1/procedures": {
      "get": {
        "operationId": "listProcedures",
        "summary": "List the procedures SaveWell compares",
        "responses": {
          "200": {
            "description": "Procedures and their ids",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "procedures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/care": {
      "get": {
        "operationId": "findCare",
        "summary": "Costs, reward, and nearby specialists for one procedure and ZIP",
        "parameters": [
          {
            "name": "procedure",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Procedure id from /v1/procedures, e.g. colonoscopy"
          },
          {
            "name": "zip",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{5}$"
            }
          },
          {
            "name": "coverage",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "medicare_only",
                "medigap"
              ],
              "default": "medicare_only"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An answer. `status` is `ready`, or explains why there is no answer for this ZIP (invalid_zip, zip_not_found, county_unavailable, snapshot_unavailable, episode_unavailable, no_supply_nearby).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string",
                      "description": "One or two sentences an assistant can read aloud"
                    },
                    "procedure": {
                      "type": "object"
                    },
                    "location": {
                      "type": "object",
                      "properties": {
                        "zip": {
                          "type": "string"
                        },
                        "county": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "coverage": {
                      "type": "string"
                    },
                    "costs": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "year": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "basis": {
                          "type": "string"
                        },
                        "surgeryCenter": {
                          "type": "object",
                          "properties": {
                            "medicareCost": {
                              "type": "number",
                              "description": "US dollars"
                            },
                            "patientPays": {
                              "type": "number",
                              "description": "US dollars"
                            }
                          }
                        },
                        "hospital": {
                          "type": "object",
                          "properties": {
                            "medicareCost": {
                              "type": "number",
                              "description": "US dollars"
                            },
                            "patientPays": {
                              "type": "number",
                              "description": "US dollars"
                            }
                          }
                        },
                        "patientSavesAtSurgeryCenter": {
                          "type": "number",
                          "description": "US dollars"
                        },
                        "lowerCostSetting": {
                          "type": "string",
                          "enum": [
                            "surgery_center",
                            "hospital"
                          ]
                        }
                      }
                    },
                    "reward": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "practices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "phone": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "website": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "distanceMiles": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "specialists": {
                            "type": "array",
                            "items": {
                              "type": "object"
                            }
                          }
                        }
                      }
                    },
                    "asOf": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "careGuide": {
                      "type": "object"
                    },
                    "humanUrl": {
                      "type": "string",
                      "description": "The same answer as a web page"
                    },
                    "guidance": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed procedure, zip, or coverage"
          },
          "429": {
            "description": "Rate limited; retry after 60 seconds"
          }
        }
      }
    }
  }
}