{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blueping-dev/json-schema/blueping-dev-deliverability-schema.json",
  "title": "Deliverability",
  "description": "An inbox's sends over a window and what became of them. Rates divide by the recipients handed to the mail service.",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blueping-dev-openapi.json#/components/schemas/Deliverability",
  "type": "object",
  "properties": {
    "inbox_id": {
      "type": "string",
      "description": "The inbox."
    },
    "days": {
      "type": "integer",
      "description": "The window, in days: 7, 30 or 90."
    },
    "from": {
      "type": "string",
      "description": "Its start, midnight UTC.",
      "format": "date-time"
    },
    "to": {
      "type": "string",
      "description": "Its end, the next midnight UTC.",
      "format": "date-time"
    },
    "sent": {
      "type": "integer",
      "description": "Messages sent."
    },
    "recipients": {
      "type": "integer",
      "description": "Recipients outside Blueping handed to the mail service."
    },
    "delivered": {
      "type": "integer",
      "description": "Recipients whose server took the message."
    },
    "deferred_now": {
      "type": "integer",
      "description": "Recipients whose delivery is being retried now."
    },
    "bounced": {
      "type": "object",
      "properties": {
        "hard": {
          "type": "integer",
          "description": "Bounced for good."
        },
        "soft": {
          "type": "integer",
          "description": "Bounced after the retries ran out."
        }
      },
      "required": [
        "hard",
        "soft"
      ]
    },
    "complained": {
      "type": "integer",
      "description": "Recipients who marked the message as spam."
    },
    "failed": {
      "type": "integer",
      "description": "Recipients the mail service couldn't deliver to."
    },
    "suppressed": {
      "type": "integer",
      "description": "Recipients refused before sending: they were on a suppression list."
    },
    "rates": {
      "type": "object",
      "properties": {
        "delivery": {
          "type": [
            "number",
            "null"
          ]
        },
        "hard_bounce": {
          "type": [
            "number",
            "null"
          ]
        },
        "complaint": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "delivery",
        "hard_bounce",
        "complaint"
      ],
      "description": "Each as a share of recipients, null with no recipient."
    },
    "thresholds": {
      "type": "object",
      "description": "The mail service's thresholds: a delivery rate of 95% or more, hard bounces under 2%, complaints under 0.1%."
    },
    "status": {
      "type": "string",
      "description": "too_few_sends under 50 recipients; at_risk at the thresholds or a delivery rate under 90%; watch from half the bounce and complaint thresholds or under 95%; healthy otherwise.",
      "enum": [
        "too_few_sends",
        "at_risk",
        "watch",
        "healthy"
      ]
    },
    "next_action": {
      "type": "string",
      "description": "What to do now."
    },
    "series": {
      "type": "array",
      "description": "With series=day: each day of the window.",
      "items": {
        "type": "object",
        "properties": {
          "day": {
            "type": "string",
            "description": "YYYY-MM-DD, UTC."
          },
          "sent": {
            "type": "integer",
            "description": "Sent."
          },
          "delivered": {
            "type": "integer",
            "description": "Delivered."
          },
          "bounced": {
            "type": "integer",
            "description": "Bounced."
          },
          "complained": {
            "type": "integer",
            "description": "Complained."
          }
        }
      }
    }
  },
  "required": [
    "inbox_id",
    "days",
    "from",
    "to",
    "sent",
    "recipients",
    "delivered",
    "deferred_now",
    "bounced",
    "complained",
    "failed",
    "suppressed",
    "rates",
    "thresholds",
    "status",
    "next_action"
  ]
}