{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dhl/json-schema/dhl-subscription-schema.json",
  "title": "Subscription",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dhl-shipment-tracking-unified-push-openapi.yml#/components/schemas/Subscription",
  "type": "object",
  "oneOf": [
    {
      "$ref": "#/$defs/SubscriptionAccountInfo"
    },
    {
      "$ref": "#/$defs/SubscriptionShipmentInfo"
    }
  ],
  "required": [
    "type"
  ],
  "$defs": {
    "ProblemDetail": {
      "description": "A problem detail response",
      "type": "object",
      "properties": {
        "detail": {
          "description": "A human-readable explanation specific to this occurrence of the problem",
          "type": "string"
        },
        "instance": {
          "description": "A URI reference that identifies the specific occurrence of the problem",
          "format": "uri",
          "type": "string"
        },
        "status": {
          "description": "The HTTP status code",
          "type": "number"
        },
        "title": {
          "description": "A short, human-readable summary of the problem type",
          "type": "string"
        },
        "type": {
          "description": "An identity of caused exception class",
          "type": "string"
        }
      }
    },
    "Service": {
      "description": "Service (provider) used to resolve this tracking number (id)",
      "type": "string",
      "enum": [
        "dgf",
        "dsc",
        "ecommerce",
        "ecommerce-apac",
        "ecommerce-europe",
        "ecommerce-ppl",
        "ecommerce-iberia",
        "express",
        "freight",
        "parcel-de",
        "parcel-nl",
        "parcel-pl",
        "parcel-uk",
        "post-de",
        "post-international",
        "sameday",
        "svb"
      ],
      "nullable": false,
      "x-enum-varnames": [
        "DGF",
        "DSC",
        "ECM",
        "ECP",
        "ECE",
        "PPL",
        "ECI",
        "XPR",
        "FRT",
        "PAD",
        "PAN",
        "PAP",
        "PUK",
        "PSD",
        "DPI",
        "SMD",
        "SVB"
      ]
    },
    "ShipmentType": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "default": "Shipment"
        }
      }
    },
    "StatusCode": {
      "description": "Code of the status (high-level grouping statuses)",
      "type": "string",
      "enum": [
        "delivered",
        "failure",
        "pre-transit",
        "transit",
        "unknown"
      ]
    },
    "SubscriptionAccountId": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "default": "Account"
        },
        "accountID": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "type",
        "accountID"
      ]
    },
    "SubscriptionAccountInfo": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/SubscriptionRequestState"
        },
        {
          "$ref": "#/$defs/SubscriptionBodyInfo"
        },
        {
          "$ref": "#/$defs/SubscriptionAccountId"
        }
      ],
      "required": [
        "type"
      ]
    },
    "SubscriptionBodyInfo": {
      "type": "object",
      "properties": {
        "format": {
          "$ref": "#/$defs/SubscriptionFormat"
        },
        "service": {
          "$ref": "#/$defs/Service"
        },
        "hook": {
          "$ref": "#/$defs/SubscriptionHookInfo"
        },
        "events": {
          "description": "To which event types the notification will be sent",
          "type": "array",
          "items": {
            "$ref": "#/$defs/StatusCode"
          }
        }
      }
    },
    "SubscriptionFormat": {
      "description": "Subscription message format",
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "Default",
        "parcel-de"
      ]
    },
    "SubscriptionHookInfo": {
      "type": "object",
      "required": [
        "uri"
      ],
      "properties": {
        "uri": {
          "$ref": "#/$defs/URI"
        }
      }
    },
    "SubscriptionRequestState": {
      "description": "Subscription request state response",
      "type": "object",
      "properties": {
        "self": {
          "description": "uniform resource identifier of system",
          "type": "string",
          "format": "uri"
        },
        "scope": {
          "$ref": "#/$defs/SubscriptionScope"
        },
        "expires": {
          "type": "string",
          "format": "iso8601-date-time"
        },
        "secret": {
          "description": "Validation of intent secret",
          "type": "string",
          "format": "password"
        },
        "note": {
          "type": "string"
        },
        "failure": {
          "$ref": "#/$defs/ProblemDetail"
        }
      },
      "required": [
        "scope"
      ]
    },
    "SubscriptionScope": {
      "type": "string",
      "enum": [
        "subscription.create",
        "subscription.validate",
        "subscription.activate",
        "subscription.ready",
        "subscription.push",
        "subscription.remove",
        "subscription.failure"
      ],
      "x-enum-varnames": [
        "CREATE",
        "VALIDATE",
        "ACTIVATE",
        "READY",
        "PUSH",
        "REMOVE",
        "FAILURE"
      ]
    },
    "SubscriptionShipmentIds": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "default": "Shipment"
            },
            "shipmentIDs": {
              "description": "maxItems: 10<br/> minItems: 1",
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "$ref": "#/$defs/ShipmentType"
        }
      ],
      "required": [
        "type"
      ]
    },
    "SubscriptionShipmentInfo": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/SubscriptionRequestState"
        },
        {
          "$ref": "#/$defs/SubscriptionBodyInfo"
        },
        {
          "$ref": "#/$defs/SubscriptionShipments"
        }
      ],
      "required": [
        "type"
      ]
    },
    "SubscriptionShipments": {
      "$ref": "#/$defs/SubscriptionShipmentIds"
    },
    "URI": {
      "description": "Uniform resource identifier of system",
      "type": "string",
      "format": "uri",
      "pattern": "^https://.*"
    }
  }
}