{"method":"GET","path":"https://api.revcent.com/v2/email_templates","summary":"Get Email Templates","description":"Returns a list of Email Templates.<br><br>Note: The template html body is not provided when retrieving a list of templates. The template html is provided when using the GetEmailTemplate operation for a specific email template using the template ID.<br><br>Only Email Templates with a trigger of 'api_direct' can be used to send a SMTP message via API using the SendSMTPMessage operation. When using an email template via API to send a SMTP message it is extremely important to review the custom_arguments array for an Email Template and provide the necessary custom arguments with their values.","operationId":"GetEmailTemplates","parameters":[{"description":"A limit on the number of objects to be returned. Limit can range between 1 and 25, and the default is 25.","in":"query","name":"limit","required":true,"schema":{"type":"integer","format":"int32","minimum":1,"maximum":25},"style":"form"},{"description":"Used for pagination, i.e. to skip to specific page of results.","in":"query","name":"page","required":true,"schema":{"type":"integer","format":"int32"},"style":"form"}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"additionalProperties":false,"properties":{},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"description":"","properties":{"api_call_id":{"type":"string","description":"A 20 character API call ID.","minLength":20,"maxLength":20},"api_call_unix":{"description":"Unix timestamp of when the API call was initiated.","type":"integer","format":"unix-time"},"code":{"description":"API call response code.","type":"integer","format":"int32","enum":[1]},"current_count":{"description":"The current number of items in the results.","type":"integer"},"current_page":{"description":"The current page for the items in the results.","type":"integer"},"results":{"items":{"allOf":[{"type":"object","additionalProperties":false,"properties":{"created_date_unix":{"description":"The unix timestamp of when the item was created.","type":"integer","format":"unix-time"},"id":{"type":"string","title":"Email Template ID","description":"A 20 character Email Template ID.","minLength":20,"maxLength":20},"name":{"description":"The name of the Email Template.","type":"string"},"description":{"description":"The description of the Email Template.","type":"string"},"enabled":{"description":"Whether the Email Template is currently enabled and able to send SMTP messages. If an Email Template is disabled it should not be used to send a SMTP message","type":"boolean"},"smtp_profile":{"type":"object","additionalProperties":false,"description":"The SMTP Profile used to send the SMTP message.","properties":{"id":{"type":"string","description":"A 20 character SMTP Profile ID.","minLength":20,"maxLength":20},"name":{"description":"The name of the SMTP Profile.","type":"string"}}},"template_subject":{"description":"The subject line of the email when sending an SMTP message using the Email Template. Handlebars shortcode is available for this field. Shortcodes can be used within the subject line to have dynamic values when sending an SMTP message. For example, use the handlebars shortcode '{{customer.first_name}}' to have the customers first name dynamically inserted into the subject line when sending an SMTP message.","type":"string"},"template_from":{"description":"The email address of the sender for the Email Template. Should match the send from email associated with the email templates' SMTP profile to prevent delivery issues. Handlebars shortcode is available for this field.","type":"string"},"template_from_name":{"description":"The name of the sender for the Email Template. Handlebars shortcode is available for this field.","type":"string"},"template_to":{"description":"An array of email address shortcodes or actual email addresses that determine the to recipients when sending an SMTP message. Use the shortcode '{{customer.email}}' to utilize the email address of the customer related to the email, if applicable, when sending an SMTP message. Handlebars shortcode is available for this field.","type":"array","items":{"type":"string","description":"An individual email address shortcode or actual email address."}},"template_to_cc":{"description":"An array of email address shortcodes or actual email addresses that determine the CC recipients when sending an SMTP message. Use the shortcode '{{customer.email}}' to utilize the email address of the customer related to the email, if applicable, when sending an SMTP message. Handlebars shortcode is available for this field.","type":"array","items":{"type":"string","description":"An individual email address shortcode or actual email address."}},"template_to_bcc":{"description":"An array of email address shortcodes or actual email addresses that determine the BCC recipients when sending an SMTP message. Use the shortcode '{{customer.email}}' to utilize the email address of the customer related to the email, if applicable, when sending an SMTP message. Handlebars shortcode is available for this field.","type":"array","items":{"type":"string","description":"An individual email address shortcode or actual email address."}},"template_trigger":{"description":"The trigger setting determines how the Email Template can be triggered to send a SMTP message. An Email Template with a trigger setting of 'api_direct' can be used to send a SMTP message directly via the API using the SendSMTPMessage operation, otherwise the email template is triggered when the specified event occurs within your RevCent account.<br><br>Options:<br><br><em>no_trigger</em>: If a draft or using the email template within an external process.<br><br><em>api_direct</em>: Trigger the template to send an SMTP message via the RevCent API/MCP or via AI through AI Web Chat or AI Assistants. AI can trigger an email template via System Tools and provide custom arguments to the template when triggered.<br><br><em>sale_create_success</em>: A sale was created and payment was successful. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/sale.json\" target=\"_blank\">sale object</a>.<br><br><em>sale_create_decline</em>: A sale was created, but all payment attempt(s) failed either due to error or decline. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/sale.json\" target=\"_blank\">sale object</a>.<br><br><em>pending_sale_no_payment</em>: A pending sale was created, however no payment attempt(s) were ever made. I.e. abandoned cart. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/sale.json\" target=\"_blank\">sale object</a>.<br><br><em>fraud_alert_create_success</em>: A sale was created, either successfully or not, and fraud was detected. However, payment was not prevented and therefore a Fraud Detection was not created. Instead, the sale was marked with a fraud alert allowing manual review. The input_data is a <a href=\"https://revcent.com/documentation/files/email_template/input_data/sentinel.json\" target=\"_blank\">sentinel object</a>.<br><br><em>sentinel_alert_create_success</em>: A sentinel fraud detection occurred. This is the same as 'fraud_alert_create_success' but has different input_data. The input_data is a <a href=\"https://revcent.com/documentation/files/email_template/input_data/sentinel.json\" target=\"_blank\">sentinel object</a>.<br><br><em>ai_memo_create_success</em>: An AI Assistant created an AI Memo. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/ai_memo.json\" target=\"_blank\">AI memo object</a>.<br><br><em>fraud_detection_create_success</em>: A fraud detection was created and attached to a sale. This is different from 'fraud_alert_create_success' and 'sentinel_alert_create_success' as it indicates that payment was prevented due to fraud detection and has different input_data available. The input data is a <a href=\"https://revcent.com/documentation/files/email_template/input_data/fraud_detection.json\" target=\"_blank\">fraud detection object</a>.<br><br><em>invoice_create_success</em>: An invoice was created with a unique URL. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/invoice.json\" target=\"_blank\">invoice object</a>.<br><br><em>customer_create_success</em>: A customer was created using the customer create method, NOT due to a new sale. Only API calls for type = customer and method = create will trigger this template (Ex: signup forms, newsletters) in order to not conflict where customers are created by other API methods such as new sales. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/customer.json\" target=\"_blank\">customer object</a>.<br><br><em>pending_refund_create_success</em>: A refund was created. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/pending_refund.json\" target=\"_blank\">pending refund object</a>.<br><br><em>shipping_item_created</em>: A shipment was created in RevCent. Useful for emailing a warehouse. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/shipping.json\" target=\"_blank\">shipping object</a>.<br><br><em>shipping_item_shipped</em>: A shipment was shipped. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/shipping.json\" target=\"_blank\">shipping object</a>.<br><br><em>shipping_item_delivered</em>: A shipment was delivered. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/shipping.json\" target=\"_blank\">shipping object</a>.<br><br><em>shipping_item_voided</em>: A shipment was voided. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/shipping.json\" target=\"_blank\">shipping object</a>.<br><br><em>subscription_renew_success</em>: A subscription renewal was successful. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/subscription_renewal.json\" target=\"_blank\">subscription renewal object</a>.<br><br><em>subscription_renew_decline</em>: A subscription renewal was declined. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/subscription_renewal.json\" target=\"_blank\">subscription renewal object</a>.<br><br><em>subscription_renewal_upcoming</em>: A subscription renewal is upcoming. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/subscription.json\" target=\"_blank\">subscription object</a>, NOT the subscription_renewal object.<br><br><em>trial_expire_success</em>: A trial expired successfully. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/trial.json\" target=\"_blank\">trial object</a>.<br><br><em>trial_expire_decline</em>: A trial expiration failed due to error or decline. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/trial.json\" target=\"_blank\">trial object</a>.<br><br><em>trial_expire_upcoming</em>: A trial expiration is upcoming. The input_data is the <a href=\"https://revcent.com/documentation/files/email_template/input_data/trial.json\" target=\"_blank\">trial object</a>.","type":"string","enum":["no_trigger","api_direct","sale_create_success","sale_create_decline","pending_sale_no_payment","sentinel_alert_create_success","ai_memo_create_success","fraud_alert_create_success","fraud_detection_create_success","invoice_create_success","customer_create_success","pending_refund_create_success","shipping_item_created","shipping_item_shipped","shipping_item_delivered","shipping_item_voided","subscription_renew_success","subscription_renew_decline","subscription_renewal_upcoming","trial_expire_success","trial_expire_decline","trial_expire_upcoming"]},"trigger_sources_allowed":{"type":"array","description":"Only applies to 'shipping_item_shipped' and 'shipping_item_delivered' template triggers. This allows a further refinement for shipping update delivery based on the origination of the shipment. I.e. you can choose to only send shipment update on a new sale, subscription renewal or trial expiration.","items":{"type":"string","enum":["sale_create","subscription_renew","trial_expire"]}},"timing":{"type":"object","additionalProperties":false,"description":"The timing settings determine when the Email Template should trigger to send a SMTP message when the specified event occurs.<br><br>If timing settings are not enabled, the Email Template will trigger to send a SMTP message immediately when the specified event occurs. If timing settings are enabled, there are two options for when the Email Template can trigger to send a SMTP message, either 'before' or 'after'. If before, the Email Template will trigger to send a SMTP message before the specified event occurs, which only applies to subscription renewals and trial expirations. If after, the Email Template will trigger to send a SMTP message after the specified event occurs.<br><br>Note: The 'api_direct' event type does not have the option for timing settings as it is intended for immediate triggering to send a SMTP message when sending an SMTP message using the SendSMTPMessage operation.","properties":{"enabled":{"description":"Whether the timing settings are enabled for the Email Template. If timing settings are not enabled, the Email Template will trigger to send a SMTP message immediately when the specified event occurs.","type":"boolean"},"time_unit":{"description":"The time unit option selected for when the Email Template should trigger to send a SMTP message when the specified event occurs. The time unit options are seconds, minutes, hours, days, weeks, months and years. For example, if the time unit is set to 'hours' and the time value is set to '2', the Email Template will trigger to send a SMTP message 2 hours after the specified event occurs when the time relative option is set to 'after'. If the time relative option is set to 'before', the Email Template will trigger to send a SMTP message 2 hours before the specified event occurs.","type":"string","enum":["hours","days","weeks","months","years"]},"time_value":{"description":"The time value, which pairs with the 'time_unit', for when the Email Template should trigger to send a SMTP message when the specified event occurs.","type":"integer"},"time_relative":{"type":"string","description":"Whether the Email Template should trigger to send a SMTP message before or after the specified event occurs.<br><br>Note: The 'before' option only applies to triggers 'subscription_renewal_upcoming' and 'trial_expire_upcoming', as those are the only events that can be anticipated before they occur. The 'after' option can be used for all event types, except for 'api_direct', and will trigger to send a SMTP message after the specified event occurs based on the time_unit and time_value.","enum":["after","before"]}}},"filters":{"type":"object","additionalProperties":false,"description":"Filters can be applied to an Email Template to determine whether the template should be triggered when the specified event occurs. For example, if you only want an Email Template to trigger when a sale is made for a specific campaign, you can set up a filter for one or more campaign ID's. When the event occurs, the system will check if the filters are met before triggering the email template to send a SMTP message.","properties":{"campaign":{"description":"The campaign filter checks for the presence of one or more campaign ID's in the related event, and if present whether it matches the specified value.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"A 20 character campaign ID."},"name":{"description":"The name of the campaign.","type":"string"}}}},"product":{"description":"The product filter checks for the presence of one or more product ID's in the related event, and if present whether it matches the specified value.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"A 20 character product ID."},"name":{"description":"The name of the product.","type":"string"}}}},"product_group":{"description":"The product group filter checks for the presence of one or more product group ID's in the related event, and if present whether it matches the specified value.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"A 20 character product group ID."},"name":{"description":"The name of the product group.","type":"string"}}}},"third_party_shop":{"description":"The third party shop filter checks for the presence of one or more third party shop ID's in the related event, and if present whether it matches the specified value.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","description":"A 20 character third party user shop ID."},"name":{"description":"The name of the third party user shop.","type":"string"}}}}}},"custom_data":{"type":"object","additionalProperties":false,"description":"The custom data source can be either a static JSON object, or a JSON object returned from a function. If enabling custom data, the 'custom_data' property will be available as input data in the handlebars shortcode syntax. Custom data is useful when using a custom function as dynamic content can be generated from the function and used within the email template via handlebars shortcode. For example, if you have a custom function that returns a JSON object with the key 'thank_you_paragraph' and value 'Thank you for purchasing our product, we hope you enjoy it!', you can use the handlebars shortcode '{{custom_data.thank_you_paragraph}}' within the email template to have the thank you paragraph dynamically inserted into the email body when sending an SMTP message. A function can also return dynamic logos, images, links and more to be used within the email template via handlebars shortcode when sending an SMTP message.","properties":{"enabled":{"description":"Whether a custom data source is enabled for the Email Template.","type":"boolean"},"source_type":{"description":"The type of the custom data source.","type":"string","enum":["custom_function","json"]},"source_value":{"description":"The value of the custom data source. Can be either a JSON string if source type is json, or a 20 character function ID if source type is custom_function.","type":"string"}}},"custom_arguments":{"description":"A list of custom arguments which should be provided as a name value object within the 'custom_arguments' array input data when sending an SMTP message using the SendSMTPMessage operation. Custom arguments are intended to be used by AI to infer values when sending an SMTP message. For example, if you have a custom argument with the description 'Generate a customized thank you paragraph based on the customers name.', when sending an SMTP message using the SendSMTPMessage operation, you can have AI read the custom argument description and infer a value for the custom argument based on the customers name.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"name":{"description":"The name of the custom argument, which should be the name within the 'custom_arguments' array object when sending an SMTP message using the SendSMTPMessage operation.","type":"string"},"description":{"description":"The description of the custom argument instructs what the actual custom argument inferred value should be when sending an SMTP message. When sending an SMTP message using the SendSMTPMessage operation, you should: Read the custom arguments' description from the source Email Template, then infer the value when sending the SMTP Message.","type":"string"}}}},"updated_date_unix":{"description":"The unix timestamp of when the item was last updated.","type":"integer","format":"unix-time"}}}]},"type":"array"},"total_count":{"description":"The total number of items found given the date_start and date_end query parameters.","type":"integer"},"total_pages":{"description":"The total number of pages given the date_start, date_end and limit query parameters.","type":"integer"}},"type":"object","additionalProperties":false}}},"description":"Successful response."},"default":{"content":{"application/json":{"schema":{"description":"","properties":{"api_call_id":{"type":"string","description":"A 20 character API call ID.","minLength":20,"maxLength":20},"api_call_unix":{"description":"Unix timestamp of when the API call was initiated.","type":"integer","format":"unix-time"},"code":{"description":"This value indicates that there is an error. Will always be 0.","type":"integer","enum":[0]},"error_code":{"description":"The specific error code.","type":"string"},"message":{"description":"A human readable description of the error.","type":"string"},"result":{"description":"A description of the API call result.","type":"string"}},"title":"APIStandardErrors","type":"object","additionalProperties":false}}},"description":"Error response."}}}