{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blueping-dev/json-schema/blueping-dev-mail-limits-schema.json",
  "title": "MailLimits",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blueping-dev-openapi.json#/components/schemas/MailLimits",
  "type": "object",
  "properties": {
    "plan": {
      "type": "string",
      "description": "The mail plan.",
      "enum": [
        "free",
        "developer",
        "startup",
        "scale"
      ]
    },
    "plan_name": {
      "type": "string",
      "description": "Free, Developer, Startup or Scale."
    },
    "plan_period": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "month",
        "year",
        null
      ],
      "description": "How a paid plan is billed; null on Free."
    },
    "plan_ends_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When a paid plan that was cancelled stops, and the agent goes back to Free; null while it renews, and on Free."
    },
    "claim": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "description": "unclaimed until a person claims the agent.",
          "enum": [
            "unclaimed",
            "claimed"
          ]
        },
        "claimed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When."
        },
        "owner_email": {
          "type": [
            "string",
            "null"
          ],
          "description": "The owner's address, as the agent gave it."
        },
        "owner_confirmed": {
          "type": "boolean",
          "description": "Whether the owner's code was confirmed."
        }
      },
      "required": [
        "status",
        "claimed_at",
        "owner_email",
        "owner_confirmed"
      ]
    },
    "limits": {
      "type": "object",
      "properties": {
        "inboxes": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Inboxes the agent may hold: 1 unclaimed, 3 on Free, 50 on Developer, 500 on Startup, null for no cap on Scale."
        },
        "sends_per_day": {
          "type": "integer",
          "description": "Recipients a UTC day: one message to two people is two."
        },
        "sends_per_month": {
          "type": "integer",
          "description": "Recipients a month the plan includes."
        },
        "overage": {
          "type": "object",
          "properties": {
            "per_1000_usd": {
              "type": "number",
              "description": "Past sends_per_month, per 1,000."
            },
            "most_per_month": {
              "type": "integer",
              "description": "The most a month can reach."
            }
          },
          "required": [
            "per_1000_usd",
            "most_per_month"
          ]
        },
        "recipients_per_message": {
          "type": "integer",
          "description": "10: to, cc and bcc together."
        },
        "storage_bytes": {
          "type": "integer",
          "description": "What the agent's mail may take."
        },
        "replies_only": {
          "type": "boolean",
          "description": "true before the claim: only people who wrote first, the echo address and the confirmed owner."
        },
        "new_recipients": {
          "type": [
            "array",
            "null"
          ],
          "description": "After the claim, the ramp of new recipients: the most in each window from the claim.",
          "items": {
            "type": "object",
            "properties": {
              "within_seconds": {
                "type": "integer",
                "description": "The window, from the claim."
              },
              "most": {
                "type": "integer",
                "description": "New recipients in it."
              }
            },
            "required": [
              "within_seconds",
              "most"
            ]
          }
        },
        "new_recipients_per_hour_after_ramp": {
          "type": "integer",
          "description": "Past the first week."
        },
        "inbox_creates_per_day": {
          "type": "integer",
          "description": "Inboxes it may create in a UTC day, deleted ones included: a deleted address stays retired."
        },
        "queue_most": {
          "type": "integer",
          "description": "Sends waiting in the queue at once. Past it, a send that meets a limit answers 429 queue_full."
        },
        "footer": {
          "type": "boolean",
          "description": "true on Free: a line \"Sent with Blueping\" follows the text of mail that leaves Blueping or reaches another inbox."
        },
        "free_pool": {
          "type": "boolean",
          "description": "true on Free and before the claim: sends to people outside Blueping, replies included, draw on a daily pool every Free agent shares, and wait in the queue past it. false on a paid plan, which sends from its own quota."
        },
        "code_lookback_seconds": {
          "type": "integer",
          "description": "How far back GET .../code looks without since: 600."
        }
      },
      "required": [
        "inboxes",
        "sends_per_day",
        "sends_per_month",
        "recipients_per_message",
        "storage_bytes",
        "replies_only",
        "new_recipients",
        "new_recipients_per_hour_after_ramp",
        "inbox_creates_per_day",
        "queue_most",
        "footer",
        "free_pool",
        "code_lookback_seconds"
      ]
    },
    "usage": {
      "type": "object",
      "properties": {
        "inboxes": {
          "type": "integer",
          "description": "Inboxes held now."
        },
        "sends_today": {
          "type": "integer",
          "description": "Recipients today, UTC."
        },
        "sends_this_month": {
          "type": "integer",
          "description": "Recipients this month, UTC."
        },
        "storage_bytes": {
          "type": "integer",
          "description": "What the agent's mail takes now."
        },
        "queued": {
          "type": "integer",
          "description": "Sends waiting in the queue now."
        },
        "queue_next_at": {
          "type": "string",
          "description": "When the queue's first send goes.",
          "format": "date-time"
        },
        "new_recipients_left": {
          "type": "integer",
          "description": "New recipients it may still add now, after the claim."
        },
        "new_recipients_window": {
          "type": "string",
          "description": "The window that count is for."
        }
      },
      "required": [
        "inboxes",
        "sends_today",
        "sends_this_month",
        "storage_bytes",
        "queued"
      ]
    },
    "resets": {
      "type": "object",
      "properties": {
        "day": {
          "type": "string",
          "description": "When the day's count starts again.",
          "format": "date-time"
        },
        "month": {
          "type": "string",
          "description": "When the month's does.",
          "format": "date-time"
        }
      },
      "required": [
        "day",
        "month"
      ]
    },
    "warnings": {
      "type": "array",
      "description": "Each limit used at 80% or more, said before it is reached. Empty when nothing is near.",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "What is near its limit. Once the day's or the month's sends are all used, the limit's own code: daily_limit_reached or monthly_limit_reached.",
            "enum": [
              "daily_limit_near",
              "daily_limit_reached",
              "monthly_limit_near",
              "monthly_limit_reached",
              "storage_near",
              "free_pool_near",
              "queue_near"
            ]
          },
          "message": {
            "type": "string",
            "description": "Where it stands."
          },
          "next_action": {
            "type": "string",
            "description": "What happens at the limit, and what to do."
          },
          "upgrade_url": {
            "type": "string",
            "description": "When a plan or a claim lifts the limit: the page where the owner decides, the claim page before a claim. Paying is the owner's decision.",
            "format": "uri"
          },
          "owner_message": {
            "type": "string",
            "description": "With upgrade_url: one line for the agent to pass on to its owner as it is."
          }
        },
        "required": [
          "code",
          "message",
          "next_action"
        ]
      }
    },
    "sending": {
      "type": "object",
      "properties": {
        "allowed": {
          "type": "boolean",
          "description": "Whether a send goes out now."
        },
        "reason": {
          "type": "string",
          "description": "Why not: suspended, paused, agent_paused, or the limit a send waits for, monthly_limit_reached, daily_limit_reached, free_pool_full or platform_busy."
        },
        "queues": {
          "type": "boolean",
          "description": "true when a send now is accepted with status queued and goes out later by itself."
        },
        "next_action": {
          "type": "string",
          "description": "What to do."
        }
      },
      "required": [
        "allowed"
      ]
    }
  },
  "required": [
    "plan",
    "plan_name",
    "plan_period",
    "plan_ends_at",
    "claim",
    "limits",
    "usage",
    "resets",
    "warnings",
    "sending"
  ]
}