PassTemplatesService
Use client.passTemplates to manage pass designs, images, and iOS deeplinks.
Methods
| Method | Purpose |
|---|---|
get(id) | Read a template |
create(data) | Create a template |
update(id, data) | Update a template |
delete(id) | Delete a template without migration |
migrateAndDelete(sourceId, targetId) | Migrate passes, then delete |
getByWorkspace(workspaceId, options?) | List workspace templates |
getByProject(projectId, options?) | List project templates |
search(query, options) | Search a workspace |
getByType(passType, options) | Filter by pass type |
duplicate(id) | Duplicate a template |
list(), search(), and getByType() require options.filter.workspace_id._eq.
Create
typescript
const { data: template } = await client.passTemplates.create({
uuid: crypto.randomUUID(),
name: "Coffee Rewards",
pass_type: "LOYALTY",
apple_pass_type_identifier: "pass.com.example.coffee",
workspace_id: "workspace-uuid",
project_id: "project-uuid",
barcode_type: "qr",
barcode_id: "${client.id}",
top_field_label: "POINTS",
top_field_value: "${wallet.points}",
front_fields: [
{ label: "Member", value: "${client.first_name}" },
],
});Use ${wallet.points} for the default wallet and ${wallet:<code>.points} for a specific wallet. ${loyalty.points} has been retired.
Images and deeplinks
typescript
await client.passTemplates.updateImages(template.id, {
icon: iconFile,
logo: "existing-file-uuid",
cover_image: "https://cdn.example.com/cover.png",
});
await client.passTemplates.setIOSDeeplink(template.id, {
ios_deeplink_id: 12345,
ios_deeplink_url: "example://loyalty",
});Image helpers also include uploadIcon(), uploadLogo(), uploadCoverImage(), removeImages(), getImageUrls(), and getOptimizedImageUrls().