import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.emailTemplates.preview("KIND");<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->emailTemplates->preview('KIND');
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.emailTemplates.preview("KIND")
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"html": "<string>",
"css": "<string>",
"subject": "<string>",
"shared": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview"
payload := strings.NewReader("{\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\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.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview")
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 \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"subject": "Your Northwind Keys order is delivered (a2855h0p1y4-71329ed4d95-1000427)",
"html": "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<meta name=\"supported-color-schemes\" content=\"light dark\">\n<title>Northwind Keys a2855h0p1y4-71329ed4d95-1000427</title>\n<style>\n:root{color-scheme:light dark;supported-color-schemes:light dark}\n@media only screen and (ma…",
"text": "Northwind Keys\n\nYour order is delivered.\n\nLifetime License (Standard)\n XXXX-7QK2-M9XD-4PLA-SAMPLE\n Your instructions for this product are shown here.\n\nView Your Order: https://northwind.myshoply.gg/customer-panel/orders/a2855h0p1y4-71329ed4d95-1000427/\n\nLeave a Review: http://localhost:3002/checkout/a2855h0p1y4-71329ed4d95-1000427#review\n\n---------------------------------------…",
"parts": {
"delivery": "<div style=\"height:21px;line-height:21px;font-size:0;\"> </div><div class=\"shp-ink\" style=\"font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;font-size:14px;line-height:21px;font-weight:600;color:#16191d;\">Lifetime License</div><div class=\"shp-muted\" style=\"font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif…",
"buttons": "<div style=\"height:18px;line-height:18px;font-size:0;\"> </div><table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"shp-stack\" valign=\"middle\"><table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"button\"><tr><td class=\"shp-btn\" align=\"center\" valign=\"middle\" bgcolor=\"#16191d\" style=\"background-color:#16191d;border-radius:6px;padding:8px 13px;…",
"summary": "<div style=\"height:22px;line-height:22px;font-size:0;\"> </div><table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"line\" style=\"width:100%;\"><tr><td class=\"shp-line\" style=\"border-top:1px solid #ebe8e3;height:0;font-size:0;line-height:0;\"> </td></tr></table><div style=\"height:16px;line-height:16px;font-size:0;\"> </div><table role=\"presentation\" width=\"100%\" …",
"reply_note": "Replies to this address aren’t received. <a href=\"https://example.com/support\" style=\"color:inherit;text-decoration:underline;\">Contact Northwind Keys</a>."
},
"values": {
"store.name": "Northwind Keys",
"store.url": "https://northwind.myshoply.gg",
"store.panel_url": "https://northwind.myshoply.gg/customer-panel",
"buyer.email": "buyer@example.com",
"order.id": "a2855h0p1y4-71329ed4d95-1000427",
"order.paid_at": "Oct 22, 2026 at 4:20 PM UTC",
"order.total": "$39.99",
"order.paid_with": "Credit/Debit Card (Stripe)",
"order.invoice_attached": false,
"links.order": "https://northwind.myshoply.gg/customer-panel/orders/a2855h0p1y4-71329ed4d95-1000427/",
"links.review": "http://localhost:3002/checkout/a2855h0p1y4-71329ed4d95-1000427#review",
"year": "2026"
},
"problems": {
"html": [],
"css": [],
"subject": []
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Preview an email template
The email for a sample buyer as it would be sent with what you send in place of what is saved: its subject, the whole page as html, its plain text, the values its variables had, and problems as Change an email template would say them. Nothing is saved and nothing is sent.
Needs the emails.read permission (Read Email Templates).
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.emailTemplates.preview("KIND");<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->emailTemplates->preview('KIND');
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.emailTemplates.preview("KIND")
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"html": "<string>",
"css": "<string>",
"subject": "<string>",
"shared": "<string>"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview"
payload := strings.NewReader("{\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\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.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/preview")
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 \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"subject\": \"<string>\",\n \"shared\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"subject": "Your Northwind Keys order is delivered (a2855h0p1y4-71329ed4d95-1000427)",
"html": "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<meta name=\"supported-color-schemes\" content=\"light dark\">\n<title>Northwind Keys a2855h0p1y4-71329ed4d95-1000427</title>\n<style>\n:root{color-scheme:light dark;supported-color-schemes:light dark}\n@media only screen and (ma…",
"text": "Northwind Keys\n\nYour order is delivered.\n\nLifetime License (Standard)\n XXXX-7QK2-M9XD-4PLA-SAMPLE\n Your instructions for this product are shown here.\n\nView Your Order: https://northwind.myshoply.gg/customer-panel/orders/a2855h0p1y4-71329ed4d95-1000427/\n\nLeave a Review: http://localhost:3002/checkout/a2855h0p1y4-71329ed4d95-1000427#review\n\n---------------------------------------…",
"parts": {
"delivery": "<div style=\"height:21px;line-height:21px;font-size:0;\"> </div><div class=\"shp-ink\" style=\"font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;font-size:14px;line-height:21px;font-weight:600;color:#16191d;\">Lifetime License</div><div class=\"shp-muted\" style=\"font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif…",
"buttons": "<div style=\"height:18px;line-height:18px;font-size:0;\"> </div><table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"shp-stack\" valign=\"middle\"><table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"button\"><tr><td class=\"shp-btn\" align=\"center\" valign=\"middle\" bgcolor=\"#16191d\" style=\"background-color:#16191d;border-radius:6px;padding:8px 13px;…",
"summary": "<div style=\"height:22px;line-height:22px;font-size:0;\"> </div><table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"line\" style=\"width:100%;\"><tr><td class=\"shp-line\" style=\"border-top:1px solid #ebe8e3;height:0;font-size:0;line-height:0;\"> </td></tr></table><div style=\"height:16px;line-height:16px;font-size:0;\"> </div><table role=\"presentation\" width=\"100%\" …",
"reply_note": "Replies to this address aren’t received. <a href=\"https://example.com/support\" style=\"color:inherit;text-decoration:underline;\">Contact Northwind Keys</a>."
},
"values": {
"store.name": "Northwind Keys",
"store.url": "https://northwind.myshoply.gg",
"store.panel_url": "https://northwind.myshoply.gg/customer-panel",
"buyer.email": "buyer@example.com",
"order.id": "a2855h0p1y4-71329ed4d95-1000427",
"order.paid_at": "Oct 22, 2026 at 4:20 PM UTC",
"order.total": "$39.99",
"order.paid_with": "Credit/Debit Card (Stripe)",
"order.invoice_attached": false,
"links.order": "https://northwind.myshoply.gg/customer-panel/orders/a2855h0p1y4-71329ed4d95-1000427/",
"links.review": "http://localhost:3002/checkout/a2855h0p1y4-71329ed4d95-1000427#review",
"year": "2026"
},
"problems": {
"html": [],
"css": [],
"subject": []
}
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...
Headers
A word of your own for this one change, up to 180 letters, digits, dots, dashes, underscores and colons. Sent again with the same key, the request is not carried out twice: the first answer comes back, with Idempotent-Replay: true.
Path Parameters
The store's ID. A key reaches the store it was made in: GET /key answers which.
Which email: receipt, invoice, reward, panel-code, balance-code, site-code, ticket-reply, sub-renewal, sub-charged, sub-due, sub-declined, sub-paused, sub-ended, recovery-first, recovery-declined, recovery-second, winback-first, winback-second.

