{
  "$id": "https://docs.honeybadger.io/guides/integrations/payloads/v2/down.schema.json",
  "title": "down webhook payload (v2)",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/WebhookV2OutageEvent",
  "$defs": {
    "WebhookV2OutageEvent": {
      "description": "An uptime site went down or came back up.",
      "allOf": [
        {
          "$ref": "#/$defs/WebhookV2Event"
        },
        {
          "type": "object",
          "required": [
            "project",
            "site",
            "outage"
          ],
          "properties": {
            "event": {
              "type": "string",
              "enum": [
                "up",
                "down"
              ]
            },
            "project": {
              "$ref": "#/$defs/WebhookV2Project"
            },
            "site": {
              "$ref": "#/$defs/WebhookV2Site"
            },
            "outage": {
              "$ref": "#/$defs/WebhookV2Outage"
            }
          }
        }
      ]
    },
    "WebhookV2Event": {
      "type": "object",
      "description": "The fields every v2 webhook body carries. Each event adds the records it's about. A v2 body has no `payload_version`; that's how it differs from the later versions.\n",
      "required": [
        "event",
        "message"
      ],
      "not": {
        "required": [
          "payload_version"
        ]
      },
      "properties": {
        "event": {
          "type": "string",
          "description": "The event's name, the same as its key under `webhooks`.",
          "examples": [
            "occurred"
          ]
        },
        "message": {
          "type": "string",
          "description": "A one-line summary of the event, as notifications show it."
        },
        "actor": {
          "allOf": [
            {
              "$ref": "#/$defs/WebhookV2User"
            }
          ],
          "description": "The person who caused the event. Absent when Honeybadger, or an API token with no user, did."
        }
      }
    },
    "WebhookV2User": {
      "type": "object",
      "description": "A Honeybadger user, or an account by its owner's details.",
      "required": [
        "id",
        "email",
        "name"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "examples": [
            4821
          ]
        },
        "email": {
          "type": "string",
          "examples": [
            "jane@example.com"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "Jane Doe"
          ]
        }
      }
    },
    "WebhookV2Project": {
      "type": "object",
      "description": "The project the event belongs to.",
      "required": [
        "id",
        "name",
        "created_at",
        "disable_public_links",
        "pivotal_project_id",
        "asana_workspace_id",
        "token",
        "github_project",
        "environments",
        "owner",
        "last_notice_at",
        "earliest_notice_at",
        "unresolved_fault_count",
        "fault_count",
        "active",
        "users",
        "sites",
        "team_id"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "examples": [
            1234
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "examples": [
            "Billing API"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "disable_public_links": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "pivotal_project_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "asana_workspace_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "token": {
          "type": "string",
          "description": "The project's ingestion key, the one its notifiers report with."
        },
        "github_project": {
          "type": [
            "string",
            "null"
          ],
          "description": "The repository of the project's newest GitHub integration.",
          "examples": [
            "acme/billing"
          ]
        },
        "environments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebhookV2Environment"
          }
        },
        "owner": {
          "allOf": [
            {
              "$ref": "#/$defs/WebhookV2User"
            }
          ],
          "description": "The account that owns the project."
        },
        "last_notice_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "earliest_notice_at": {
          "type": "string",
          "format": "date-time",
          "description": "The oldest notice the plan's retention keeps."
        },
        "unresolved_fault_count": {
          "type": "integer"
        },
        "fault_count": {
          "type": "integer"
        },
        "active": {
          "type": "boolean",
          "description": "Whether the account is active."
        },
        "users": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebhookV2User"
          }
        },
        "sites": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/WebhookV2ProjectSite"
          }
        },
        "team_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The project's errors page. Sent on `volume_spike` only."
        }
      }
    },
    "WebhookV2Environment": {
      "type": "object",
      "description": "One of the project's environments.",
      "required": [
        "id",
        "project_id",
        "name",
        "notifications",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "project_id": {
          "type": "integer"
        },
        "name": {
          "type": "string",
          "examples": [
            "production"
          ]
        },
        "notifications": {
          "type": "boolean",
          "description": "Whether errors in this environment send notifications."
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "WebhookV2ProjectSite": {
      "type": "object",
      "description": "One of the project's uptime sites, in brief.",
      "required": [
        "id",
        "active",
        "last_checked_at",
        "name",
        "state",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "active": {
          "type": "boolean"
        },
        "last_checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "name": {
          "type": "string"
        },
        "state": {
          "type": "string",
          "examples": [
            "up"
          ]
        },
        "url": {
          "type": "string",
          "description": "The checked URL, as entered."
        }
      }
    },
    "WebhookV2Site": {
      "type": "object",
      "description": "The uptime site the event is about.",
      "required": [
        "id",
        "name",
        "url",
        "frequency",
        "match_type",
        "match",
        "state",
        "active",
        "last_checked_at",
        "retries",
        "proxy",
        "cert_will_expire_at",
        "timeout",
        "response_headers",
        "details_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "description": "The checked URL, as entered."
        },
        "frequency": {
          "type": "integer",
          "description": "Minutes between checks."
        },
        "match_type": {
          "type": "string",
          "examples": [
            "success"
          ]
        },
        "match": {
          "type": [
            "string",
            "null"
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "pending",
            "up",
            "down"
          ]
        },
        "active": {
          "type": "boolean"
        },
        "last_checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "retries": {
          "type": [
            "integer",
            "null"
          ]
        },
        "proxy": {
          "type": "integer"
        },
        "cert_will_expire_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "timeout": {
          "type": [
            "integer",
            "null"
          ]
        },
        "response_headers": {
          "type": [
            "object",
            "null"
          ],
          "description": "Headers the site is set to expect in each check's response."
        },
        "details_url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "WebhookV2Outage": {
      "type": "object",
      "description": "The site's latest outage. Every field but `details_url` is null when the site has none on record.\n",
      "required": [
        "down_at",
        "up_at",
        "status",
        "reason",
        "headers",
        "details_url"
      ],
      "properties": {
        "down_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "up_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Null while the site is still down."
        },
        "status": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The HTTP status the failing check got.",
          "examples": [
            503
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "headers": {
          "type": [
            "object",
            "null"
          ],
          "description": "Headers from the failing check's response."
        },
        "details_url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
