This library provides easy access to the Templates Resource.
Note: All methods return promises and accept an optional last argument callback. Read about how we handle callbacks and promises.
- list()
List a summary of all templates. - get(id[, options])
Get details about a specified template by its idoptions.id- the id of the template you want to look up requiredoptions.draft- specifies a draft or published template
- create(template)
Create a new templatetemplate- an object of template attributes required
- update(id, template[, options])
Update an existing templateid- the id of the template you want to update requiredtemplate- an object of template attributes requiredoptions.update_published- If true, directly overwrite the existing published template. If false, create a new draft.
- delete(id)
Delete an existing templateid- the id of the template you want to delete required
- preview(id[, options])
Preview the most recent version of an existing template by idid- the id of the template you want to look up requiredoptions.substitution_data- Object of substitution dataoptions.draft- specifies a draft or published template
Visit our examples section to see all of our template resource examples.