{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "9in webhook event",
  "description": "The JSON body 9in POSTs to a webhook endpoint.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Event id (evt_…): the same on every retry and redelivery, so you can ignore duplicates."
    },
    "type": {
      "type": "string",
      "enum": [
        "user.created",
        "user.updated",
        "user.deleted",
        "user.login",
        "user.login_failed",
        "user.password_changed",
        "user.mfa_enabled",
        "user.mfa_disabled",
        "user.sessions_revoked",
        "session.revoked",
        "token.revoked",
        "webhook.test"
      ]
    },
    "createdAt": {
      "type": "string",
      "description": "ISO 8601 time the event happened."
    },
    "tenant": {
      "type": "string",
      "description": "Tenant id (tnt_…)."
    },
    "environment": {
      "type": "string",
      "enum": [
        "production",
        "sandbox"
      ]
    },
    "data": {
      "type": "object",
      "properties": {
        "userId": {
          "description": "The user the event is about, when there is one.",
          "type": [
            "string",
            "null"
          ]
        },
        "user": {
          "description": "A snapshot of the user (the Management API user object); null once deleted.",
          "anyOf": [
            {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": {},
      "description": "Event details: see the webhook events reference for the fields of each type."
    }
  },
  "required": [
    "id",
    "type",
    "createdAt",
    "tenant",
    "environment",
    "data"
  ],
  "additionalProperties": false
}
