{
 "openapi": "3.1.0",
 "info": {
  "title": "failover.io API",
  "version": "1.0.0",
  "description": "Manage monitors, read check results and incidents, and acknowledge incidents. Authenticate with a workspace API key: Authorization: Bearer fo_live_... Create keys in the dashboard under Profile, API Keys. Timestamps are Unix seconds (UTC). Errors are {\"error\": \"message\"}.",
  "contact": {
   "url": "https://failover.io/contact"
  }
 },
 "servers": [
  {
   "url": "https://api.failover.io/v1"
  }
 ],
 "security": [
  {
   "apiKey": []
  }
 ],
 "components": {
  "securitySchemes": {
   "apiKey": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "fo_live_<32 characters>",
    "description": "Read keys can call GET endpoints. Write keys can also create, change, pause, delete and acknowledge."
   }
  },
  "responses": {
   "Error": {
    "description": "Error",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "Unauthorized": {
    "description": "Missing, invalid or revoked API key",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "Forbidden": {
    "description": "Read-only key, or a plan limit (then upgrade_required is true)",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "NotFound": {
    "description": "Not found in this workspace",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "RateLimited": {
    "description": "Too many requests. Free 10, Pro 60, Team 300 requests per minute per key. See Retry-After.",
    "headers": {
     "Retry-After": {
      "schema": {
       "type": "integer"
      }
     },
     "X-RateLimit-Limit": {
      "schema": {
       "type": "integer"
      }
     },
     "X-RateLimit-Remaining": {
      "schema": {
       "type": "integer"
      }
     },
     "X-RateLimit-Reset": {
      "schema": {
       "type": "integer"
      },
      "description": "Unix time when the window resets"
     }
    },
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string"
     },
     "upgrade_required": {
      "type": "boolean"
     }
    },
    "required": [
     "error"
    ]
   },
   "Monitor": {
    "type": "object",
    "description": "A monitor. Fields not listed here may also be returned.",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "type": {
      "type": "string",
      "enum": [
       "http",
       "heartbeat"
      ]
     },
     "url": {
      "type": "string",
      "description": "For heartbeat monitors: the URL to ping (POST)."
     },
     "method": {
      "type": "string",
      "enum": [
       "GET",
       "HEAD",
       "POST",
       "PUT",
       "PATCH",
       "DELETE",
       "OPTIONS"
      ]
     },
     "interval_seconds": {
      "type": "integer"
     },
     "timeout_seconds": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30
     },
     "expected_status": {
      "type": "integer"
     },
     "keyword": {
      "type": [
       "string",
       "null"
      ]
     },
     "is_active": {
      "type": "integer",
      "enum": [
       0,
       1
      ]
     },
     "status": {
      "type": "string"
     },
     "ssl_check": {
      "type": "integer",
      "enum": [
       0,
       1
      ]
     },
     "retry_threshold": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10
     },
     "grace_period_seconds": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Heartbeat monitors only"
     },
     "tags": {
      "type": "string",
      "description": "JSON array as text"
     },
     "created_at": {
      "type": "integer"
     },
     "last_checked_at": {
      "type": [
       "integer",
       "null"
      ]
     },
     "keyword_absent": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "MonitorInput": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 200
     },
     "type": {
      "type": "string",
      "enum": [
       "http",
       "heartbeat"
      ],
      "default": "http"
     },
     "url": {
      "type": "string",
      "description": "Required for http. Ignored for heartbeat (generated)."
     },
     "method": {
      "type": "string",
      "default": "GET"
     },
     "interval_seconds": {
      "type": "integer",
      "description": "At least your plan's minimum: Free 60, Pro 30, Team 15. Heartbeat: up to 30 days."
     },
     "timeout_seconds": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30
     },
     "expected_status": {
      "type": "integer",
      "minimum": 100,
      "maximum": 599
     },
     "keyword": {
      "type": [
       "string",
       "null"
      ],
      "description": "The response body must contain this text"
     },
     "keyword_absent": {
      "type": [
       "string",
       "null"
      ],
      "description": "The response body must not contain this text"
     },
     "ssl_check": {
      "type": "boolean"
     },
     "retry_threshold": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10
     },
     "grace_period_seconds": {
      "type": "integer",
      "description": "Heartbeat only"
     },
     "tags": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "maxItems": 10
     },
     "custom_headers": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      },
      "description": "Up to 20 headers"
     },
     "request_body": {
      "type": "string"
     },
     "repeat_interval_minutes": {
      "type": "integer",
      "minimum": 5,
      "maximum": 60
     },
     "max_repeat_cycles": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10,
      "description": "Always 0 on Free"
     },
     "is_active": {
      "type": "boolean",
      "description": "Update only"
     }
    }
   },
   "Incident": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "monitor_id": {
      "type": "string"
     },
     "monitor_name": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "open",
       "resolved"
      ]
     },
     "type": {
      "type": "string",
      "description": "downtime, ssl_warning, ..."
     },
     "started_at": {
      "type": "integer"
     },
     "acknowledged_at": {
      "type": [
       "integer",
       "null"
      ]
     },
     "acknowledged_by": {
      "type": [
       "string",
       "null"
      ],
      "description": "The channel used: email, sms, voice, api, ..."
     },
     "resolved_at": {
      "type": [
       "integer",
       "null"
      ]
     }
    }
   },
   "StatusPage": {
    "type": "object",
    "description": "A status page. Other fields may also be returned.",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "monitor_count": {
      "type": "integer"
     }
    }
   }
  }
 },
 "paths": {
  "/me": {
   "get": {
    "summary": "The key's workspace plan, access and rate limit",
    "operationId": "getMe",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "plan": {
           "type": "string"
          },
          "access": {
           "type": "string",
           "enum": [
            "read",
            "write"
           ]
          },
          "via": {
           "type": "string"
          },
          "rate_per_minute": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors": {
   "get": {
    "summary": "List monitors",
    "operationId": "listMonitors",
    "responses": {
     "200": {
      "description": "Monitors, newest first, with checks_24h, up_checks_24h and last_response_ms",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Monitor"
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   },
   "post": {
    "summary": "Create a monitor",
    "operationId": "createMonitor",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "allOf": [
         {
          "$ref": "#/components/schemas/MonitorInput"
         },
         {
          "required": [
           "name"
          ]
         }
        ]
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors/{id}": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Monitor id"
    }
   ],
   "get": {
    "summary": "Get a monitor with its last checks, alert chain, incidents and uptime",
    "operationId": "getMonitor",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   },
   "put": {
    "summary": "Update a monitor (only the fields sent change)",
    "operationId": "updateMonitor",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MonitorInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Updated",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   },
   "patch": {
    "summary": "Same as PUT",
    "operationId": "patchMonitor",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MonitorInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Updated",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   },
   "delete": {
    "summary": "Delete a monitor and its history",
    "operationId": "deleteMonitor",
    "responses": {
     "200": {
      "description": "Deleted",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "success": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors/{id}/pause": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Monitor id"
    }
   ],
   "post": {
    "summary": "Pause a monitor",
    "operationId": "pauseMonitor",
    "responses": {
     "200": {
      "description": "Paused",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors/{id}/resume": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Monitor id"
    }
   ],
   "post": {
    "summary": "Resume a monitor (counts against the plan's active monitors)",
    "operationId": "resumeMonitor",
    "responses": {
     "200": {
      "description": "Resumed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Monitor"
        }
       }
      }
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors/{id}/uptime": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Monitor id"
    }
   ],
   "get": {
    "summary": "Uptime over the periods your plan's history allows",
    "operationId": "getUptime",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/monitors/{id}/checks": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Monitor id"
    }
   ],
   "get": {
    "summary": "Check history, newest first, within your plan's history",
    "operationId": "listChecks",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/incidents": {
   "get": {
    "summary": "List incidents, newest first",
    "operationId": "listIncidents",
    "parameters": [
     {
      "name": "monitor_id",
      "in": "query",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "open",
        "resolved"
       ]
      }
     },
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Unix seconds, started at or after"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 50
      }
     },
     {
      "name": "cursor",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "next_cursor from the previous page"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "incidents": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Incident"
           }
          },
          "next_cursor": {
           "type": [
            "string",
            "null"
           ]
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/incidents/{id}": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Incident id"
    }
   ],
   "get": {
    "summary": "Get an incident",
    "operationId": "getIncident",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Incident"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/incidents/{id}/acknowledge": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Incident id"
    }
   ],
   "post": {
    "summary": "Acknowledge an incident: the escalation chain stops, as with the link in an alert",
    "operationId": "acknowledgeIncident",
    "responses": {
     "200": {
      "description": "state is acknowledged, already_acknowledged or already_resolved",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "state": {
           "type": "string",
           "enum": [
            "acknowledged",
            "already_acknowledged",
            "already_resolved"
           ]
          },
          "incident": {
           "$ref": "#/components/schemas/Incident"
          }
         }
        }
       }
      }
     },
     "403": {
      "$ref": "#/components/responses/Forbidden"
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/status-pages": {
   "get": {
    "summary": "List status pages",
    "operationId": "listStatusPages",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/StatusPage"
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  },
  "/status-pages/{id}": {
   "parameters": [
    {
     "name": "id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string"
     },
     "description": "Status page id"
    }
   ],
   "get": {
    "summary": "Get a status page with its monitors",
    "operationId": "getStatusPage",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StatusPage"
        }
       }
      }
     },
     "404": {
      "$ref": "#/components/responses/NotFound"
     },
     "401": {
      "$ref": "#/components/responses/Unauthorized"
     },
     "429": {
      "$ref": "#/components/responses/RateLimited"
     }
    }
   }
  }
 }
}