{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/blueping-dev/json-schema/blueping-dev-domain-schema.json",
  "title": "Domain",
  "description": "A domain or subdomain the agent connected: its mail goes through Amazon SES, once its owner added the records it lists.",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/blueping-dev-openapi.json#/components/schemas/Domain",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The domain id, dom_..."
    },
    "name": {
      "type": "string",
      "description": "The domain or subdomain, lowercase, such as agents.acme.com."
    },
    "status": {
      "type": "string",
      "description": "pending_dns: add the records listed in dns.records. receiving: mail to the domain reaches its inboxes, which write to Blueping inboxes only for now. sending: it receives and sends. failed: failure says why.",
      "enum": [
        "pending_dns",
        "receiving",
        "sending",
        "failed"
      ]
    },
    "receiving": {
      "type": "boolean",
      "description": "Inboxes can live on it, and mail to them arrives."
    },
    "sending": {
      "type": "boolean",
      "description": "Its inboxes send outside Blueping too."
    },
    "inboxes": {
      "type": "integer",
      "description": "Its inboxes, deleted ones aside."
    },
    "dns": {
      "type": "object",
      "description": "The records to add at the domain's DNS provider, each with what a public resolver found at the last look, and what Amazon SES says.",
      "properties": {
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "description": "CNAME, MX or TXT."
              },
              "name": {
                "type": "string",
                "description": "The full name of the record."
              },
              "host": {
                "type": "string",
                "description": "The name relative to zone, as most DNS providers ask for it: @ for the zone itself."
              },
              "value": {
                "type": "string",
                "description": "What the record holds."
              },
              "priority": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "An MX record's priority."
              },
              "purpose": {
                "type": "string",
                "description": "What it is for."
              },
              "required": {
                "type": "boolean",
                "description": "true for the records the domain needs to work: the 3 DKIM CNAMEs and the MX. false for the recommended ones, which improve delivery: the bounce address's MX and SPF, and DMARC. The bounce MX is required too for a domain connected before, as the proof the domain is yours."
              },
              "found": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Found at the last look through a public resolver; null before any look, or when the lookup failed."
              }
            }
          }
        },
        "checked_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "dkim": {
          "type": "string",
          "description": "Amazon SES's DKIM verification: pending, success, failed, temporary_failure or not_started."
        },
        "mail_from": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string",
              "description": "The domain's own bounce address domain, bounce-xxxxxx.<domain>, recommended."
            },
            "status": {
              "type": "string",
              "description": "Amazon SES's verification of it: pending, success, failed or temporary_failure."
            }
          }
        },
        "mx_found": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "description": "The domain's MX hosts at the last look, lowest priority number first."
        },
        "provider": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "type": "string",
              "description": "Such as Cloudflare, GoDaddy or OVHcloud."
            },
            "url": {
              "type": "string",
              "description": "Its dashboard, where the records are added."
            }
          },
          "description": "Where the domain's DNS is managed, known by its nameservers; null when Blueping can't tell."
        },
        "zone": {
          "type": "string",
          "description": "The zone the records go in, such as acme.com: each record's host is relative to it."
        }
      }
    },
    "failure": {
      "type": [
        "string",
        "null"
      ],
      "description": "With failed: why, in plain words. With receiving: why it doesn't send now."
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "While pending_dns: when Blueping removes the domain if its records still aren't found (3 days)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "receiving_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "sending_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "next_action": {
      "type": "string",
      "description": "The next step, in one paragraph."
    },
    "next_steps": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The same, one step per item."
    }
  },
  "required": [
    "id",
    "name",
    "status",
    "receiving",
    "sending",
    "inboxes",
    "dns",
    "failure",
    "expires_at",
    "created_at",
    "next_action",
    "next_steps"
  ]
}