Get Template Source Code
curl --request GET \
--url https://senderr.dev/api/v1/templates/{id}/source \
--header 'Authorization: Bearer <token>'import requests
url = "https://senderr.dev/api/v1/templates/{id}/source"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://senderr.dev/api/v1/templates/{id}/source', 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://senderr.dev/api/v1/templates/{id}/source",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://senderr.dev/api/v1/templates/{id}/source"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://senderr.dev/api/v1/templates/{id}/source")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://senderr.dev/api/v1/templates/{id}/source")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"source": {
"name": "Welcome Email Template",
"description": "A warm welcome email for new users",
"code": "import { Html, Body, Container, Text } from '@react-email/components';\n\nexport default function WelcomeEmail({ name = 'there' }) {\n return (\n <Html>\n <Body>\n <Container>\n <Text>Welcome {name}!</Text>\n </Container>\n </Body>\n </Html>\n );\n}"
}
}{
"error": "Authentication required",
"success": false
}{
"error": "Template not found",
"success": false
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR",
"success": false
}Templates
Get Template Source Code
Download the React Email source code for a template in your library.
GET
/
templates
/
{id}
/
source
Get Template Source Code
curl --request GET \
--url https://senderr.dev/api/v1/templates/{id}/source \
--header 'Authorization: Bearer <token>'import requests
url = "https://senderr.dev/api/v1/templates/{id}/source"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://senderr.dev/api/v1/templates/{id}/source', 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://senderr.dev/api/v1/templates/{id}/source",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://senderr.dev/api/v1/templates/{id}/source"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://senderr.dev/api/v1/templates/{id}/source")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://senderr.dev/api/v1/templates/{id}/source")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"source": {
"name": "Welcome Email Template",
"description": "A warm welcome email for new users",
"code": "import { Html, Body, Container, Text } from '@react-email/components';\n\nexport default function WelcomeEmail({ name = 'there' }) {\n return (\n <Html>\n <Body>\n <Container>\n <Text>Welcome {name}!</Text>\n </Container>\n </Body>\n </Html>\n );\n}"
}
}{
"error": "Authentication required",
"success": false
}{
"error": "Template not found",
"success": false
}{
"error": "Internal server error",
"code": "INTERNAL_ERROR",
"success": false
}⌘I