{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dynamicdocumentapi-com/json-schema/dynamicdocumentapi-com-email-connection-schema.json",
  "title": "EmailConnection",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dynamicdocumentapi-com-openapi.yml#/components/schemas/EmailConnection",
  "properties": {
    "config": {
      "additionalProperties": {},
      "description": "The provider's settings (see the write `config`), always with `attachment_budget_bytes` and `max_per_second`: the provider's defaults unless set.",
      "type": "object"
    },
    "created_at": {
      "format": "date-time",
      "type": "string"
    },
    "credentials": {
      "$ref": "#/$defs/EmailCredentialsState"
    },
    "credentials_delete_at": {
      "description": "Set after a downgrade: the credentials are deleted then.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "default_from": {
      "$ref": "#/$defs/EmailDefaultFrom"
    },
    "egress_ips": {
      "description": "The addresses our email traffic leaves from: authorize them at providers that restrict calling IPs (Brevo: Security → Authorized IPs).",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "events": {
      "additionalProperties": {
        "description": "* `registered` - registered\n* `failed` - failed",
        "enum": [
          "registered",
          "failed"
        ],
        "type": "string",
        "x-spec-enum-id": "f519474cfe52e720"
      },
      "description": "Brevo connections only: the delivery-events webhook in the Brevo account, per region; empty for other providers.",
      "type": "object"
    },
    "id": {
      "description": "`emc_…`",
      "type": "string"
    },
    "last_error": {
      "oneOf": [
        {
          "$ref": "#/$defs/EmailConnectionError"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_test_at": {
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "last_test_status": {
      "description": "* `succeeded` - succeeded\n* `failed` - failed",
      "enum": [
        "succeeded",
        "failed",
        null
      ],
      "type": [
        "string",
        "null"
      ],
      "x-spec-enum-id": "c784105c2922494d"
    },
    "name": {
      "type": "string"
    },
    "object": {
      "default": "email_connection",
      "type": "string"
    },
    "provider": {
      "description": "* `brevo` - Brevo\n* `smtp` - SMTP\n* `postmark` - Postmark\n* `resend` - Resend\n* `ses` - Amazon SES\n* `graph` - Microsoft 365 (Graph)",
      "enum": [
        "brevo",
        "smtp",
        "postmark",
        "resend",
        "ses",
        "graph"
      ],
      "type": "string",
      "x-spec-enum-id": "e7a31054cb3443ae"
    },
    "reply_to": {
      "type": [
        "string",
        "null"
      ]
    },
    "senders": {
      "description": "Verified senders and domains found by the last test.",
      "items": {
        "$ref": "#/$defs/EmailSender"
      },
      "type": "array"
    },
    "status": {
      "description": "* `active` - active\n* `failing` - failing",
      "enum": [
        "active",
        "failing"
      ],
      "type": "string",
      "x-spec-enum-id": "998d9403dd142d1d"
    },
    "test_mode": {
      "description": "* `sandbox` - Sandbox\n* `redirect` - Redirect\n* `skip` - Skip",
      "enum": [
        "sandbox",
        "redirect",
        "skip"
      ],
      "type": "string",
      "x-spec-enum-id": "edd83b93494872a4"
    },
    "test_recipient": {
      "type": [
        "string",
        "null"
      ]
    },
    "updated_at": {
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "config",
    "created_at",
    "credentials",
    "credentials_delete_at",
    "default_from",
    "egress_ips",
    "events",
    "id",
    "last_error",
    "last_test_at",
    "last_test_status",
    "name",
    "provider",
    "reply_to",
    "senders",
    "status",
    "test_mode",
    "test_recipient",
    "updated_at"
  ],
  "type": "object",
  "$defs": {
    "EmailConnectionError": {
      "properties": {
        "at": {
          "format": "date-time",
          "type": "string"
        },
        "code": {
          "description": "`email_provider_auth_failed`, `email_ip_not_authorized` or `email_credentials_removed`.",
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "at",
        "code",
        "message"
      ],
      "type": "object"
    },
    "EmailCredentialsState": {
      "properties": {
        "configured": {
          "description": "Credentials are write-only; `false` once they were deleted after a downgrade.",
          "type": "boolean"
        }
      },
      "required": [
        "configured"
      ],
      "type": "object"
    },
    "EmailDefaultFrom": {
      "properties": {
        "email": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "email",
        "name"
      ],
      "type": "object"
    },
    "EmailSender": {
      "properties": {
        "email": {
          "description": "An address, or the domain for `kind: domain`.",
          "type": "string"
        },
        "kind": {
          "description": "* `sender` - sender\n* `domain` - domain",
          "enum": [
            "sender",
            "domain"
          ],
          "type": "string",
          "x-spec-enum-id": "782a6daad730dd03"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "verified": {
          "type": "boolean"
        }
      },
      "required": [
        "email",
        "kind",
        "name",
        "verified"
      ],
      "type": "object"
    }
  }
}