curl --request POST \
--url https://platform.trylath.com/email/template/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://platform.trylath.com/email/template/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://platform.trylath.com/email/template/generate"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.trylath.com/email/template/generate"
payload := strings.NewReader("{\n \"prompt\": \"<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))
}{
"activityId": "<string>",
"result": {
"subject": "<string>",
"blocks": [
"<unknown>"
],
"variables": [
"<string>"
]
}
}email.template.generate
Drafts an email from a plain-language description and returns it as blocks (the dashboard editor’s model) with a subject and the it uses. Pass existing to change a draft instead of starting over. Saves nothing: review the draft, then write it with email.template.set. Refuses with ai_not_configured when this deployment has no model key.
curl --request POST \
--url https://platform.trylath.com/email/template/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://platform.trylath.com/email/template/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://platform.trylath.com/email/template/generate"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.trylath.com/email/template/generate"
payload := strings.NewReader("{\n \"prompt\": \"<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))
}{
"activityId": "<string>",
"result": {
"subject": "<string>",
"blocks": [
"<unknown>"
],
"variables": [
"<string>"
]
}
}Authorizations
A Lath API key: lath_live_… or lath_test_… on a server, lath_live_pk… or lath_test_pk… in a browser.
Headers
Replays the stored response for the same key and input; refuses different input.
Body
What the email should say, in plain language. When existing is given, what to change.
1 - 2000What sort of email this is; shapes the draft's structure.
welcome, receipt, announcement, reset, digest, other How it should sound.
friendly, professional, direct, warm A draft to refine, as returned by a previous call.
Show child attributes
Show child attributes
Was this page helpful?

