{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dhl/json-schema/dhl-subscription-request-schema.json",
  "title": "SubscriptionRequest",
  "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/SubscriptionRequest",
  "type": "object",
  "oneOf": [
    {
      "$ref": "#/$defs/SubscriptionAccountRequest"
    },
    {
      "$ref": "#/$defs/SubscriptionShipmentRequest"
    }
  ],
  "required": [
    "type"
  ],
  "$defs": {
    "ApiAuthentication": {
      "description": "The request for authentication",
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/ApiKeyAuthentication"
        },
        {
          "$ref": "#/$defs/BasicAuthentication"
        },
        {
          "$ref": "#/$defs/JWTAuthentication"
        },
        {
          "$ref": "#/$defs/OAuthAuthentication"
        },
        {
          "$ref": "#/$defs/GApisAuthentication"
        },
        {
          "$ref": "#/$defs/eBayAuthentication"
        }
      ]
    },
    "ApiKeyAuthentication": {
      "description": "API Key HTTP header authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "ApiKeyAuthentication"
        },
        "header": {
          "description": "The name of the HTTP header to be used for authentication",
          "type": "string",
          "format": "password",
          "pattern": "^[a-zA-Z0-9\\-]+$"
        },
        "token": {
          "description": "The secret token to be used for authentication",
          "type": "string",
          "format": "password"
        }
      },
      "required": [
        "type",
        "header",
        "token"
      ]
    },
    "AuthenticationSignatureAlgorithm": {
      "description": "The signature algorithm used to sign the JWT",
      "type": "string",
      "default": "RS256",
      "enum": [
        "none",
        "RS256"
      ]
    },
    "BasicAuthentication": {
      "description": "Basic authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "BasicAuthentication"
        },
        "client_id": {
          "description": "Client ID (username) of the application",
          "type": "string",
          "format": "password"
        },
        "client_secret": {
          "description": "Client secret (password) of the application",
          "type": "string",
          "format": "password"
        }
      },
      "required": [
        "type",
        "client_id",
        "client_secret"
      ]
    },
    "GApisAuthentication": {
      "description": "Google Apis OAuth authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "GApisAuthentication"
        },
        "claim": {
          "$ref": "#/$defs/GApisAuthenticationClaim"
        }
      },
      "required": [
        "type",
        "claim"
      ]
    },
    "GApisAuthenticationClaim": {
      "type": "object",
      "properties": {
        "iss": {
          "description": "Google SA Client email as issuer claim identifies the principal that issued the JWT.",
          "type": "string",
          "format": "email"
        },
        "scope": {
          "description": "The scope of the Google Apis access request",
          "type": "string"
        }
      },
      "required": [
        "iss",
        "scope"
      ]
    },
    "JWTAuthentication": {
      "description": "JSON Web Token authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "JWTAuthentication"
        },
        "header": {
          "$ref": "#/$defs/JWTAuthenticationHeader"
        },
        "claim": {
          "$ref": "#/$defs/JWTAuthenticationClaim"
        }
      },
      "required": [
        "type",
        "claim"
      ]
    },
    "JWTAuthenticationClaim": {
      "type": "object",
      "properties": {
        "iss": {
          "description": "Issuer claim identifies the principal that issued the JWT",
          "type": "string"
        },
        "sub": {
          "description": "Subject claim identifies the principal that is the subject of the JWT",
          "type": "string"
        },
        "aud": {
          "description": "Audience claim identifies the recipients that the JWT is intended for",
          "type": "string"
        },
        "private": {
          "description": "List of private claim identifies the claim of the JWT",
          "type": "array",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        }
      },
      "required": [
        "iss"
      ]
    },
    "JWTAuthenticationHeader": {
      "type": "object",
      "properties": {
        "alg": {
          "$ref": "#/$defs/AuthenticationSignatureAlgorithm"
        },
        "typ": {
          "description": "Type of the token",
          "type": "string",
          "default": "JWT",
          "enum": [
            "JWT"
          ]
        }
      },
      "required": [
        "alg"
      ]
    },
    "NameValuePair": {
      "type": "object",
      "properties": {
        "name": {
          "description": "Name of the item",
          "type": "string"
        },
        "value": {
          "description": "Value of the item",
          "type": "string"
        }
      }
    },
    "OAuthAuthentication": {
      "description": "OAuth authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "OAuthAuthentication"
        },
        "uri": {
          "$ref": "#/$defs/URI"
        },
        "header": {
          "$ref": "#/$defs/OAuthAuthenticationHeader"
        },
        "claim": {
          "$ref": "#/$defs/OAuthAuthenticationClaim"
        }
      },
      "required": [
        "type",
        "uri",
        "claim"
      ]
    },
    "OAuthAuthenticationClaim": {
      "type": "object",
      "properties": {
        "client_id": {
          "description": "Client ID of the application",
          "type": "string",
          "format": "password"
        },
        "client_secret": {
          "description": "Client secret of the application",
          "type": "string",
          "format": "password"
        },
        "grant_type": {
          "description": "The type of grant to be used",
          "type": "string"
        },
        "custom": {
          "description": "List of custom claim identifies of the application",
          "type": "array",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        }
      },
      "required": [
        "grant_type"
      ]
    },
    "OAuthAuthenticationHeader": {
      "type": "object",
      "properties": {
        "client_id": {
          "description": "Client ID (username) of the application for Basic authentication",
          "type": "string",
          "format": "password"
        },
        "client_secret": {
          "description": "Client secret (password) of the application for Basic authentication",
          "type": "string",
          "format": "password"
        },
        "custom": {
          "description": "List of custom headers",
          "type": "array",
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        }
      },
      "required": [
        "grant_type"
      ]
    },
    "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"
      ]
    },
    "SubscriptionAccountRequest": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/SubscriptionBody"
        },
        {
          "$ref": "#/$defs/SubscriptionAccountId"
        }
      ],
      "required": [
        "type"
      ]
    },
    "SubscriptionBody": {
      "type": "object",
      "properties": {
        "format": {
          "$ref": "#/$defs/SubscriptionFormat"
        },
        "service": {
          "$ref": "#/$defs/Service"
        },
        "hook": {
          "$ref": "#/$defs/SubscriptionHook"
        },
        "events": {
          "description": "To which event types the notification will be sent",
          "type": "array",
          "items": {
            "$ref": "#/$defs/StatusCode"
          }
        }
      },
      "required": [
        "hook",
        "events"
      ]
    },
    "SubscriptionFormat": {
      "description": "Subscription message format",
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "Default",
        "parcel-de"
      ]
    },
    "SubscriptionHook": {
      "type": "object",
      "required": [
        "uri"
      ],
      "properties": {
        "uri": {
          "$ref": "#/$defs/URI"
        },
        "authentication": {
          "$ref": "#/$defs/ApiAuthentication"
        },
        "headers": {
          "description": "Additional HTTP headers included with webhook push requests.",
          "type": "array",
          "maxItems": 20,
          "items": {
            "$ref": "#/$defs/NameValuePair"
          }
        }
      }
    },
    "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"
      ]
    },
    "SubscriptionShipmentRequest": {
      "type": "object",
      "x-class-extra-annotation": "@com.dhl.utapi.common.dto.validation.SubscriptionShipmentRequestConstraint",
      "allOf": [
        {
          "$ref": "#/$defs/SubscriptionBody"
        },
        {
          "$ref": "#/$defs/SubscriptionShipments"
        }
      ],
      "required": [
        "type"
      ]
    },
    "SubscriptionShipments": {
      "$ref": "#/$defs/SubscriptionShipmentIds"
    },
    "URI": {
      "description": "Uniform resource identifier of system",
      "type": "string",
      "format": "uri",
      "pattern": "^https://.*"
    },
    "eBayAuthentication": {
      "description": "eBay OAuth authentication",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of authentication",
          "type": "string",
          "default": "eBayAuthentication"
        },
        "claim": {
          "$ref": "#/$defs/eBayAuthenticationClaim"
        }
      },
      "required": [
        "type",
        "claim"
      ]
    },
    "eBayAuthenticationClaim": {
      "type": "object",
      "properties": {
        "keyset": {
          "description": "eBay environment keyset",
          "type": "string",
          "enum": [
            "production",
            "sandbox"
          ]
        }
      },
      "required": [
        "keyset"
      ]
    }
  }
}