{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blueping-dev/json-schema/blueping-dev-email-send-result-schema.json",
  "title": "EmailSendResult",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blueping-dev-openapi.json#/components/schemas/EmailSendResult",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The message id, em_..."
    },
    "inbox_id": {
      "type": "string",
      "description": "The inbox that sent it."
    },
    "thread_id": {
      "type": "string",
      "description": "Its thread."
    },
    "status": {
      "type": "string",
      "description": "sent once the mail service took it, or it was delivered inside Blueping. queued when it met a limit that only takes time: it goes out by itself at sends_at, and email.sent fires then.",
      "enum": [
        "sent",
        "queued",
        "unknown"
      ]
    },
    "sends_at": {
      "type": "string",
      "description": "With status queued: when it goes out by itself, with every check run again then.",
      "format": "date-time"
    },
    "reason": {
      "type": "string",
      "description": "With status queued: the limit it waits for, the code a refusal would have had.",
      "enum": [
        "new_recipient_limit",
        "daily_limit_reached",
        "monthly_limit_reached",
        "free_pool_full",
        "platform_busy"
      ]
    },
    "next_action": {
      "type": "string",
      "description": "What happens next, in words: with status queued, when it goes; once sent, where the replies, or the echo's test code, arrive."
    },
    "upgrade_url": {
      "type": "string",
      "description": "With status queued, when a plan or a claim lifts the limit it waits for: the page where the owner decides, the claim page before a claim.",
      "format": "uri"
    },
    "owner_message": {
      "type": "string",
      "description": "With upgrade_url: one line for the agent to pass on to its owner as it is."
    },
    "warnings": {
      "type": "array",
      "description": "From 80% of the plan's day or month: what happens at the limit, with upgrade_url and owner_message when a plan or a claim lifts it.",
      "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"
        ]
      }
    },
    "footer": {
      "type": "boolean",
      "description": "Present and true on Free when a line \"Sent with Blueping\" followed the text as it left: the stored text is the agent's own."
    },
    "deduplicated": {
      "type": "boolean",
      "description": "Present and true when the same message went to the same people from this inbox in the last 5 minutes: this is that message, and nothing went twice."
    },
    "internal": {
      "type": "array",
      "description": "Recipients inside Blueping, delivered at once.",
      "items": {
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "description": "A Blueping address."
          },
          "status": {
            "type": "string",
            "description": "delivered or refused.",
            "enum": [
              "delivered",
              "refused"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Why it was refused."
          }
        },
        "required": [
          "address",
          "status"
        ]
      }
    },
    "echo": {
      "type": "string",
      "description": "For a message to echo@blueping.dev: scheduled, or why it was skipped."
    },
    "channel": {
      "type": "string",
      "description": "a2a on an answer to an A2A message, which went to its task: no email was sent.",
      "enum": [
        "a2a"
      ]
    },
    "a2a": {
      "type": "object",
      "description": "On an answer to an A2A message only.",
      "properties": {
        "task_id": {
          "type": "string",
          "description": "The task the answer went to."
        },
        "context_id": {
          "type": "string",
          "description": "The caller's conversation."
        },
        "task_state": {
          "type": "string",
          "description": "completed, or input_required when the answer asked the caller a question.",
          "enum": [
            "completed",
            "input_required"
          ]
        }
      },
      "required": [
        "task_id",
        "context_id",
        "task_state"
      ]
    }
  },
  "required": [
    "id",
    "inbox_id",
    "thread_id",
    "status"
  ]
}