{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mepmail-dev/json-schema/mepmail-dev-usage-response-schema.json",
  "title": "UsageResponse",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mepmail-dev-api-openapi.json#/components/schemas/UsageResponse",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "usage"
      ]
    },
    "cloud": {
      "type": "boolean",
      "description": "True on MepMail Cloud, where plan limits apply"
    },
    "plan": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "free",
        "starter",
        "pro",
        "scale",
        null
      ],
      "description": "Effective plan; null self-hosted or on the instance's own (system) team"
    },
    "limits": {
      "type": "object",
      "properties": {
        "emails_per_day": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Daily cap (UTC day) on Free and Starter; null on monthly plans and self-hosted"
        },
        "emails_per_month": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Emails included per billing period on Pro and Scale; null on daily plans and self-hosted"
        },
        "domains": {
          "type": [
            "integer",
            "null"
          ],
          "description": "null = unlimited or self-hosted"
        },
        "contacts": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Contacts the team may hold; null = unlimited or self-hosted"
        }
      },
      "required": [
        "emails_per_day",
        "emails_per_month",
        "domains",
        "contacts"
      ]
    },
    "sending": {
      "type": "object",
      "properties": {
        "nominal_emails_per_day": {
          "type": [
            "integer",
            "null"
          ]
        },
        "effective_emails_per_day": {
          "type": [
            "integer",
            "null"
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "approved",
            "restricted",
            "unrestricted"
          ]
        },
        "reason": {
          "type": "string"
        }
      },
      "required": [
        "nominal_emails_per_day",
        "effective_emails_per_day",
        "state",
        "reason"
      ]
    },
    "today": {
      "type": "object",
      "properties": {
        "emails_sent": {
          "type": "integer",
          "description": "Emails accepted so far this UTC day"
        },
        "resets_at": {
          "type": "string",
          "description": "Next UTC midnight, when the daily counter resets"
        }
      },
      "required": [
        "emails_sent",
        "resets_at"
      ]
    },
    "period": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "emails_sent": {
          "type": "integer",
          "description": "Emails accepted so far this billing period"
        },
        "included": {
          "type": "integer",
          "description": "Emails the plan includes per period"
        },
        "overage_enabled": {
          "type": "boolean",
          "description": "Whether sends past `included` bill overage instead of being refused"
        },
        "overage_usd_per_1k": {
          "type": "number",
          "description": "Overage price per 1,000 emails, in USD"
        },
        "starts_at": {
          "type": "string",
          "description": "Billing period start"
        },
        "ends_at": {
          "type": "string",
          "description": "Billing period end, when the counter resets"
        }
      },
      "required": [
        "emails_sent",
        "included",
        "overage_enabled",
        "overage_usd_per_1k",
        "starts_at",
        "ends_at"
      ],
      "description": "Billing-period usage on monthly plans; null on daily plans and self-hosted"
    },
    "team": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ]
    },
    "app_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Dashboard origin, for building links; null when unset"
    }
  },
  "required": [
    "object",
    "cloud",
    "plan",
    "limits",
    "today",
    "period",
    "team",
    "app_url"
  ]
}