# Templates

Templates

## List metadata transaction templates

> List metadata transaction templates

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"paths":{"/metadata/templates":{"get":{"summary":"List metadata transaction templates","tags":["Templates"],"responses":{"200":{"$ref":"#/components/responses/MetadataTemplatesResponse"}},"operationId":"list-metadata-templates","description":"List metadata transaction templates","parameters":[{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"RFC 7231 language tags format (e.g., `en-US`, `nl-NL`) to use for returning localized names"}]}}},"components":{"responses":{"MetadataTemplatesResponse":{"description":"List templates response","content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MetadataTemplateSchema"}}}}}}}},"schemas":{"MetadataTemplateSchema":{"title":"TemplateMetadataSchema","type":"object","required":["type","name","template","mimeType","fields"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"template":{"type":"string"},"mimeType":{"$ref":"#/components/schemas/TemplateMimeType"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/MetadataTemplateFieldSchema"}}}},"TemplateMimeType":{"title":"TemplateMimeType","enum":["HTML","TEXT"],"description":""},"MetadataTemplateFieldSchema":{"title":"MetadataTemplateFieldSchema","type":"object","required":["name","description"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}}
```

## List transaction templates

> List transaction templates

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"TransactionTemplatesResponse":{"description":"TransactionTemplatesResponse","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/TransactionTemplateResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}},"schemas":{"TransactionTemplateResponseSchema":{"title":"TransactionTemplateResponseSchema","type":"object","required":["type","name","template","subject","mimeType","templateUid","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"template":{"type":"string","description":"The template body."},"subject":{"type":"string","description":"The template subject, used for emails"},"mimeType":{"$ref":"#/components/schemas/TemplateMimeType"},"templateUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"}}},"TemplateMimeType":{"title":"TemplateMimeType","enum":["HTML","TEXT"],"description":""},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"templateTypeQuery":{"name":"templateType","in":"query","required":false,"schema":{"type":"string"},"description":"Filter on Template Type"}}},"paths":{"/tenants/{tenantUid}/templates":{"get":{"summary":"List transaction templates","tags":["Templates","Notifications"],"responses":{"200":{"$ref":"#/components/responses/TransactionTemplatesResponse"}},"operationId":"list-tenant-templates","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/templateTypeQuery"}],"description":"List transaction templates"}}}}
```

## Create transaction template

> Create transaction template\
> \
> Required permissions: TEMPLATE

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"TransactionTemplateResponse":{"description":"TransactionTemplateResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionTemplateResponseSchema"}}}}},"schemas":{"TransactionTemplateResponseSchema":{"title":"TransactionTemplateResponseSchema","type":"object","required":["type","name","template","subject","mimeType","templateUid","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"template":{"type":"string","description":"The template body."},"subject":{"type":"string","description":"The template subject, used for emails"},"mimeType":{"$ref":"#/components/schemas/TemplateMimeType"},"templateUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"}}},"TemplateMimeType":{"title":"TemplateMimeType","enum":["HTML","TEXT"],"description":""},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"TransactionTemplateRequestSchema":{"title":"TransactionTemplateRequestSchema","type":"object","description":"TransactionTemplateRequestSchema","required":["type","template"],"properties":{"type":{"type":"string","description":"This must be a valid type from /metadata/templates"},"template":{"type":"string"},"subject":{"type":"string"},"templateUid":{"$ref":"#/components/schemas/UID"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}},"requestBodies":{"TransactionTemplateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionTemplateRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/templates":{"post":{"summary":"Create transaction template","tags":["Templates","Notifications"],"responses":{"201":{"$ref":"#/components/responses/TransactionTemplateResponse"}},"operationId":"create-tenant-template","description":"Create transaction template\n\nRequired permissions: TEMPLATE","requestBody":{"$ref":"#/components/requestBodies/TransactionTemplateRequest"}}}}}
```

## Get transaction template by templateUid

> Get transaction template by templateUid

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"TransactionTemplateResponse":{"description":"TransactionTemplateResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionTemplateResponseSchema"}}}}},"schemas":{"TransactionTemplateResponseSchema":{"title":"TransactionTemplateResponseSchema","type":"object","required":["type","name","template","subject","mimeType","templateUid","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"template":{"type":"string","description":"The template body."},"subject":{"type":"string","description":"The template subject, used for emails"},"mimeType":{"$ref":"#/components/schemas/TemplateMimeType"},"templateUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"}}},"TemplateMimeType":{"title":"TemplateMimeType","enum":["HTML","TEXT"],"description":""},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}}},"paths":{"/tenants/{tenantUid}/templates/{templateUid}":{"get":{"summary":"Get transaction template by templateUid","tags":["Templates","Notifications"],"responses":{"200":{"$ref":"#/components/responses/TransactionTemplateResponse"}},"operationId":"get-tenant-template-templateUid","description":"Get transaction template by templateUid"}}}}
```

## Update transaction template by templateUid

> Update transaction template by templateUid\
> \
> Required permissions: TEMPLATE

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"TransactionTemplateResponse":{"description":"TransactionTemplateResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionTemplateResponseSchema"}}}}},"schemas":{"TransactionTemplateResponseSchema":{"title":"TransactionTemplateResponseSchema","type":"object","required":["type","name","template","subject","mimeType","templateUid","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"type":{"type":"string"},"name":{"type":"string"},"template":{"type":"string","description":"The template body."},"subject":{"type":"string","description":"The template subject, used for emails"},"mimeType":{"$ref":"#/components/schemas/TemplateMimeType"},"templateUid":{"$ref":"#/components/schemas/OptionalUID"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"}}},"TemplateMimeType":{"title":"TemplateMimeType","enum":["HTML","TEXT"],"description":""},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"TransactionTemplateUpdateSchema":{"title":"TransactionTemplateUpdateSchema","type":"object","required":["template"],"properties":{"template":{"type":"string"},"subject":{"type":"string"}}}},"requestBodies":{"TransactionTemplateUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionTemplateUpdateSchema"}}}}}},"paths":{"/tenants/{tenantUid}/templates/{templateUid}":{"put":{"summary":"Update transaction template by templateUid","tags":["Templates","Notifications"],"responses":{"200":{"$ref":"#/components/responses/TransactionTemplateResponse"}},"operationId":"update-tenant-template-templateUid","description":"Update transaction template by templateUid\n\nRequired permissions: TEMPLATE","requestBody":{"$ref":"#/components/requestBodies/TransactionTemplateUpdateRequest"}}}}}
```

## Delete transaction template by templateUId

> Delete transaction template by templateUId\
> \
> Required permissions: TEMPLATE

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}}},"paths":{"/tenants/{tenantUid}/templates/{templateUid}":{"delete":{"summary":"Delete transaction template by templateUId","tags":["Templates","Notifications"],"responses":{"200":{"description":"OK"},"404":{"description":"Not Found"}},"operationId":"delete-tenant-template-templateUid","description":"Delete transaction template by templateUId\n\nRequired permissions: TEMPLATE"}}}}
```

## Render transaction template preview

> Render transaction template preview\
> \
> Required permissions: TEMPLATE

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Notifications","description":"Notifications"},{"name":"Templates","description":"Templates"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"authToken":[]},{"accessToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}}},"paths":{"/tenants/{tenantUid}/templates/{templateUid}/notifications-preview":{"post":{"summary":"Render transaction template preview","tags":["Templates","Notifications"],"responses":{"200":{"description":"OK","content":{"text/html":{"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request"}},"operationId":"render-tenant-template-notifications-preview","description":"Render transaction template preview\n\nRequired permissions: TEMPLATE"}}}}
```
