{
  "$id": "https://docs.honeybadger.io/guides/integrations/payloads/v2/volume_spike.schema.json",
  "title": "volume_spike webhook payload (v2)",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/WebhookV2VolumeSpikeEvent",
  "$defs": {
    "WebhookV2VolumeSpikeEvent": {
      "description": "A project's error volume rose well above its usual level.",
      "allOf": [
        {
          "$ref": "#/$defs/WebhookV2Event"
        },
        {
          "type": "object",
          "required": [
            "project",
            "volume_spike"
          ],
          "properties": {
            "event": {
              "type": "string",
              "enum": [
                "volume_spike"
              ]
            },
            "project": {
              "$ref": "#/$defs/WebhookV2Project"
            },
            "volume_spike": {
              "$ref": "#/$defs/WebhookV2VolumeSpike"
            }
          }
        }
      ]
    },
    "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."
        }
      }
    },
    "WebhookV2VolumeSpike": {
      "type": "object",
      "description": "The error volume that triggered the spike alert.",
      "required": [
        "observed",
        "baseline_median",
        "factor",
        "z_score",
        "window_minutes"
      ],
      "properties": {
        "observed": {
          "type": "integer",
          "description": "Errors in the window just checked."
        },
        "baseline_median": {
          "type": "integer"
        },
        "factor": {
          "type": [
            "number",
            "null"
          ]
        },
        "z_score": {
          "type": [
            "number",
            "null"
          ]
        },
        "window_minutes": {
          "type": "integer"
        }
      }
    }
  }
}
