# Template objects

Template objects vary based on the vendor they're intended for and the types of passes you want to create.


## Apple Pass personalization requirements {#personalizationrequirements}

[Jump to examples ↓](#personalizationrequirements-examples)

- **`description`** `string` **REQUIRED**

  A brief description of the rewards program that the recipient is signing up for. The description appears on the signup sheet, under the personalization logo.

- **`imageUrl`** `string`

  The URL of the image you want to appear at the top of the signup form. This image must be a 150 x 40 point PNG image.


  Format: `url`

- **`requiredPersonalizationFields`** `array[string]` **REQUIRED**

  An array of strings representing fields that a customer must provide to sign up for your rewards/loyalty program. Some keys populate multiple fields in the personalization callback or on passes.

* name - requires the user to enter their `fullName`. This also populates the `givenName` and `familyName` fields on passes and/or personalization callbacks.
* postalCode - prompts the user for their postal code. This populates both `postalCode` and `ISOCountryCode` on passes and/or personalization callbacks.
* emailAddress - requires the user's email address.
* phoneNumber - requires the user's phone number.


  Min items: 1, Max items: 4

  Possible values: `name`, `postalCode`, `emailAddress`, `phoneNumber`

- **`termsAndConditions`** `string`

  The terms and conditions for the reward program. If present, this information appears after the user enters their personal information and taps Next. The user then has the option to agree to the terms, or to cancel the signup process.


**Used in:**

- [Add personalization requirements]({{< ref "/developer/rest-api/wallet/operations/apple-wallet-pass-personalization/" >}}#addpersonalizationrequirements)
- [Delete personalization requirements]({{< ref "/developer/rest-api/wallet/operations/apple-wallet-pass-personalization/" >}}#removepersonalizationrequirements)
- [Get personalization requirements]({{< ref "/developer/rest-api/wallet/operations/apple-wallet-pass-personalization/" >}}#getpersonalizationrequirements)
- [Update personalization requirements]({{< ref "/developer/rest-api/wallet/operations/apple-wallet-pass-personalization/" >}}#updatepersonalizationrequirements)

**Examples**

*Example Apple loyalty personalization requirements*

```json
{
  "requiredPersonalizationFields": ["name", "postalCode", "emailAddress", "phoneNumber"
  ],
  "description": "Enter your information to sign up and earn points.",
  "termsAndConditions": "Terms and conditions go here"
}

```

---

## Apple Wallet template request {#iostemplate}

A complete iOS template includes template meta information, headers, and fields.

[Jump to examples ↓](#iostemplate-examples)

**All of:**

- [General template headers]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#templaterequestheaders)

  Meta information about templates; this object appears on all templates and identifies templates associated with a project.

- [iOS template headers]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#iosheaders)

  The iOS template `headers` object can contain the following objects. Each object
has a `formatType`, `fieldType`, and `value`.

* `formatType` is always `1`, indicating that the `value` is a string.

* `fieldType` is `topLevel` — a text or color value on the top-front of the pass, `image`, or `barcode`.

* `value` is the default value for the header field.

- [iOS fields]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#iosfieldobject)

  Defines fields on iOS templates and subsequent passes generated from the template.


**Used in:**

- [Create template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createtemplate)
- [Create template with external ID]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createexternaltemplate)
- [Get template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplate)
- [Get template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplatesv2)
- [Patch template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#patchtemplates)
- [Update template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplate)
- [Update template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplatesv2)

**Examples**

*Example Apple Wallet template request*

```json
{
  "headers": {
    "logo_color": {
      "formatType": 1,
      "fieldType": "topLevel",
      "value": "rgb(24,86,148)"
    },
    "icon_image": {
      "formatType": 1,
      "fieldType": "image",
      "value": "https:\/\/example.com\/passtools_prod\/1\/images\/default-pass-icon.png"
    },
    "logo_text": {
      "formatType": 1,
      "fieldType": "topLevel",
      "value": "Logo Text"
    },
    "barcode_encoding": {
      "formatType": 1,
      "fieldType": "barcode",
      "value": "iso-8859-1"
    },
    "suppress_strip_shine": {
      "formatType": 1,
      "fieldType": "topLevel",
      "value": "true"
    },
    "logo_image": {
      "formatType": 1,
      "fieldType": "image",
      "value": "https:\/\/example.com\/passtools_prod\/1\/images\/default-pass-logo.png"
    },
    "foreground_color": {
      "formatType": 1,
      "fieldType": "topLevel",
      "value": "rgb(255,255,255)"
    },
    "background_color": {
      "formatType": 1,
      "fieldType": "topLevel",
      "value": "rgb(49,159,196)"
    }
  },
  "fields": {
    "Coupon": {
      "formatType": "String",
      "changeMessage": "Enjoy %@ off your next order!",
      "order": 1,
      "fieldType": "primary",
      "textAlignment": "textAlignmentRight",
      "value": "20%",
      "label": "coupon",
      "required": false,
      "hideEmpty": true
    },
    "SiteAddress": {
      "formatType": "Number",
      "changeMessage": "New stuff, just for you at %@",
      "order": 2,
      "textAlignment": "textAlignmentCenter",
      "fieldType": "secondary",
      "value": "https://www.example.com/new?custnumb=123456",
      "label": "personalDeals",
      "required": false,
      "hideEmpty": true
    },
    "InStore": {
      "formatType": "String",
      "changeMessage": "Or visit your nearest store at %@",
      "order": 1,
      "fieldType": "secondary",
      "value": "1234 Fake St.",
      "label": "nearestStore",
      "required": false,
      "hideEmpty": false
    }
  },

  "vendor": "Apple",
  "projectType": "memberCard",
  "projectId": 1234,
  "type": "Store Card",
  "vendorId": 1,
  "deleted": "False",
  "description": "Description",
  "name": "Loyalty Card",
  "disabled": "False"
}

```

---

## Google Wallet template request {#googletemplate}

A google template organizes fields into a series of module objects. Include only the objects you want to populate for a particular template; some modules may not apply to your template type.

[Jump to examples ↓](#googletemplate-examples)

**All of:**

- [General template headers]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#templaterequestheaders)

  Meta information about templates; this object appears on all templates and identifies templates associated with a project.

- [Google fields]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#googletemplaterequestfieldsmodel)

  Fields on a Google pass are organized into modules. Modules define how fields on the pass are organized and appear. Fields within each module are objects with a string names.


**Used in:**

- [Create template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createtemplate)
- [Create template with external ID]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createexternaltemplate)
- [Get template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplate)
- [Get template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplatesv2)
- [Patch template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#patchtemplates)
- [Update template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplate)
- [Update template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplatesv2)

**Examples**

*Example Google template request*

```json
{
  "infoModuleData": {
     "hexFontColor": "#666666",
     "hexBackgroundColor": "#0096e1",
     "Program ID": {
        "label": "Program ID",
        "value": "12345678",
        "row": 0,
        "col": 0,
        "formatType": "String"
     },
     "Tier Name": {
        "label": "Tier Name",
        "value": "Silver",
        "row": 0,
        "col": 1,
        "formatType": "String"
     },
     "Last Updated": {
        "label": "Last Updated",
        "value": "Five days ago",
        "row": 1,
        "col": 0,
        "formatType": "String"
     }
  },
  "headers": {
     "barcode_type": {
        "fieldType": "barcode",
        "value": "",
        "notShared": true
     },
     "barcode_value": {
        "fieldType": "barcode",
        "value": "",
        "notShared": true
     },
     "barcode_label": {
        "fieldType": "barcode",
        "value": "",
        "notShared": true
     },
     "barcode_encoding": {
        "fieldType": "barcode",
        "value": "",
        "notShared": true
     },
     "barcodeAltText": {
        "fieldType": "barcode",
        "value": "",
        "notShared": true
     }
  },
  "textModulesData": {
     "Program Details": {
        "header": "Program Details",
        "body": "Some Basic Text",
        "row": 0,
        "col": 0,
        "formatType": "String"
     }
  },
  "linksModuleData": {
     "Merchant Website": {
        "description": "Merchant Website",
        "uri": "http:\/\/www.example.com",
        "order": 1,
        "formatType": "URL"
     }
  },
  "messageModule": {
  },
  "imageModulesData": {
  },
  "pointsModule": {
     "Tier": {
        "label": "Tier",
        "value": 2,
        "row": 0,
        "col": 1,
        "formatType": "Number",
        "numberStyle": "PKNumberStyleDecimal"
     },
     "Points": {
        "label": "Points",
        "value": 1234,
        "row": 0,
        "col": 0,
        "formatType": "Number"
     }
  },
  "notAssigned": {
  },
  "titleModule": {
     "image": "https:\/\/example.com\/passtools_prod\/1\/images\/default-pass-icon.png",
     "imageDescription": "Logo Image",
     "Program Name": {
        "label": "Program Name",
        "value": "UA",
        "row": 0,
        "col": 0,
        "formatType": "String"
    }
  },
  "vendor": "Google",
  "projectType": "memberCard",
  "type": "Loyalty1",
  "vendorId": 2,
  "deleted": "False",
  "description": "description",
  "name": "Adding Google"
}

```

---

## Optional fields for Google headers {#googleheaderitemshared}

Header objects for Google Wallet templates use many of the same keys as fields on the template/pass. Populate these keys as necessary. Template responses include these keys with their default values.

[Jump to examples ↓](#googleheaderitemshared-examples)

- **`changeMessage`** `string`

  The message that appears when you update this field.

  Nullable: true

- **`hideEmpty`** `boolean`

  If true, the field is hidden if empty.

- **`ignoresTimeZone`** `boolean`

  if true, the date-time value in a field on an Apple Wallet pass is not offset to account for the pass recipient's time zone. This may be helpful for things like boarding passes or events, where your times are set local to an airport or venue and should not change based on a user's device. When applied to a non-date-time field or a Google template, this setting is ignored.


- **`label`** `string`

  In most cases, you should not set a label for a Google template header. In responses, the label is typically an empty string.

- **`required`** `boolean`

  Indicates whether or not the field is required on passes created from this template.

- **`textAlignment`** `string`

  The alignment of text on the pass.

  Possible values: `textAlignmentLeft`, `textAlignmentCenter`, `textAlignmentRight`, `textAlignmentNatural`


**Used in:**

- [Create pass]({{< ref "/developer/rest-api/wallet/operations/passes-with-external-ids/" >}}#createpassexternalid)
- [Create pass]({{< ref "/developer/rest-api/wallet/operations/passes/" >}}#createpass)
- [Create pass from a template]({{< ref "/developer/rest-api/wallet/operations/passes-with-external-ids/" >}}#createpassfromtemplateexternalid)
- [Create template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createtemplate)
- [Create template with external ID]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#createexternaltemplate)
- [Generates a pass]({{< ref "/developer/rest-api/wallet/operations/passes/" >}}#createdynamiclink)
- [Get pass]({{< ref "/developer/rest-api/wallet/operations/passes-with-external-ids/" >}}#getpassfromtemplateexternalid)
- [Get pass]({{< ref "/developer/rest-api/wallet/operations/passes/" >}}#getpass)
- [Get template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplate)
- [Get template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#gettemplatesv2)
- [Patch template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#patchtemplates)
- [Update pass]({{< ref "/developer/rest-api/wallet/operations/passes/" >}}#updatepass)
- [Update template]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplate)
- [Update template v2]({{< ref "/developer/rest-api/wallet/operations/templates/" >}}#updatetemplatesv2)

**Examples**

*Example Google header object with optional keys*

```json
{
  "background_color": {
    "ignoresTimeZone": null,
    "changeMessage": null,
    "label": "",
    "hideEmpty": false,
    "formatType": "String",
    "value": "#006491",
    "fieldType": "topLevel",
    "required": false
  }
}

```

---

