{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/e2a-dev/json-schema/e2a-dev-contact-engagement-view-schema.json",
  "title": "ContactEngagementView",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/e2a-dev-api-openapi.yml#/components/schemas/ContactEngagementView",
  "additionalProperties": true,
  "properties": {
    "address": {
      "type": "string"
    },
    "agent_email": {
      "type": "string"
    },
    "contact": {
      "$ref": "#/$defs/EmbeddedContactView"
    },
    "created_at": {
      "format": "date-time",
      "type": "string"
    },
    "first_outbound_at": {
      "description": "Server-owned.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "inbound_count": {
      "description": "DMARC-authenticated inbound messages delivered since enrollment. Spoofed, held, blocked, and pre-enrollment messages are excluded. Server-owned.",
      "format": "int64",
      "type": "integer"
    },
    "last_conversation_id": {
      "description": "Server-owned.",
      "type": "string"
    },
    "last_inbound_at": {
      "description": "Server-owned.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "last_outbound_at": {
      "description": "Server-owned. Include it in the due query (last_outbound_before) so a lost client state-write cannot cause a duplicate send.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "metadata": {
      "additionalProperties": {},
      "description": "Caller-owned key/value data scoped to this relationship. Opaque to e2a.",
      "type": "object"
    },
    "next_action_at": {
      "description": "When the caller wants to act next. e2a does not act on it; it drives the outreach query and the contact.due wake-up.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "outbound_count": {
      "description": "Successfully submitted outbound messages since enrollment. Queue failures and pre-enrollment history are excluded. Server-owned.",
      "format": "int64",
      "type": "integer"
    },
    "replied": {
      "description": "Whether this contact has answered since outreach began — computed as last_inbound_at > first_outbound_at, so it means 'replied to us' rather than 'has ever written'. Server-owned.",
      "type": "boolean"
    },
    "stage": {
      "description": "Caller-defined outreach stage. Opaque to e2a — there is no server-side state machine, and any string is valid.",
      "type": "string"
    },
    "suppressed": {
      "description": "Whether sends to this address are blocked, by an account-wide or agent-scoped suppression. Server-owned; reflects the same state the send path enforces.",
      "type": "boolean"
    },
    "suppression_reason": {
      "description": "Free-text detail recorded with the block, when present.",
      "type": "string"
    },
    "suppression_source": {
      "description": "Why the block exists, when suppressed. Open set; tolerate unknown values. Known values: unsubscribe, manual, bounce, complaint.",
      "type": "string"
    },
    "updated_at": {
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "agent_email",
    "address",
    "stage",
    "next_action_at",
    "metadata",
    "replied",
    "suppressed",
    "first_outbound_at",
    "last_outbound_at",
    "last_inbound_at",
    "outbound_count",
    "inbound_count",
    "contact",
    "created_at",
    "updated_at"
  ],
  "type": "object",
  "x-stability-level": "beta",
  "$defs": {
    "EmbeddedContactView": {
      "additionalProperties": true,
      "properties": {
        "address": {
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        }
      },
      "required": [
        "address",
        "display_name",
        "metadata"
      ],
      "type": "object",
      "x-stability-level": "beta"
    }
  }
}