# Event Envelope V1

- Object ID: `em:schema:sha256:fac57b4d18022fc4b3b12b83ec6488bf8d680aee5151f235731cfbce1111b1ec`
- Kind: `schema`
- Repository path: [`schemas/event-envelope-v1.json`](https://github.com/yoheinakajima/epistemedia/blob/f92846570180dfa4511263f8ba98ecd18f7772c9/schemas/event-envelope-v1.json)
- Content digest: `93f7f4bb4f64eb7b871baab47d2c0eb20df5c4c956e5406a90d3c1d9fae2eb46`

**Also filed under:** [Disclosure and Public Projection](https://epistemedia.org/topics/disclosure/), [Epistemic Mesh Protocol](https://epistemedia.org/topics/epistemic-mesh/), [Sovereign Realm Federation](https://epistemedia.org/topics/federation/), [Knowledge Objects](https://epistemedia.org/topics/knowledge-objects/)

## Source content

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://epistemedia.com/schemas/event-envelope-v1.json",
  "title": "Epistemedia Event Envelope v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "event_id",
    "event_type",
    "realm_id",
    "actor",
    "recorded_time",
    "payload",
    "payload_digest",
    "parents"
  ],
  "properties": {
    "schema": {"const": "https://epistemedia.com/schemas/event-envelope-v1.json"},
    "event_id": {"type": "string", "pattern": "^em:event:sha256:[a-f0-9]{64}$"},
    "event_type": {"type": "string", "minLength": 3},
    "realm_id": {"type": "string", "minLength": 3},
    "actor": {
      "type": "object",
      "required": ["id", "kind"],
      "properties": {
        "id": {"type": "string"},
        "kind": {"enum": ["human", "agent", "instrument", "service", "collective"]},
        "lineage": {"type": "object"}
      },
      "additionalProperties": true
    },
    "valid_time": {"$ref": "#/$defs/timeRange"},
    "observed_time": {"$ref": "#/$defs/timeRange"},
    "recorded_time": {"type": "string", "format": "date-time"},
    "payload": {"type": "object"},
    "payload_digest": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"},
    "parents": {
      "type": "array",
      "items": {"type": "string", "pattern": "^em:event:sha256:[a-f0-9]{64}$"},
      "uniqueItems": true
    },
    "signatures": {"type": "array", "items": {"type": "object"}},
    "supersedes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
    "visibility": {"enum": ["public", "internal", "restricted", "private"], "default": "internal"}
  },
  "$defs": {
    "timeRange": {
      "oneOf": [
        {"type": "string", "format": "date-time"},
        {
          "type": "object",
          "required": ["start"],
          "properties": {
            "start": {"type": "string", "format": "date-time"},
            "end": {"type": ["string", "null"], "format": "date-time"},
            "precision": {"type": "string"},
            "timezone": {"type": "string"}
          },
          "additionalProperties": false
        }
      ]
    }
  }
}
