Templates
View as MarkdownTemplates store reusable content for emails, SMS, and printable pages.
On this page
- The template object
- List templatesGET
/api/v1/templates - Retrieve a templateGET
/api/v1/templates/{id} - Update a templatePATCH / PUT / POST
/api/v1/templates/{id} - Delete a templateDELETE
/api/v1/templates/{id}POST/api/v1/templates/{id}/delete - List template variablesGET
/api/v1/templates/tags - Render template HTMLPOST
/api/v1/templates/{id}/parse - Generate a template PDFPOST
/api/v1/templates/{id}/print - Set profile print visibilityPOST
/api/v1/templates/{id}/profile-print-visibility
Templates store reusable content for emails, SMS, and printable pages.
Attributes
idinteger- Identifier assigned by the API.
namestring- Template name, up to 100 characters.
typestring- Use email, sms, or page.
editorstring- Editor format, email or page.
subjectstring or null- Email subject, up to 140 characters.
body_htmlstring or null- HTML content, optionally containing template variables.
body_jsonmap or array or null- Structured template editor data.
sms_textstring or null- Text used by an SMS template.
style_cssstring or null- CSS for a page template. Use null to clear it.
metadatamap or null- Additional template information.
editableboolean- Whether you can change or remove the template.
is_defaultboolean- Whether the template is a workspace default.
parent_idinteger or null- Source template ID, if copied.
profile_print_enabledboolean- Whether a page template appears in the profile print menu.
tscinteger or null- Creation time as Unix seconds.
tsuinteger or null- Last update time as Unix seconds.
/api/v1/templatesLists template records in the workspace.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Read.
Query parameters
typestring- Use email, sms, or page.
profile_print_enabledboolean- Whether a page template appears in the profile print menu.
qstring- Search template names.
lengthinteger- Number of records to return.
startinteger- Zero-based offset.
drawstring- Optional request marker echoed in the response.
sortstring- Sort by id, tsc, or tsu. Prefix the field name with a minus sign for descending order.
orderstring- Direction for unprefixed sort fields. Use asc or desc.
Returns
Returns templates in data with the counts before and after text search.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
400- The profile print filter must be a boolean.
/api/v1/templates/{id}Returns one template by ID.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Read.
Path parameters
idintegerRequired- ID of the template.
Returns
The template is returned in data.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
404- The requested record was not found.
/api/v1/templates/{id}Updates a template by ID.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Write.
Path parameters
idintegerRequired- ID of the template.
Body parameters
namestring- Template name, up to 100 characters.
typestring- Use email, sms, or page.
editorstring- Editor format, email or page.
subjectstring or null- Email subject, up to 140 characters.
body_htmlstring or null- HTML content, optionally containing template variables.
body_jsonmap or array or null- Structured template editor data.
sms_textstring or null- Text used by an SMS template.
style_cssstring or null- CSS for a page template. Use null to clear it.
metadatamap or null- Additional template information.
Only editable templates can be changed. Use Set profile print visibility to change menu visibility for a page.
Returns
Returns a successful update response.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
404- The requested record was not found.
400- The template, body, or stylesheet could not be processed.
/api/v1/templates/{id}/api/v1/templates/{id}/deleteRemoves an editable template.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Write.
Path parameters
idintegerRequired- ID of the template.
Returns
Returns a successful removal response.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
404- The requested record was not found.
400- The template could not be removed.
/api/v1/templates/{id}/parseRenders the stored template HTML using request values.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Write.
Path parameters
idintegerRequired- ID of the template.
Body parameters
athlete_idinteger- Use an athlete ID to populate the athlete variables.
contextstring- Use athlete_print to require a valid athlete and fail if any template variables remain unresolved.
additional propertiesmap values- Send template variables as top-level properties. The JSON body takes precedence over form or query values.
Returns
Returns the rendered fragment in html. Page templates also return a complete HTML document in document_html and any CSS in style_css.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
400- The template, body, or stylesheet could not be processed.
404- The requested record was not found.
422- The athlete print context is invalid or variables could not be resolved.
/api/v1/templates/{id}/printGenerates a PDF from a stored template or an HTML preview.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Write.
Path parameters
idintegerRequired- ID of the template.
Body parameters
athlete_idinteger- Use an athlete ID to populate the athlete variables.
contextstring- Use athlete_print to require a valid athlete and fail if any template variables remain unresolved.
htmlstring- Optional HTML preview. If supplied, it replaces the rendered template content.
style_cssstring or null- Override the page stylesheet when also supplying preview HTML.
filenamestring- Optional name for the generated PDF.
additional propertiesmap values- Send template variables as top-level properties when rendering the stored template.
Returns
Returns the URL of the generated PDF in url.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
400- The template, body, or stylesheet could not be processed.
404- The requested record was not found.
422- The athlete print context is invalid or variables could not be resolved.
500- The PDF could not be generated.
/api/v1/templates/{id}/profile-print-visibilityUpdates whether a page template appears in the profile print menu.
Permissions
Send your API key in X-API-Key. Required permissions are Templates → Write.
Path parameters
idintegerRequired- ID of the template.
Body parameters
enabledbooleanRequired- Set true to show the page template in the menu or false to hide it.
Returns
Returns the updated page template in data.
Errors
401- The API key is missing or invalid.
403- The API key lacks the required permission.
400- The template is not a page or enabled is missing or invalid.
404- The requested record was not found.