{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/vng-realisatie/main/json-schema/vng-realisatie-subscription-schema.json",
  "title": "Subscription",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vng-realisatie-notificaties-openapi.yml#/components/schemas/Subscription",
  "required": [
    "protocol",
    "sink"
  ],
  "type": "object",
  "properties": {
    "id": {
      "title": "Id",
      "description": "UUID of the subscription.",
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "protocol": {
      "title": "Protocol",
      "description": "Identifier of a delivery protocol.",
      "type": "string",
      "enum": [
        "HTTP"
      ]
    },
    "protocolSettings": {
      "$ref": "#/$defs/ProtocolSettings"
    },
    "sink": {
      "title": "Sink",
      "description": "The address to which events shall be delivered using the selected protocol.",
      "type": "string",
      "format": "uri",
      "maxLength": 200,
      "minLength": 1
    },
    "sinkCredential": {
      "$ref": "#/$defs/SinkCredential"
    },
    "config": {
      "title": "Config",
      "description": "Implementation-specific configuration parameters needed by the subscription manager for acquiring events.",
      "type": [
        "object",
        "null"
      ]
    },
    "source": {
      "title": "Source",
      "description": "Source to which the subscription applies. May be implied by the request address.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255
    },
    "domain": {
      "title": "Domain",
      "description": "Domain to which the subscription applies.",
      "type": [
        "string",
        "null"
      ]
    },
    "types": {
      "description": "CloudEvent types eligible to be delivered by this subscription.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "title": "Types",
        "type": "string",
        "maxLength": 255,
        "minLength": 1
      }
    },
    "subscriberReference": {
      "title": "Subscriber reference",
      "description": "Events that are send to the subscriber will contain this reference. The subscriber can use the reference for internal routing of the event.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255
    },
    "filters": {
      "title": "Filters",
      "description": "This filter evaluates to 'true' if all contained filters are 'true'.",
      "type": "object"
    },
    "url": {
      "title": "Url",
      "description": "URL-referentie naar dit object. Dit is de unieke identificatie en locatie van dit object.",
      "type": "string",
      "format": "uri",
      "readOnly": true,
      "maxLength": 1000,
      "minLength": 1
    }
  },
  "$defs": {
    "ProtocolSettings": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "headers": {
          "title": "Headers",
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "maxLength": 255,
            "minLength": 1
          }
        },
        "method": {
          "title": "Method",
          "type": "string",
          "enum": [
            "POST"
          ]
        }
      }
    },
    "SinkCredential": {
      "required": [
        "credentialType",
        "accessToken",
        "accessTokenExpiresUtc",
        "accessTokenType"
      ],
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "credentialType": {
          "title": "Credential type",
          "type": "string",
          "enum": [
            "ACCESSTOKEN"
          ]
        },
        "accessToken": {
          "title": "Access token",
          "type": "string",
          "minLength": 1
        },
        "accessTokenExpiresUtc": {
          "title": "Access token expires utc",
          "type": "string",
          "format": "date-time"
        },
        "accessTokenType": {
          "title": "Access token type",
          "type": "string",
          "enum": [
            "bearer"
          ]
        }
      }
    }
  }
}