{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/walletpassbuilder-com/json-schema/walletpassbuilder-com-pass-template-schema.json",
  "title": "PassTemplate",
  "description": "A pass's full design. See https://walletpassbuilder.com/api-docs#passes for a complete example; only the commonly-used fields are typed here. passType, cardTitle, logoText, backgroundColor, and assets.logo are required - everything else defaults sensibly if omitted.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/walletpassbuilder-com-openapi.yaml#/components/schemas/PassTemplate",
  "type": "object",
  "required": [
    "passType",
    "cardTitle",
    "logoText",
    "backgroundColor",
    "assets"
  ],
  "properties": {
    "passType": {
      "type": "string",
      "enum": [
        "generic",
        "loyalty"
      ],
      "description": "generic covers gift cards, tickets, and membership cards; loyalty adds a stamp counter. Every pass renders with the same visual layout regardless of type."
    },
    "logoText": {
      "type": "string"
    },
    "cardTitle": {
      "type": "string"
    },
    "backgroundColor": {
      "type": "string",
      "description": "Shared by both wallets."
    },
    "backSections": {
      "type": "array",
      "description": "Extra rows shown on the back of the pass.",
      "items": {
        "$ref": "#/$defs/BackSection"
      }
    },
    "apple": {
      "$ref": "#/$defs/PassApple"
    },
    "assets": {
      "$ref": "#/$defs/PassAssets"
    },
    "rows": {
      "type": "array",
      "description": "One entry per row of fields. Only the first entry is rendered today - more may be supported later, so extra entries are accepted but ignored, not rejected.",
      "items": {
        "$ref": "#/$defs/PassRow"
      }
    },
    "scan": {
      "$ref": "#/$defs/PassScan"
    },
    "notification": {
      "$ref": "#/$defs/PassNotification"
    }
  },
  "additionalProperties": true,
  "$defs": {
    "BackSection": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "\"__notification\" is reserved - a Send Notification call upserts that one section, so using it yourself means a future notification will overwrite it."
        },
        "type": {
          "type": "string",
          "enum": [
            "Text",
            "Link",
            "Phone"
          ],
          "description": "Link opens value as a URL, Phone dials it, Text just displays it."
        },
        "label": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "NotifyBeacon": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "uuid": {
          "type": "string"
        },
        "major": {
          "type": "string"
        },
        "minor": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "NotifyLocation": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "latitude": {
          "type": "string"
        },
        "longitude": {
          "type": "string"
        }
      }
    },
    "PassApple": {
      "type": "object",
      "description": "Fields that only apply to Apple Wallet - there's no Google Wallet equivalent for any of these today.",
      "properties": {
        "textColor": {
          "type": "string",
          "description": "Primary text color."
        },
        "labelColor": {
          "type": "string",
          "description": "Field label color."
        },
        "topRightLabel": {
          "type": "string"
        },
        "topRightValue": {
          "type": "string"
        }
      }
    },
    "PassAssets": {
      "type": "object",
      "required": [
        "logo"
      ],
      "properties": {
        "logo": {
          "type": "string",
          "description": "Small square logo image URL."
        },
        "rectLogo": {
          "type": [
            "string",
            "null"
          ]
        },
        "appleHero": {
          "type": [
            "string",
            "null"
          ],
          "description": "Apple Wallet hero/strip image URL."
        },
        "googleHero": {
          "type": [
            "string",
            "null"
          ],
          "description": "Google Wallet hero image URL."
        },
        "appleThumbnail": {
          "type": [
            "string",
            "null"
          ]
        },
        "imageRules": {
          "type": "array",
          "maxItems": 20,
          "description": "Per-person hero images. A card whose `{variable}` value matches shows `image` as its Apple strip and Google hero; the first matching rule wins, the rest keep appleHero / googleHero. Comparison ignores case and outer spaces. A rule's variable counts as one of the pass's variables, so each recipient brings its value.",
          "items": {
            "type": "object",
            "required": [
              "variable",
              "value",
              "image"
            ],
            "properties": {
              "variable": {
                "type": "string",
                "description": "Variable name without braces, such as `ticket_type`."
              },
              "match": {
                "type": "string",
                "enum": [
                  "is",
                  "isNot",
                  "contains"
                ],
                "default": "is"
              },
              "value": {
                "type": "string",
                "maxLength": 200
              },
              "image": {
                "type": "string",
                "description": "Image URL or data URL."
              }
            }
          }
        }
      }
    },
    "PassNotification": {
      "type": "object",
      "description": "Automatic lock-screen triggers - Apple Wallet only today, no Google Wallet equivalent yet.",
      "properties": {
        "triggers": {
          "type": "array",
          "description": "Which triggers are on for this pass. Each one also needs its own field(s) below to actually fire.",
          "items": {
            "type": "string",
            "enum": [
              "eventStart",
              "beforeExpiry",
              "nearLocation",
              "nearBeacon"
            ]
          }
        },
        "eventStartDate": {
          "type": "string",
          "format": "date-time",
          "description": "Required if triggers includes \"eventStart\"."
        },
        "scheduledExpiry": {
          "type": "string",
          "format": "date-time",
          "description": "Required if triggers includes \"beforeExpiry\" (surfaces the pass 48 hours prior). Whether or not that trigger is on, the pass is marked expired at this time on both wallets (Apple Wallet's expiration date, Google Wallet's valid-until time)."
        },
        "locations": {
          "type": "array",
          "description": "Required if triggers includes \"nearLocation\". Up to 10.",
          "items": {
            "$ref": "#/$defs/NotifyLocation"
          }
        },
        "beacons": {
          "type": "array",
          "description": "Required if triggers includes \"nearBeacon\". Up to 10.",
          "items": {
            "$ref": "#/$defs/NotifyBeacon"
          }
        }
      }
    },
    "PassRow": {
      "type": "object",
      "description": "The three data fields on the pass face.",
      "properties": {
        "left": {
          "$ref": "#/$defs/PassRowField"
        },
        "middle": {
          "$ref": "#/$defs/PassRowField"
        },
        "right": {
          "$ref": "#/$defs/PassRowField"
        }
      }
    },
    "PassRowField": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "PassScan": {
      "type": "object",
      "properties": {
        "hidden": {
          "type": "boolean",
          "description": "Hides the barcode/QR block entirely."
        },
        "type": {
          "type": "string",
          "enum": [
            "barcode",
            "qr"
          ]
        },
        "value": {
          "type": "string",
          "description": "The encoded value. Set this unless hidden is true."
        },
        "label": {
          "type": "string",
          "description": "Text shown under the scan code."
        }
      }
    }
  }
}