# Templates

A template determines the format, style, field placement, and default values for passes. You must specify a template when creating passes or adaptive links.


{{< note >}}
The `Create Template` and `Update Template` calls expect a different data structure than the response from a `Get Template` call.
{{< /note >}}

## Add locations to template {#addlocationstotemplate}

Add locations to the specified template.

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

### `POST /template/{templateId}/locations`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `string` | Required | The template you want to add locations to. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{templateId}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

A request includes an array of locations.

**Content-Type:** `application/json`

- **`Locations`** `array` <[Location object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#locationobject)>
**Responses**

**`200`** A successful request returns the locations on the pass.

Response body:

**Content-Type:** `application/json; charset=utf-8`

Type: `array`

**Examples**

*Example request*

```http
POST /v1/template/12345/locations HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
   "locations":[
      {
         "longitude": -122.374,
         "latitude": 37.618,
         "relevantText": "Hello loc0",
         "streetAddress1": "address line #1",
         "streetAddress2": "address line #2",
         "city": "San Francisco",
         "region": "CA",
         "regionCode": "94404",
         "country": "US"
      }
   ]
}

```

*Example request with external ID*

```http
POST /v1/template/id/myTemplate/locations HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
   "locations":[
      {
         "longitude": -122.374,
         "latitude": 37.618,
         "relevantText": "Hello loc0",
         "streetAddress1": "address line #1",
         "streetAddress2": "address line #2",
         "city": "San Francisco",
         "region": "CA",
         "regionCode": "94404",
         "country": "US"
      }
   ]
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
   {
      "locationId": 65,
      "value": {
         "region": "CA",
         "regionCode": "94404",
         "relevantText": "Hello loc0",
         "streetAddress1": "address line #1",
         "streetAddress2": "address line #2",
         "longitude": -122.374,
         "latitude": 37.618,
         "city": "San Francisco"
      },
      "fieldId": 1842
   }
]

```

---

## Create template {#createtemplate}

Create a template within the specified project. A template is specific to a vendor platform, Apple or Google.
See also [Create template with external ID](#operation-template-projectid-id-templateexternalid-post).

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

### `POST /template/{id}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `projectId` of the project that will contain the new template. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

The request body is structured by the platform `vendor` your template and subsequent passes are intended for.

**Content-Type:** `application/json`

**One of:**

- [Apple Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#iostemplate)

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

- [Google Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#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.


**Responses**

**`200`** A response returns the template's unique identifier. Use this `templateId` to reference the template in subsequent operations.


Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example Apple template*

```http
POST /v1/template/1234 HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
  "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",
  "expiryInfo": {
    "expiryDuration": 365
  }
}

```

*Example Google template*

```http
POST /v1/template/12345 HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
  "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",
  "expiryDuration": 365
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "templateId": 12345
}

```

---

## Create template with external ID {#createexternaltemplate}

Create a template with an external ID within the specified project. A template is specific to a vendor platform, Apple or Google.
See also [Create template](/docs/developer/rest-api/wallet/operations/templates/#createtemplate).

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

### `POST /template/{projectId}/id/{templateExternalId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | `string` | Required | The project you want to associate your new template with. |
| `templateExternalId` | `string` | Required | The custom identifier you want to give to your new template. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

The request body is structured by the platform `vendor` your template and subsequent passes are intended for.

**Content-Type:** `application/json`

**One of:**

- [Apple Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#iostemplate)

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

- [Google Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#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.


**Responses**

**`200`** A response returns the template's unique identifier. Use this `templateId` or the external ID to reference the template in subsequent operations.


Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example Apple template*

```http
POST /v1/template/1234/id/myTemplate HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
  "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",
  "expiryInfo": {
    "expiryDuration": 365
  }
}

```

*Example Google template*

```http
POST /v1/template/project/id/someProjectExtId/id/someTemplateExtId HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
  "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",
  "expiryInfo": {
   "expiryDuration": 365
  }
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "templateId": 12345
}

```

---

## Delete location from template {#deletelocationfromtemplate}

Remove a location from template.

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

### `DELETE /template/{templateId}/location/{locationId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `string` | Required | The template you want to remove a location from. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{templateId}` as `id/{externalId}`. |
| `locationId` | `string` | Required | The ID of the location you want to remove. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** The location is deleted.

Response body:

**Content-Type:** `application/json; charset=utf-8`

Type: `object`

**Examples**

*Example request*

```http
DELETE /v1/template/12345/location/456 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
DELETE /v1/template/id/myTemplate/location/456 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

---

## Delete template {#deletetemplate}

Delete the specified template.

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

### `DELETE /template/{id}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to delete. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{externalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** Returns the status of the deleted template.

Response body:

**Content-Type:** `application/json`

- **`TemplateId`** `integer`

  The identifier of the deleted template.

- **`status`** `string`

  Indicates that the request succeeded.

  Possible values: `success`

**Examples**

*Example request*

```http
DELETE /v1/template/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
DELETE /v1/template/id/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "status": "Deleted",
   "TemplateID": "12345"
}

```

---

## Duplicate template {#duplicatetemplate}

Duplicates the specified template and put it in the same project.

`/v1/template/duplicate/id/(templateExternalId)` duplicates the template specified by the external ID and puts the newly created template in the same project.

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

### `POST /template/duplicate/{templateId}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `string` | Required | The templateId of the template you want to duplicate. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** A successful request returns the ID of the newly created template.

Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example request*

```http
POST /v1/template/duplicate/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "templateId": 12346
}

```

*Example request with external ID*

```http
POST /v1/template/duplicate/id/23456 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{}

```

*Response with external ID*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "templateId": 23457
}

```

---

## Get template {#gettemplate}

Get the template specified by the `templateId`. To get the template payload in the same format as you would use in a `POST` or `PUT` operation, use the [/templates](/docs/developer/rest-api/wallet/operations/templates/#gettemplatesv2) endpoint instead.

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

### `GET /template/{id}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to look up. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** A successful response returns returns the identifier of the template and dates when the template was created and last updated.

Response body:

**Content-Type:** `application/json`

**All of:**

  - **`createdAt`** `string`

    The date and time when the item was created.

    Format: `date-time`

    Read only: true

  - **`id`** `integer`

    The identifier for the template. You can recall the template by ID in other operations.

    Read only: true

  - **`updatedAt`** `string`

    The date and time when the item was last updated.

    Format: `date-time`

    Read only: true

- `oneOf`

**Examples**

*Example request*

```http
GET /v1/template/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Example request with external ID*

```http
GET /v1/template/id/myTemplate HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response — Apple template*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "fieldsModel": {
      "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
        }
      }
   },
   "templateHeader": {
      "vendor": "Apple",
      "projectType": "memberCard",
      "projectId": 1234,
      "type": "Store Card",
      "vendorId": 1,
      "deleted": "False",
      "id": "12345",
      "updatedAt": "2013-07-01T18:28:33.000Z",
      "description": "Description",
      "createdAt": "2013-07-01T18:28:33.000Z",
      "name": "Loyalty Card",
      "disabled": "False",
      "expiryDuration": 730
   }
}

```

---

## Get template passes {#getpassesbytemplate}

Get passes for a template.

`/v1/template/id/{templateExternalId}/passes` get passes associated with a template identified by external ID.


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

### `GET /template/{templateId}/passes`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wpas

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `integer` | Required | The `templateId` of the template you want to get passes for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `status` | `string` |  | Find only passes matching the installation status.  * `installed` — passes currently installed. * `uninstalled` — passes that have been uninstalled. * `been_installed` — passes that have been either installed or uninstalled. * `not_been_installed` — passes that have never been installed.  Possible values: `installed`, `uninstalled`, `been_installed`, `not_been_installed` |
| `pageSize` | `integer` |  | The number of passes per page. Defaults to 10. Default: `10` |
| `page` | `integer` |  | The page of results you want to retrieve, starting at 1. Default: `1` |
| `order` | `string` |  | The order you want passes returned in, defaulting to `id`. Possible values: `id`, `createdAt`, `updatedAt` Default: `id` |
| `direction` | `string` |  | Determines whether to return values in ascending or descending order. Defaults to `DESC`. Possible values: `ASC`, `DESC` Default: `DESC` |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** A successful request returns a paged list of passes for a particular template.

Response body:

**Content-Type:** `application/json`

- **`pagination`** `object` <[Pagination object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#paginationobject)>

  Contains information about pagination, according to your query parameters.

- **`passes`** `array[object]`

  The metadata for passes associated with the template. Each object in the array represents a pass.

**`404`** Template not found.       


**Examples**

*Example request*

```http
GET /v1/template/12345/passes HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "passes": [{
      "id": 3,
      "templateId": 12345,
      "url": "https://d720-104-177-34-165.ngrok.io/v1/pass/3/download",
      "serialNumber": "aff7ffbf-04d7-4180-9da2-c790e08da051",
      "createdAt": "2023-04-19T06:17:01.000Z",
      "updatedAt": "2023-04-19T06:17:01.000Z",
      "status": "uninstalled",
      "uninstalledAt": "2023-05-19T06:17:02.000Z",
      "installedAt": "2023-04-19T06:17:02.000Z",
      "platform": "android"
    },
    {
      "id": 1,
      "templateId": 12345,
      "url": "https://d720-104-177-34-165.ngrok.io/v1/pass/1/download",
      "serialNumber": "34b6f9de-3745-4107-99ae-3f952208e253",
      "createdAt": "2023-04-05T17:55:23.000Z",
      "updatedAt": "2023-04-05T17:55:23.000Z",
      "status": "installed",
      "installedAt": "2023-04-05T17:55:23.000Z",
      "platform": "android"
    }
  ],
  "pagination": {
    "order": "id",
    "direction": "desc",
    "page": 1,
    "start": 0,
    "pageSize": 2
  }
}

```

*Example request with external ID*

```http
GET /v1/template/id/23456/passes HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response with external ID*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "passes": [{
      "id": 3,
      "templateId": 23456,
      "url": "https://d720-104-177-34-165.ngrok.io/v1/pass/3/download",
      "serialNumber": "aff7ffbf-04d7-4180-9da2-c790e08da051",
      "createdAt": "2023-04-19T06:17:01.000Z",
      "updatedAt": "2023-04-19T06:17:01.000Z",
      "status": "uninstalled",
      "uninstalledAt": "2023-05-19T06:17:02.000Z",
      "installedAt": "2023-04-19T06:17:02.000Z",
      "platform": "android"
    },
    {
      "id": 1,
      "templateId": 23456,
      "url": "https://d720-104-177-34-165.ngrok.io/v1/pass/1/download",
      "serialNumber": "34b6f9de-3745-4107-99ae-3f952208e253",
      "createdAt": "2023-04-05T17:55:23.000Z",
      "updatedAt": "2023-04-05T17:55:23.000Z",
      "status": "installed",
      "installedAt": "2023-04-05T17:55:23.000Z",
      "platform": "android"
    }
  ],
  "pagination": {
    "order": "id",
    "direction": "desc",
    "page": 1,
    "start": 0,
    "pageSize": 2
  }
}

```

---

## Get template v2 {#gettemplatesv2}

Get the template specified by the `templateId`. The template payload returned will be in the same format you would use in a `POST` or `PUT` operation unlike the [/template](/docs/developer/rest-api/wallet/operations/templates/#gettemplate) endpoint.

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

### `GET /templates/{id}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to look up. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Responses**

**`200`** A successful response returns returns the identifier of the template and dates when the template was created and last updated.

Response body:

**Content-Type:** `application/json`

**All of:**

  - **`createdAt`** `string`

    The date and time when the item was created.

    Format: `date-time`

    Read only: true

  - **`id`** `integer`

    The identifier for the template. You can recall the template by ID in other operations.

    Read only: true

  - **`updatedAt`** `string`

    The date and time when the item was last updated.

    Format: `date-time`

    Read only: true

- `oneOf`

**Examples**

*Example request*

```http
GET /templates/179229 HTTP/1.1
Authorization: Basic <Base64 key>

```

*Example request with external ID*

```http
GET /templates/id/myTemplate HTTP/1.1
Authorization: Basic <Base64 key>

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "type": "loyalty",
  "name": "Member Card Android",
  "vendorId": 2,
  "vendor": "Google",
  "projectId": 7311,
  "description": "Member Card Android",
  "projectType": "loyalty",
  "createdAt": "2025-09-26T20:44:15.000Z",
  "updatedAt": "2025-09-26T20:44:16.000Z",
  "id": 179229,
  "deleted": false,
  "disabled": false,
  "expiryInfo": {
    "expiryDuration": 730,
    "expiryNever": null
  },
  "headers": {
    "barcode_value": {
      "fieldType": "barcode",
      "value": "123456789",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcode_encoding": {
      "fieldType": "barcode",
      "value": "iso-8859-1",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcodeAltText": {
      "fieldType": "barcode",
      "value": "",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcode_type": {
      "fieldType": "barcode",
      "value": "PDF_417",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    }
  },
  "fields": {
    "image": {
      "fieldType": "titleModule",
      "value": "",
      "formatType": "String",
      "label": "http://storage.googleapis.com/wallet-stag-storage-bucket/1000002/images/ff9367b7cff7cad7fa67ae2c871485e3befae602_6fc517eff2d76511c062913946b9149876a17623_Metro-Logo-1200x1200.png",
      "hideEmpty": false,
      "required": false
    },
    "Program Points": {
      "fieldType": "loyaltyPoints",
      "value": "3600",
      "formatType": "Number",
      "label": "Member Points",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Program Details": {
      "fieldType": "textModulesData",
      "value": "Pre-Membership for Metro Members",
      "formatType": "String",
      "label": "Pre-Member Program",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Tier": {
      "fieldType": "acctModule",
      "value": "Pre-Member",
      "formatType": "String",
      "label": "Member Level",
      "hideEmpty": false,
      "required": false,
      "order": 2,
      "row": 0,
      "col": 1
    },
    "Merchant Website": {
      "fieldType": "linksModuleData",
      "value": "Merchant Website",
      "formatType": "URL",
      "label": "www.example.com.sg",
      "hideEmpty": false,
      "required": false,
      "order": 0
    },
    "Member Name": {
      "fieldType": "acctModule",
      "value": "Henry Christian",
      "formatType": "String",
      "label": "Member Name",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Loyalty Program Name": {
      "fieldType": "titleModule",
      "value": "Metro",
      "formatType": "String",
      "label": "Pre-Member",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    }
  },
  "locations": [
  ]
}

```

---

## List templates {#listtemplates}

List the headers for templates you created.

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

### `GET /template/headers`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `pageSize` | `number` |  | Number of templates per page. Defaults to 10. |
| `page` | `number` |  | The page you want to retrieve. Defaults to 1. |
| `order` | `string` |  | The order you want the projects returned in. Defaults to `id`. Possible values: `id`, `name`, `createdAt`, `updatedAt` |
| `direction` | `string` |  | The values ordered ascending or descending. Defaults to `DESC`. Possible values: `ASC`, `DESC` |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Responses**

**`200`** A successful response includes an array of template headers for templates you created. Look up an individual template to see field and header information for any individual template.

Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`count`** `string`

  The total number of results.

- **`pagination`** `object` <[Pagination object]({{< ref "/developer/rest-api/wallet/schemas/others/" >}}#paginationobject)>

  Contains information about pagination, according to your query parameters.

- **`templateHeaders`** `array`

  A list of template header objects.

  **All of:**

    - **`createdAt`** `string`

      The date and time when the item was created.

      Format: `date-time`

      Read only: true

    - **`id`** `integer`

      The identifier for the template. You can recall the template by ID in other operations.

      Read only: true

    - **`updatedAt`** `string`

      The date and time when the item was last updated.

      Format: `date-time`

      Read only: true

  - [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.


**Examples**

*Example request*

```http
GET /v1/template/headers HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "count": 2,
   "templateHeaders": [
      {
         "vendor": "Google",
         "projectType": "memberCard",
         "projectId": "12345",
         "type": "Loyalty1",
         "vendorId": "2",
         "deleted": "False",
         "id": "12344",
         "updatedAt": "2013-07-01T18:28:54.000Z",
         "description": "description",
         "createdAt": "2013-07-01T18:28:54.000Z",
         "name": "New Wallet Template",
         "disabled": "False",
         "expiryDuration": 730
      },
      {
         "vendor": "Apple",
         "projectType": "memberCard",
         "projectId": "12346",
         "type": "Store Card",
         "vendorId": "1",
         "deleted": "False",
         "id": "12345",
         "updatedAt": "2013-07-01T18:28:33.000Z",
         "description": "Description",
         "createdAt": "2013-07-01T18:28:33.000Z",
         "name": "Loyalty Card",
         "disabled": "False",
         "expiryDuration": 730
      }
   ],
   "pagination": {
      "order": "id",
      "page": 1,
      "start": 0,
      "direction": "DESC",
      "pageSize": 10
   }
}

```

---

## Patch template {#patchtemplates}

Update the template with the `overrides` object, performing a partial update. In the payload, you only need to provide the fields in your template that you want to override.

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

### `PATCH /templates/{id}`

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to update. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Request body**

The structure of your template is determined by the device/wallet vendor you create passes for.

**Content-Type:** `application/json`

**One of:**

- [Apple Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#iostemplate)

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

- [Google Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#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.


**Responses**

**`200`** A response returns the template's unique identifier. Use this `templateId` to reference the template in subsequent operations.


Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example patch template*

```http
PATCH /templates/179229 HTTP/1.1
Authorization: Basic <authorization string>
Content-Type: application/json

{
  "fields" : {
    "Loyalty Program Name": {
            "fieldType": "titleModule",
            "value": "MVP",
            "formatType": "String",
            "label": "program",
            "hideEmpty": false,
            "required": false,
            "order": 1,
            "row": 0,
            "col": 0
        }
  }
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "type": "loyalty",
  "name": "Member Card Android",
  "vendorId": 2,
  "vendor": "Google",
  "projectId": 7311,
  "description": "Member Card Android",
  "projectType": "loyalty",
  "createdAt": "2025-09-26T20:44:15.000Z",
  "updatedAt": "2025-09-26T20:44:16.000Z",
  "id": 179229,
  "deleted": false,
  "disabled": false,
  "expiryInfo": {
    "expiryDuration": 730,
    "expiryNever": null
  },
  "headers": {
    "barcodeAltText": {
      "fieldType": "barcode",
      "value": "",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcode_type": {
      "fieldType": "barcode",
      "value": "PDF_417",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcode_value": {
      "fieldType": "barcode",
      "value": "123456789",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    },
    "barcode_encoding": {
      "fieldType": "barcode",
      "value": "iso-8859-1",
      "formatType": "String",
      "label": "",
      "hideEmpty": false,
      "required": false
    }
  },
  "fields": {
    "image": {
      "fieldType": "titleModule",
      "value": "",
      "formatType": "String",
      "label": "http://storage.googleapis.com/wallet-stag-storage-bucket/1000002/images/ff9367b7cff7cad7fa67ae2c871485e3befae602_6fc517eff2d76511c062913946b9149876a17623_Metro-Logo-1200x1200.png",
      "hideEmpty": false,
      "required": false
    },
    "Program Points": {
      "fieldType": "loyaltyPoints",
      "value": "3600",
      "formatType": "Number",
      "label": "Member Points",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Program Details": {
      "fieldType": "textModulesData",
      "value": "Pre-Membership for Metro Members",
      "formatType": "String",
      "label": "Pre-Member Program",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Tier": {
      "fieldType": "acctModule",
      "value": "Pre-Member",
      "formatType": "String",
      "label": "Member Level",
      "hideEmpty": false,
      "required": false,
      "order": 2,
      "row": 0,
      "col": 1
    },
    "Merchant Website": {
      "fieldType": "linksModuleData",
      "value": "Merchant Website",
      "formatType": "URL",
      "label": "www.example.com.sg",
      "hideEmpty": false,
      "required": false,
      "order": 0
    },
    "Member Name": {
      "fieldType": "acctModule",
      "value": "Henry Christian",
      "formatType": "String",
      "label": "Member Name",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    },
    "Loyalty Program Name": {
      "fieldType": "titleModule",
      "value": "MVP",
      "formatType": "String",
      "label": "program",
      "hideEmpty": false,
      "required": false,
      "order": 1,
      "row": 0,
      "col": 0
    }
  }
}

```

---

## Publish a bulk update to passes {#updatepassesbytemplate}

Updates all passes based on a particular template. The only information you can modify on passes for the specified template ID are images, barcode data, and the following fields:

  * Membership ID fields
  * Coupon codes
  * Barcode values or alternative text
  * Any other field or image on the pass


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

### `PUT /template/{templateId}/passes`

{{< important >}}
Updating the `order` value for `linkModulesData` can only be done in an Event or Boarding Pass template.

{{< /important >}}

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wpas

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `templateId` | `integer` | Required | The `templateId` of the template you want to get passes for. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `status` | `string` |  | Find only passes matching the installation status.  * `installed` — passes currently installed. * `uninstalled` — passes that have been uninstalled. * `been_installed` — passes that have been either installed or uninstalled. * `not_been_installed` — passes that have never been installed.  Possible values: `installed`, `uninstalled`, `been_installed`, `not_been_installed` |
| `pageSize` | `integer` |  | The number of passes per page. Defaults to 10. Default: `10` |
| `page` | `integer` |  | The page of results you want to retrieve, starting at 1. Default: `1` |
| `order` | `string` |  | The order you want passes returned in, defaulting to `id`. Possible values: `id`, `createdAt`, `updatedAt` Default: `id` |
| `direction` | `string` |  | Determines whether to return values in ascending or descending order. Defaults to `DESC`. Possible values: `ASC`, `DESC` Default: `DESC` |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

Specify the fields you want to update. Any field you do not specify in this payload remains unchanged.

**Content-Type:** `application/json`

- **`fields`** `object`
**Responses**

**`200`** Returns a ticket ID as a reference for the update operation.

Response body:

**Content-Type:** `application/json`

- **`ticketId`** `integer`

  A ticket you can use to reference this operation for status, troubleshooting, or logging purposes.

**`404`** Template with ID `templateId` was not found.


**Examples**

*Example request*

```http
PUT /v1/template/12345/passes HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
   "fields": {
      "Member Name": {
         "value": "Jack Handey"
      },
      "barcode_value": {
         "value": "55555"
      },
      "Points": {
         "value": 1000
      }
   }
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "ticketId": 56789
}

```

---

## Update template {#updatetemplate}

Update the specified template. This endpoint takes any of the parameters used for Creating a Template. You can also add or remove fields from the template with this call by adding or omitting those fields from the request.

To update the template payload in the same format as you would use in a `POST` or `PUT` operation, use the [/templates](/docs/developer/rest-api/wallet/operations/templates/#updatetemplatesv2) endpoint instead.

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

### `PUT /template/{id}`

{{< note >}}
Provide a complete template object when updating a template. This call replaces the existing template object in its entirety. You must include all keys and fields that should remain in the template, otherwise they are removed.
{{< /note >}}

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to update. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Request headers:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Api-Revision` | `string` | Required | The particular API revision you want to use. In general, this is `1.2`. Possible values: `1.2` |

**Request body**

The structure of your template is determined by the device/wallet vendor you create passes for.

**Content-Type:** `application/json`

**One of:**

- [Apple Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#iostemplate)

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

- [Google Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#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.


**Responses**

**`200`** A response returns the template's unique identifier. Use this `templateId` to reference the template in subsequent operations.


Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example request — Apple template*

```http
PUT /v1/template/12345 HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
   "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
      }
   },
   "beacons":[
      {
        "uuid": "55502220-A123-A88A-F321-555A444B333C",
        "relevantText": "You are near the Ship",
        "major": 2,
        "minor": 346
      }
   ],
   "vendor": "Apple",
   "projectType": "memberCard",
   "projectId": "1234",
   "type": "Store Card",
   "vendorId": "1",
   "deleted": "False",
   "description": "Description",
   "name": "Loyalty Card (Edited)",
   "disabled": "False"
}

```

*Example request with external ID - Google template*

```http
PUT /v1/template/id/12345 HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>
Api-Revision: 1.2

{
  "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"
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
   "templateId": "12345"
}

```

---

## Update template v2 {#updatetemplatesv2}

Update the template with the whole resource specified in the request, performing a complete replacement. You can also add or remove fields from the template with this call by adding or omitting those fields from the request. The template payload will be in the same format as in a `POST` or `PUT` operation, unlike the [/template](/docs/developer/rest-api/wallet/operations/templates/#updatetemplate) endpoint.

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

### `PUT /templates/{id}`

{{< note >}}
Provide a complete template object when updating a template. This call replaces the existing template object in its entirety. You must include all keys and fields that should remain in the template, otherwise they will be removed.
{{< /note >}}

**Security:**

- [httpBasic]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-httpBasic)
- [oauth2Token]({{< ref "/developer/rest-api/wallet/introduction/" >}}#security-oauth2Token): wtmp

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | `string` | Required | The `templateId` of the template you want to update. For [External IDs](/docs/developer/rest-api/wallet/introduction/#external-ids), format the `{id}` as `id/{templateExternalId}`. |

**Request body**

The structure of your template is determined by the device/wallet vendor you create passes for.

**Content-Type:** `application/json`

**One of:**

- [Apple Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#iostemplate)

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

- [Google Wallet template request]({{< ref "/developer/rest-api/wallet/schemas/template-objects/" >}}#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.


**Responses**

**`200`** A response returns the template's unique identifier. Use this `templateId` to reference the template in subsequent operations.


Response body:

**Content-Type:** `application/json; charset=utf-8`

- **`templateId`** `integer`

  The identifier for the template. You can recall the template by ID in other operations.

  Read only: true

**Examples**

*Example request*

```http
PUT /templates/12345 HTTP/1.1
Content-Type: application/json
Authorization: Basic <Base64 key>

{
    "type": "loyalty",
    "name": "Member Card Android",
    "vendorId": 2,
    "vendor": "Google",
    "projectId": 7311,
    "description": "Member Card Android",
    "projectType": "loyalty",
    "deleted": false,
    "disabled": false,
    "headers": {
        "barcode_value": {
            "fieldType": "barcode",
            "value": "123456789",
            "formatType": "String",
            "label": "",
            "hideEmpty": false,
            "required": false
        },
        "barcode_encoding": {
            "fieldType": "barcode",
            "value": "iso-8859-1",
            "formatType": "String",
            "label": "",
            "hideEmpty": false,
            "required": false
        },
        "barcodeAltText": {
            "fieldType": "barcode",
            "value": "",
            "formatType": "String",
            "label": "",
            "hideEmpty": false,
            "required": false
        },
        "barcode_type": {
            "fieldType": "barcode",
            "value": "PDF_417",
            "formatType": "String",
            "label": "",
            "hideEmpty": false,
            "required": false
        }
    },
    "fields": {
        "image": {
            "fieldType": "titleModule",
            "value": "Image description for title image"
            "formatType": "String",
            "label": "http://storage.googleapis.com/wallet-stag-storage-bucket/1000002/images/ff9367b7cff7cad7fa67ae2c871485e3befae602_6fc517eff2d76511c062913946b9149876a17623_Metro-Logo-1200x1200.png",
            "hideEmpty": false,
            "required": false
        },
        "Program Points": {
            "fieldType": "loyaltyPoints",
            "value": "3600",
            "formatType": "Number",
            "label": "Member Points",
            "hideEmpty": false,
            "required": false,
            "order": 1,
            "row": 0,
            "col": 0
        },
        "Program Details": {
            "fieldType": "textModulesData",
            "value": "Pre-Membership for Metro Members",
            "formatType": "String",
            "label": "Pre-Member Program",
            "hideEmpty": false,
            "required": false,
            "order": 1,
            "row": 0,
            "col": 0
        },
        "Tier": {
            "fieldType": "acctModule",
            "value": "Pre-Member",
            "formatType": "String",
            "label": "Member Level",
            "hideEmpty": false,
            "required": false,
            "order": 2,
            "row": 0,
            "col": 1
        },
        "Merchant Website": {
            "fieldType": "linksModuleData",
            "value": "Merchant Website",
            "formatType": "URL",
            "label": "www.example.com.sg",
            "hideEmpty": false,
            "required": false,
            "order": 0
        },
        "Member Name": {
            "fieldType": "acctModule",
            "value": "Henry Christian",
            "formatType": "String",
            "label": "Member Name",
            "hideEmpty": false,
            "required": false,
            "order": 1,
            "row": 0,
            "col": 0
        },
        "Loyalty Program Name": {
            "fieldType": "titleModule",
            "value": "Metro",
            "formatType": "String",
            "label": "Pre-Member",
            "hideEmpty": false,
            "required": false,
            "order": 1,
            "row": 0,
            "col": 0
        }
    }
}

```

*Response*

```http
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "templateId": 179229
}

```

---

