PUT Update a template
Update specific email template for your project. Please be advised this is restricted to the Platform tier and is not available for apps in test mode.
Endpoint
PUT https://api.timekit.io/v2/templates/notifyCustomerOfBooking
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
contents |
body | string | yes | Content of the email in valid twig format | |
subject |
body | string | yes | Subject line of the email | |
override |
body | boolean | false | boolean flag to determine whether this template needs to be overwritten | |
email |
body | string | Not used by this endpoint (it is used when sending a test email) | ||
project_id |
body | string or integer | yes | The project id for which this template will be used. Send the number 0 (not the string "0") to update the global template for the whole app |
Request examples
curlcurl --request PUT \
--url https://api.timekit.io/v2/templates/notifyCustomerOfBooking \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"contents": "<!DOCTYPE html>\n<html>\n <head>\n <title>{{ customer.name }}</title>\n </head>\n <body>\n <h1>Hello, {{ customer.name }}</h1>\n <ul id=\"navigation\">\n {% for item in customerMeta %}\n <li><a href=\"{{ loop.index }}\">{{ item }}</a></li>\n {% endfor %}\n </ul>\n </body>\n</html>",
"subject": "Your booking is confirmed",
"override": true,
"email": "",
"project_id": "4b3c6db8-f79c-4ec1-9a59-6538695cf190"
}'
Response examples
201
json{
"data": {
"id": 42,
"type": "notifyCustomerOfBooking",
"app_id": 2,
"contents": "<!DOCTYPE html>\n<html>\n <head>\n <title>{{ customer.name }}</title>\n </head>\n <body>\n <h1>Hello, {{ customer.name }}</h1>\n </body>\n</html>",
"project_id": 17,
"created_at": "2024-11-18T17:16:58+0000",
"updated_at": "2024-11-18T17:16:58+0000"
}
}
id, app_id and project_id in the response are internal numeric ids, not UUIDs.
422
Returned when the project can't be found or contents isn't valid Twig. A missing required field also returns 422, with the standard errors object described in Responses & errors.
json{
"fields": [],
"errors": [
"Error message here"
]
}
Requests from apps whose plan doesn't include email templates (including apps in test mode) return 403.