Create / Update Email Template
curl --request POST \
--url https://api.launchmystore.io/api/v1/email-templates.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "<string>",
"htmlBody": "<string>",
"subject": "<string>",
"enabled": true
}
'import requests
url = "https://api.launchmystore.io/api/v1/email-templates.json"
payload = {
"event": "<string>",
"htmlBody": "<string>",
"subject": "<string>",
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: '<string>', htmlBody: '<string>', subject: '<string>', enabled: true})
};
fetch('https://api.launchmystore.io/api/v1/email-templates.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/api/v1/email-templates.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event' => '<string>',
'htmlBody' => '<string>',
'subject' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/email-templates.json"
payload := strings.NewReader("{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/api/v1/email-templates.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/email-templates.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_bodyEmail Templates
Create / Update Email Template
Register or replace a transactional email template override for an event
POST
/
api
/
v1
/
email-templates.json
Create / Update Email Template
curl --request POST \
--url https://api.launchmystore.io/api/v1/email-templates.json \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event": "<string>",
"htmlBody": "<string>",
"subject": "<string>",
"enabled": true
}
'import requests
url = "https://api.launchmystore.io/api/v1/email-templates.json"
payload = {
"event": "<string>",
"htmlBody": "<string>",
"subject": "<string>",
"enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({event: '<string>', htmlBody: '<string>', subject: '<string>', enabled: true})
};
fetch('https://api.launchmystore.io/api/v1/email-templates.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/api/v1/email-templates.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event' => '<string>',
'htmlBody' => '<string>',
'subject' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/email-templates.json"
payload := strings.NewReader("{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/api/v1/email-templates.json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/email-templates.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"event\": \"<string>\",\n \"htmlBody\": \"<string>\",\n \"subject\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_bodyRegisters (or replaces) your app’s HTML override for a transactional email
event. This is an upsert keyed by (store, app, event) — posting the
same event again replaces the previous override. When enabled, your HTML is
used in place of the platform default the next time that email is sent.
Auth: OAuth access token with the write_email_templates scope.
See Email template extensions for the supported
event names and the template variables available to each.
Body Parameters
string
required
The transactional event this template overrides (e.g.
order_confirmation,
order_cancellation, shipment_notification, newsletter_welcome,
abandoned_cart, digital_delivery).string
required
The HTML body to send for this event. May reference the event’s template
variables.
string
Subject line override. Defaults to the platform subject for the event when
omitted.
boolean
default:"true"
Whether the override is active. Set
false to keep the row but fall back to
the platform default at send time.Request
{
"event": "order_confirmation",
"subject": "Your order is confirmed 🎉",
"htmlBody": "<h1>Thanks {{ customer.first_name }}!</h1><p>Order {{ order.name }} is confirmed.</p>",
"enabled": true
}
Response
{
"template": {
"id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"event": "order_confirmation",
"subject": "Your order is confirmed 🎉",
"htmlBody": "<h1>Thanks…</h1>",
"enabled": true
}
}
Errors
| Status | Body | Cause |
|---|---|---|
400 | { "error": "event and htmlBody are required" } | event or htmlBody missing. |
403 | { errors: { base: [...] } } | Token lacks the write_email_templates scope. |